diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-08-10 18:47:58 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-08-14 01:52:14 -0400 |
commit | 7f353bf29e162459f2f1e2ca25e41011fae65241 (patch) | |
tree | 8df6d6c66b69f18d521f76018ff98706e4e2a1b3 /net/bridge/br_if.c | |
parent | f71417614d63932cf56ed98a0947568d6259d11e (diff) |
[NET]: Share correct feature code between bridging and bonding
http://bugzilla.kernel.org/show_bug.cgi?id=8797 shows that the
bonding driver may produce bogus combinations of the checksum
flags and SG/TSO.
For example, if you bond devices with NETIF_F_HW_CSUM and
NETIF_F_IP_CSUM you'll end up with a bonding device that
has neither flag set. If both have TSO then this produces
an illegal combination.
The bridge device on the other hand has the correct code to
deal with this.
In fact, the same code can be used for both. So this patch
moves that logic into net/core/dev.c and uses it for both
bonding and bridging.
In the process I've made small adjustments such as only
setting GSO_ROBUST if at least one constituent device
supports it.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r-- | net/bridge/br_if.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index b40dada002bf..749f0e8f541d 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -349,43 +349,15 @@ int br_min_mtu(const struct net_bridge *br) | |||
349 | void br_features_recompute(struct net_bridge *br) | 349 | void br_features_recompute(struct net_bridge *br) |
350 | { | 350 | { |
351 | struct net_bridge_port *p; | 351 | struct net_bridge_port *p; |
352 | unsigned long features, checksum; | 352 | unsigned long features; |
353 | 353 | ||
354 | checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0; | 354 | features = br->feature_mask; |
355 | features = br->feature_mask & ~NETIF_F_ALL_CSUM; | ||
356 | 355 | ||
357 | list_for_each_entry(p, &br->port_list, list) { | 356 | list_for_each_entry(p, &br->port_list, list) { |
358 | unsigned long feature = p->dev->features; | 357 | features = netdev_compute_features(features, p->dev->features); |
359 | |||
360 | /* if device needs checksumming, downgrade to hw checksumming */ | ||
361 | if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM)) | ||
362 | checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM; | ||
363 | |||
364 | /* if device can't do all checksum, downgrade to ipv4/ipv6 */ | ||
365 | if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM)) | ||
366 | checksum ^= NETIF_F_HW_CSUM | ||
367 | | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | ||
368 | |||
369 | if (checksum & NETIF_F_IPV6_CSUM && !(feature & NETIF_F_IPV6_CSUM)) | ||
370 | checksum &= ~NETIF_F_IPV6_CSUM; | ||
371 | |||
372 | if (!(feature & NETIF_F_IP_CSUM)) | ||
373 | checksum = 0; | ||
374 | |||
375 | if (feature & NETIF_F_GSO) | ||
376 | feature |= NETIF_F_GSO_SOFTWARE; | ||
377 | feature |= NETIF_F_GSO; | ||
378 | |||
379 | features &= feature; | ||
380 | } | 358 | } |
381 | 359 | ||
382 | if (!(checksum & NETIF_F_ALL_CSUM)) | 360 | br->dev->features = features; |
383 | features &= ~NETIF_F_SG; | ||
384 | if (!(features & NETIF_F_SG)) | ||
385 | features &= ~NETIF_F_GSO_MASK; | ||
386 | |||
387 | br->dev->features = features | checksum | NETIF_F_LLTX | | ||
388 | NETIF_F_GSO_ROBUST; | ||
389 | } | 361 | } |
390 | 362 | ||
391 | /* called with RTNL */ | 363 | /* called with RTNL */ |