diff mbox series

[RFCv2,net-next,027/167] bridge: use netdev feature helpers

Message ID 20210929155334.12454-28-shenjian15@huawei.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: extend the netdev_features_t | expand

Commit Message

shenjian (K) Sept. 29, 2021, 3:51 p.m. UTC
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 net/bridge/br_device.c | 16 +++++++++++-----
 net/bridge/br_if.c     |  4 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index fc508b9cbaa9..c9894b9944ab 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -490,11 +490,17 @@  void br_dev_setup(struct net_device *dev)
 	SET_NETDEV_DEVTYPE(dev, &br_type);
 	dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
 
-	dev->features = COMMON_FEATURES | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL |
-			NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
-	dev->hw_features = COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
-			   NETIF_F_HW_VLAN_STAG_TX;
-	dev->vlan_features = COMMON_FEATURES;
+	netdev_feature_zero(&dev->features);
+	netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_LLTX |
+				NETIF_F_NETNS_LOCAL |
+				NETIF_F_HW_VLAN_CTAG_TX |
+				NETIF_F_HW_VLAN_STAG_TX,
+				&dev->features);
+	netdev_feature_zero(&dev->hw_features);
+	netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
+				NETIF_F_HW_VLAN_STAG_TX, &dev->hw_features);
+	netdev_feature_zero(&dev->vlan_features);
+	netdev_feature_set_bits(COMMON_FEATURES, &dev->vlan_features);
 
 	br->dev = dev;
 	spin_lock_init(&br->lock);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 914ca4b2d07c..c0a71fd6f772 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -540,8 +540,8 @@  void br_features_recompute(struct net_bridge *br, netdev_features_t *features)
 	if (list_empty(&br->port_list))
 		return;
 
-	mask = *features;
-	*features &= ~NETIF_F_ONE_FOR_ALL;
+	netdev_feature_copy(&mask, *features);
+	netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features);
 
 	list_for_each_entry(p, &br->port_list, list) {
 		netdev_increment_features(features, *features, p->dev->features,