diff mbox

[net-next,1/1] vlan: restore offload use on vlan transmit

Message ID 1354827296-12009-2-git-send-email-gallatin@myri.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Andrew Gallatin Dec. 6, 2012, 8:54 p.m. UTC
This patch copies the vlan device's dev->features to its
dev->vlan_features, which allows packets to arrive at
vlan_dev_hard_start_xmit() with their offloads intact.

When a packet destined for a vlan interface is transmitted, it passes
through dev_hard_start_xmit() (and netif_skb_features()) twice.  First
on its way to vlan_dev_hard_start_xmit(), and then again on its way to
the backing device's xmit handler. If the vlan device does not setup
its dev->vlan_features, then netif_skb_features() will strip the
features on the first trip through it (on the way to
vlan_dev_hard_start_xmit()).

Signed-off-by: Andrew Gallatin <gallatin@myri.com>
---
 net/8021q/vlan_dev.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Ben Hutchings Dec. 6, 2012, 11:43 p.m. UTC | #1
On Thu, 2012-12-06 at 15:54 -0500, Andrew Gallatin wrote:
> This patch copies the vlan device's dev->features to its
> dev->vlan_features, which allows packets to arrive at
> vlan_dev_hard_start_xmit() with their offloads intact.
> 
> When a packet destined for a vlan interface is transmitted, it passes
> through dev_hard_start_xmit() (and netif_skb_features()) twice.  First
> on its way to vlan_dev_hard_start_xmit(), and then again on its way to
> the backing device's xmit handler. If the vlan device does not setup
> its dev->vlan_features, then netif_skb_features() will strip the
> features on the first trip through it (on the way to
> vlan_dev_hard_start_xmit()).
> 
> Signed-off-by: Andrew Gallatin <gallatin@myri.com>
> ---
>  net/8021q/vlan_dev.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index 4a6d31a..9d4b3c9 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -559,6 +559,7 @@ static int vlan_dev_init(struct net_device *dev)
>  
>  	dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
>  	dev->gso_max_size = real_dev->gso_max_size;
> +	dev->vlan_features = dev->features;

To repeat myself: no, this will result in the features being transferred
to VLAN devices stacked on top of this one (to an arbitrary depth!).

Ben.

>  	/* ipv6 shared card related stuff */
>  	dev->dev_id = real_dev->dev_id;
diff mbox

Patch

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4a6d31a..9d4b3c9 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -559,6 +559,7 @@  static int vlan_dev_init(struct net_device *dev)
 
 	dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
 	dev->gso_max_size = real_dev->gso_max_size;
+	dev->vlan_features = dev->features;
 
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;