Browse Source

vlan: Warn the user if lowerdev has bad vlan features.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Vlad Yasevich 11 years ago
parent
commit
2adb956b08
2 changed files with 10 additions and 0 deletions
  1. 7 0
      include/linux/netdev_features.h
  2. 3 0
      net/8021q/vlan_dev.c

+ 7 - 0
include/linux/netdev_features.h

@@ -163,4 +163,11 @@ enum {
 /* changeable features with no special hardware requirements */
 /* changeable features with no special hardware requirements */
 #define NETIF_F_SOFT_FEATURES	(NETIF_F_GSO | NETIF_F_GRO)
 #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 */
 #endif	/* _LINUX_NETDEV_FEATURES_H */

+ 3 - 0
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->features |= real_dev->vlan_features | NETIF_F_LLTX;
 	dev->gso_max_size = real_dev->gso_max_size;
 	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 */
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
 	dev->dev_id = real_dev->dev_id;