Signed-off-by: Pravin B Shelar <pshe...@nicira.com>
---
 datapath/Modules.mk               |    1 -
 datapath/datapath.c               |   10 ++++--
 datapath/datapath.h               |    5 ---
 datapath/linux/compat/netdevice.c |    4 --
 datapath/linux/compat/vxlan.c     |   10 +++++-
 datapath/vlan.c                   |   58 -------------------------------------
 datapath/vlan.h                   |   34 ---------------------
 datapath/vport-gre.c              |   11 +++++--
 datapath/vport-internal_dev.c     |   12 +++++--
 datapath/vport-lisp.c             |   10 +++++-
 datapath/vport-netdev.c           |    2 -
 11 files changed, 38 insertions(+), 119 deletions(-)
 delete mode 100644 datapath/vlan.c

diff --git a/datapath/Modules.mk b/datapath/Modules.mk
index e2a4dad..7ddf79c 100644
--- a/datapath/Modules.mk
+++ b/datapath/Modules.mk
@@ -11,7 +11,6 @@ openvswitch_sources = \
        datapath.c \
        dp_notify.c \
        flow.c \
-       vlan.c \
        vport.c \
        vport-gre.c \
        vport-internal_dev.c \
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 9ed213e..bbec48f 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -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;
        }
diff --git a/datapath/datapath.h b/datapath/datapath.h
index e3cd2f7..5d50dd4 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -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)
 
diff --git a/datapath/linux/compat/netdevice.c 
b/datapath/linux/compat/netdevice.c
index f03efde..248066d 100644
--- a/datapath/linux/compat/netdevice.c
+++ b/datapath/linux/compat/netdevice.c
@@ -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;
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 780344e..d774b6c 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -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
index 104ed55..0000000
--- a/datapath/vlan.c
+++ /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 */
diff --git a/datapath/vlan.h b/datapath/vlan.h
index 1356aed..e930e97 100644
--- a/datapath/vlan.h
+++ b/datapath/vlan.h
@@ -46,13 +46,6 @@
  * 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,32 +62,5 @@ 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;
-
-       vlan_set_tci(skb, 0);
-       return 0;
-}
 
 #endif /* vlan.h */
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index 7c65109..a49002f 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -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. */
diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index f05f723..8707e46 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -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,14 @@ 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;
+
+               vlan_set_tci(skb, 0);
+       }
 #endif
 
        len = skb->len;
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 6eb101a..5caef8d 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -541,8 +541,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);
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index c033816..215a47e 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -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;
 
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to