All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jian Shen <shenjian15@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <andrew@lunn.ch>,
	<hkallweit1@gmail.com>
Cc: <netdev@vger.kernel.org>, <linuxarm@openeuler.org>
Subject: [RFCv2 net-next 082/167] net: wireless: use netdev feature helpers
Date: Wed, 29 Sep 2021 23:52:09 +0800	[thread overview]
Message-ID: <20210929155334.12454-83-shenjian15@huawei.com> (raw)
In-Reply-To: <20210929155334.12454-1-shenjian15@huawei.com>

Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.

For iwiwifi, it initializes the features in struct. So it's
unable to change the prototype from u64 to bitmap. Define it
as u64 array instead.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 drivers/net/wireless/ath/ath10k/mac.c           |  7 +++++--
 drivers/net/wireless/ath/ath11k/mac.c           |  4 +++-
 drivers/net/wireless/ath/ath6kl/main.c          | 15 ++++++++++-----
 drivers/net/wireless/ath/ath6kl/txrx.c          |  6 ++++--
 drivers/net/wireless/ath/wil6210/netdev.c       | 11 +++++++----
 .../wireless/broadcom/brcm80211/brcmfmac/core.c |  4 ++--
 drivers/net/wireless/intel/iwlwifi/cfg/22000.c  |  4 ++--
 drivers/net/wireless/intel/iwlwifi/cfg/8000.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/cfg/9000.c   |  2 +-
 .../net/wireless/intel/iwlwifi/dvm/mac80211.c   |  7 +++++--
 drivers/net/wireless/intel/iwlwifi/iwl-config.h |  2 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c   | 17 +++++++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c     |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c     | 10 +++++++---
 .../net/wireless/mediatek/mt76/mt7615/init.c    |  3 ++-
 .../net/wireless/mediatek/mt76/mt7915/init.c    |  3 ++-
 .../net/wireless/mediatek/mt76/mt7921/init.c    |  3 ++-
 net/wireless/core.c                             | 15 ++++++++++-----
 19 files changed, 77 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c272b290fa73..493d15f4d4e9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -10119,8 +10119,11 @@ int ath10k_mac_register(struct ath10k *ar)
 	if (ar->hw_params.dynamic_sar_support)
 		ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
 
-	if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
-		ar->hw->netdev_features = NETIF_F_HW_CSUM;
+	if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
+		netdev_feature_zero(&ar->hw->netdev_features);
+		netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT,
+				       &ar->hw->netdev_features);
+	}
 
 	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) {
 		/* Init ath dfs pattern detector */
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index e9b3689331ec..ba892c4ab3eb 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -6570,7 +6570,9 @@ static int __ath11k_mac_register(struct ath11k *ar)
 	ath11k_reg_init(ar);
 
 	if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
-		ar->hw->netdev_features = NETIF_F_HW_CSUM;
+		netdev_feature_zero(&ar->hw->netdev_features);
+		netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT,
+				       &ar->hw->netdev_features);
 		ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
 		ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT);
 	}
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index d3aa9e7a37c2..cbf0e5dcac02 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -1126,24 +1126,28 @@ static int ath6kl_set_features(struct net_device *dev,
 	struct ath6kl *ar = vif->ar;
 	int err = 0;
 
-	if ((features & NETIF_F_RXCSUM) &&
+	if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) &&
 	    (ar->rx_meta_ver != WMI_META_VERSION_2)) {
 		ar->rx_meta_ver = WMI_META_VERSION_2;
 		err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi,
 							 vif->fw_vif_idx,
 							 ar->rx_meta_ver, 0, 0);
 		if (err) {
-			dev->features = features & ~NETIF_F_RXCSUM;
+			netdev_feature_copy(&dev->features, features);
+			netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT,
+						 &dev->features);
 			return err;
 		}
-	} else if (!(features & NETIF_F_RXCSUM) &&
+	} else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) &&
 		   (ar->rx_meta_ver == WMI_META_VERSION_2)) {
 		ar->rx_meta_ver = 0;
 		err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi,
 							 vif->fw_vif_idx,
 							 ar->rx_meta_ver, 0, 0);
 		if (err) {
-			dev->features = features | NETIF_F_RXCSUM;
+			netdev_feature_copy(&dev->features, features);
+			netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
+					       &dev->features);
 			return err;
 		}
 	}
@@ -1305,7 +1309,8 @@ void init_netdev(struct net_device *dev)
 
 	if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM,
 		      ar->fw_capabilities))
-		dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+		netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM,
+					&dev->hw_features);
 
 	return;
 }
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index b22ed499f7ba..6c7569c20d00 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -391,7 +391,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	if (test_bit(WMI_ENABLED, &ar->flag)) {
-		if ((dev->features & NETIF_F_IP_CSUM) &&
+		if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
+					    dev->features) &&
 		    (csum == CHECKSUM_PARTIAL)) {
 			csum_start = skb->csum_start -
 					(skb_network_header(skb) - skb->head) +
@@ -410,7 +411,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 			goto fail_tx;
 		}
 
-		if ((dev->features & NETIF_F_IP_CSUM) &&
+		if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
+					    dev->features) &&
 		    (csum == CHECKSUM_PARTIAL)) {
 			meta_v2.csum_start = csum_start;
 			meta_v2.csum_dest = csum_dest;
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
index 0913f0bf60e7..b29a4d6c3c0f 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -335,11 +335,14 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name,
 	ndev->netdev_ops = &wil_netdev_ops;
 	wil_set_ethtoolops(ndev);
 	ndev->ieee80211_ptr = wdev;
-	ndev->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
-			    NETIF_F_SG | NETIF_F_GRO |
-			    NETIF_F_TSO | NETIF_F_TSO6;
+	netdev_feature_zero(&ndev->hw_features);
+	netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
+				NETIF_F_SG | NETIF_F_GRO |
+				NETIF_F_TSO | NETIF_F_TSO6,
+				&ndev->hw_features);
+
+	netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features);
 
-	ndev->features |= ndev->hw_features;
 	SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
 	wdev->netdev = ndev;
 	return vif;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index db5f8535fdb5..d04bff1a60f4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -616,9 +616,9 @@ static int brcmf_netdev_open(struct net_device *ndev)
 	/* Get current TOE mode from dongle */
 	if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0
 	    && (toe_ol & TOE_TX_CSUM_OL) != 0)
-		ndev->features |= NETIF_F_IP_CSUM;
+		netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
 	else
-		ndev->features &= ~NETIF_F_IP_CSUM;
+		netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
 
 	if (brcmf_cfg80211_up(ndev)) {
 		bphy_err(drvr, "failed to bring up cfg80211\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
index d8231cc821ae..fd2408f80676 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
@@ -150,7 +150,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
 	.smem_len = IWL_22000_SMEM_LEN,					\
-	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
+	.features = { IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM },		\
 	.apmg_not_supported = true,					\
 	.trans.mq_rx_supported = true,					\
 	.vht_mu_mimo_supported = true,					\
@@ -227,7 +227,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
 	.smem_len = IWL_22000_SMEM_LEN,					\
-	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
+	.features = { IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM },	\
 	.apmg_not_supported = true,					\
 	.trans.mq_rx_supported = true,					\
 	.vht_mu_mimo_supported = true,					\
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
index a6454287d506..d4e33cd76702 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
@@ -81,7 +81,7 @@ static const struct iwl_tt_params iwl8000_tt_params = {
 	.trans.base_params = &iwl8000_base_params,			\
 	.led_mode = IWL_LED_RF_STATE,					\
 	.nvm_hw_section_num = 10,					\
-	.features = NETIF_F_RXCSUM,					\
+	.features = { NETIF_F_RXCSUM },					\
 	.non_shared_ant = ANT_A,					\
 	.dccm_offset = IWL8260_DCCM_OFFSET,				\
 	.dccm_len = IWL8260_DCCM_LEN,					\
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index 7a7ca06d46c1..36d0049cb900 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -84,7 +84,7 @@ static const struct iwl_tt_params iwl9000_tt_params = {
 	.dccm2_len = IWL9000_DCCM2_LEN,					\
 	.smem_offset = IWL9000_SMEM_OFFSET,				\
 	.smem_len = IWL9000_SMEM_LEN,					\
-	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
+	.features = { IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM },	\
 	.thermal_params = &iwl9000_tt_params,				\
 	.apmg_not_supported = true,					\
 	.num_rbds = 512,						\
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
index 75e7665773c5..81df8565a22f 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
@@ -101,8 +101,11 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
 	ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
 	ieee80211_hw_set(hw, WANT_MONITOR_VIF);
 
-	if (priv->trans->max_skb_frags)
-		hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
+	if (priv->trans->max_skb_frags) {
+		netdev_feature_zero(&hw->netdev_features);
+		netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG,
+					&hw->netdev_features);
+	}
 
 	hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE;
 	hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FMT;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 7eb534df5331..01acacf0219e 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -366,7 +366,7 @@ struct iwl_cfg {
 	enum iwl_nvm_type nvm_type;
 	u32 max_data_size;
 	u32 max_inst_size;
-	netdev_features_t features;
+	u64 features[NETDEV_FEATURE_DWORDS];
 	u32 dccm_offset;
 	u32 dccm_len;
 	u32 dccm2_offset;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 3a4585222d6d..fdfda9cc55f3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -387,8 +387,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 	if (mvm->trans->num_rx_queues > 1)
 		ieee80211_hw_set(hw, USES_RSS);
 
-	if (mvm->trans->max_skb_frags)
-		hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
+	if (mvm->trans->max_skb_frags) {
+		netdev_feature_zero(&hw->netdev_features);
+		netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG,
+					&hw->netdev_features);
+	}
 
 	hw->queues = IEEE80211_NUM_ACS;
 	hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
@@ -703,10 +706,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 		hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH;
 	}
 
-	hw->netdev_features |= mvm->cfg->features;
+	netdev_feature_set_bits(mvm->cfg->features[0], &hw->netdev_features);
 	if (!iwl_mvm_is_csum_supported(mvm))
-		hw->netdev_features &= ~(IWL_TX_CSUM_NETIF_FLAGS |
-					 NETIF_F_RXCSUM);
+		netdev_feature_clear_bits(IWL_TX_CSUM_NETIF_FLAGS |
+					  NETIF_F_RXCSUM,
+					  &hw->netdev_features);
 
 	if (mvm->cfg->vht_mu_mimo_supported)
 		wiphy_ext_feature_set(hw->wiphy,
@@ -1451,7 +1455,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
 		goto out_unlock;
 	}
 
-	mvmvif->features |= hw->netdev_features;
+	netdev_feature_or(&mvmvif->features, mvmvif->features,
+			  hw->netdev_features);
 
 	ret = iwl_mvm_mac_ctxt_add(mvm, vif);
 	if (ret)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 8ef5399ad9be..21d97eb6c207 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -276,7 +276,7 @@ static void iwl_mvm_rx_csum(struct ieee80211_sta *sta,
 	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
 
-	if (mvmvif->features & NETIF_F_RXCSUM &&
+	if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, mvmvif->features) &&
 	    status & RX_MPDU_RES_STATUS_CSUM_DONE &&
 	    status & RX_MPDU_RES_STATUS_CSUM_OK)
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index c12f303cf652..a0daf93c36c1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -472,7 +472,7 @@ static void iwl_mvm_rx_csum(struct iwl_mvm *mvm,
 
 		mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
 
-		if (mvmvif->features & NETIF_F_RXCSUM &&
+		if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, mvmvif->features) &&
 		    flags & IWL_RX_L3L4_TCP_UDP_CSUM_OK &&
 		    (flags & IWL_RX_L3L4_IP_HDR_CSUM_OK ||
 		     l3_prot == IWL_RX_L3_TYPE_IPV6 ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 0a13c2bda2ee..cfe0fcb1a0ba 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -53,7 +53,8 @@ static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
 		goto out;
 
 	/* We do not expect to be requested to csum stuff we do not support */
-	if (WARN_ONCE(!(mvm->hw->netdev_features & IWL_TX_CSUM_NETIF_FLAGS) ||
+	if (WARN_ONCE(!netdev_feature_test_bits(IWL_TX_CSUM_NETIF_FLAGS,
+						mvm->hw->netdev_features) ||
 		      (skb->protocol != htons(ETH_P_IP) &&
 		       skb->protocol != htons(ETH_P_IPV6)),
 		      "No support for requested checksum\n")) {
@@ -836,9 +837,12 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
 	unsigned int mss = skb_shinfo(skb)->gso_size;
 	unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len;
 	u16 snap_ip_tcp, pad;
-	netdev_features_t netdev_flags = NETIF_F_CSUM_MASK | NETIF_F_SG;
+	netdev_features_t netdev_flags;
 	u8 tid;
 
+	netdev_feature_zero(&netdev_flags);
+	netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, &netdev_flags);
+
 	snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
 		tcp_hdrlen(skb);
 
@@ -854,7 +858,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
 	if (skb->protocol == htons(ETH_P_IPV6) &&
 	    ((struct ipv6hdr *)skb_network_header(skb))->nexthdr !=
 	    IPPROTO_TCP) {
-		netdev_flags &= ~NETIF_F_CSUM_MASK;
+		netdev_feature_clear_bits(NETIF_F_CSUM_MASK, &netdev_flags);
 		return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb);
 	}
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 2f1ac644e018..e690e095ba60 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -363,7 +363,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw)
 	hw->max_rates = 3;
 	hw->max_report_rates = 7;
 	hw->max_rate_tries = 11;
-	hw->netdev_features = NETIF_F_RXCSUM;
+	netdev_feature_zero(&hw->netdev_features);
+	netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
 
 	hw->radiotap_timestamp.units_pos =
 		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 4798d6344305..a3ab1a5f3f94 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -217,7 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)
 	hw->queues = 4;
 	hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
 	hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
-	hw->netdev_features = NETIF_F_RXCSUM;
+	netdev_feature_zero(&hw->netdev_features);
+	netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
 
 	hw->radiotap_timestamp.units_pos =
 		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index a9ce10b98827..368d6cfb2881 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -51,7 +51,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
 	hw->queues = 4;
 	hw->max_rx_aggregation_subframes = 64;
 	hw->max_tx_aggregation_subframes = 128;
-	hw->netdev_features = NETIF_F_RXCSUM;
+	netdev_feature_zero(&hw->netdev_features);
+	netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
 
 	hw->radiotap_timestamp.units_pos =
 		IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 03323121ca50..5849ebf7ca5f 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -164,11 +164,13 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
 	list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
 		if (!wdev->netdev)
 			continue;
-		wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+		netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT,
+					 &wdev->netdev->features);
 		err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
 		if (err)
 			break;
-		wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+		netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
+				       &wdev->netdev->features);
 	}
 
 	if (err) {
@@ -180,11 +182,13 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
 						     list) {
 			if (!wdev->netdev)
 				continue;
-			wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+			netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT,
+						 &wdev->netdev->features);
 			err = dev_change_net_namespace(wdev->netdev, net,
 							"wlan%d");
 			WARN_ON(err);
-			wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+			netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
+					       &wdev->netdev->features);
 		}
 
 		return err;
@@ -1384,7 +1388,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
 		SET_NETDEV_DEVTYPE(dev, &wiphy_type);
 		wdev->netdev = dev;
 		/* can only change netns with wiphy */
-		dev->features |= NETIF_F_NETNS_LOCAL;
+		netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
+				       &dev->features);
 
 		cfg80211_init_wdev(wdev);
 		break;
-- 
2.33.0


  parent reply	other threads:[~2021-09-29 16:00 UTC|newest]

Thread overview: 181+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 15:50 [RFCv2 net-next 000/167] net: extend the netdev_features_t Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 001/167] net: convert the prototype of netdev_intersect_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 002/167] net: convert the prototype of netdev_get_wanted_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 003/167] net: convert the prototype of net_mpls_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 004/167] net: convert the prototype of harmonize_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 005/167] net: convert the prototype of gso_features_check Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 006/167] net: convert the prototype of vlan_features_check Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 007/167] net: convert the prototype of vxlan_features_check Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 008/167] net: convert the prototype of dflt_features_check Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 009/167] net: convert the prototype of ndo_features_check Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 010/167] net: convert the prototype of netif_skb_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 011/167] net: convert the prototype of ndo_fix_features Jian Shen
2021-09-29 15:50 ` [RFCv2 net-next 012/167] net: convert the prototype of netdev_fix_features Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 013/167] net: convert the prototype of netdev_sync_upper_features Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 014/167] net: convert the prototype of br_features_recompute Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 015/167] net: convert the prototype of netdev_add_tso_features Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 016/167] net: convert the prototype of netdev_increment_features Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 017/167] net: convert the prototype of hsr_features_recompute Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 018/167] net: mlx5: convert prototype of mlx5e_ipsec_feature_check, mlx5e_tunnel_features_check and mlx5e_fix_uplink_rep_features Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 019/167] net: sfc: convert the prototype of xxx_supported_features Jian Shen
2021-09-30  0:28   ` Edward Cree
2021-09-29 15:51 ` [RFCv2 net-next 020/167] net: qlogic: convert the prototype of qlcnic_process_flags Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 021/167] net: realtek: convert the prototype of rtl8168evl_fix_tso Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 022/167] ethtool: convert the prototype of ethtool_get_feature_mask Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 023/167] net: add netdev feature helpers Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 024/167] net: core: use " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 025/167] skbuff: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 026/167] net: vlan: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 027/167] bridge: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 028/167] ipvlan: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 029/167] veth: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 030/167] bonding: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 031/167] net: tun: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 032/167] net: tap: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 033/167] net: geneve: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 034/167] hv_netvsc: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 035/167] macvlan: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 036/167] macsec: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 037/167] net: tls: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 038/167] s390: qeth: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 039/167] dsa: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 040/167] macvtap: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 041/167] team: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 042/167] vmxnet3: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 043/167] net_failover: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 044/167] pktgen: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 045/167] net: sched: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 046/167] netdevsim: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 047/167] virtio_net: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 048/167] net: ipv4: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 049/167] net: ipv6: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 050/167] net: hsr: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 051/167] net: mpls: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 052/167] net: nsh: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 053/167] net: decnet: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 054/167] net: dccp: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 055/167] net: l2tp: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 056/167] net: ntb_netdev: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 057/167] net: thunderbolt: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 058/167] net: phonet: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 059/167] net: vrf: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 060/167] net: sctp: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 061/167] vxlan: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 062/167] xen-netback: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 063/167] xen-netfront: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 064/167] sock: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 065/167] sunrpc: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 066/167] net: caif: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 067/167] net: loopback: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 068/167] net: dummy: use netdev_feature helpers Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 069/167] net: mac80211: use netdev feature helpers Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 070/167] net: ifb: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 071/167] net: bareudp: " Jian Shen
2021-09-29 15:51 ` [RFCv2 net-next 072/167] net: rionet: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 073/167] net: gtp: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 074/167] net: vsockmon: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 075/167] net: nlmon: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 076/167] net: wireguard: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 077/167] net: can: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 078/167] net: ppp: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 079/167] net: ipa: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 080/167] net: fjes: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 081/167] net: usb: " Jian Shen
2021-09-29 15:52 ` Jian Shen [this message]
2021-09-29 15:52 ` [RFCv2 net-next 083/167] net: realtek: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 084/167] net: broadcom: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 085/167] net: intel: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 086/167] net: hisilicon: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 087/167] net: mellanox: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 088/167] net: atlantic: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 089/167] net: atheros: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 090/167] net: chelsio: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 091/167] net: davicom: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 092/167] net: freescale: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 093/167] net: synopsys: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 094/167] net: sfc: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 095/167] net: qualcomm: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 096/167] net: nvidia: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 097/167] net: faraday: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 098/167] net: google: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 099/167] net: hinic: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 100/167] net: ibm: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 101/167] net: ionic: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 102/167] net: jme: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 103/167] net: micrel: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 104/167] net: cavium: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 105/167] net: cadence: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 106/167] net: mediatek: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 107/167] net: marvell: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 108/167] net: socionext: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 109/167] net: qlogic: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 110/167] net: nfp: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 111/167] net: mscc: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 112/167] net: oki-semi: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 113/167] net: renesas: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 114/167] net: neterion: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 115/167] net: cortina: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 116/167] net: stmmac: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 117/167] net: sxgbe: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 118/167] net: xgmac: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 119/167] net: altera: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 120/167] net: ti: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 121/167] net: benet: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 122/167] net: amd: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 123/167] net: bna: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 124/167] net: enic: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 125/167] net: 3com: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 126/167] net: aeroflex: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 127/167] net: sun: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 128/167] net: mana: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 129/167] net: myricom: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 130/167] net: alacritech: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 131/167] net: toshiba: " Jian Shen
2021-09-29 15:52 ` [RFCv2 net-next 132/167] net: tehuti: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 133/167] net: alteon: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 134/167] net: ena: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 135/167] net: sgi: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 136/167] net: microchip: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 137/167] net: ni: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 138/167] net: apm: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 139/167] net: natsemi: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 140/167] net: xilinx: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 141/167] net: pasemi: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 142/167] net: rocker: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 143/167] net: silan: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 144/167] net: adaptec: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 145/167] net: tundra: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 146/167] net: via: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 147/167] net: wiznet: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 148/167] net: dnet: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 149/167] net: ethoc: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 150/167] RDMA: ipoib: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 151/167] um: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 152/167] scsi: fcoe: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 153/167] net: ipvs: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 154/167] net: xfrm: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 155/167] net: cirrus: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 156/167] net: ec_bhf: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 157/167] net: hamradio: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 158/167] net: batman: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 159/167] net: ieee802154: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 160/167] test_bpf: change the prototype of features Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 161/167] net: openvswitch: use netdev feature helpers Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 162/167] firewire: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 163/167] staging: qlge: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 164/167] staging: octeon: " Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 165/167] net: sock: add helper sk_nocaps_add_gso() Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 166/167] treewide: introduce macro __DECLARE_NETDEV_FEATURE_MASK Jian Shen
2021-09-29 15:53 ` [RFCv2 net-next 167/167] net: extend the type of netdev_features_t to bitmap Jian Shen
2021-09-29 17:15 ` [RFCv2 net-next 000/167] net: extend the netdev_features_t Andrew Lunn
2021-09-30  2:57   ` shenjian (K)
2021-09-30  0:55 ` Edward Cree
2021-09-30  3:15   ` shenjian (K)
2021-10-01 15:17 ` Alexander Lobakin
2021-10-04 14:59   ` Andrew Lunn
2021-10-04 22:30     ` Saeed Mahameed
2021-10-05 14:22       ` Alexander Lobakin
2021-10-08  2:54       ` shenjian (K)
2022-01-27  9:16 ` Leon Romanovsky
2022-01-27  9:40   ` shenjian (K)
2022-01-27  9:50     ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210929155334.12454-83-shenjian15@huawei.com \
    --to=shenjian15@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.