From 0aa52d88bdf6bc22fed80beb175a6dfe420dfabd Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Wed, 6 Feb 2013 14:40:36 -0800 Subject: [PATCH] datapath: adjust skb_gso_segment() for calling in rx path skb_gso_segment() is almost always called in tx path, except for openvswitch. It calls this function when it receives the packet and tries to queue it to user-space. In this special case, the ->ip_summed check inside skb_gso_segment() is no longer true, as ->ip_summed value has different meanings on rx path. This patch adjusts skb_gso_segment() so that we can at least avoid such warnings on checksum. Cc: Jesse Gross Cc: David S. Miller Signed-off-by: Cong Wang Signed-off-by: David S. Miller [jesse: backport to kernels before 3.9 and add to tunnel.c] Signed-off-by: Jesse Gross --- datapath/datapath.c | 2 +- datapath/linux/compat/include/linux/netdevice.h | 13 +++++++++++++ datapath/tunnel.c | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 04a5e7f2f..86ceb9f80 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -306,7 +306,7 @@ static int queue_gso_packets(struct net *net, int dp_ifindex, struct sk_buff *segs, *nskb; int err; - segs = skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM); + segs = __skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM, false); if (IS_ERR(segs)) return PTR_ERR(segs); diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index 0c2f2f4c7..71aad8704 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -154,4 +154,17 @@ static inline int rpl_netif_needs_gso(struct sk_buff *skb, int features) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +typedef u32 netdev_features_t; +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +static inline struct sk_buff *__skb_gso_segment(struct sk_buff *skb, + netdev_features_t features, + bool tx_path) +{ + return skb_gso_segment(skb, features); +} +#endif + #endif diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 61938910a..7c2560f50 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -435,7 +435,7 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb, if (skb_is_gso(skb)) { struct sk_buff *nskb; - nskb = skb_gso_segment(skb, 0); + nskb = __skb_gso_segment(skb, 0, false); if (IS_ERR(nskb)) { kfree_skb(skb); err = PTR_ERR(nskb); -- 2.43.0