wifi: iwlwifi: get the max number of links from the firmware
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 31 Dec 2024 11:59:02 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 13 Jan 2025 14:34:06 +0000 (15:34 +0100)
The firmware advertises the maximum number of links.
Use it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241231135726.5eb29510f2b4.I7f35f61987c2ee905960ee476df6803632b0feb8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/file.h
drivers/net/wireless/intel/iwlwifi/fw/img.h
drivers/net/wireless/intel/iwlwifi/iwl-drv.c

index dce6186..9860903 100644 (file)
@@ -104,6 +104,7 @@ enum iwl_ucode_tlv_type {
        IWL_UCODE_TLV_CURRENT_PC                = 68,
 
        IWL_UCODE_TLV_FW_NUM_STATIONS           = IWL_UCODE_TLV_CONST_BASE + 0,
+       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_TYPE_DEBUG_INFO           = IWL_UCODE_TLV_DEBUG_BASE + 0,
index 96bda80..f9de139 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2024 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016 Intel Deutschland GmbH
  */
@@ -51,6 +51,7 @@ struct iwl_ucode_capabilities {
        u32 error_log_addr;
        u32 error_log_size;
        u32 num_stations;
+       u32 num_links;
        u32 num_beacons;
        unsigned long _api[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_API)];
        unsigned long _capa[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_CAPA)];
index fba9fee..57991c2 100644 (file)
@@ -22,6 +22,7 @@
 #include "iwl-modparams.h"
 #include "fw/api/alive.h"
 #include "fw/api/mac.h"
+#include "fw/api/mac-cfg.h"
 
 /******************************************************************************
  *
@@ -1197,6 +1198,19 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
                        capa->num_stations =
                                le32_to_cpup((const __le32 *)tlv_data);
                        break;
+               case IWL_UCODE_TLV_FW_NUM_LINKS:
+                       if (tlv_len != sizeof(u32))
+                               goto invalid_tlv_len;
+                       if (le32_to_cpup((const __le32 *)tlv_data) >
+                           IWL_FW_MAX_LINK_ID + 1) {
+                               IWL_ERR(drv,
+                                       "%d is an invalid number of links\n",
+                                       le32_to_cpup((const __le32 *)tlv_data));
+                               goto tlv_error;
+                       }
+                       capa->num_links =
+                               le32_to_cpup((const __le32 *)tlv_data);
+                       break;
                case IWL_UCODE_TLV_FW_NUM_BEACONS:
                        if (tlv_len != sizeof(u32))
                                goto invalid_tlv_len;