ia64/xen-unstable

view xen/include/public/io/netif.h @ 10642:4b9876fe2f1f

[NET] back: Add GSO features field and check gso_size

This patch adds the as-yet unused GSO features which will contain
protocol-independent bits such as the ECN marker.

It also makes the backend check gso_size to ensure that it is non-zero.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jul 03 09:05:18 2006 +0100 (2006-07-03)
parents 5db7bbccf4d2
children 23c37bc942da
line source
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 */
9 #ifndef __XEN_PUBLIC_IO_NETIF_H__
10 #define __XEN_PUBLIC_IO_NETIF_H__
12 #include "ring.h"
13 #include "../grant_table.h"
15 /*
16 * Note that there is *never* any need to notify the backend when
17 * enqueuing receive requests (struct netif_rx_request). Notifications
18 * after enqueuing any other type of message should be conditional on
19 * the appropriate req_event or rsp_event field in the shared ring.
20 */
22 /*
23 * This is the 'wire' format for packets:
24 * Request 1: netif_tx_request -- NETTXF_* (any flags)
25 * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info)
26 * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE)
27 * Request 4: netif_tx_request -- NETTXF_more_data
28 * Request 5: netif_tx_request -- NETTXF_more_data
29 * ...
30 * Request N: netif_tx_request -- 0
31 */
33 /* Protocol checksum field is blank in the packet (hardware offload)? */
34 #define _NETTXF_csum_blank (0)
35 #define NETTXF_csum_blank (1U<<_NETTXF_csum_blank)
37 /* Packet data has been validated against protocol checksum. */
38 #define _NETTXF_data_validated (1)
39 #define NETTXF_data_validated (1U<<_NETTXF_data_validated)
41 /* Packet continues in the next request descriptor. */
42 #define _NETTXF_more_data (2)
43 #define NETTXF_more_data (1U<<_NETTXF_more_data)
45 /* Packet to be followed by extra descriptor(s). */
46 #define _NETTXF_extra_info (3)
47 #define NETTXF_extra_info (1U<<_NETTXF_extra_info)
49 struct netif_tx_request {
50 grant_ref_t gref; /* Reference to buffer page */
51 uint16_t offset; /* Offset within buffer page */
52 uint16_t flags; /* NETTXF_* */
53 uint16_t id; /* Echoed in response message. */
54 uint16_t size; /* Packet size in bytes. */
55 };
56 typedef struct netif_tx_request netif_tx_request_t;
58 /* Types of netif_extra_info descriptors. */
59 #define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
60 #define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
61 #define XEN_NETIF_EXTRA_TYPE_MAX (2)
63 /* netif_extra_info flags. */
64 #define _XEN_NETIF_EXTRA_FLAG_MORE (0)
65 #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
67 /* GSO types - only TCPv4 currently supported. */
68 #define XEN_NETIF_GSO_TYPE_TCPV4 (1)
70 /*
71 * This structure needs to fit within both netif_tx_request and
72 * netif_rx_response for compatibility.
73 */
74 struct netif_extra_info {
75 uint8_t type; /* XEN_NETIF_EXTRA_TYPE_* */
76 uint8_t flags; /* XEN_NETIF_EXTRA_FLAG_* */
78 union {
79 struct {
80 /*
81 * Maximum payload size of each segment. For example, for TCP this
82 * is just the path MSS.
83 */
84 uint16_t size;
86 /*
87 * GSO type. This determines the protocol of the packet and any
88 * extra features required to segment the packet properly.
89 */
90 uint8_t type; /* XEN_NETIF_GSO_TYPE_* */
92 /* Future expansion. */
93 uint8_t pad;
95 /*
96 * GSO features. This specifies any extra GSO features required
97 * to process this packet, such as ECN support for TCPv4.
98 */
99 uint16_t features; /* XEN_NETIF_GSO_FEAT_* */
100 } gso;
102 uint16_t pad[3];
103 } u;
104 };
106 struct netif_tx_response {
107 uint16_t id;
108 int16_t status; /* NETIF_RSP_* */
109 };
110 typedef struct netif_tx_response netif_tx_response_t;
112 struct netif_rx_request {
113 uint16_t id; /* Echoed in response message. */
114 grant_ref_t gref; /* Reference to incoming granted frame */
115 };
116 typedef struct netif_rx_request netif_rx_request_t;
118 /* Packet data has been validated against protocol checksum. */
119 #define _NETRXF_data_validated (0)
120 #define NETRXF_data_validated (1U<<_NETRXF_data_validated)
122 /* Protocol checksum field is blank in the packet (hardware offload)? */
123 #define _NETRXF_csum_blank (1)
124 #define NETRXF_csum_blank (1U<<_NETRXF_csum_blank)
126 struct netif_rx_response {
127 uint16_t id;
128 uint16_t offset; /* Offset in page of start of received packet */
129 uint16_t flags; /* NETRXF_* */
130 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
131 };
132 typedef struct netif_rx_response netif_rx_response_t;
134 /*
135 * Generate netif ring structures and types.
136 */
138 DEFINE_RING_TYPES(netif_tx, struct netif_tx_request, struct netif_tx_response);
139 DEFINE_RING_TYPES(netif_rx, struct netif_rx_request, struct netif_rx_response);
141 #define NETIF_RSP_DROPPED -2
142 #define NETIF_RSP_ERROR -1
143 #define NETIF_RSP_OKAY 0
144 /* No response: used for auxiliary requests (e.g., netif_tx_extra). */
145 #define NETIF_RSP_NULL 1
147 #endif
149 /*
150 * Local variables:
151 * mode: C
152 * c-set-style: "BSD"
153 * c-basic-offset: 4
154 * tab-width: 4
155 * indent-tabs-mode: nil
156 * End:
157 */