mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
net: Fix disjunct computation of netdev features
My change
commit e2a6b85247
net: Enable TSO if supported by at least one device
didn't do what was intended because the netdev_compute_features
function was designed for conjunctions. So what happened was that
it would simply take the TSO status of the last constituent device.
This patch extends it to support both conjunctions and disjunctions
under the new name of netdev_increment_features.
It also adds a new function netdev_fix_features which does the
sanity checking that usually occurs upon registration. This ensures
that the computation doesn't result in an illegal combination
since this checking is absent when the change is initiated via
ethtool.
The two users of netdev_compute_features have been converted.
Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
2e3f92dad6
commit
b63365a2d6
5 changed files with 104 additions and 75 deletions
|
|
@ -1341,18 +1341,24 @@ static int bond_compute_features(struct bonding *bond)
|
|||
int i;
|
||||
|
||||
features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
|
||||
features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
|
||||
NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
|
||||
features |= NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
|
||||
|
||||
if (!bond->first_slave)
|
||||
goto done;
|
||||
|
||||
features &= ~NETIF_F_ONE_FOR_ALL;
|
||||
|
||||
bond_for_each_slave(bond, slave, i) {
|
||||
features = netdev_compute_features(features,
|
||||
slave->dev->features);
|
||||
features = netdev_increment_features(features,
|
||||
slave->dev->features,
|
||||
NETIF_F_ONE_FOR_ALL);
|
||||
if (slave->dev->hard_header_len > max_hard_header_len)
|
||||
max_hard_header_len = slave->dev->hard_header_len;
|
||||
}
|
||||
|
||||
done:
|
||||
features |= (bond_dev->features & BOND_VLAN_FEATURES);
|
||||
bond_dev->features = features;
|
||||
bond_dev->features = netdev_fix_features(features, NULL);
|
||||
bond_dev->hard_header_len = max_hard_header_len;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue