wifi: iwlwifi: mld: support FW TLV for NAN max channel switch time

Add a new FW TLV (IWL_UCODE_TLV_FW_NAN_MAX_CHAN_SWITCH_TIME) that
allows the firmware to specify the NAN maximum channel switch time
in microseconds.

When the TLV is present, use its value for the NAN device capability.
Otherwise, fall back to the default of 4 milliseconds.

Signed-off-by: Israel Kozitz <israel.kozitz@intel.com>
Link: https://patch.msgid.link/20260527230313.e8ae1a3adacd.I15b933407ca3974a65047b63b4f9b00bed3520fb@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
This commit is contained in:
Israel Kozitz
2026-06-03 17:02:54 +03:00
committed by Miri Korenblit
parent 44e9ece99e
commit 13676ae3cf
4 changed files with 15 additions and 2 deletions
@@ -112,6 +112,7 @@ enum iwl_ucode_tlv_type {
IWL_UCODE_TLV_FW_NUM_LINKS = IWL_UCODE_TLV_CONST_BASE + 1,
IWL_UCODE_TLV_FW_NUM_BEACONS = IWL_UCODE_TLV_CONST_BASE + 2,
IWL_UCODE_TLV_FW_NUM_MCAST_KEY_ENTRIES = IWL_UCODE_TLV_CONST_BASE + 3,
IWL_UCODE_TLV_FW_NAN_MAX_CHAN_SWITCH_TIME = IWL_UCODE_TLV_CONST_BASE + 4,
IWL_UCODE_TLV_TYPE_DEBUG_INFO = IWL_UCODE_TLV_DEBUG_BASE + 0,
IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_TLV_DEBUG_BASE + 1,
@@ -54,6 +54,7 @@ struct iwl_ucode_capabilities {
u32 num_links;
u32 num_beacons;
u32 num_mcast_key_entries;
u16 nan_max_chan_switch_time;
DECLARE_BITMAP(_api, NUM_IWL_UCODE_TLV_API);
DECLARE_BITMAP(_capa, NUM_IWL_UCODE_TLV_CAPA);
@@ -1337,6 +1337,12 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
capa->num_mcast_key_entries =
le32_to_cpup((const __le32 *)tlv_data);
break;
case IWL_UCODE_TLV_FW_NAN_MAX_CHAN_SWITCH_TIME:
if (tlv_len != sizeof(u32))
goto invalid_tlv_len;
capa->nan_max_chan_switch_time =
le32_to_cpup((const __le32 *)tlv_data);
break;
case IWL_UCODE_TLV_UMAC_DEBUG_ADDRS: {
const struct iwl_umac_debug_addrs *dbg_ptrs =
(const void *)tlv_data;
@@ -291,8 +291,13 @@ static void iwl_mld_hw_set_nan(struct iwl_mld *mld)
NAN_DEV_CAPA_NUM_RX_ANT_POS) &
NAN_DEV_CAPA_NUM_RX_ANT_MASK);
/* Maximal channel switch time is 4 msec */
hw->wiphy->nan_capa.max_channel_switch_time = 4 * USEC_PER_MSEC;
/* Maximal channel switch time - use FW TLV value if available */
if (mld->fw->ucode_capa.nan_max_chan_switch_time)
hw->wiphy->nan_capa.max_channel_switch_time =
mld->fw->ucode_capa.nan_max_chan_switch_time;
else
hw->wiphy->nan_capa.max_channel_switch_time =
4 * USEC_PER_MSEC;
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;