From: Miri Korenblit Date: Sun, 10 May 2026 20:48:35 +0000 (+0300) Subject: wifi: iwlwifi: mld: extract NAN capabilities setting to a function X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0359d3fa3ccb2f48dfd7ba54c18e1378254a3054;p=thirdparty%2Flinux.git wifi: iwlwifi: mld: extract NAN capabilities setting to a function 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 --- diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c index cabf47367fda..e76421a8a8e6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c @@ -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;