diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-22 02:31:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-28 16:33:08 -0400 |
commit | c4d27ef957cd9261c0bc8488edaf8390e412cd35 (patch) | |
tree | f8e263ca9a1842803a2265bffd5eaa3e5b3d9660 /net/bridge/br_device.c | |
parent | 1742f183fc218798dab6fcf0ded25b6608fc0a48 (diff) |
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>
Diffstat (limited to 'net/bridge/br_device.c')
-rw-r--r-- | net/bridge/br_device.c | 61 |
1 files changed, 8 insertions, 53 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 45cfd54b06d3..a6b2f86378c7 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -90,8 +90,7 @@ static int br_dev_open(struct net_device *dev) | |||
90 | struct net_bridge *br = netdev_priv(dev); | 90 | struct net_bridge *br = netdev_priv(dev); |
91 | 91 | ||
92 | netif_carrier_off(dev); | 92 | netif_carrier_off(dev); |
93 | 93 | netdev_update_features(dev); | |
94 | br_features_recompute(br); | ||
95 | netif_start_queue(dev); | 94 | netif_start_queue(dev); |
96 | br_stp_enable_bridge(br); | 95 | br_stp_enable_bridge(br); |
97 | br_multicast_open(br); | 96 | br_multicast_open(br); |
@@ -188,48 +187,11 @@ static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
188 | strcpy(info->bus_info, "N/A"); | 187 | strcpy(info->bus_info, "N/A"); |
189 | } | 188 | } |
190 | 189 | ||
191 | static int br_set_sg(struct net_device *dev, u32 data) | 190 | static u32 br_fix_features(struct net_device *dev, u32 features) |
192 | { | ||
193 | struct net_bridge *br = netdev_priv(dev); | ||
194 | |||
195 | if (data) | ||
196 | br->feature_mask |= NETIF_F_SG; | ||
197 | else | ||
198 | br->feature_mask &= ~NETIF_F_SG; | ||
199 | |||
200 | br_features_recompute(br); | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int br_set_tso(struct net_device *dev, u32 data) | ||
205 | { | 191 | { |
206 | struct net_bridge *br = netdev_priv(dev); | 192 | struct net_bridge *br = netdev_priv(dev); |
207 | 193 | ||
208 | if (data) | 194 | return br_features_recompute(br, features); |
209 | br->feature_mask |= NETIF_F_TSO; | ||
210 | else | ||
211 | br->feature_mask &= ~NETIF_F_TSO; | ||
212 | |||
213 | br_features_recompute(br); | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static int br_set_tx_csum(struct net_device *dev, u32 data) | ||
218 | { | ||
219 | struct net_bridge *br = netdev_priv(dev); | ||
220 | |||
221 | if (data) | ||
222 | br->feature_mask |= NETIF_F_NO_CSUM; | ||
223 | else | ||
224 | br->feature_mask &= ~NETIF_F_ALL_CSUM; | ||
225 | |||
226 | br_features_recompute(br); | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int br_set_flags(struct net_device *netdev, u32 data) | ||
231 | { | ||
232 | return ethtool_op_set_flags(netdev, data, ETH_FLAG_TXVLAN); | ||
233 | } | 195 | } |
234 | 196 | ||
235 | #ifdef CONFIG_NET_POLL_CONTROLLER | 197 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -330,16 +292,6 @@ static int br_del_slave(struct net_device *dev, struct net_device *slave_dev) | |||
330 | static const struct ethtool_ops br_ethtool_ops = { | 292 | static const struct ethtool_ops br_ethtool_ops = { |
331 | .get_drvinfo = br_getinfo, | 293 | .get_drvinfo = br_getinfo, |
332 | .get_link = ethtool_op_get_link, | 294 | .get_link = ethtool_op_get_link, |
333 | .get_tx_csum = ethtool_op_get_tx_csum, | ||
334 | .set_tx_csum = br_set_tx_csum, | ||
335 | .get_sg = ethtool_op_get_sg, | ||
336 | .set_sg = br_set_sg, | ||
337 | .get_tso = ethtool_op_get_tso, | ||
338 | .set_tso = br_set_tso, | ||
339 | .get_ufo = ethtool_op_get_ufo, | ||
340 | .set_ufo = ethtool_op_set_ufo, | ||
341 | .get_flags = ethtool_op_get_flags, | ||
342 | .set_flags = br_set_flags, | ||
343 | }; | 295 | }; |
344 | 296 | ||
345 | static const struct net_device_ops br_netdev_ops = { | 297 | static const struct net_device_ops br_netdev_ops = { |
@@ -359,6 +311,7 @@ static const struct net_device_ops br_netdev_ops = { | |||
359 | #endif | 311 | #endif |
360 | .ndo_add_slave = br_add_slave, | 312 | .ndo_add_slave = br_add_slave, |
361 | .ndo_del_slave = br_del_slave, | 313 | .ndo_del_slave = br_del_slave, |
314 | .ndo_fix_features = br_fix_features, | ||
362 | }; | 315 | }; |
363 | 316 | ||
364 | static void br_dev_free(struct net_device *dev) | 317 | static void br_dev_free(struct net_device *dev) |
@@ -389,7 +342,10 @@ void br_dev_setup(struct net_device *dev) | |||
389 | 342 | ||
390 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | | 343 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | |
391 | NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX | | 344 | NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX | |
392 | NETIF_F_NETNS_LOCAL | NETIF_F_GSO | NETIF_F_HW_VLAN_TX; | 345 | NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX; |
346 | dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | | ||
347 | NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | | ||
348 | NETIF_F_HW_VLAN_TX; | ||
393 | 349 | ||
394 | br->dev = dev; | 350 | br->dev = dev; |
395 | spin_lock_init(&br->lock); | 351 | spin_lock_init(&br->lock); |
@@ -401,7 +357,6 @@ void br_dev_setup(struct net_device *dev) | |||
401 | 357 | ||
402 | memcpy(br->group_addr, br_group_address, ETH_ALEN); | 358 | memcpy(br->group_addr, br_group_address, ETH_ALEN); |
403 | 359 | ||
404 | br->feature_mask = dev->features; | ||
405 | br->stp_enabled = BR_NO_STP; | 360 | br->stp_enabled = BR_NO_STP; |
406 | br->designated_root = br->bridge_id; | 361 | br->designated_root = br->bridge_id; |
407 | br->bridge_max_age = br->max_age = 20 * HZ; | 362 | br->bridge_max_age = br->max_age = 20 * HZ; |