Skip to contentSkip to conversation

8021q: set hard_header_len when VLAN offload features are toggled

PATCH Applied John Fastabend 3 participants 9 messages Oct 31, 2010 – Nov 15, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 05b867e..cb78b99 100644
@@ -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
#1 lore raw

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
index 14e3d1f..afb03c5 100644
@@ -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);
 
Acked-by on v1 2/3
#2 lore raw

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_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.

maintainer Applied
#3 lore raw

Re: [net-next-2.6 PATCH 2/3] net: remove check for headroom in vlan_dev_create

In reply to John Fastabend

From: 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_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.

Applied.

#4 lore raw

PATCH 3/3 net: consolidate 8021q tagging

In reply to 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_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
index db01b31..4625ba6 100644
@@ -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
index 80e280f..8a64db1 100644
@@ -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: "
Acked-by on v1 3/3
#5 lore raw

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_tci in the skb is always set and we allow the stack to add the actual tag in dev_hard_start_xmit().

Thanks John.

maintainer Applied
#6 lore raw

Re: [net-next-2.6 PATCH 3/3] net: consolidate 8021q tagging

In reply to John Fastabend

From: 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_tci in the skb is always set and we allow the stack to add the actual tag in dev_hard_start_xmit().

Applied.