aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tcp.h
diff options
context:
space:
mode:
authorJoseph Gasparakis <joseph.gasparakis@intel.com>2012-12-07 09:14:14 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-09 00:20:28 -0500
commit6a674e9c75b17e7a88ff15b3c2e269eed54f7cfb (patch)
treecff48ec155b5c7d8a595d66cc7dc0216a91f9ec3 /include/linux/tcp.h
parent9ecb9aabaf634677c77af467f4e3028b09d7bcda (diff)
net: Add support for hardware-offloaded encapsulation
This patch adds support in the kernel for offloading in the NIC Tx and Rx checksumming for encapsulated packets (such as VXLAN and IP GRE). For Tx encapsulation offload, the driver will need to set the right bits in netdev->hw_enc_features. The protocol driver will have to set the skb->encapsulation bit and populate the inner headers, so the NIC driver will use those inner headers to calculate the csum in hardware. For Rx encapsulation offload, the driver will need to set again the skb->encapsulation flag and the skb->ip_csum to CHECKSUM_UNNECESSARY. In that case the protocol driver should push the decapsulated packet up to the stack, again with CHECKSUM_UNNECESSARY. In ether case, the protocol driver should set the skb->encapsulation flag back to zero. Finally the protocol driver should have NETIF_F_RXCSUM flag set in its features. Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/tcp.h')
-rw-r--r--include/linux/tcp.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 60b7aac15e0e..4e1d2283e3cc 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -35,6 +35,16 @@ static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
35 return tcp_hdr(skb)->doff * 4; 35 return tcp_hdr(skb)->doff * 4;
36} 36}
37 37
38static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)
39{
40 return (struct tcphdr *)skb_inner_transport_header(skb);
41}
42
43static inline unsigned int inner_tcp_hdrlen(const struct sk_buff *skb)
44{
45 return inner_tcp_hdr(skb)->doff * 4;
46}
47
38static inline unsigned int tcp_optlen(const struct sk_buff *skb) 48static inline unsigned int tcp_optlen(const struct sk_buff *skb)
39{ 49{
40 return (tcp_hdr(skb)->doff - 5) * 4; 50 return (tcp_hdr(skb)->doff - 5) * 4;