Patchwork net: Fix vlan_features propagation

login
register
mail settings
Submitter Michał Mirosław
Date May 6, 2011, 5:56 p.m.
Message ID <20110506175629.AF59713A6A@rere.qmqm.pl>
Download mbox | patch
Permalink /patch/94421/
State Accepted
Delegated to: David Miller
Headers show

Comments

Michał Mirosław - May 6, 2011, 5:56 p.m.
Fix VLAN features propagation for devices which change vlan_features.
For this to work, driver needs to make sure netdev_features_changed()
gets called after the change (it is e.g. after ndo_set_features()).

Side effect is that a user might request features that will never
be enabled on a VLAN device.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 net/8021q/vlan_dev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
David Miller - May 12, 2011, 9:55 p.m.
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Fri,  6 May 2011 19:56:29 +0200 (CEST)

> Fix VLAN features propagation for devices which change vlan_features.
> For this to work, driver needs to make sure netdev_features_changed()
> gets called after the change (it is e.g. after ndo_set_features()).
> 
> Side effect is that a user might request features that will never
> be enabled on a VLAN device.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

Applied.
--
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 --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index d174c31..526159a 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -531,7 +531,7 @@  static int vlan_dev_init(struct net_device *dev)
 					  (1<<__LINK_STATE_DORMANT))) |
 		      (1<<__LINK_STATE_PRESENT);
 
-	dev->hw_features = real_dev->vlan_features & NETIF_F_ALL_TX_OFFLOADS;
+	dev->hw_features = NETIF_F_ALL_TX_OFFLOADS;
 	dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
 	dev->gso_max_size = real_dev->gso_max_size;
 
@@ -590,9 +590,11 @@  static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
 {
 	struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
 
-	features &= (real_dev->features | NETIF_F_LLTX);
+	features &= real_dev->features;
+	features &= real_dev->vlan_features;
 	if (dev_ethtool_get_rx_csum(real_dev))
 		features |= NETIF_F_RXCSUM;
+	features |= NETIF_F_LLTX;
 
 	return features;
 }