netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] Audit all drivers for correct vlan_features.
@ 2014-03-28  2:14 Vlad Yasevich
  2014-03-28  2:14 ` [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans Vlad Yasevich
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Vlad Yasevich @ 2014-03-28  2:14 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich

Some drivers set vlan acceleration features in vlan_features.  This causes
issues with Q-in-Q/802.1ad configurations.

Audit all the drivers for correct vlan_features.  Fix broken ones.
Add a warning to vlan code to help catch future offenders.

Vlad Yasevich (4):
  qlge: Do not propaged vlan tag offloads to vlans
  ifb: Remove vlan acceleration from vlan_features
  veth: Turn off vlan rx acceleration in vlan_features
  vlan: Mask off vlan acceleration features on vlan device.

 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 4 +++-
 drivers/net/ifb.c                            | 3 ++-
 drivers/net/veth.c                           | 5 ++++-
 include/linux/netdev_features.h              | 5 +++++
 net/8021q/vlan_dev.c                         | 4 ++++
 5 files changed, 18 insertions(+), 3 deletions(-)

-- 
1.8.5.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans
  2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
@ 2014-03-28  2:14 ` Vlad Yasevich
  2014-03-28  3:32   ` Jitendra Kalsaria
  2014-03-28  2:14 ` [PATCH net 2/4] ifb: Remove vlan acceleration from vlan_features Vlad Yasevich
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Vlad Yasevich @ 2014-03-28  2:14 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich, Shahed Shaikh, Jitendra Kalsaria, Ron Mercer

qlge driver turns off NETIF_F_HW_CTAG_FILTER, but forgets to
turn off HW_CTAG_TX and HW_CTAG_RX on vlan devices.  With the
current settings, q-in-q will only generate a single vlan header.
Remember to mask off CTAG_TX and CTAG_RX features in vlan_features.

CC: Shahed Shaikh <shahed.shaikh@qlogic.com>
CC: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
CC: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index ce2cfdd..656c65d 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4765,7 +4765,9 @@ static int qlge_probe(struct pci_dev *pdev,
 	ndev->features = ndev->hw_features;
 	ndev->vlan_features = ndev->hw_features;
 	/* vlan gets same features (except vlan filter) */
-	ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+	ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER |
+				 NETIF_F_HW_VLAN_CTAG_TX |
+				 NETIF_F_HW_VLAN_CTAG_RX);
 
 	if (test_bit(QL_DMA64, &qdev->flags))
 		ndev->features |= NETIF_F_HIGHDMA;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net 2/4] ifb: Remove vlan acceleration from vlan_features
  2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
  2014-03-28  2:14 ` [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans Vlad Yasevich
@ 2014-03-28  2:14 ` Vlad Yasevich
  2014-03-28  2:14 ` [PATCH net 3/4] veth: Turn off vlan rx acceleration in vlan_features Vlad Yasevich
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Vlad Yasevich @ 2014-03-28  2:14 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich

Do not include vlan acceleration features in vlan_features as that
precludes correct Q-in-Q operation.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 drivers/net/ifb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index c14d39b..d7b2e94 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -180,7 +180,8 @@ static void ifb_setup(struct net_device *dev)
 	dev->tx_queue_len = TX_Q_LIMIT;
 
 	dev->features |= IFB_FEATURES;
-	dev->vlan_features |= IFB_FEATURES;
+	dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
+					       NETIF_F_HW_VLAN_STAG_TX);
 
 	dev->flags |= IFF_NOARP;
 	dev->flags &= ~IFF_MULTICAST;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net 3/4] veth: Turn off vlan rx acceleration in vlan_features
  2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
  2014-03-28  2:14 ` [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans Vlad Yasevich
  2014-03-28  2:14 ` [PATCH net 2/4] ifb: Remove vlan acceleration from vlan_features Vlad Yasevich
@ 2014-03-28  2:14 ` Vlad Yasevich
  2014-03-28  2:14 ` [PATCH 4/4] vlan: Warn the user if lowerdev has bad vlan features Vlad Yasevich
  2014-03-28 21:17 ` [PATCH net 0/4] Audit all drivers for correct vlan_features David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: Vlad Yasevich @ 2014-03-28  2:14 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich

For completeness, turn off vlan rx acceleration in vlan_features so
that it doesn't show up on q-in-q setups.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 drivers/net/veth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 5b37437..c0e7c64 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -286,7 +286,10 @@ static void veth_setup(struct net_device *dev)
 	dev->features |= NETIF_F_LLTX;
 	dev->features |= VETH_FEATURES;
 	dev->vlan_features = dev->features &
-			     ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX);
+			     ~(NETIF_F_HW_VLAN_CTAG_TX |
+			       NETIF_F_HW_VLAN_STAG_TX |
+			       NETIF_F_HW_VLAN_CTAG_RX |
+			       NETIF_F_HW_VLAN_STAG_RX);
 	dev->destructor = veth_dev_free;
 
 	dev->hw_features = VETH_FEATURES;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] vlan: Warn the user if lowerdev has bad vlan features.
  2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
                   ` (2 preceding siblings ...)
  2014-03-28  2:14 ` [PATCH net 3/4] veth: Turn off vlan rx acceleration in vlan_features Vlad Yasevich
@ 2014-03-28  2:14 ` Vlad Yasevich
  2014-03-28 21:17 ` [PATCH net 0/4] Audit all drivers for correct vlan_features David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: Vlad Yasevich @ 2014-03-28  2:14 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich

Some drivers incorrectly assign vlan acceleration features to
vlan_features thus causing issues for Q-in-Q vlan configurations.
Warn the user of such cases.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 include/linux/netdev_features.h | 7 +++++++
 net/8021q/vlan_dev.c            | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 1005ebf..5a09a48 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -163,4 +163,11 @@ enum {
 /* changeable features with no special hardware requirements */
 #define NETIF_F_SOFT_FEATURES	(NETIF_F_GSO | NETIF_F_GRO)
 
+#define NETIF_F_VLAN_FEATURES	(NETIF_F_HW_VLAN_CTAG_FILTER | \
+				 NETIF_F_HW_VLAN_CTAG_RX | \
+				 NETIF_F_HW_VLAN_CTAG_TX | \
+				 NETIF_F_HW_VLAN_STAG_FILTER | \
+				 NETIF_F_HW_VLAN_STAG_RX | \
+				 NETIF_F_HW_VLAN_STAG_TX)
+
 #endif	/* _LINUX_NETDEV_FEATURES_H */
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index a9591ff..0e1db36 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -578,6 +578,9 @@ 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;
+	if (dev->features & NETIF_F_VLAN_FEATURES)
+		netdev_warn(real_dev, "VLAN features are set incorrectly.  Q-in-Q configurations may not work correctly.\n");
+
 
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans
  2014-03-28  2:14 ` [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans Vlad Yasevich
@ 2014-03-28  3:32   ` Jitendra Kalsaria
  0 siblings, 0 replies; 7+ messages in thread
From: Jitendra Kalsaria @ 2014-03-28  3:32 UTC (permalink / raw)
  To: Vlad Yasevich, netdev; +Cc: Shahed Shaikh, Ron Mercer


On 3/27/14 7:14 PM, "Vlad Yasevich" <vyasevic@redhat.com> wrote:

>qlge driver turns off NETIF_F_HW_CTAG_FILTER, but forgets to
>turn off HW_CTAG_TX and HW_CTAG_RX on vlan devices.  With the
>current settings, q-in-q will only generate a single vlan header.
>Remember to mask off CTAG_TX and CTAG_RX features in vlan_features.
>
>CC: Shahed Shaikh <shahed.shaikh@qlogic.com>
>CC: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
>CC: Ron Mercer <ron.mercer@qlogic.com>
>Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
>---
> drivers/net/ethernet/qlogic/qlge/qlge_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 0/4] Audit all drivers for correct vlan_features.
  2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
                   ` (3 preceding siblings ...)
  2014-03-28  2:14 ` [PATCH 4/4] vlan: Warn the user if lowerdev has bad vlan features Vlad Yasevich
@ 2014-03-28 21:17 ` David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2014-03-28 21:17 UTC (permalink / raw)
  To: vyasevic; +Cc: netdev

From: Vlad Yasevich <vyasevic@redhat.com>
Date: Thu, 27 Mar 2014 22:14:45 -0400

> Some drivers set vlan acceleration features in vlan_features.  This causes
> issues with Q-in-Q/802.1ad configurations.
> 
> Audit all the drivers for correct vlan_features.  Fix broken ones.
> Add a warning to vlan code to help catch future offenders.
> 
> Vlad Yasevich (4):
>   qlge: Do not propaged vlan tag offloads to vlans
>   ifb: Remove vlan acceleration from vlan_features
>   veth: Turn off vlan rx acceleration in vlan_features
>   vlan: Mask off vlan acceleration features on vlan device.

Excellent work, thanks for doing this Vlad!

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-28 21:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28  2:14 [PATCH net 0/4] Audit all drivers for correct vlan_features Vlad Yasevich
2014-03-28  2:14 ` [PATCH net 1/4] qlge: Do not propaged vlan tag offloads to vlans Vlad Yasevich
2014-03-28  3:32   ` Jitendra Kalsaria
2014-03-28  2:14 ` [PATCH net 2/4] ifb: Remove vlan acceleration from vlan_features Vlad Yasevich
2014-03-28  2:14 ` [PATCH net 3/4] veth: Turn off vlan rx acceleration in vlan_features Vlad Yasevich
2014-03-28  2:14 ` [PATCH 4/4] vlan: Warn the user if lowerdev has bad vlan features Vlad Yasevich
2014-03-28 21:17 ` [PATCH net 0/4] Audit all drivers for correct vlan_features David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).