Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.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 1e5e9fc..784f87a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1991,13 +1991,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 05f4c3c..9b69e53 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -909,6 +909,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 || @@ -958,7 +959,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)