diff options
author | Ian Campbell <Ian.Campbell@citrix.com> | 2011-03-14 20:06:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-15 22:38:03 -0400 |
commit | f942dc2552b8bfdee607be867b12a8971bb9cd85 (patch) | |
tree | ba7d264f94d9e6938ef4e36f93e179162e12cf20 /include/xen | |
parent | e0da2481fc00e031c04480b9dc88fae9eff39a19 (diff) |
xen network backend driver
netback is the host side counterpart to the frontend driver in
drivers/net/xen-netfront.c. The PV protocol is also implemented by
frontend drivers in other OSes too, such as the BSDs and even Windows.
The patch is based on the driver from the xen.git pvops kernel tree but
has been put through the checkpatch.pl wringer plus several manual
cleanup passes and review iterations. The driver has been moved from
drivers/xen/netback to drivers/net/xen-netback.
One major change from xen.git is that the guest transmit path (i.e. what
looks like receive to netback) has been significantly reworked to remove
the dependency on the out of tree PageForeign page flag (a core kernel
patch which enables a per page destructor callback on the final
put_page). This page flag was used in order to implement a grant map
based transmit path (where guest pages are mapped directly into SKB
frags). Instead this version of netback uses grant copy operations into
regular memory belonging to the backend domain. Reinstating the grant
map functionality is something which I would like to revisit in the
future.
Note that this driver depends on 2e820f58f7ad "xen/irq: implement
bind_interdomain_evtchn_to_irqhandler for backend drivers" which is in
linux next via the "xen-two" tree and is intended for the 2.6.39 merge
window:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/backends
this branch has only that single commit since 2.6.38-rc2 and is safe for
cross merging into the net branch.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/interface/io/netif.h | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h index 518481c95f18..cb94668f6e9f 100644 --- a/include/xen/interface/io/netif.h +++ b/include/xen/interface/io/netif.h | |||
@@ -22,50 +22,50 @@ | |||
22 | 22 | ||
23 | /* | 23 | /* |
24 | * This is the 'wire' format for packets: | 24 | * This is the 'wire' format for packets: |
25 | * Request 1: netif_tx_request -- NETTXF_* (any flags) | 25 | * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) |
26 | * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) | 26 | * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info) |
27 | * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) | 27 | * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE) |
28 | * Request 4: netif_tx_request -- NETTXF_more_data | 28 | * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data |
29 | * Request 5: netif_tx_request -- NETTXF_more_data | 29 | * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data |
30 | * ... | 30 | * ... |
31 | * Request N: netif_tx_request -- 0 | 31 | * Request N: xen_netif_tx_request -- 0 |
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* Protocol checksum field is blank in the packet (hardware offload)? */ | 34 | /* Protocol checksum field is blank in the packet (hardware offload)? */ |
35 | #define _NETTXF_csum_blank (0) | 35 | #define _XEN_NETTXF_csum_blank (0) |
36 | #define NETTXF_csum_blank (1U<<_NETTXF_csum_blank) | 36 | #define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank) |
37 | 37 | ||
38 | /* Packet data has been validated against protocol checksum. */ | 38 | /* Packet data has been validated against protocol checksum. */ |
39 | #define _NETTXF_data_validated (1) | 39 | #define _XEN_NETTXF_data_validated (1) |
40 | #define NETTXF_data_validated (1U<<_NETTXF_data_validated) | 40 | #define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated) |
41 | 41 | ||
42 | /* Packet continues in the next request descriptor. */ | 42 | /* Packet continues in the next request descriptor. */ |
43 | #define _NETTXF_more_data (2) | 43 | #define _XEN_NETTXF_more_data (2) |
44 | #define NETTXF_more_data (1U<<_NETTXF_more_data) | 44 | #define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data) |
45 | 45 | ||
46 | /* Packet to be followed by extra descriptor(s). */ | 46 | /* Packet to be followed by extra descriptor(s). */ |
47 | #define _NETTXF_extra_info (3) | 47 | #define _XEN_NETTXF_extra_info (3) |
48 | #define NETTXF_extra_info (1U<<_NETTXF_extra_info) | 48 | #define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) |
49 | 49 | ||
50 | struct xen_netif_tx_request { | 50 | struct xen_netif_tx_request { |
51 | grant_ref_t gref; /* Reference to buffer page */ | 51 | grant_ref_t gref; /* Reference to buffer page */ |
52 | uint16_t offset; /* Offset within buffer page */ | 52 | uint16_t offset; /* Offset within buffer page */ |
53 | uint16_t flags; /* NETTXF_* */ | 53 | uint16_t flags; /* XEN_NETTXF_* */ |
54 | uint16_t id; /* Echoed in response message. */ | 54 | uint16_t id; /* Echoed in response message. */ |
55 | uint16_t size; /* Packet size in bytes. */ | 55 | uint16_t size; /* Packet size in bytes. */ |
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* Types of netif_extra_info descriptors. */ | 58 | /* Types of xen_netif_extra_info descriptors. */ |
59 | #define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ | 59 | #define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ |
60 | #define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ | 60 | #define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ |
61 | #define XEN_NETIF_EXTRA_TYPE_MAX (2) | 61 | #define XEN_NETIF_EXTRA_TYPE_MAX (2) |
62 | 62 | ||
63 | /* netif_extra_info flags. */ | 63 | /* xen_netif_extra_info flags. */ |
64 | #define _XEN_NETIF_EXTRA_FLAG_MORE (0) | 64 | #define _XEN_NETIF_EXTRA_FLAG_MORE (0) |
65 | #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) | 65 | #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) |
66 | 66 | ||
67 | /* GSO types - only TCPv4 currently supported. */ | 67 | /* GSO types - only TCPv4 currently supported. */ |
68 | #define XEN_NETIF_GSO_TYPE_TCPV4 (1) | 68 | #define XEN_NETIF_GSO_TYPE_TCPV4 (1) |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * This structure needs to fit within both netif_tx_request and | 71 | * This structure needs to fit within both netif_tx_request and |
@@ -107,7 +107,7 @@ struct xen_netif_extra_info { | |||
107 | 107 | ||
108 | struct xen_netif_tx_response { | 108 | struct xen_netif_tx_response { |
109 | uint16_t id; | 109 | uint16_t id; |
110 | int16_t status; /* NETIF_RSP_* */ | 110 | int16_t status; /* XEN_NETIF_RSP_* */ |
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct xen_netif_rx_request { | 113 | struct xen_netif_rx_request { |
@@ -116,25 +116,29 @@ struct xen_netif_rx_request { | |||
116 | }; | 116 | }; |
117 | 117 | ||
118 | /* Packet data has been validated against protocol checksum. */ | 118 | /* Packet data has been validated against protocol checksum. */ |
119 | #define _NETRXF_data_validated (0) | 119 | #define _XEN_NETRXF_data_validated (0) |
120 | #define NETRXF_data_validated (1U<<_NETRXF_data_validated) | 120 | #define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated) |
121 | 121 | ||
122 | /* Protocol checksum field is blank in the packet (hardware offload)? */ | 122 | /* Protocol checksum field is blank in the packet (hardware offload)? */ |
123 | #define _NETRXF_csum_blank (1) | 123 | #define _XEN_NETRXF_csum_blank (1) |
124 | #define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) | 124 | #define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank) |
125 | 125 | ||
126 | /* Packet continues in the next request descriptor. */ | 126 | /* Packet continues in the next request descriptor. */ |
127 | #define _NETRXF_more_data (2) | 127 | #define _XEN_NETRXF_more_data (2) |
128 | #define NETRXF_more_data (1U<<_NETRXF_more_data) | 128 | #define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data) |
129 | 129 | ||
130 | /* Packet to be followed by extra descriptor(s). */ | 130 | /* Packet to be followed by extra descriptor(s). */ |
131 | #define _NETRXF_extra_info (3) | 131 | #define _XEN_NETRXF_extra_info (3) |
132 | #define NETRXF_extra_info (1U<<_NETRXF_extra_info) | 132 | #define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info) |
133 | |||
134 | /* GSO Prefix descriptor. */ | ||
135 | #define _XEN_NETRXF_gso_prefix (4) | ||
136 | #define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix) | ||
133 | 137 | ||
134 | struct xen_netif_rx_response { | 138 | struct xen_netif_rx_response { |
135 | uint16_t id; | 139 | uint16_t id; |
136 | uint16_t offset; /* Offset in page of start of received packet */ | 140 | uint16_t offset; /* Offset in page of start of received packet */ |
137 | uint16_t flags; /* NETRXF_* */ | 141 | uint16_t flags; /* XEN_NETRXF_* */ |
138 | int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ | 142 | int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ |
139 | }; | 143 | }; |
140 | 144 | ||
@@ -149,10 +153,10 @@ DEFINE_RING_TYPES(xen_netif_rx, | |||
149 | struct xen_netif_rx_request, | 153 | struct xen_netif_rx_request, |
150 | struct xen_netif_rx_response); | 154 | struct xen_netif_rx_response); |
151 | 155 | ||
152 | #define NETIF_RSP_DROPPED -2 | 156 | #define XEN_NETIF_RSP_DROPPED -2 |
153 | #define NETIF_RSP_ERROR -1 | 157 | #define XEN_NETIF_RSP_ERROR -1 |
154 | #define NETIF_RSP_OKAY 0 | 158 | #define XEN_NETIF_RSP_OKAY 0 |
155 | /* No response: used for auxiliary requests (e.g., netif_tx_extra). */ | 159 | /* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */ |
156 | #define NETIF_RSP_NULL 1 | 160 | #define XEN_NETIF_RSP_NULL 1 |
157 | 161 | ||
158 | #endif | 162 | #endif |