wifi: iwlwifi: add a macro for max FW links

Currently we use IWL_FW_MAX_LINK_ID + 1 to indicate the maximum number
of link that the fw supports. This is a bit confusing.
Add a macro that indicates the number if maximum links that the FW
supports and use it instead.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.8da9f991526f.I72709f1db90036265c98c5d45682bcf5f36be7ba@changeid
This commit is contained in:
Miri Korenblit 2026-03-21 19:29:15 +02:00
parent 4f1da5cf31
commit f2463eff4a
7 changed files with 8 additions and 8 deletions

View File

@ -709,6 +709,7 @@ struct iwl_link_config_cmd {
*/
#define IWL_FW_MAX_ACTIVE_LINKS_NUM 2
#define IWL_FW_MAX_LINK_ID 3
#define IWL_FW_MAX_LINKS IWL_FW_MAX_LINK_ID + 1
/**
* enum iwl_fw_sta_type - FW station types

View File

@ -598,7 +598,6 @@ struct iwl_stats_ntfy_per_sta {
} __packed; /* STATISTICS_NTFY_PER_STA_API_S_VER_1 */
#define IWL_STATS_MAX_PHY_OPERATIONAL 3
#define IWL_STATS_MAX_FW_LINKS (IWL_FW_MAX_LINK_ID + 1)
/**
* struct iwl_system_statistics_notif_oper - statistics notification
@ -610,7 +609,7 @@ struct iwl_stats_ntfy_per_sta {
*/
struct iwl_system_statistics_notif_oper {
__le32 time_stamp;
struct iwl_stats_ntfy_per_link per_link[IWL_STATS_MAX_FW_LINKS];
struct iwl_stats_ntfy_per_link per_link[IWL_FW_MAX_LINKS];
struct iwl_stats_ntfy_per_phy per_phy[IWL_STATS_MAX_PHY_OPERATIONAL];
struct iwl_stats_ntfy_per_sta per_sta[IWL_STATION_COUNT_MAX];
} __packed; /* STATISTICS_FW_NTFY_OPERATIONAL_API_S_VER_3 */
@ -624,7 +623,7 @@ struct iwl_system_statistics_notif_oper {
*/
struct iwl_system_statistics_part1_notif_oper {
__le32 time_stamp;
struct iwl_stats_ntfy_part1_per_link per_link[IWL_STATS_MAX_FW_LINKS];
struct iwl_stats_ntfy_part1_per_link per_link[IWL_FW_MAX_LINKS];
__le32 per_phy_crc_error_stats[IWL_STATS_MAX_PHY_OPERATIONAL];
} __packed; /* STATISTICS_FW_NTFY_OPERATIONAL_PART1_API_S_VER_4 */

View File

@ -1315,7 +1315,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32))
goto invalid_tlv_len;
if (le32_to_cpup((const __le32 *)tlv_data) >
IWL_FW_MAX_LINK_ID + 1) {
IWL_FW_MAX_LINKS) {
IWL_ERR(drv,
"%d is an invalid number of links\n",
le32_to_cpup((const __le32 *)tlv_data));

View File

@ -205,7 +205,7 @@
struct iwl_mld {
/* Add here fields that need clean up on restart */
struct_group(zeroed_on_hw_restart,
struct ieee80211_bss_conf __rcu *fw_id_to_bss_conf[IWL_FW_MAX_LINK_ID + 1];
struct ieee80211_bss_conf __rcu *fw_id_to_bss_conf[IWL_FW_MAX_LINKS];
struct ieee80211_vif __rcu *fw_id_to_vif[NUM_MAC_INDEX_DRIVER];
struct ieee80211_txq __rcu *fw_id_to_txq[IWL_MAX_TVQM_QUEUES];
u8 used_phy_ids: NUM_PHY_CTX;

View File

@ -938,7 +938,7 @@ static void iwl_mld_count_mpdu(struct ieee80211_link_sta *link_sta, int queue,
if (!(mld_vif->emlsr.blocked_reasons & IWL_MLD_EMLSR_BLOCKED_TPT))
goto unlock;
for (int i = 0; i <= IWL_FW_MAX_LINK_ID; i++)
for (int i = 0; i < IWL_FW_MAX_LINKS; i++)
total_mpdus += tx ? queue_counter->per_link[i].tx :
queue_counter->per_link[i].rx;

View File

@ -89,7 +89,7 @@ struct iwl_mld_per_link_mpdu_counter {
*/
struct iwl_mld_per_q_mpdu_counter {
spinlock_t lock;
struct iwl_mld_per_link_mpdu_counter per_link[IWL_FW_MAX_LINK_ID + 1];
struct iwl_mld_per_link_mpdu_counter per_link[IWL_FW_MAX_LINKS];
unsigned long window_start_time;
} ____cacheline_aligned_in_smp;

View File

@ -42,7 +42,7 @@ int iwlmld_kunit_test_init(struct kunit *test)
iwl_construct_mld(mld, trans, cfg, fw, hw, NULL);
fw->ucode_capa.num_stations = IWL_STATION_COUNT_MAX;
fw->ucode_capa.num_links = IWL_FW_MAX_LINK_ID + 1;
fw->ucode_capa.num_links = IWL_FW_MAX_LINKS;
mld->fwrt.trans = trans;
mld->fwrt.fw = fw;