aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/vxlan.h
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2015-01-12 20:00:38 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-14 15:20:04 -0500
commitdfd8645ea1bd91277f841e74c33e1f4dbbede808 (patch)
treeae1ac810501bacae10209b8faa94595fc10c3884 /include/net/vxlan.h
parenta2b12f3c7ac1ea43ae646db74faf0b56c2bba563 (diff)
vxlan: Remote checksum offload
Add support for remote checksum offload in VXLAN. This uses a reserved bit to indicate that RCO is being done, and uses the low order reserved eight bits of the VNI to hold the start and offset values in a compressed manner. Start is encoded in the low order seven bits of VNI. This is start >> 1 so that the checksum start offset is 0-254 using even values only. Checksum offset (transport checksum field) is indicated in the high order bit in the low order byte of the VNI. If the bit is set, the checksum field is for UDP (so offset = start + 6), else checksum field is for TCP (so offset = start + 16). Only TCP and UDP are supported in this implementation. Remote checksum offload for VXLAN is described in: https://tools.ietf.org/html/draft-herbert-vxlan-rco-00 Tested by running 200 TCP_STREAM connections with VXLAN (over IPv4). With UDP checksums and Remote Checksum Offload IPv4 Client 11.84% CPU utilization Server 12.96% CPU utilization 9197 Mbps IPv6 Client 12.46% CPU utilization Server 14.48% CPU utilization 8963 Mbps With UDP checksums, no remote checksum offload IPv4 Client 15.67% CPU utilization Server 14.83% CPU utilization 9094 Mbps IPv6 Client 16.21% CPU utilization Server 14.32% CPU utilization 9058 Mbps No UDP checksums IPv4 Client 15.03% CPU utilization Server 23.09% CPU utilization 9089 Mbps IPv6 Client 16.18% CPU utilization Server 26.57% CPU utilization 8954 Mbps Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/vxlan.h')
-rw-r--r--include/net/vxlan.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index a0d80736224f..0a7443b49133 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -19,6 +19,14 @@ struct vxlanhdr {
19 19
20/* VXLAN header flags. */ 20/* VXLAN header flags. */
21#define VXLAN_HF_VNI 0x08000000 21#define VXLAN_HF_VNI 0x08000000
22#define VXLAN_HF_RCO 0x00200000
23
24/* Remote checksum offload header option */
25#define VXLAN_RCO_MASK 0x7f /* Last byte of vni field */
26#define VXLAN_RCO_UDP 0x80 /* Indicate UDP RCO (TCP when not set *) */
27#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
28#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
29#define VXLAN_MAX_REMCSUM_START (VXLAN_RCO_MASK << VXLAN_RCO_SHIFT)
22 30
23#define VXLAN_N_VID (1u << 24) 31#define VXLAN_N_VID (1u << 24)
24#define VXLAN_VID_MASK (VXLAN_N_VID - 1) 32#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
@@ -38,6 +46,7 @@ struct vxlan_sock {
38 struct hlist_head vni_list[VNI_HASH_SIZE]; 46 struct hlist_head vni_list[VNI_HASH_SIZE];
39 atomic_t refcnt; 47 atomic_t refcnt;
40 struct udp_offload udp_offloads; 48 struct udp_offload udp_offloads;
49 u32 flags;
41}; 50};
42 51
43#define VXLAN_F_LEARN 0x01 52#define VXLAN_F_LEARN 0x01
@@ -49,6 +58,8 @@ struct vxlan_sock {
49#define VXLAN_F_UDP_CSUM 0x40 58#define VXLAN_F_UDP_CSUM 0x40
50#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80 59#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
51#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100 60#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
61#define VXLAN_F_REMCSUM_TX 0x200
62#define VXLAN_F_REMCSUM_RX 0x400
52 63
53struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, 64struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
54 vxlan_rcv_t *rcv, void *data, 65 vxlan_rcv_t *rcv, void *data,