ia64/xen-unstable

view xen/include/public/io/netif.h @ 10612:5db7bbccf4d2

[NET]: Remove gso.segs field from netif protocol.
From: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Fri Jun 30 10:04:22 2006 +0100 (2006-06-30)
parents 5d622ded9efe
children 4b9876fe2f1f
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_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 uint16_t type; /* XEN_NETIF_GSO_* */
91 } gso;
93 uint16_t pad[3];
94 } u;
95 };
97 struct netif_tx_response {
98 uint16_t id;
99 int16_t status; /* NETIF_RSP_* */
100 };
101 typedef struct netif_tx_response netif_tx_response_t;
103 struct netif_rx_request {
104 uint16_t id; /* Echoed in response message. */
105 grant_ref_t gref; /* Reference to incoming granted frame */
106 };
107 typedef struct netif_rx_request netif_rx_request_t;
109 /* Packet data has been validated against protocol checksum. */
110 #define _NETRXF_data_validated (0)
111 #define NETRXF_data_validated (1U<<_NETRXF_data_validated)
113 /* Protocol checksum field is blank in the packet (hardware offload)? */
114 #define _NETRXF_csum_blank (1)
115 #define NETRXF_csum_blank (1U<<_NETRXF_csum_blank)
117 struct netif_rx_response {
118 uint16_t id;
119 uint16_t offset; /* Offset in page of start of received packet */
120 uint16_t flags; /* NETRXF_* */
121 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
122 };
123 typedef struct netif_rx_response netif_rx_response_t;
125 /*
126 * Generate netif ring structures and types.
127 */
129 DEFINE_RING_TYPES(netif_tx, struct netif_tx_request, struct netif_tx_response);
130 DEFINE_RING_TYPES(netif_rx, struct netif_rx_request, struct netif_rx_response);
132 #define NETIF_RSP_DROPPED -2
133 #define NETIF_RSP_ERROR -1
134 #define NETIF_RSP_OKAY 0
135 /* No response: used for auxiliary requests (e.g., netif_tx_extra). */
136 #define NETIF_RSP_NULL 1
138 #endif
140 /*
141 * Local variables:
142 * mode: C
143 * c-set-style: "BSD"
144 * c-basic-offset: 4
145 * tab-width: 4
146 * indent-tabs-mode: nil
147 * End:
148 */