datapath: adjust skb_gso_segment() for calling in rx path
authorCong Wang <amwang@redhat.com>
Wed, 6 Feb 2013 22:40:36 +0000 (14:40 -0800)
committerJesse Gross <jesse@nicira.com>
Wed, 6 Feb 2013 22:42:30 +0000 (14:42 -0800)
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 <jesse@nicira.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[jesse: backport to kernels before 3.9 and add to tunnel.c]
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/datapath.c
datapath/linux/compat/include/linux/netdevice.h
datapath/tunnel.c

index 04a5e7f..86ceb9f 100644 (file)
@@ -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);
 
index 0c2f2f4..71aad87 100644 (file)
@@ -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
index 6193891..7c2560f 100644 (file)
@@ -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);