8021q: set hard_header_len when VLAN offload features are toggled
Subsystems (2)
PATCH 1/3 8021q: set hard_header_len when VLAN offload features are toggled
Toggling the vlan tx|rx hw offloads needs to set the hard_header_len as well otherwise we end up using LL_RESERVED_SPACE incorrectly. This results in pskb_expand_head() being used unnecessarily.
---
net/8021q/vlan.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
net/8021q/vlan.c +6 -0
@@ -334,6 +334,12 @@ static void vlan_transfer_features(struct net_device *dev, vlandev->features &= ~dev->vlan_features; vlandev->features |= dev->features & dev->vlan_features; vlandev->gso_max_size = dev->gso_max_size; + +if (dev->features &NETIF_F_HW_VLAN_TX ) + vlandev->hard_header_len = dev->hard_header_len; +else + vlandev->hard_header_len = dev->hard_header_len +VLAN_HLEN ; +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;#endif
PATCH 2/3 net: remove check for headroom in vlan_dev_create
It is possible for the headroom to be smaller then the hard_header_len for a short period of time after toggling the vlan offload setting.
This is not a hard error and skb_cow_head is called in __vlan_put_tag() to resolve this.
---
net/8021q/vlan_dev.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
net/8021q/vlan_dev.c +0 -3
@@ -274,9 +274,6 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,u16 vlan_tci =0 ;int rc; -if (WARN_ON (skb_headroom (skb) < dev->hard_header_len)) -return -ENOSPC ; -if (!(vlan_dev_info (dev)->flags &VLAN_FLAG_REORDER_HDR )) { vhdr = (struct vlan_hdr *)skb_push (skb,VLAN_HLEN );
Re: [net-next-2.6 PATCH 2/3] net: remove check for headroom in vlan_dev_create
Quoted 8 lines · John Fastabend
It is possible for the headroom to be smaller then the
hard_header_lenfor a short period of time after toggling the vlan offload setting.This is not a hard error and
skb_cow_headis called in__vlan_put_tag()to resolve this.Signed-off-by John Fastabend <[email protected]>
Re: [net-next-2.6 PATCH 2/3] net: remove check for headroom in vlan_dev_create
In reply to John FastabendFrom: John Fastabend <[email protected]>
Date: Sat, 30 Oct 2010 17:22:37 -0700
Quoted 8 lines
It is possible for the headroom to be smaller then the
hard_header_lenfor a short period of time after toggling the vlan offload setting.This is not a hard error and
skb_cow_headis called in__vlan_put_tag()to resolve this.Signed-off-by John Fastabend <[email protected]>
Applied.
PATCH 3/3 net: consolidate 8021q tagging
In reply to John FastabendNow that VLAN packets are tagged in dev_hard_start_xmit() at the bottom of the stack we no longer need to tag them in the 8021Q module (Except in the !VLAN_FLAG_REORDER_HDR case).
This allows the accel path and non accel paths to be consolidated. Here the vlan_tci in the skb is always set and we allow the stack to add the actual tag in dev_hard_start_xmit().
---
net/8021q/vlan.h | 4 -- net/8021q/vlan_dev.c | 105 +++----------------------------------------------- net/8021q/vlanproc.c | 4 -- 3 files changed, 7 insertions(+), 106 deletions(-)
net/8021q/vlan.h +0 -4
@@ -45,8 +45,6 @@ struct vlan_rx_stats {* @real_dev: underlying netdevice * @real_dev_addr: address of underlying netdevice * @dent: proc dir entry -* @cnt_inc_headroom_on_tx: statistic - number of skb expansions on TX -* @cnt_encap_on_xmit: statistic - number of skb encapsulations on TX * @vlan_rx_stats: ptr to percpu rx stats */ struct vlan_dev_info {
@@ -62,8 +60,6 @@ struct vlan_dev_info {unsigned char real_dev_addr[ETH_ALEN ];struct proc_dir_entry *dent; -unsigned long cnt_inc_headroom_on_tx; -unsigned long cnt_encap_on_xmit;struct vlan_rx_stats __percpu *vlan_rx_stats; };
net/8021q/vlan_dev.c +7 -98
151 lines not on this page · raw message
net/8021q/vlanproc.c +0 -4
@@ -299,10 +299,6 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)seq_puts (seq,"\n" );seq_printf (seq, fmt64,"total frames transmitted" , stats->tx_packets);seq_printf (seq, fmt64,"total bytes transmitted" , stats->tx_bytes); -seq_printf (seq, fmt,"total headroom inc" , - dev_info->cnt_inc_headroom_on_tx); -seq_printf (seq, fmt,"total encap on xmit" , - dev_info->cnt_encap_on_xmit);seq_printf (seq,"Device: %s" , dev_info->real_dev->name);/* now show all PRIORITY mappings relating to this VLAN */ seq_printf(seq, "\nINGRESS priority mappings: "
Re: [net-next-2.6 PATCH 3/3] net: consolidate 8021q tagging
Quoted 10 lines · John Fastabend
Now that VLAN packets are tagged in
dev_hard_start_xmit()at the bottom of the stack we no longer need to tag them in the 8021Q module (Except in the !VLAN_FLAG_REORDER_HDR case).This allows the accel path and non accel paths to be consolidated. Here the
vlan_tciin the skb is always set and we allow the stack to add the actual tag indev_hard_start_xmit().Signed-off-by John Fastabend <[email protected]>
Thanks John.
Re: [net-next-2.6 PATCH 3/3] net: consolidate 8021q tagging
In reply to John FastabendFrom: John Fastabend <[email protected]>
Date: Sat, 30 Oct 2010 17:22:42 -0700
Quoted 10 lines
Now that VLAN packets are tagged in
dev_hard_start_xmit()at the bottom of the stack we no longer need to tag them in the 8021Q module (Except in the !VLAN_FLAG_REORDER_HDR case).This allows the accel path and non accel paths to be consolidated. Here the
vlan_tciin the skb is always set and we allow the stack to add the actual tag indev_hard_start_xmit().Signed-off-by John Fastabend <[email protected]>
Applied.
Quoted 5 lines · John Fastabend
Toggling the vlan tx|rx hw offloads needs to set the
hard_header_lenas well otherwise we end up usingLL_RESERVED_SPACEincorrectly. This results inpskb_expand_head()being used unnecessarily.Signed-off-by John Fastabend <[email protected]>
From: John Fastabend <[email protected]>
Date: Sat, 30 Oct 2010 17:22:32 -0700
Quoted 5 lines
Toggling the vlan tx|rx hw offloads needs to set the
hard_header_lenas well otherwise we end up usingLL_RESERVED_SPACEincorrectly. This results inpskb_expand_head()being used unnecessarily.Signed-off-by John Fastabend <[email protected]>
Applied.