Patchwork [net] tun: remove bogus hardware vlan acceleration flags from vlan_features

login
register
mail settings
Submitter Toshiaki Makita
Date Feb. 18, 2014, 12:20 p.m.
Message ID <1392726009-8083-2-git-send-email-makita.toshiaki@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/321428/
State Accepted
Delegated to: David Miller
Headers show

Comments

Toshiaki Makita - Feb. 18, 2014, 12:20 p.m.
From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>

Even though only the outer vlan tag can be HW accelerated in the transmission
path, in the TUN/TAP driver vlan_features mirrors hw_features, which happens
to have the NETIF_F_HW_VLAN_?TAG_TX flags set. Because of this, during packet
tranmisssion through a stacked vlan device dev_hard_start_xmit, (incorrectly)
assuming that the vlan device supports hardware vlan acceleration, does not
add the vlan header to the skb payload and the inner vlan tags are lost
(vlan_tci contains the outer vlan tag when userspace reads the packet from
the tap device).

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Feb. 20, 2014, 7:16 a.m.
From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Date: Tue, 18 Feb 2014 21:20:09 +0900

> From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
> 
> Even though only the outer vlan tag can be HW accelerated in the transmission
> path, in the TUN/TAP driver vlan_features mirrors hw_features, which happens
> to have the NETIF_F_HW_VLAN_?TAG_TX flags set. Because of this, during packet
> tranmisssion through a stacked vlan device dev_hard_start_xmit, (incorrectly)
> assuming that the vlan device supports hardware vlan acceleration, does not
> add the vlan header to the skb payload and the inner vlan tags are lost
> (vlan_tci contains the outer vlan tag when userspace reads the packet from
> the tap device).
> 
> Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>

Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urNp linux-3.13.3-orig/drivers/net/tun.c linux-3.13.3/drivers/net/tun.c
--- linux-3.13.3-orig/drivers/net/tun.c	2014-01-20 11:40:07.000000000 +0900
+++ linux-3.13.3/drivers/net/tun.c	2014-02-18 16:23:04.461078629 +0900
@@ -1651,7 +1651,9 @@  static int tun_set_iff(struct net *net,
 				   TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
 				   NETIF_F_HW_VLAN_STAG_TX;
 		dev->features = dev->hw_features;
-		dev->vlan_features = dev->features;
+		dev->vlan_features = dev->features &
+				     ~(NETIF_F_HW_VLAN_CTAG_TX |
+				       NETIF_F_HW_VLAN_STAG_TX);
 
 		INIT_LIST_HEAD(&tun->disabled);
 		err = tun_attach(tun, file, false);