datapath.c \
dp_notify.c \
flow.c \
- vlan.c \
vport.c \
vport-gre.c \
vport-internal_dev.c \
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;
}
* @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)
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;
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);
+++ /dev/null
-/*
- * 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 */
* 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)
#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 */
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. */
/* 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();
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;
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);
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;