Skip to content

Commit

Permalink
datapath: Remove vlan compat support
Browse files Browse the repository at this point in the history
Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Jesse Gross <[email protected]>
  • Loading branch information
Pravin B Shelar committed Sep 6, 2013
1 parent 237c4f2 commit 07ac71e
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 124 deletions.
1 change: 0 additions & 1 deletion datapath/Modules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ openvswitch_sources = \
datapath.c \
dp_notify.c \
flow.c \
vlan.c \
vport.c \
vport-gre.c \
vport-internal_dev.c \
Expand Down
10 changes: 6 additions & 4 deletions datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 0 additions & 5 deletions datapath/datapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 0 additions & 4 deletions datapath/linux/compat/netdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions datapath/linux/compat/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
58 changes: 0 additions & 58 deletions datapath/vlan.c

This file was deleted.

39 changes: 0 additions & 39 deletions datapath/vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 */
11 changes: 8 additions & 3 deletions datapath/vport-gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
17 changes: 13 additions & 4 deletions datapath/vport-internal_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions datapath/vport-lisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions datapath/vport-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 07ac71e

Please sign in to comment.