Currently, the driver uses memory profile parameters to determine the maximum number of supported clients, with a default limit of 512 for single-radio and 128 for DBS and DBS+SBS configurations. However, some devices have lower hardware limits depending on the radio configuration. Exceeding these hardware-specific limits can lead to firmware crashes. Add hardware parameters in ath12k_hw_params to define the maximum supported clients for each radio configuration. The driver uses the minimum of the memory profile limit and the hardware capability limit to prevent exceeding hardware constraints. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.6-01275-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu --- drivers/net/wireless/ath/ath12k/hw.h | 25 +++++++++++++++--- drivers/net/wireless/ath/ath12k/wifi7/hw.c | 30 ++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/ath/ath12k/hw.h index a9888e0521a1..d135b2936378 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -19,14 +19,28 @@ #define TARGET_NUM_VDEVS(ab) ((ab)->profile_param->num_vdevs) /* Max num of stations for Single Radio mode */ -#define TARGET_NUM_STATIONS_SINGLE(ab) ((ab)->profile_param->max_client_single) +#define TARGET_NUM_STATIONS_SINGLE(ab) \ +({ \ + typeof(ab) _ab = (ab); \ + min_not_zero(_ab->hw_params->client.max_client_single, \ + _ab->profile_param->max_client_single); \ +}) /* Max num of stations for DBS */ -#define TARGET_NUM_STATIONS_DBS(ab) ((ab)->profile_param->max_client_dbs) +#define TARGET_NUM_STATIONS_DBS(ab) \ +({ \ + typeof(ab) _ab = (ab); \ + min_not_zero(_ab->hw_params->client.max_client_dbs, \ + _ab->profile_param->max_client_dbs); \ +}) /* Max num of stations for DBS_SBS */ #define TARGET_NUM_STATIONS_DBS_SBS(ab) \ - ((ab)->profile_param->max_client_dbs_sbs) +({ \ + typeof(ab) _ab = (ab); \ + min_not_zero(_ab->hw_params->client.max_client_dbs_sbs, \ + _ab->profile_param->max_client_dbs_sbs); \ +}) #define TARGET_NUM_STATIONS(ab, x) TARGET_NUM_STATIONS_##x(ab) @@ -213,6 +227,11 @@ struct ath12k_hw_params { /* setup REO queue, frag etc only for primary link peer */ bool dp_primary_link_only:1; + struct { + u32 max_client_single; + u32 max_client_dbs; + u32 max_client_dbs_sbs; + } client; }; struct ath12k_hw_ops { diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wireless/ath/ath12k/wifi7/hw.c index cb3185850439..98bf9293dd33 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c @@ -434,6 +434,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .current_cc_support = false, .dp_primary_link_only = true, + .client = { + .max_client_single = 512, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, { .name = "wcn7850 hw2.0", @@ -520,6 +525,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .current_cc_support = true, .dp_primary_link_only = false, + .client = { + .max_client_single = 512, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, { .name = "qcn9274 hw2.0", @@ -602,6 +612,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .current_cc_support = false, .dp_primary_link_only = true, + .client = { + .max_client_single = 512, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, { .name = "ipq5332 hw1.0", @@ -677,6 +692,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .bdf_addr_offset = 0xC00000, .dp_primary_link_only = true, + .client = { + .max_client_single = 256, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, { .name = "qcc2072 hw1.0", @@ -764,6 +784,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .current_cc_support = true, .dp_primary_link_only = false, + .client = { + .max_client_single = 512, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, { .name = "ipq5424 hw1.0", @@ -843,6 +868,11 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { .current_cc_support = false, .dp_primary_link_only = true, + .client = { + .max_client_single = 512, + .max_client_dbs = 128, + .max_client_dbs_sbs = 128, + }, }, }; base-commit: 8b3115499abadba0f4f8408978df0c6d258fe7ea -- 2.34.1