bridge: convert br_features_recompute() to ndo_fix_features

Note: netdev_update_features() needs only rtnl_lock as br->port_list
is only changed while holding it.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Michał Mirosław
2011-04-22 06:31:16 +00:00
committed by David S. Miller
parent 1742f183fc
commit c4d27ef957
4 changed files with 19 additions and 67 deletions

View File

@@ -291,15 +291,15 @@ int br_min_mtu(const struct net_bridge *br)
/*
* Recomputes features using slave's features
*/
void br_features_recompute(struct net_bridge *br)
u32 br_features_recompute(struct net_bridge *br, u32 features)
{
struct net_bridge_port *p;
u32 features, mask;
u32 mask;
features = mask = br->feature_mask;
if (list_empty(&br->port_list))
goto done;
return features;
mask = features;
features &= ~NETIF_F_ONE_FOR_ALL;
list_for_each_entry(p, &br->port_list, list) {
@@ -307,8 +307,7 @@ void br_features_recompute(struct net_bridge *br)
p->dev->features, mask);
}
done:
br->dev->features = netdev_fix_features(br->dev, features);
return features;
}
/* called with RTNL */
@@ -373,9 +372,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
list_add_rcu(&p->list, &br->port_list);
netdev_update_features(br->dev);
spin_lock_bh(&br->lock);
changed_addr = br_stp_recalculate_bridge_id(br);
br_features_recompute(br);
if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
(br->dev->flags & IFF_UP))
@@ -423,9 +423,10 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
spin_lock_bh(&br->lock);
br_stp_recalculate_bridge_id(br);
br_features_recompute(br);
spin_unlock_bh(&br->lock);
netdev_update_features(br->dev);
return 0;
}