[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-70-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:51:56 +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 069/167] net: mac80211: 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/mac80211/iface.c | 10 +++++++---
net/mac80211/main.c | 5 ++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 62c95597704b..7e7431144727 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -2034,13 +2034,17 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ieee80211_setup_sdata(sdata, type);
if (ndev) {
+ netdev_features_t tmp;
+
ndev->ieee80211_ptr->use_4addr = params->use_4addr;
if (type == NL80211_IFTYPE_STATION)
sdata->u.mgd.use_4addr = params->use_4addr;
- ndev->features |= local->hw.netdev_features;
- ndev->hw_features |= ndev->features &
- MAC80211_SUPPORTED_FEATURES_TX;
+ netdev_feature_or(&ndev->features, ndev->features,
+ local->hw.netdev_features);
+ netdev_feature_copy(&tmp, ndev->features);
+ netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, &tmp);
+ netdev_feature_or(&ndev->hw_features, ndev->hw_features, tmp);
netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 45fb517591ee..06142de8f8db 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -911,6 +911,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
int channels, max_bitrates;
bool supp_ht, supp_vht, supp_he;
struct cfg80211_chan_def dflt_chandef = {};
+ netdev_features_t tmp;
if (ieee80211_hw_check(hw, QUEUE_CONTROL) &&
(local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
@@ -960,7 +961,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
}
/* Only HW csum features are currently compatible with mac80211 */
- if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES))
+ netdev_feature_copy(&tmp, hw->netdev_features);
+ netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, &tmp);
+ if (WARN_ON(!netdev_feature_empty(tmp)))
return -EINVAL;
if (hw->max_report_rates == 0)
--
2.33.0
Powered by blists - more mailing lists