datapath: Remove vlan compat support
authorPravin B Shelar <pshelar@nicira.com>
Wed, 4 Sep 2013 18:35:13 +0000 (11:35 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 6 Sep 2013 16:48:32 +0000 (09:48 -0700)
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/Modules.mk
datapath/datapath.c
datapath/datapath.h
datapath/linux/compat/netdevice.c
datapath/linux/compat/vxlan.c
datapath/vlan.c [deleted file]
datapath/vlan.h
datapath/vport-gre.c
datapath/vport-internal_dev.c
datapath/vport-lisp.c
datapath/vport-netdev.c

index e2a4dad..7ddf79c 100644 (file)
@@ -11,7 +11,6 @@ openvswitch_sources = \
        datapath.c \
        dp_notify.c \
        flow.c \
-       vlan.c \
        vport.c \
        vport-gre.c \
        vport-internal_dev.c \
index 9ed213e..70c9391 100644 (file)
@@ -411,10 +411,12 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
                nskb = skb_clone(skb, GFP_ATOMIC);
                if (!nskb)
                        return -ENOMEM;
-               
-               err = vlan_deaccel_tag(nskb);
-               if (err)
-                       return err;
+
+               nskb = __vlan_put_tag(nskb, nskb->vlan_proto, vlan_tx_tag_get(nskb));
+               if (!nskb)
+                       return -ENOMEM;
+
+               vlan_set_tci(nskb, 0);
 
                skb = nskb;
        }
index e3cd2f7..5d50dd4 100644 (file)
@@ -93,16 +93,11 @@ struct datapath {
  * @pkt_key: The flow information extracted from the packet.  Must be nonnull.
  * @tun_key: Key for the tunnel that encapsulated this packet. NULL if the
  * packet is not being tunneled.
- * @vlan_tci: Provides a substitute for the skb->vlan_tci field on kernels
- * before 2.6.27.
  */
 struct ovs_skb_cb {
        struct sw_flow          *flow;
        struct sw_flow_key      *pkt_key;
        struct ovs_key_ipv4_tunnel  *tun_key;
-#ifdef NEED_VLAN_FIELD
-       u16                     vlan_tci;
-#endif
 };
 #define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb)
 
index f03efde..248066d 100644 (file)
@@ -49,11 +49,7 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features
 
 u32 rpl_netif_skb_features(struct sk_buff *skb)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
-       unsigned long vlan_features = 0;
-#else
        unsigned long vlan_features = skb->dev->vlan_features;
-#endif /* kernel version < 2.6.26 */
 
        __be16 protocol = skb->protocol;
        u32 features = skb->dev->features;
index 780344e..d774b6c 100644 (file)
@@ -230,8 +230,14 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs,
        if (unlikely(err))
                return err;
 
-       if (unlikely(vlan_deaccel_tag(skb)))
-               return -ENOMEM;
+       if (vlan_tx_tag_present(skb)) {
+               if (unlikely(!__vlan_put_tag(skb,
+                                               skb->vlan_proto,
+                                               vlan_tx_tag_get(skb))))
+                       return -ENOMEM;
+
+               vlan_set_tci(skb, 0);
+       }
 
        vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
        vxh->vx_flags = htonl(VXLAN_FLAGS);
diff --git a/datapath/vlan.c b/datapath/vlan.c
deleted file mode 100644 (file)
index 104ed55..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2007-2011 Nicira, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/if_vlan.h>
-#include <linux/skbuff.h>
-
-#include "datapath.h"
-#include "vlan.h"
-
-#ifdef NEED_VLAN_FIELD
-void vlan_copy_skb_tci(struct sk_buff *skb)
-{
-       OVS_CB(skb)->vlan_tci = 0;
-}
-
-u16 vlan_get_tci(struct sk_buff *skb)
-{
-       return OVS_CB(skb)->vlan_tci;
-}
-
-void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
-{
-       OVS_CB(skb)->vlan_tci = vlan_tci;
-}
-
-bool vlan_tx_tag_present(struct sk_buff *skb)
-{
-       return OVS_CB(skb)->vlan_tci & VLAN_TAG_PRESENT;
-}
-
-u16 vlan_tx_tag_get(struct sk_buff *skb)
-{
-       return OVS_CB(skb)->vlan_tci & ~VLAN_TAG_PRESENT;
-}
-
-struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci)
-{
-       OVS_CB(skb)->vlan_tci = vlan_tci | VLAN_TAG_PRESENT;
-       return skb;
-}
-#endif /* NEED_VLAN_FIELD */
index 2e92c40..13ae6a7 100644 (file)
  * equivalent to those on 2.6.33+.
  */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
-#define NEED_VLAN_FIELD
-#endif
-
-#ifndef NEED_VLAN_FIELD
-static inline void vlan_copy_skb_tci(struct sk_buff *skb) { }
-
 static inline u16 vlan_get_tci(struct sk_buff *skb)
 {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
@@ -69,36 +62,4 @@ static inline void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
 #endif
        skb->vlan_tci = vlan_tci;
 }
-#else
-void vlan_copy_skb_tci(struct sk_buff *skb);
-u16 vlan_get_tci(struct sk_buff *skb);
-void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci);
-
-#undef vlan_tx_tag_present
-bool vlan_tx_tag_present(struct sk_buff *skb);
-
-#undef vlan_tx_tag_get
-u16 vlan_tx_tag_get(struct sk_buff *skb);
-
-#define __vlan_hwaccel_put_tag rpl__vlan_hwaccel_put_tag
-struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci);
-#endif /* NEED_VLAN_FIELD */
-
-static inline int vlan_deaccel_tag(struct sk_buff *skb)
-{
-       if (!vlan_tx_tag_present(skb))
-               return 0;
-
-       skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb));
-       if (unlikely(!skb))
-               return -ENOMEM;
-
-       if (skb->ip_summed == CHECKSUM_COMPLETE)
-               skb->csum = csum_add(skb->csum, csum_partial(skb->data
-                                       + (2 * ETH_ALEN), VLAN_HLEN, 0));
-
-       vlan_set_tci(skb, 0);
-       return 0;
-}
-
 #endif /* vlan.h */
index 7c65109..a49002f 100644 (file)
@@ -156,9 +156,14 @@ static int __send(struct vport *vport, struct sk_buff *skb,
                        goto err_free_rt;
        }
 
-       if (unlikely(vlan_deaccel_tag(skb))) {
-               err = -ENOMEM;
-               goto err_free_rt;
+       if (vlan_tx_tag_present(skb)) {
+               if (unlikely(!__vlan_put_tag(skb,
+                                            skb->vlan_proto,
+                                            vlan_tx_tag_get(skb)))) {
+                       err = -ENOMEM;
+                       goto err_free_rt;
+               }
+               vlan_set_tci(skb, 0);
        }
 
        /* Push Tunnel header. */
index f05f723..8e65f71 100644 (file)
@@ -79,8 +79,6 @@ static struct net_device_stats *internal_dev_sys_stats(struct net_device *netdev
 /* Called with rcu_read_lock_bh. */
 static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
-       vlan_copy_skb_tci(skb);
-
        rcu_read_lock();
        ovs_vport_receive(internal_dev_priv(netdev)->vport, skb, NULL);
        rcu_read_unlock();
@@ -254,8 +252,19 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
        int len;
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
-       if (unlikely(vlan_deaccel_tag(skb)))
-               return 0;
+       if (vlan_tx_tag_present(skb)) {
+               if (unlikely(!__vlan_put_tag(skb,
+                                            skb->vlan_proto,
+                                            vlan_tx_tag_get(skb))))
+                       return 0;
+
+               if (skb->ip_summed == CHECKSUM_COMPLETE)
+                       skb->csum = csum_add(skb->csum,
+                                            csum_partial(skb->data + (2 * ETH_ALEN),
+                                                         VLAN_HLEN, 0));
+
+               vlan_set_tci(skb, 0);
+       }
 #endif
 
        len = skb->len;
index 3fe3957..259cc2b 100644 (file)
@@ -542,8 +542,14 @@ static int ovs_tnl_send(struct vport *vport, struct sk_buff *skb,
 
                skb->next = NULL;
 
-               if (unlikely(vlan_deaccel_tag(skb)))
-                       goto next;
+               if (vlan_tx_tag_present(skb)) {
+                       if (unlikely(!__vlan_put_tag(skb,
+                                                       skb->vlan_proto,
+                                                       vlan_tx_tag_get(skb))))
+                               goto next;
+
+                       vlan_set_tci(skb, 0);
+               }
 
                frag_len = skb->len;
                skb_push(skb, tunnel_hlen);
index c033816..215a47e 100644 (file)
@@ -242,8 +242,6 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
        skb_push(skb, ETH_HLEN);
        ovs_skb_postpush_rcsum(skb, skb->data, ETH_HLEN);
 
-       vlan_copy_skb_tci(skb);
-
        ovs_vport_receive(vport, skb, NULL);
        return;