[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-28-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:51:14 +0800
From: Jian Shen <shenjian15@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <andrew@...n.ch>,
<hkallweit1@...il.com>
CC: <netdev@...r.kernel.org>, <linuxarm@...neuler.org>
Subject: [RFCv2 net-next 027/167] bridge: use netdev feature helpers
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.
Signed-off-by: Jian Shen <shenjian15@...wei.com>
---
net/bridge/br_device.c | 16 +++++++++++-----
net/bridge/br_if.c | 4 ++--
2 files changed, 13 insertions(+), 7 deletions(-)
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,
--
2.33.0
Powered by blists - more mailing lists