xen-netfront: reduce gso_max_size to account for max TCP header
[deliverable/linux.git] / include / xen / interface / io / netif.h
CommitLineData
a42089dd
JF
1/******************************************************************************
2 * netif.h
3 *
4 * Unified network-device I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser
7 */
8
9#ifndef __XEN_PUBLIC_IO_NETIF_H__
10#define __XEN_PUBLIC_IO_NETIF_H__
11
a1ce3928
DH
12#include <xen/interface/io/ring.h>
13#include <xen/interface/grant_table.h>
a42089dd
JF
14
15/*
16 * Notifications after enqueuing any type of message should be conditional on
17 * the appropriate req_event or rsp_event field in the shared ring.
18 * If the client sends notification for rx requests then it should specify
19 * feature 'feature-rx-notify' via xenbus. Otherwise the backend will assume
20 * that it cannot safely queue packets (as it may not be kicked to send them).
21 */
22
23/*
24 * This is the 'wire' format for packets:
f942dc25
IC
25 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
26 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
27 * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE)
28 * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data
29 * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data
a42089dd 30 * ...
f942dc25 31 * Request N: xen_netif_tx_request -- 0
a42089dd
JF
32 */
33
34/* Protocol checksum field is blank in the packet (hardware offload)? */
f942dc25
IC
35#define _XEN_NETTXF_csum_blank (0)
36#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank)
a42089dd
JF
37
38/* Packet data has been validated against protocol checksum. */
f942dc25
IC
39#define _XEN_NETTXF_data_validated (1)
40#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated)
a42089dd
JF
41
42/* Packet continues in the next request descriptor. */
f942dc25
IC
43#define _XEN_NETTXF_more_data (2)
44#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data)
a42089dd
JF
45
46/* Packet to be followed by extra descriptor(s). */
f942dc25
IC
47#define _XEN_NETTXF_extra_info (3)
48#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
a42089dd 49
9ecd1a75 50#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
a42089dd
JF
51struct xen_netif_tx_request {
52 grant_ref_t gref; /* Reference to buffer page */
53 uint16_t offset; /* Offset within buffer page */
f942dc25 54 uint16_t flags; /* XEN_NETTXF_* */
a42089dd
JF
55 uint16_t id; /* Echoed in response message. */
56 uint16_t size; /* Packet size in bytes. */
57};
58
f942dc25
IC
59/* Types of xen_netif_extra_info descriptors. */
60#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
61#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
62#define XEN_NETIF_EXTRA_TYPE_MAX (2)
a42089dd 63
f942dc25
IC
64/* xen_netif_extra_info flags. */
65#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
66#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
a42089dd
JF
67
68/* GSO types - only TCPv4 currently supported. */
f942dc25 69#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
a42089dd
JF
70
71/*
72 * This structure needs to fit within both netif_tx_request and
73 * netif_rx_response for compatibility.
74 */
75struct xen_netif_extra_info {
76 uint8_t type; /* XEN_NETIF_EXTRA_TYPE_* */
77 uint8_t flags; /* XEN_NETIF_EXTRA_FLAG_* */
78
79 union {
80 struct {
81 /*
82 * Maximum payload size of each segment. For
83 * example, for TCP this is just the path MSS.
84 */
85 uint16_t size;
86
87 /*
88 * GSO type. This determines the protocol of
89 * the packet and any extra features required
90 * to segment the packet properly.
91 */
92 uint8_t type; /* XEN_NETIF_GSO_TYPE_* */
93
94 /* Future expansion. */
95 uint8_t pad;
96
97 /*
98 * GSO features. This specifies any extra GSO
99 * features required to process this packet,
100 * such as ECN support for TCPv4.
101 */
102 uint16_t features; /* XEN_NETIF_GSO_FEAT_* */
103 } gso;
104
105 uint16_t pad[3];
106 } u;
107};
108
109struct xen_netif_tx_response {
110 uint16_t id;
f942dc25 111 int16_t status; /* XEN_NETIF_RSP_* */
a42089dd
JF
112};
113
114struct xen_netif_rx_request {
115 uint16_t id; /* Echoed in response message. */
116 grant_ref_t gref; /* Reference to incoming granted frame */
117};
118
119/* Packet data has been validated against protocol checksum. */
f942dc25
IC
120#define _XEN_NETRXF_data_validated (0)
121#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated)
a42089dd
JF
122
123/* Protocol checksum field is blank in the packet (hardware offload)? */
f942dc25
IC
124#define _XEN_NETRXF_csum_blank (1)
125#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank)
a42089dd
JF
126
127/* Packet continues in the next request descriptor. */
f942dc25
IC
128#define _XEN_NETRXF_more_data (2)
129#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data)
a42089dd
JF
130
131/* Packet to be followed by extra descriptor(s). */
f942dc25
IC
132#define _XEN_NETRXF_extra_info (3)
133#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info)
134
135/* GSO Prefix descriptor. */
136#define _XEN_NETRXF_gso_prefix (4)
137#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix)
a42089dd
JF
138
139struct xen_netif_rx_response {
140 uint16_t id;
141 uint16_t offset; /* Offset in page of start of received packet */
f942dc25 142 uint16_t flags; /* XEN_NETRXF_* */
a42089dd
JF
143 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
144};
145
146/*
147 * Generate netif ring structures and types.
148 */
149
150DEFINE_RING_TYPES(xen_netif_tx,
151 struct xen_netif_tx_request,
152 struct xen_netif_tx_response);
153DEFINE_RING_TYPES(xen_netif_rx,
154 struct xen_netif_rx_request,
155 struct xen_netif_rx_response);
156
f942dc25
IC
157#define XEN_NETIF_RSP_DROPPED -2
158#define XEN_NETIF_RSP_ERROR -1
159#define XEN_NETIF_RSP_OKAY 0
160/* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */
161#define XEN_NETIF_RSP_NULL 1
a42089dd
JF
162
163#endif
This page took 0.649394 seconds and 5 git commands to generate.