Commit 4875e0b5 authored by Erik Stromdahl's avatar Erik Stromdahl Committed by Kalle Valo

ath10k: add per target config of max_num_peers

This patch makes sure the value of max_num_peers matches
num_peers in hw_params (if set to a non zero value).

hw_params->num_peers is used in the TLV WMI init command.
If ar->max_num_peers is not set to the same value, there is a risk
that the user creates more peers than the maximum number of peers
supported by the device.
Signed-off-by: default avatarErik Stromdahl <erik.stromdahl@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9faaa143
...@@ -2200,6 +2200,7 @@ static void ath10k_core_set_coverage_class_work(struct work_struct *work) ...@@ -2200,6 +2200,7 @@ static void ath10k_core_set_coverage_class_work(struct work_struct *work)
static int ath10k_core_init_firmware_features(struct ath10k *ar) static int ath10k_core_init_firmware_features(struct ath10k *ar)
{ {
struct ath10k_fw_file *fw_file = &ar->normal_mode_fw.fw_file; struct ath10k_fw_file *fw_file = &ar->normal_mode_fw.fw_file;
int max_num_peers;
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) && if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) &&
!test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) { !test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
...@@ -2279,7 +2280,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ...@@ -2279,7 +2280,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
switch (fw_file->wmi_op_version) { switch (fw_file->wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN: case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->max_num_peers = TARGET_NUM_PEERS; max_num_peers = TARGET_NUM_PEERS;
ar->max_num_stations = TARGET_NUM_STATIONS; ar->max_num_stations = TARGET_NUM_STATIONS;
ar->max_num_vdevs = TARGET_NUM_VDEVS; ar->max_num_vdevs = TARGET_NUM_VDEVS;
ar->htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC; ar->htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC;
...@@ -2291,10 +2292,10 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ...@@ -2291,10 +2292,10 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
case ATH10K_FW_WMI_OP_VERSION_10_2: case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4: case ATH10K_FW_WMI_OP_VERSION_10_2_4:
if (ath10k_peer_stats_enabled(ar)) { if (ath10k_peer_stats_enabled(ar)) {
ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS; max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS;
ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS; ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS;
} else { } else {
ar->max_num_peers = TARGET_10X_NUM_PEERS; max_num_peers = TARGET_10X_NUM_PEERS;
ar->max_num_stations = TARGET_10X_NUM_STATIONS; ar->max_num_stations = TARGET_10X_NUM_STATIONS;
} }
ar->max_num_vdevs = TARGET_10X_NUM_VDEVS; ar->max_num_vdevs = TARGET_10X_NUM_VDEVS;
...@@ -2303,7 +2304,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ...@@ -2303,7 +2304,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM; ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break; break;
case ATH10K_FW_WMI_OP_VERSION_TLV: case ATH10K_FW_WMI_OP_VERSION_TLV:
ar->max_num_peers = TARGET_TLV_NUM_PEERS; max_num_peers = TARGET_TLV_NUM_PEERS;
ar->max_num_stations = TARGET_TLV_NUM_STATIONS; ar->max_num_stations = TARGET_TLV_NUM_STATIONS;
ar->max_num_vdevs = TARGET_TLV_NUM_VDEVS; ar->max_num_vdevs = TARGET_TLV_NUM_VDEVS;
ar->max_num_tdls_vdevs = TARGET_TLV_NUM_TDLS_VDEVS; ar->max_num_tdls_vdevs = TARGET_TLV_NUM_TDLS_VDEVS;
...@@ -2315,7 +2316,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ...@@ -2315,7 +2316,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
ar->wmi.mgmt_max_num_pending_tx = TARGET_TLV_MGMT_NUM_MSDU_DESC; ar->wmi.mgmt_max_num_pending_tx = TARGET_TLV_MGMT_NUM_MSDU_DESC;
break; break;
case ATH10K_FW_WMI_OP_VERSION_10_4: case ATH10K_FW_WMI_OP_VERSION_10_4:
ar->max_num_peers = TARGET_10_4_NUM_PEERS; max_num_peers = TARGET_10_4_NUM_PEERS;
ar->max_num_stations = TARGET_10_4_NUM_STATIONS; ar->max_num_stations = TARGET_10_4_NUM_STATIONS;
ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS; ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS; ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS;
...@@ -2334,10 +2335,16 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ...@@ -2334,10 +2335,16 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
break; break;
case ATH10K_FW_WMI_OP_VERSION_UNSET: case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX: case ATH10K_FW_WMI_OP_VERSION_MAX:
default:
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
if (ar->hw_params.num_peers)
ar->max_num_peers = ar->hw_params.num_peers;
else
ar->max_num_peers = max_num_peers;
/* Backwards compatibility for firmwares without /* Backwards compatibility for firmwares without
* ATH10K_FW_IE_HTT_OP_VERSION. * ATH10K_FW_IE_HTT_OP_VERSION.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment