
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- net/hsr/hsr_device.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 7e6dd37..b7ba16b 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -183,7 +183,7 @@ static void hsr_features_recompute(struct hsr_priv *hsr, netdev_features_t mask; struct hsr_port *port; - mask = *features; + netdev_feature_copy(&mask, *features); /* Mask out all features that, if supported by one device, should be * enabled for all devices (see NETIF_F_ONE_FOR_ALL). @@ -192,7 +192,7 @@ static void hsr_features_recompute(struct hsr_priv *hsr, * that were in features originally, and also is in NETIF_F_ONE_FOR_ALL, * may become enabled. */ - *features &= ~NETIF_F_ONE_FOR_ALL; + netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); hsr_for_each_port(hsr, port) netdev_increment_features(features, *features, port->dev->features, mask); @@ -445,22 +445,25 @@ void hsr_dev_setup(struct net_device *dev) dev->needs_free_netdev = true; - dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | + NETIF_F_HIGHDMA | + NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); - dev->features = dev->hw_features; + netdev_feature_copy(&dev->features, dev->hw_features); /* Prevent recursive tx locking */ - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + /* VLAN on top of HSR needs testing and probably some work on * hsr_header_create() etc. */ - dev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &dev->features); /* Not sure about this. Taken from bridge code. netdev_features.h says * it means "Does not change network namespaces". */ - dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); } /* Return true if dev is a HSR master; return false otherwise. -- 2.8.1