]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mld: extract NAN capabilities setting to a function
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 10 May 2026 20:48:35 +0000 (23:48 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 26 May 2026 12:17:09 +0000 (15:17 +0300)
There are now quite a lot of capabilities to set, so move it to a
dedicated function, for better clarity.

Link: https://patch.msgid.link/20260510234534.da1f380ced3b.I02013e9d5946a1b3372d2fcd570057fdb4416b65@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c

index cabf47367fda07cb1d8aa177b8bb3bbf886dc48c..e76421a8a8e6a775e811e8de06930d25eabc4b34 100644 (file)
@@ -272,6 +272,38 @@ static void iwl_mac_hw_set_flags(struct iwl_mld *mld)
        ieee80211_hw_set(hw, TDLS_WIDER_BW);
 }
 
+static void iwl_mld_hw_set_nan(struct iwl_mld *mld)
+{
+       struct ieee80211_hw *hw = mld->hw;
+
+       hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_NAN);
+
+       hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ);
+       if (mld->nvm_data->bands[NL80211_BAND_5GHZ].n_channels)
+               hw->wiphy->nan_supported_bands |=
+                       BIT(NL80211_BAND_5GHZ);
+
+       hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
+                                   WIPHY_NAN_FLAGS_USERSPACE_DE;
+
+       hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_VHT |
+                                     NAN_OP_MODE_PHY_MODE_HE |
+                                     NAN_OP_MODE_160MHZ;
+
+       /* Support 2 antennas for Tx and Rx */
+       hw->wiphy->nan_capa.n_antennas = 0x22;
+
+       /* Maximal channel switch time is 4 msec */
+       hw->wiphy->nan_capa.max_channel_switch_time = 4;
+       hw->wiphy->nan_capa.dev_capabilities =
+               NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED |
+               NAN_DEV_CAPA_NDPE_SUPPORTED;
+
+       hw->wiphy->nan_capa.phy.ht = mld->nvm_data->nan_phy_capa.ht;
+       hw->wiphy->nan_capa.phy.vht = mld->nvm_data->nan_phy_capa.vht;
+       hw->wiphy->nan_capa.phy.he = mld->nvm_data->nan_phy_capa.he;
+}
+
 static void iwl_mac_hw_set_wiphy(struct iwl_mld *mld)
 {
        struct ieee80211_hw *hw = mld->hw;
@@ -334,38 +366,13 @@ static void iwl_mac_hw_set_wiphy(struct iwl_mld *mld)
 
        wiphy->hw_timestamp_max_peers = 1;
 
+       wiphy->iface_combinations = iwl_mld_iface_combinations;
+
        if (iwl_mld_nan_supported(mld)) {
-               hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_NAN);
-               hw->wiphy->iface_combinations = iwl_mld_iface_combinations;
-               hw->wiphy->n_iface_combinations =
+               wiphy->n_iface_combinations =
                        ARRAY_SIZE(iwl_mld_iface_combinations);
-
-               hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ);
-               if (mld->nvm_data->bands[NL80211_BAND_5GHZ].n_channels)
-                       hw->wiphy->nan_supported_bands |=
-                               BIT(NL80211_BAND_5GHZ);
-
-               hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
-                                           WIPHY_NAN_FLAGS_USERSPACE_DE;
-
-               hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
-                                             NAN_OP_MODE_80P80MHZ |
-                                             NAN_OP_MODE_160MHZ;
-
-               /* Support 2 antenna's for Tx and Rx */
-               hw->wiphy->nan_capa.n_antennas = 0x22;
-
-               /* Maximal channel switch time is 4 msec */
-               hw->wiphy->nan_capa.max_channel_switch_time = 4;
-               hw->wiphy->nan_capa.dev_capabilities =
-                       NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED |
-                       NAN_DEV_CAPA_NDPE_SUPPORTED;
-
-               hw->wiphy->nan_capa.phy.ht = mld->nvm_data->nan_phy_capa.ht;
-               hw->wiphy->nan_capa.phy.vht = mld->nvm_data->nan_phy_capa.vht;
-               hw->wiphy->nan_capa.phy.he = mld->nvm_data->nan_phy_capa.he;
+               iwl_mld_hw_set_nan(mld);
        } else {
-               wiphy->iface_combinations = iwl_mld_iface_combinations;
                /* Do not include NAN combinations */
                wiphy->n_iface_combinations =
                        ARRAY_SIZE(iwl_mld_iface_combinations) - 2;