summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorKalle Valo <kvalo@codeaurora.org>2019-07-01 15:23:11 -0400
committerKalle Valo <kvalo@codeaurora.org>2019-07-01 15:23:11 -0400
commit5adcdab6ae1b0a53456e8a269b1856094dc20a59 (patch)
treec2fcf3e7359498fd5b0a976fae9ed6fe606bb6a2 /drivers/net/wireless
parent1375da478712369d1af8586768cf476e4f42f0ce (diff)
parentd44c732cffe544d38641065a12e416e0ce4217c1 (diff)
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
ath.git patches for 5.3. Major changes: ath10k * fixes for SDIO support * add support for firmware logging via WMI
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c34
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h15
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c8
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.h25
-rw-r--r--drivers/net/wireless/ath/ath10k/hif.h15
-rw-r--r--drivers/net/wireless/ath/ath10k/htt.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/htt.h16
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_rx.c20
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_tx.c9
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.c6
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h7
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c209
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c25
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi.c46
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi.h1
-rw-r--r--drivers/net/wireless/ath/ath10k/sdio.c17
-rw-r--r--drivers/net/wireless/ath/ath10k/snoc.c15
-rw-r--r--drivers/net/wireless/ath/ath10k/swap.c4
-rw-r--r--drivers/net/wireless/ath/ath10k/testmode.c17
-rw-r--r--drivers/net/wireless/ath/ath10k/trace.c1
-rw-r--r--drivers/net/wireless/ath/ath10k/trace.h6
-rw-r--r--drivers/net/wireless/ath/ath10k/usb.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.c33
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.h8
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c6
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c9
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c39
-rw-r--r--drivers/net/wireless/ath/wil6210/cfg80211.c22
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c168
-rw-r--r--drivers/net/wireless/ath/wil6210/main.c19
-rw-r--r--drivers/net/wireless/ath/wil6210/pcie_bus.c1
-rw-r--r--drivers/net/wireless/ath/wil6210/rx_reorder.c31
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.c9
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx_edma.c16
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx_edma.h2
-rw-r--r--drivers/net/wireless/ath/wil6210/wil6210.h6
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.c127
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.h47
39 files changed, 832 insertions, 227 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 61ef90329788..dc45d16e8d21 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
@@ -26,10 +26,13 @@
26#include "coredump.h" 26#include "coredump.h"
27 27
28unsigned int ath10k_debug_mask; 28unsigned int ath10k_debug_mask;
29EXPORT_SYMBOL(ath10k_debug_mask);
30
29static unsigned int ath10k_cryptmode_param; 31static unsigned int ath10k_cryptmode_param;
30static bool uart_print; 32static bool uart_print;
31static bool skip_otp; 33static bool skip_otp;
32static bool rawmode; 34static bool rawmode;
35static bool fw_diag_log;
33 36
34unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) | 37unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) |
35 BIT(ATH10K_FW_CRASH_DUMP_CE_DATA); 38 BIT(ATH10K_FW_CRASH_DUMP_CE_DATA);
@@ -40,6 +43,7 @@ module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644);
40module_param(uart_print, bool, 0644); 43module_param(uart_print, bool, 0644);
41module_param(skip_otp, bool, 0644); 44module_param(skip_otp, bool, 0644);
42module_param(rawmode, bool, 0644); 45module_param(rawmode, bool, 0644);
46module_param(fw_diag_log, bool, 0644);
43module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444); 47module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444);
44 48
45MODULE_PARM_DESC(debug_mask, "Debugging mask"); 49MODULE_PARM_DESC(debug_mask, "Debugging mask");
@@ -48,6 +52,7 @@ MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode");
48MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); 52MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software");
49MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath"); 53MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath");
50MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); 54MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file");
55MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging");
51 56
52static const struct ath10k_hw_params ath10k_hw_params_list[] = { 57static const struct ath10k_hw_params ath10k_hw_params_list[] = {
53 { 58 {
@@ -83,6 +88,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
83 .rri_on_ddr = false, 88 .rri_on_ddr = false,
84 .hw_filter_reset_required = true, 89 .hw_filter_reset_required = true,
85 .fw_diag_ce_download = false, 90 .fw_diag_ce_download = false,
91 .tx_stats_over_pktlog = true,
86 }, 92 },
87 { 93 {
88 .id = QCA988X_HW_2_0_VERSION, 94 .id = QCA988X_HW_2_0_VERSION,
@@ -117,6 +123,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
117 .rri_on_ddr = false, 123 .rri_on_ddr = false,
118 .hw_filter_reset_required = true, 124 .hw_filter_reset_required = true,
119 .fw_diag_ce_download = false, 125 .fw_diag_ce_download = false,
126 .tx_stats_over_pktlog = true,
120 }, 127 },
121 { 128 {
122 .id = QCA9887_HW_1_0_VERSION, 129 .id = QCA9887_HW_1_0_VERSION,
@@ -152,6 +159,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
152 .rri_on_ddr = false, 159 .rri_on_ddr = false,
153 .hw_filter_reset_required = true, 160 .hw_filter_reset_required = true,
154 .fw_diag_ce_download = false, 161 .fw_diag_ce_download = false,
162 .tx_stats_over_pktlog = false,
155 }, 163 },
156 { 164 {
157 .id = QCA6174_HW_3_2_VERSION, 165 .id = QCA6174_HW_3_2_VERSION,
@@ -170,7 +178,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
170 .board_size = QCA6174_BOARD_DATA_SZ, 178 .board_size = QCA6174_BOARD_DATA_SZ,
171 .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, 179 .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
172 }, 180 },
173 .hw_ops = &qca6174_ops, 181 .hw_ops = &qca6174_sdio_ops,
174 .hw_clk = qca6174_clk, 182 .hw_clk = qca6174_clk,
175 .target_cpu_freq = 176000000, 183 .target_cpu_freq = 176000000,
176 .decap_align_bytes = 4, 184 .decap_align_bytes = 4,
@@ -179,6 +187,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
179 .ast_skid_limit = 0x10, 187 .ast_skid_limit = 0x10,
180 .num_wds_entries = 0x20, 188 .num_wds_entries = 0x20,
181 .uart_pin_workaround = true, 189 .uart_pin_workaround = true,
190 .tx_stats_over_pktlog = false,
182 }, 191 },
183 { 192 {
184 .id = QCA6174_HW_2_1_VERSION, 193 .id = QCA6174_HW_2_1_VERSION,
@@ -213,6 +222,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
213 .rri_on_ddr = false, 222 .rri_on_ddr = false,
214 .hw_filter_reset_required = true, 223 .hw_filter_reset_required = true,
215 .fw_diag_ce_download = false, 224 .fw_diag_ce_download = false,
225 .tx_stats_over_pktlog = false,
216 }, 226 },
217 { 227 {
218 .id = QCA6174_HW_2_1_VERSION, 228 .id = QCA6174_HW_2_1_VERSION,
@@ -247,6 +257,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
247 .rri_on_ddr = false, 257 .rri_on_ddr = false,
248 .hw_filter_reset_required = true, 258 .hw_filter_reset_required = true,
249 .fw_diag_ce_download = false, 259 .fw_diag_ce_download = false,
260 .tx_stats_over_pktlog = false,
250 }, 261 },
251 { 262 {
252 .id = QCA6174_HW_3_0_VERSION, 263 .id = QCA6174_HW_3_0_VERSION,
@@ -281,6 +292,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
281 .rri_on_ddr = false, 292 .rri_on_ddr = false,
282 .hw_filter_reset_required = true, 293 .hw_filter_reset_required = true,
283 .fw_diag_ce_download = false, 294 .fw_diag_ce_download = false,
295 .tx_stats_over_pktlog = false,
284 }, 296 },
285 { 297 {
286 .id = QCA6174_HW_3_2_VERSION, 298 .id = QCA6174_HW_3_2_VERSION,
@@ -318,6 +330,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
318 .rri_on_ddr = false, 330 .rri_on_ddr = false,
319 .hw_filter_reset_required = true, 331 .hw_filter_reset_required = true,
320 .fw_diag_ce_download = true, 332 .fw_diag_ce_download = true,
333 .tx_stats_over_pktlog = false,
321 }, 334 },
322 { 335 {
323 .id = QCA99X0_HW_2_0_DEV_VERSION, 336 .id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -358,6 +371,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
358 .rri_on_ddr = false, 371 .rri_on_ddr = false,
359 .hw_filter_reset_required = true, 372 .hw_filter_reset_required = true,
360 .fw_diag_ce_download = false, 373 .fw_diag_ce_download = false,
374 .tx_stats_over_pktlog = false,
361 }, 375 },
362 { 376 {
363 .id = QCA9984_HW_1_0_DEV_VERSION, 377 .id = QCA9984_HW_1_0_DEV_VERSION,
@@ -405,6 +419,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
405 .rri_on_ddr = false, 419 .rri_on_ddr = false,
406 .hw_filter_reset_required = true, 420 .hw_filter_reset_required = true,
407 .fw_diag_ce_download = false, 421 .fw_diag_ce_download = false,
422 .tx_stats_over_pktlog = false,
408 }, 423 },
409 { 424 {
410 .id = QCA9888_HW_2_0_DEV_VERSION, 425 .id = QCA9888_HW_2_0_DEV_VERSION,
@@ -449,6 +464,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
449 .rri_on_ddr = false, 464 .rri_on_ddr = false,
450 .hw_filter_reset_required = true, 465 .hw_filter_reset_required = true,
451 .fw_diag_ce_download = false, 466 .fw_diag_ce_download = false,
467 .tx_stats_over_pktlog = false,
452 }, 468 },
453 { 469 {
454 .id = QCA9377_HW_1_0_DEV_VERSION, 470 .id = QCA9377_HW_1_0_DEV_VERSION,
@@ -483,6 +499,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
483 .rri_on_ddr = false, 499 .rri_on_ddr = false,
484 .hw_filter_reset_required = true, 500 .hw_filter_reset_required = true,
485 .fw_diag_ce_download = false, 501 .fw_diag_ce_download = false,
502 .tx_stats_over_pktlog = false,
486 }, 503 },
487 { 504 {
488 .id = QCA9377_HW_1_1_DEV_VERSION, 505 .id = QCA9377_HW_1_1_DEV_VERSION,
@@ -519,6 +536,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
519 .rri_on_ddr = false, 536 .rri_on_ddr = false,
520 .hw_filter_reset_required = true, 537 .hw_filter_reset_required = true,
521 .fw_diag_ce_download = true, 538 .fw_diag_ce_download = true,
539 .tx_stats_over_pktlog = false,
522 }, 540 },
523 { 541 {
524 .id = QCA4019_HW_1_0_DEV_VERSION, 542 .id = QCA4019_HW_1_0_DEV_VERSION,
@@ -560,6 +578,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
560 .rri_on_ddr = false, 578 .rri_on_ddr = false,
561 .hw_filter_reset_required = true, 579 .hw_filter_reset_required = true,
562 .fw_diag_ce_download = false, 580 .fw_diag_ce_download = false,
581 .tx_stats_over_pktlog = false,
563 }, 582 },
564 { 583 {
565 .id = WCN3990_HW_1_0_DEV_VERSION, 584 .id = WCN3990_HW_1_0_DEV_VERSION,
@@ -587,6 +606,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
587 .rri_on_ddr = true, 606 .rri_on_ddr = true,
588 .hw_filter_reset_required = false, 607 .hw_filter_reset_required = false,
589 .fw_diag_ce_download = false, 608 .fw_diag_ce_download = false,
609 .tx_stats_over_pktlog = false,
590 }, 610 },
591}; 611};
592 612
@@ -612,6 +632,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
612 [ATH10K_FW_FEATURE_MGMT_TX_BY_REF] = "mgmt-tx-by-reference", 632 [ATH10K_FW_FEATURE_MGMT_TX_BY_REF] = "mgmt-tx-by-reference",
613 [ATH10K_FW_FEATURE_NON_BMI] = "non-bmi", 633 [ATH10K_FW_FEATURE_NON_BMI] = "non-bmi",
614 [ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL] = "single-chan-info-per-channel", 634 [ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL] = "single-chan-info-per-channel",
635 [ATH10K_FW_FEATURE_PEER_FIXED_RATE] = "peer-fixed-rate",
615}; 636};
616 637
617static unsigned int ath10k_core_get_fw_feature_str(char *buf, 638static unsigned int ath10k_core_get_fw_feature_str(char *buf,
@@ -2179,6 +2200,7 @@ static void ath10k_core_restart(struct work_struct *work)
2179 complete(&ar->offchan_tx_completed); 2200 complete(&ar->offchan_tx_completed);
2180 complete(&ar->install_key_done); 2201 complete(&ar->install_key_done);
2181 complete(&ar->vdev_setup_done); 2202 complete(&ar->vdev_setup_done);
2203 complete(&ar->vdev_delete_done);
2182 complete(&ar->thermal.wmi_sync); 2204 complete(&ar->thermal.wmi_sync);
2183 complete(&ar->bss_survey_done); 2205 complete(&ar->bss_survey_done);
2184 wake_up(&ar->htt.empty_tx_wq); 2206 wake_up(&ar->htt.empty_tx_wq);
@@ -2760,6 +2782,12 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2760 if (status) 2782 if (status)
2761 goto err_hif_stop; 2783 goto err_hif_stop;
2762 2784
2785 status = ath10k_hif_set_target_log_mode(ar, fw_diag_log);
2786 if (status && status != -EOPNOTSUPP) {
2787 ath10k_warn(ar, "set traget log mode faileds: %d\n", status);
2788 goto err_hif_stop;
2789 }
2790
2763 return 0; 2791 return 0;
2764 2792
2765err_hif_stop: 2793err_hif_stop:
@@ -3145,8 +3173,10 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
3145 3173
3146 init_completion(&ar->install_key_done); 3174 init_completion(&ar->install_key_done);
3147 init_completion(&ar->vdev_setup_done); 3175 init_completion(&ar->vdev_setup_done);
3176 init_completion(&ar->vdev_delete_done);
3148 init_completion(&ar->thermal.wmi_sync); 3177 init_completion(&ar->thermal.wmi_sync);
3149 init_completion(&ar->bss_survey_done); 3178 init_completion(&ar->bss_survey_done);
3179 init_completion(&ar->peer_delete_done);
3150 3180
3151 INIT_DELAYED_WORK(&ar->scan.timeout, ath10k_scan_timeout_work); 3181 INIT_DELAYED_WORK(&ar->scan.timeout, ath10k_scan_timeout_work);
3152 3182
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 2d109c030ec4..4d7db07db6ba 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
6 */ 6 */
7 7
8#ifndef _CORE_H_ 8#ifndef _CORE_H_
@@ -514,7 +514,8 @@ struct ath10k_sta {
514 u32 peer_ps_state; 514 u32 peer_ps_state;
515}; 515};
516 516
517#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5 * HZ) 517#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5 * HZ)
518#define ATH10K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)
518 519
519enum ath10k_beacon_state { 520enum ath10k_beacon_state {
520 ATH10K_BEACON_SCHEDULED = 0, 521 ATH10K_BEACON_SCHEDULED = 0,
@@ -579,6 +580,10 @@ struct ath10k_vif {
579 struct work_struct ap_csa_work; 580 struct work_struct ap_csa_work;
580 struct delayed_work connection_loss_work; 581 struct delayed_work connection_loss_work;
581 struct cfg80211_bitrate_mask bitrate_mask; 582 struct cfg80211_bitrate_mask bitrate_mask;
583
584 /* For setting VHT peer fixed rate, protected by conf_mutex */
585 int vht_num_rates;
586 u8 vht_pfr;
582}; 587};
583 588
584struct ath10k_vif_iter { 589struct ath10k_vif_iter {
@@ -640,6 +645,7 @@ struct ath10k_debug {
640 u32 nf_cal_period; 645 u32 nf_cal_period;
641 void *cal_data; 646 void *cal_data;
642 u32 enable_extd_tx_stats; 647 u32 enable_extd_tx_stats;
648 u8 fw_dbglog_mode;
643}; 649};
644 650
645enum ath10k_state { 651enum ath10k_state {
@@ -770,6 +776,9 @@ enum ath10k_fw_features {
770 /* Firmware sends only one chan_info event per channel */ 776 /* Firmware sends only one chan_info event per channel */
771 ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL = 20, 777 ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL = 20,
772 778
779 /* Firmware allows setting peer fixed rate */
780 ATH10K_FW_FEATURE_PEER_FIXED_RATE = 21,
781
773 /* keep last */ 782 /* keep last */
774 ATH10K_FW_FEATURE_COUNT, 783 ATH10K_FW_FEATURE_COUNT,
775}; 784};
@@ -1065,6 +1074,7 @@ struct ath10k {
1065 1074
1066 int last_wmi_vdev_start_status; 1075 int last_wmi_vdev_start_status;
1067 struct completion vdev_setup_done; 1076 struct completion vdev_setup_done;
1077 struct completion vdev_delete_done;
1068 1078
1069 struct workqueue_struct *workqueue; 1079 struct workqueue_struct *workqueue;
1070 /* Auxiliary workqueue */ 1080 /* Auxiliary workqueue */
@@ -1199,6 +1209,7 @@ struct ath10k {
1199 struct ath10k_radar_found_info last_radar_info; 1209 struct ath10k_radar_found_info last_radar_info;
1200 struct work_struct radar_confirmation_work; 1210 struct work_struct radar_confirmation_work;
1201 struct ath10k_bus_params bus_param; 1211 struct ath10k_bus_params bus_param;
1212 struct completion peer_delete_done;
1202 1213
1203 /* must be last */ 1214 /* must be last */
1204 u8 drv_priv[0] __aligned(sizeof(void *)); 1215 u8 drv_priv[0] __aligned(sizeof(void *));
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 740781fe80f8..bd2b5628f850 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2664,8 +2664,8 @@ void ath10k_debug_unregister(struct ath10k *ar)
2664#endif /* CONFIG_ATH10K_DEBUGFS */ 2664#endif /* CONFIG_ATH10K_DEBUGFS */
2665 2665
2666#ifdef CONFIG_ATH10K_DEBUG 2666#ifdef CONFIG_ATH10K_DEBUG
2667void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, 2667void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
2668 const char *fmt, ...) 2668 const char *fmt, ...)
2669{ 2669{
2670 struct va_format vaf; 2670 struct va_format vaf;
2671 va_list args; 2671 va_list args;
@@ -2682,7 +2682,7 @@ void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
2682 2682
2683 va_end(args); 2683 va_end(args);
2684} 2684}
2685EXPORT_SYMBOL(ath10k_dbg); 2685EXPORT_SYMBOL(__ath10k_dbg);
2686 2686
2687void ath10k_dbg_dump(struct ath10k *ar, 2687void ath10k_dbg_dump(struct ath10k *ar,
2688 enum ath10k_debug_mask mask, 2688 enum ath10k_debug_mask mask,
@@ -2695,7 +2695,7 @@ void ath10k_dbg_dump(struct ath10k *ar,
2695 2695
2696 if (ath10k_debug_mask & mask) { 2696 if (ath10k_debug_mask & mask) {
2697 if (msg) 2697 if (msg)
2698 ath10k_dbg(ar, mask, "%s\n", msg); 2698 __ath10k_dbg(ar, mask, "%s\n", msg);
2699 2699
2700 for (ptr = buf; (ptr - buf) < len; ptr += 16) { 2700 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
2701 linebuflen = 0; 2701 linebuflen = 0;
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index db78e855a80f..82f7eb8583d9 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -71,6 +71,9 @@ struct ath10k_pktlog_hdr {
71/* FIXME: How to calculate the buffer size sanely? */ 71/* FIXME: How to calculate the buffer size sanely? */
72#define ATH10K_FW_STATS_BUF_SIZE (1024 * 1024) 72#define ATH10K_FW_STATS_BUF_SIZE (1024 * 1024)
73 73
74#define ATH10K_TX_POWER_MAX_VAL 70
75#define ATH10K_TX_POWER_MIN_VAL 0
76
74extern unsigned int ath10k_debug_mask; 77extern unsigned int ath10k_debug_mask;
75 78
76__printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...); 79__printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...);
@@ -240,18 +243,18 @@ void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,
240#endif /* CONFIG_MAC80211_DEBUGFS */ 243#endif /* CONFIG_MAC80211_DEBUGFS */
241 244
242#ifdef CONFIG_ATH10K_DEBUG 245#ifdef CONFIG_ATH10K_DEBUG
243__printf(3, 4) void ath10k_dbg(struct ath10k *ar, 246__printf(3, 4) void __ath10k_dbg(struct ath10k *ar,
244 enum ath10k_debug_mask mask, 247 enum ath10k_debug_mask mask,
245 const char *fmt, ...); 248 const char *fmt, ...);
246void ath10k_dbg_dump(struct ath10k *ar, 249void ath10k_dbg_dump(struct ath10k *ar,
247 enum ath10k_debug_mask mask, 250 enum ath10k_debug_mask mask,
248 const char *msg, const char *prefix, 251 const char *msg, const char *prefix,
249 const void *buf, size_t len); 252 const void *buf, size_t len);
250#else /* CONFIG_ATH10K_DEBUG */ 253#else /* CONFIG_ATH10K_DEBUG */
251 254
252static inline int ath10k_dbg(struct ath10k *ar, 255static inline int __ath10k_dbg(struct ath10k *ar,
253 enum ath10k_debug_mask dbg_mask, 256 enum ath10k_debug_mask dbg_mask,
254 const char *fmt, ...) 257 const char *fmt, ...)
255{ 258{
256 return 0; 259 return 0;
257} 260}
@@ -263,4 +266,14 @@ static inline void ath10k_dbg_dump(struct ath10k *ar,
263{ 266{
264} 267}
265#endif /* CONFIG_ATH10K_DEBUG */ 268#endif /* CONFIG_ATH10K_DEBUG */
269
270/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
271 * disabled.
272 */
273#define ath10k_dbg(ar, dbg_mask, fmt, ...) \
274do { \
275 if ((ath10k_debug_mask & dbg_mask) || \
276 trace_ath10k_log_dbg_enabled()) \
277 __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
278} while (0)
266#endif /* _DEBUG_H_ */ 279#endif /* _DEBUG_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/hif.h b/drivers/net/wireless/ath/ath10k/hif.h
index fe5417962f40..496ee34a4d78 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -12,6 +12,12 @@
12#include "bmi.h" 12#include "bmi.h"
13#include "debug.h" 13#include "debug.h"
14 14
15/* Types of fw logging mode */
16enum ath_dbg_mode {
17 ATH10K_ENABLE_FW_LOG_DIAG,
18 ATH10K_ENABLE_FW_LOG_CE,
19};
20
15struct ath10k_hif_sg_item { 21struct ath10k_hif_sg_item {
16 u16 transfer_id; 22 u16 transfer_id;
17 void *transfer_context; /* NULL = tx completion callback not called */ 23 void *transfer_context; /* NULL = tx completion callback not called */
@@ -88,6 +94,7 @@ struct ath10k_hif_ops {
88 94
89 int (*get_target_info)(struct ath10k *ar, 95 int (*get_target_info)(struct ath10k *ar,
90 struct bmi_target_info *target_info); 96 struct bmi_target_info *target_info);
97 int (*set_target_log_mode)(struct ath10k *ar, u8 fw_log_mode);
91}; 98};
92 99
93static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id, 100static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
@@ -230,4 +237,12 @@ static inline int ath10k_hif_get_target_info(struct ath10k *ar,
230 return ar->hif.ops->get_target_info(ar, tgt_info); 237 return ar->hif.ops->get_target_info(ar, tgt_info);
231} 238}
232 239
240static inline int ath10k_hif_set_target_log_mode(struct ath10k *ar,
241 u8 fw_log_mode)
242{
243 if (!ar->hif.ops->set_target_log_mode)
244 return -EOPNOTSUPP;
245
246 return ar->hif.ops->set_target_log_mode(ar, fw_log_mode);
247}
233#endif /* _HIF_H_ */ 248#endif /* _HIF_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index d235ff3098e8..7b75200ceae5 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -257,7 +257,7 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
257 return status; 257 return status;
258 } 258 }
259 259
260 status = htt->tx_ops->htt_h2t_aggr_cfg_msg(htt, 260 status = ath10k_htt_h2t_aggr_cfg_msg(htt,
261 htt->max_num_ampdu, 261 htt->max_num_ampdu,
262 htt->max_num_amsdu); 262 htt->max_num_amsdu);
263 if (status) { 263 if (status) {
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 19cd0cb5875f..30c080094af1 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -2086,6 +2086,19 @@ static inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt)
2086 htt->tx_ops->htt_free_txbuff(htt); 2086 htt->tx_ops->htt_free_txbuff(htt);
2087} 2087}
2088 2088
2089static inline int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
2090 u8 max_subfrms_ampdu,
2091 u8 max_subfrms_amsdu)
2092
2093{
2094 if (!htt->tx_ops->htt_h2t_aggr_cfg_msg)
2095 return -EOPNOTSUPP;
2096
2097 return htt->tx_ops->htt_h2t_aggr_cfg_msg(htt,
2098 max_subfrms_ampdu,
2099 max_subfrms_amsdu);
2100}
2101
2089struct ath10k_htt_rx_ops { 2102struct ath10k_htt_rx_ops {
2090 size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt); 2103 size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt);
2091 void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr); 2104 void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr);
@@ -2246,9 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
2246int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); 2259int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
2247int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask, 2260int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask,
2248 u64 cookie); 2261 u64 cookie);
2249int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
2250 u8 max_subfrms_ampdu,
2251 u8 max_subfrms_amsdu);
2252void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb); 2262void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb);
2253int ath10k_htt_tx_fetch_resp(struct ath10k *ar, 2263int ath10k_htt_tx_fetch_resp(struct ath10k *ar,
2254 __le32 token, 2264 __le32 token,
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 0c18c58de71d..83a7fb68fd24 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2158,13 +2158,14 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,
2158 int num_mpdu_ranges; 2158 int num_mpdu_ranges;
2159 size_t tot_hdr_len; 2159 size_t tot_hdr_len;
2160 struct ieee80211_channel *ch; 2160 struct ieee80211_channel *ch;
2161 bool pn_invalid;
2161 2162
2162 peer_id = __le16_to_cpu(rx->hdr.peer_id); 2163 peer_id = __le16_to_cpu(rx->hdr.peer_id);
2163 2164
2164 spin_lock_bh(&ar->data_lock); 2165 spin_lock_bh(&ar->data_lock);
2165 peer = ath10k_peer_find_by_id(ar, peer_id); 2166 peer = ath10k_peer_find_by_id(ar, peer_id);
2166 spin_unlock_bh(&ar->data_lock); 2167 spin_unlock_bh(&ar->data_lock);
2167 if (!peer) 2168 if (!peer && peer_id != HTT_INVALID_PEERID)
2168 ath10k_warn(ar, "Got RX ind from invalid peer: %u\n", peer_id); 2169 ath10k_warn(ar, "Got RX ind from invalid peer: %u\n", peer_id);
2169 2170
2170 num_mpdu_ranges = MS(__le32_to_cpu(rx->hdr.info1), 2171 num_mpdu_ranges = MS(__le32_to_cpu(rx->hdr.info1),
@@ -2183,15 +2184,21 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,
2183 num_mpdu_ranges); 2184 num_mpdu_ranges);
2184 2185
2185 if (mpdu_ranges->mpdu_range_status != 2186 if (mpdu_ranges->mpdu_range_status !=
2186 HTT_RX_IND_MPDU_STATUS_OK) { 2187 HTT_RX_IND_MPDU_STATUS_OK &&
2188 mpdu_ranges->mpdu_range_status !=
2189 HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR) {
2187 ath10k_warn(ar, "MPDU range status: %d\n", 2190 ath10k_warn(ar, "MPDU range status: %d\n",
2188 mpdu_ranges->mpdu_range_status); 2191 mpdu_ranges->mpdu_range_status);
2189 goto err; 2192 goto err;
2190 } 2193 }
2191 2194
2192 if (check_pn_type == HTT_RX_PN_CHECK && 2195 if (check_pn_type == HTT_RX_PN_CHECK) {
2193 ath10k_htt_rx_pn_check_replay_hl(ar, peer, rx)) 2196 spin_lock_bh(&ar->data_lock);
2194 goto err; 2197 pn_invalid = ath10k_htt_rx_pn_check_replay_hl(ar, peer, rx);
2198 spin_unlock_bh(&ar->data_lock);
2199 if (pn_invalid)
2200 goto err;
2201 }
2195 2202
2196 /* Strip off all headers before the MAC header before delivery to 2203 /* Strip off all headers before the MAC header before delivery to
2197 * mac80211 2204 * mac80211
@@ -2253,6 +2260,9 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,
2253 rx_status->flag &= ~RX_FLAG_IV_STRIPPED & 2260 rx_status->flag &= ~RX_FLAG_IV_STRIPPED &
2254 ~RX_FLAG_MMIC_STRIPPED; 2261 ~RX_FLAG_MMIC_STRIPPED;
2255 2262
2263 if (mpdu_ranges->mpdu_range_status == HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR)
2264 rx_status->flag |= RX_FLAG_MMIC_ERROR;
2265
2256 ieee80211_rx_ni(ar->hw, skb); 2266 ieee80211_rx_ni(ar->hw, skb);
2257 2267
2258 /* We have delivered the skb to the upper layers (mac80211) so we 2268 /* We have delivered the skb to the upper layers (mac80211) so we
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 1f391c739e40..2ef717f18795 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -978,9 +978,9 @@ static int ath10k_htt_send_rx_ring_cfg_hl(struct ath10k_htt *htt)
978 return 0; 978 return 0;
979} 979}
980 980
981int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, 981static int ath10k_htt_h2t_aggr_cfg_msg_32(struct ath10k_htt *htt,
982 u8 max_subfrms_ampdu, 982 u8 max_subfrms_ampdu,
983 u8 max_subfrms_amsdu) 983 u8 max_subfrms_amsdu)
984{ 984{
985 struct ath10k *ar = htt->ar; 985 struct ath10k *ar = htt->ar;
986 struct htt_aggr_conf *aggr_conf; 986 struct htt_aggr_conf *aggr_conf;
@@ -1747,7 +1747,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_32 = {
1747 .htt_tx = ath10k_htt_tx_32, 1747 .htt_tx = ath10k_htt_tx_32,
1748 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_32, 1748 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_32,
1749 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_32, 1749 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_32,
1750 .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg, 1750 .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32,
1751}; 1751};
1752 1752
1753static const struct ath10k_htt_tx_ops htt_tx_ops_64 = { 1753static const struct ath10k_htt_tx_ops htt_tx_ops_64 = {
@@ -1765,6 +1765,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_hl = {
1765 .htt_send_rx_ring_cfg = ath10k_htt_send_rx_ring_cfg_hl, 1765 .htt_send_rx_ring_cfg = ath10k_htt_send_rx_ring_cfg_hl,
1766 .htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32, 1766 .htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32,
1767 .htt_tx = ath10k_htt_tx_hl, 1767 .htt_tx = ath10k_htt_tx_hl,
1768 .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32,
1768}; 1769};
1769 1770
1770void ath10k_htt_set_tx_ops(struct ath10k_htt *htt) 1771void ath10k_htt_set_tx_ops(struct ath10k_htt *htt)
diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
index ad082b7d7643..c415e971735b 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -158,7 +158,7 @@ const struct ath10k_hw_values qca6174_values = {
158}; 158};
159 159
160const struct ath10k_hw_values qca99x0_values = { 160const struct ath10k_hw_values qca99x0_values = {
161 .rtc_state_val_on = 5, 161 .rtc_state_val_on = 7,
162 .ce_count = 12, 162 .ce_count = 12,
163 .msi_assign_ce_max = 12, 163 .msi_assign_ce_max = 12,
164 .num_target_ce_config_wlan = 10, 164 .num_target_ce_config_wlan = 10,
@@ -1153,6 +1153,10 @@ const struct ath10k_hw_ops qca6174_ops = {
1153 .is_rssi_enable = ath10k_htt_tx_rssi_enable, 1153 .is_rssi_enable = ath10k_htt_tx_rssi_enable,
1154}; 1154};
1155 1155
1156const struct ath10k_hw_ops qca6174_sdio_ops = {
1157 .enable_pll_clk = ath10k_hw_qca6174_enable_pll_clock,
1158};
1159
1156const struct ath10k_hw_ops wcn3990_ops = { 1160const struct ath10k_hw_ops wcn3990_ops = {
1157 .tx_data_rssi_pad_bytes = ath10k_get_htt_tx_data_rssi_pad, 1161 .tx_data_rssi_pad_bytes = ath10k_get_htt_tx_data_rssi_pad,
1158 .is_rssi_enable = ath10k_htt_tx_rssi_enable_wcn3990, 1162 .is_rssi_enable = ath10k_htt_tx_rssi_enable_wcn3990,
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 248cfb4e53c3..2ae57c1de7b5 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -152,6 +152,8 @@ enum qca9377_chip_id_rev {
152#define ATH10K_FW_UTF_FILE "utf.bin" 152#define ATH10K_FW_UTF_FILE "utf.bin"
153#define ATH10K_FW_UTF_API2_FILE "utf-2.bin" 153#define ATH10K_FW_UTF_API2_FILE "utf-2.bin"
154 154
155#define ATH10K_FW_UTF_FILE_BASE "utf"
156
155/* includes also the null byte */ 157/* includes also the null byte */
156#define ATH10K_FIRMWARE_MAGIC "QCA-ATH10K" 158#define ATH10K_FIRMWARE_MAGIC "QCA-ATH10K"
157#define ATH10K_BOARD_MAGIC "QCA-ATH10K-BOARD" 159#define ATH10K_BOARD_MAGIC "QCA-ATH10K-BOARD"
@@ -612,6 +614,9 @@ struct ath10k_hw_params {
612 * firmware bug 614 * firmware bug
613 */ 615 */
614 bool uart_pin_workaround; 616 bool uart_pin_workaround;
617
618 /* tx stats support over pktlog */
619 bool tx_stats_over_pktlog;
615}; 620};
616 621
617struct htt_rx_desc; 622struct htt_rx_desc;
@@ -631,6 +636,7 @@ struct ath10k_hw_ops {
631extern const struct ath10k_hw_ops qca988x_ops; 636extern const struct ath10k_hw_ops qca988x_ops;
632extern const struct ath10k_hw_ops qca99x0_ops; 637extern const struct ath10k_hw_ops qca99x0_ops;
633extern const struct ath10k_hw_ops qca6174_ops; 638extern const struct ath10k_hw_ops qca6174_ops;
639extern const struct ath10k_hw_ops qca6174_sdio_ops;
634extern const struct ath10k_hw_ops wcn3990_ops; 640extern const struct ath10k_hw_ops wcn3990_ops;
635 641
636extern const struct ath10k_hw_clk_params qca6174_clk[]; 642extern const struct ath10k_hw_clk_params qca6174_clk[];
@@ -1101,6 +1107,7 @@ ath10k_is_rssi_enable(struct ath10k_hw_params *hw,
1101#define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS 0x00000819 1107#define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS 0x00000819
1102#define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB 0 1108#define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB 0
1103#define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff 1109#define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff
1110#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001
1104#define MBOX_ERROR_STATUS_ENABLE_ADDRESS 0x0000081a 1111#define MBOX_ERROR_STATUS_ENABLE_ADDRESS 0x0000081a
1105#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 1112#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1
1106#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 1113#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index b500fd427595..e43a566eef77 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -693,6 +693,26 @@ ath10k_mac_get_any_chandef_iter(struct ieee80211_hw *hw,
693 *def = &conf->def; 693 *def = &conf->def;
694} 694}
695 695
696static void ath10k_wait_for_peer_delete_done(struct ath10k *ar, u32 vdev_id,
697 const u8 *addr)
698{
699 unsigned long time_left;
700 int ret;
701
702 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) {
703 ret = ath10k_wait_for_peer_deleted(ar, vdev_id, addr);
704 if (ret) {
705 ath10k_warn(ar, "failed wait for peer deleted");
706 return;
707 }
708
709 time_left = wait_for_completion_timeout(&ar->peer_delete_done,
710 5 * HZ);
711 if (!time_left)
712 ath10k_warn(ar, "Timeout in receiving peer delete response\n");
713 }
714}
715
696static int ath10k_peer_create(struct ath10k *ar, 716static int ath10k_peer_create(struct ath10k *ar,
697 struct ieee80211_vif *vif, 717 struct ieee80211_vif *vif,
698 struct ieee80211_sta *sta, 718 struct ieee80211_sta *sta,
@@ -737,7 +757,7 @@ static int ath10k_peer_create(struct ath10k *ar,
737 spin_unlock_bh(&ar->data_lock); 757 spin_unlock_bh(&ar->data_lock);
738 ath10k_warn(ar, "failed to find peer %pM on vdev %i after creation\n", 758 ath10k_warn(ar, "failed to find peer %pM on vdev %i after creation\n",
739 addr, vdev_id); 759 addr, vdev_id);
740 ath10k_wmi_peer_delete(ar, vdev_id, addr); 760 ath10k_wait_for_peer_delete_done(ar, vdev_id, addr);
741 return -ENOENT; 761 return -ENOENT;
742 } 762 }
743 763
@@ -819,6 +839,18 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
819 if (ret) 839 if (ret)
820 return ret; 840 return ret;
821 841
842 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) {
843 unsigned long time_left;
844
845 time_left = wait_for_completion_timeout
846 (&ar->peer_delete_done, 5 * HZ);
847
848 if (!time_left) {
849 ath10k_warn(ar, "Timeout in receiving peer delete response\n");
850 return -ETIMEDOUT;
851 }
852 }
853
822 ar->num_peers--; 854 ar->num_peers--;
823 855
824 return 0; 856 return 0;
@@ -1011,6 +1043,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
1011 arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; 1043 arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
1012 1044
1013 reinit_completion(&ar->vdev_setup_done); 1045 reinit_completion(&ar->vdev_setup_done);
1046 reinit_completion(&ar->vdev_delete_done);
1014 1047
1015 ret = ath10k_wmi_vdev_start(ar, &arg); 1048 ret = ath10k_wmi_vdev_start(ar, &arg);
1016 if (ret) { 1049 if (ret) {
@@ -1060,6 +1093,7 @@ static int ath10k_monitor_vdev_stop(struct ath10k *ar)
1060 ar->monitor_vdev_id, ret); 1093 ar->monitor_vdev_id, ret);
1061 1094
1062 reinit_completion(&ar->vdev_setup_done); 1095 reinit_completion(&ar->vdev_setup_done);
1096 reinit_completion(&ar->vdev_delete_done);
1063 1097
1064 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); 1098 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id);
1065 if (ret) 1099 if (ret)
@@ -1401,6 +1435,7 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
1401 lockdep_assert_held(&ar->conf_mutex); 1435 lockdep_assert_held(&ar->conf_mutex);
1402 1436
1403 reinit_completion(&ar->vdev_setup_done); 1437 reinit_completion(&ar->vdev_setup_done);
1438 reinit_completion(&ar->vdev_delete_done);
1404 1439
1405 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); 1440 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id);
1406 if (ret) { 1441 if (ret) {
@@ -1437,6 +1472,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif,
1437 lockdep_assert_held(&ar->conf_mutex); 1472 lockdep_assert_held(&ar->conf_mutex);
1438 1473
1439 reinit_completion(&ar->vdev_setup_done); 1474 reinit_completion(&ar->vdev_setup_done);
1475 reinit_completion(&ar->vdev_delete_done);
1440 1476
1441 arg.vdev_id = arvif->vdev_id; 1477 arg.vdev_id = arvif->vdev_id;
1442 arg.dtim_period = arvif->dtim_period; 1478 arg.dtim_period = arvif->dtim_period;
@@ -5419,8 +5455,11 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
5419 5455
5420err_peer_delete: 5456err_peer_delete:
5421 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || 5457 if (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
5422 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) 5458 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
5423 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); 5459 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
5460 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id,
5461 vif->addr);
5462 }
5424 5463
5425err_vdev_delete: 5464err_vdev_delete:
5426 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); 5465 ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
@@ -5455,6 +5494,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
5455 struct ath10k *ar = hw->priv; 5494 struct ath10k *ar = hw->priv;
5456 struct ath10k_vif *arvif = (void *)vif->drv_priv; 5495 struct ath10k_vif *arvif = (void *)vif->drv_priv;
5457 struct ath10k_peer *peer; 5496 struct ath10k_peer *peer;
5497 unsigned long time_left;
5458 int ret; 5498 int ret;
5459 int i; 5499 int i;
5460 5500
@@ -5485,6 +5525,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
5485 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", 5525 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n",
5486 arvif->vdev_id, ret); 5526 arvif->vdev_id, ret);
5487 5527
5528 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id,
5529 vif->addr);
5488 kfree(arvif->u.ap.noa_data); 5530 kfree(arvif->u.ap.noa_data);
5489 } 5531 }
5490 5532
@@ -5496,6 +5538,15 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
5496 ath10k_warn(ar, "failed to delete WMI vdev %i: %d\n", 5538 ath10k_warn(ar, "failed to delete WMI vdev %i: %d\n",
5497 arvif->vdev_id, ret); 5539 arvif->vdev_id, ret);
5498 5540
5541 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) {
5542 time_left = wait_for_completion_timeout(&ar->vdev_delete_done,
5543 ATH10K_VDEV_DELETE_TIMEOUT_HZ);
5544 if (time_left == 0) {
5545 ath10k_warn(ar, "Timeout in receiving vdev delete response\n");
5546 goto out;
5547 }
5548 }
5549
5499 /* Some firmware revisions don't notify host about self-peer removal 5550 /* Some firmware revisions don't notify host about self-peer removal
5500 * until after associated vdev is deleted. 5551 * until after associated vdev is deleted.
5501 */ 5552 */
@@ -5546,6 +5597,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
5546 5597
5547 ath10k_mac_txq_unref(ar, vif->txq); 5598 ath10k_mac_txq_unref(ar, vif->txq);
5548 5599
5600out:
5549 mutex_unlock(&ar->conf_mutex); 5601 mutex_unlock(&ar->conf_mutex);
5550} 5602}
5551 5603
@@ -6358,6 +6410,41 @@ static void ath10k_mac_dec_num_stations(struct ath10k_vif *arvif,
6358 ar->num_stations--; 6410 ar->num_stations--;
6359} 6411}
6360 6412
6413static int ath10k_sta_set_txpwr(struct ieee80211_hw *hw,
6414 struct ieee80211_vif *vif,
6415 struct ieee80211_sta *sta)
6416{
6417 struct ath10k *ar = hw->priv;
6418 struct ath10k_vif *arvif = (void *)vif->drv_priv;
6419 int ret = 0;
6420 s16 txpwr;
6421
6422 if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) {
6423 txpwr = 0;
6424 } else {
6425 txpwr = sta->txpwr.power;
6426 if (!txpwr)
6427 return -EINVAL;
6428 }
6429
6430 if (txpwr > ATH10K_TX_POWER_MAX_VAL || txpwr < ATH10K_TX_POWER_MIN_VAL)
6431 return -EINVAL;
6432
6433 mutex_lock(&ar->conf_mutex);
6434
6435 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
6436 WMI_PEER_USE_FIXED_PWR, txpwr);
6437 if (ret) {
6438 ath10k_warn(ar, "failed to set tx power for station ret: %d\n",
6439 ret);
6440 goto out;
6441 }
6442
6443out:
6444 mutex_unlock(&ar->conf_mutex);
6445 return ret;
6446}
6447
6361static int ath10k_sta_state(struct ieee80211_hw *hw, 6448static int ath10k_sta_state(struct ieee80211_hw *hw,
6362 struct ieee80211_vif *vif, 6449 struct ieee80211_vif *vif,
6363 struct ieee80211_sta *sta, 6450 struct ieee80211_sta *sta,
@@ -7107,18 +7194,23 @@ exit:
7107static bool 7194static bool
7108ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar, 7195ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar,
7109 enum nl80211_band band, 7196 enum nl80211_band band,
7110 const struct cfg80211_bitrate_mask *mask) 7197 const struct cfg80211_bitrate_mask *mask,
7198 int *vht_num_rates)
7111{ 7199{
7112 int num_rates = 0; 7200 int num_rates = 0;
7113 int i; 7201 int i, tmp;
7114 7202
7115 num_rates += hweight32(mask->control[band].legacy); 7203 num_rates += hweight32(mask->control[band].legacy);
7116 7204
7117 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) 7205 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++)
7118 num_rates += hweight8(mask->control[band].ht_mcs[i]); 7206 num_rates += hweight8(mask->control[band].ht_mcs[i]);
7119 7207
7120 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) 7208 *vht_num_rates = 0;
7121 num_rates += hweight16(mask->control[band].vht_mcs[i]); 7209 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) {
7210 tmp = hweight16(mask->control[band].vht_mcs[i]);
7211 num_rates += tmp;
7212 *vht_num_rates += tmp;
7213 }
7122 7214
7123 return num_rates == 1; 7215 return num_rates == 1;
7124} 7216}
@@ -7176,7 +7268,7 @@ static int
7176ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar, 7268ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar,
7177 enum nl80211_band band, 7269 enum nl80211_band band,
7178 const struct cfg80211_bitrate_mask *mask, 7270 const struct cfg80211_bitrate_mask *mask,
7179 u8 *rate, u8 *nss) 7271 u8 *rate, u8 *nss, bool vht_only)
7180{ 7272{
7181 int rate_idx; 7273 int rate_idx;
7182 int i; 7274 int i;
@@ -7184,6 +7276,9 @@ ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar,
7184 u8 preamble; 7276 u8 preamble;
7185 u8 hw_rate; 7277 u8 hw_rate;
7186 7278
7279 if (vht_only)
7280 goto next;
7281
7187 if (hweight32(mask->control[band].legacy) == 1) { 7282 if (hweight32(mask->control[band].legacy) == 1) {
7188 rate_idx = ffs(mask->control[band].legacy) - 1; 7283 rate_idx = ffs(mask->control[band].legacy) - 1;
7189 7284
@@ -7217,6 +7312,7 @@ ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar,
7217 } 7312 }
7218 } 7313 }
7219 7314
7315next:
7220 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { 7316 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) {
7221 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { 7317 if (hweight16(mask->control[band].vht_mcs[i]) == 1) {
7222 *nss = i + 1; 7318 *nss = i + 1;
@@ -7278,7 +7374,8 @@ static int ath10k_mac_set_fixed_rate_params(struct ath10k_vif *arvif,
7278static bool 7374static bool
7279ath10k_mac_can_set_bitrate_mask(struct ath10k *ar, 7375ath10k_mac_can_set_bitrate_mask(struct ath10k *ar,
7280 enum nl80211_band band, 7376 enum nl80211_band band,
7281 const struct cfg80211_bitrate_mask *mask) 7377 const struct cfg80211_bitrate_mask *mask,
7378 bool allow_pfr)
7282{ 7379{
7283 int i; 7380 int i;
7284 u16 vht_mcs; 7381 u16 vht_mcs;
@@ -7297,7 +7394,8 @@ ath10k_mac_can_set_bitrate_mask(struct ath10k *ar,
7297 case BIT(10) - 1: 7394 case BIT(10) - 1:
7298 break; 7395 break;
7299 default: 7396 default:
7300 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); 7397 if (!allow_pfr)
7398 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n");
7301 return false; 7399 return false;
7302 } 7400 }
7303 } 7401 }
@@ -7305,6 +7403,26 @@ ath10k_mac_can_set_bitrate_mask(struct ath10k *ar,
7305 return true; 7403 return true;
7306} 7404}
7307 7405
7406static bool ath10k_mac_set_vht_bitrate_mask_fixup(struct ath10k *ar,
7407 struct ath10k_vif *arvif,
7408 struct ieee80211_sta *sta)
7409{
7410 int err;
7411 u8 rate = arvif->vht_pfr;
7412
7413 /* skip non vht and multiple rate peers */
7414 if (!sta->vht_cap.vht_supported || arvif->vht_num_rates != 1)
7415 return false;
7416
7417 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
7418 WMI_PEER_PARAM_FIXED_RATE, rate);
7419 if (err)
7420 ath10k_warn(ar, "failed to eanble STA %pM peer fixed rate: %d\n",
7421 sta->addr, err);
7422
7423 return true;
7424}
7425
7308static void ath10k_mac_set_bitrate_mask_iter(void *data, 7426static void ath10k_mac_set_bitrate_mask_iter(void *data,
7309 struct ieee80211_sta *sta) 7427 struct ieee80211_sta *sta)
7310{ 7428{
@@ -7315,6 +7433,9 @@ static void ath10k_mac_set_bitrate_mask_iter(void *data,
7315 if (arsta->arvif != arvif) 7433 if (arsta->arvif != arvif)
7316 return; 7434 return;
7317 7435
7436 if (ath10k_mac_set_vht_bitrate_mask_fixup(ar, arvif, sta))
7437 return;
7438
7318 spin_lock_bh(&ar->data_lock); 7439 spin_lock_bh(&ar->data_lock);
7319 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; 7440 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED;
7320 spin_unlock_bh(&ar->data_lock); 7441 spin_unlock_bh(&ar->data_lock);
@@ -7322,6 +7443,26 @@ static void ath10k_mac_set_bitrate_mask_iter(void *data,
7322 ieee80211_queue_work(ar->hw, &arsta->update_wk); 7443 ieee80211_queue_work(ar->hw, &arsta->update_wk);
7323} 7444}
7324 7445
7446static void ath10k_mac_clr_bitrate_mask_iter(void *data,
7447 struct ieee80211_sta *sta)
7448{
7449 struct ath10k_vif *arvif = data;
7450 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
7451 struct ath10k *ar = arvif->ar;
7452 int err;
7453
7454 /* clear vht peers only */
7455 if (arsta->arvif != arvif || !sta->vht_cap.vht_supported)
7456 return;
7457
7458 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
7459 WMI_PEER_PARAM_FIXED_RATE,
7460 WMI_FIXED_RATE_NONE);
7461 if (err)
7462 ath10k_warn(ar, "failed to clear STA %pM peer fixed rate: %d\n",
7463 sta->addr, err);
7464}
7465
7325static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, 7466static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
7326 struct ieee80211_vif *vif, 7467 struct ieee80211_vif *vif,
7327 const struct cfg80211_bitrate_mask *mask) 7468 const struct cfg80211_bitrate_mask *mask)
@@ -7338,6 +7479,9 @@ static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
7338 u8 ldpc; 7479 u8 ldpc;
7339 int single_nss; 7480 int single_nss;
7340 int ret; 7481 int ret;
7482 int vht_num_rates, allow_pfr;
7483 u8 vht_pfr;
7484 bool update_bitrate_mask = true;
7341 7485
7342 if (ath10k_mac_vif_chan(vif, &def)) 7486 if (ath10k_mac_vif_chan(vif, &def))
7343 return -EPERM; 7487 return -EPERM;
@@ -7351,9 +7495,21 @@ static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
7351 if (sgi == NL80211_TXRATE_FORCE_LGI) 7495 if (sgi == NL80211_TXRATE_FORCE_LGI)
7352 return -EINVAL; 7496 return -EINVAL;
7353 7497
7354 if (ath10k_mac_bitrate_mask_has_single_rate(ar, band, mask)) { 7498 allow_pfr = test_bit(ATH10K_FW_FEATURE_PEER_FIXED_RATE,
7499 ar->normal_mode_fw.fw_file.fw_features);
7500 if (allow_pfr) {
7501 mutex_lock(&ar->conf_mutex);
7502 ieee80211_iterate_stations_atomic(ar->hw,
7503 ath10k_mac_clr_bitrate_mask_iter,
7504 arvif);
7505 mutex_unlock(&ar->conf_mutex);
7506 }
7507
7508 if (ath10k_mac_bitrate_mask_has_single_rate(ar, band, mask,
7509 &vht_num_rates)) {
7355 ret = ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask, 7510 ret = ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask,
7356 &rate, &nss); 7511 &rate, &nss,
7512 false);
7357 if (ret) { 7513 if (ret) {
7358 ath10k_warn(ar, "failed to get single rate for vdev %i: %d\n", 7514 ath10k_warn(ar, "failed to get single rate for vdev %i: %d\n",
7359 arvif->vdev_id, ret); 7515 arvif->vdev_id, ret);
@@ -7369,12 +7525,30 @@ static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
7369 max(ath10k_mac_max_ht_nss(ht_mcs_mask), 7525 max(ath10k_mac_max_ht_nss(ht_mcs_mask),
7370 ath10k_mac_max_vht_nss(vht_mcs_mask))); 7526 ath10k_mac_max_vht_nss(vht_mcs_mask)));
7371 7527
7372 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask)) 7528 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask,
7373 return -EINVAL; 7529 allow_pfr)) {
7530 u8 vht_nss;
7531
7532 if (!allow_pfr || vht_num_rates != 1)
7533 return -EINVAL;
7534
7535 /* Reach here, firmware supports peer fixed rate and has
7536 * single vht rate, and don't update vif birate_mask, as
7537 * the rate only for specific peer.
7538 */
7539 ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask,
7540 &vht_pfr,
7541 &vht_nss,
7542 true);
7543 update_bitrate_mask = false;
7544 }
7374 7545
7375 mutex_lock(&ar->conf_mutex); 7546 mutex_lock(&ar->conf_mutex);
7376 7547
7377 arvif->bitrate_mask = *mask; 7548 if (update_bitrate_mask)
7549 arvif->bitrate_mask = *mask;
7550 arvif->vht_num_rates = vht_num_rates;
7551 arvif->vht_pfr = vht_pfr;
7378 ieee80211_iterate_stations_atomic(ar->hw, 7552 ieee80211_iterate_stations_atomic(ar->hw,
7379 ath10k_mac_set_bitrate_mask_iter, 7553 ath10k_mac_set_bitrate_mask_iter,
7380 arvif); 7554 arvif);
@@ -7877,7 +8051,8 @@ ath10k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
7877 arvif->vdev_id, ret); 8051 arvif->vdev_id, ret);
7878 } 8052 }
7879 8053
7880 if (ath10k_peer_stats_enabled(ar)) { 8054 if (ath10k_peer_stats_enabled(ar) &&
8055 ar->hw_params.tx_stats_over_pktlog) {
7881 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; 8056 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS;
7882 ret = ath10k_wmi_pdev_pktlog_enable(ar, 8057 ret = ath10k_wmi_pdev_pktlog_enable(ar,
7883 ar->pktlog_filter); 8058 ar->pktlog_filter);
@@ -8015,6 +8190,7 @@ static const struct ieee80211_ops ath10k_ops = {
8015 .set_key = ath10k_set_key, 8190 .set_key = ath10k_set_key,
8016 .set_default_unicast_key = ath10k_set_default_unicast_key, 8191 .set_default_unicast_key = ath10k_set_default_unicast_key,
8017 .sta_state = ath10k_sta_state, 8192 .sta_state = ath10k_sta_state,
8193 .sta_set_txpwr = ath10k_sta_set_txpwr,
8018 .conf_tx = ath10k_conf_tx, 8194 .conf_tx = ath10k_conf_tx,
8019 .remain_on_channel = ath10k_remain_on_channel, 8195 .remain_on_channel = ath10k_remain_on_channel,
8020 .cancel_remain_on_channel = ath10k_cancel_remain_on_channel, 8196 .cancel_remain_on_channel = ath10k_cancel_remain_on_channel,
@@ -8703,6 +8879,9 @@ int ath10k_mac_register(struct ath10k *ar)
8703 wiphy_ext_feature_set(ar->hw->wiphy, 8879 wiphy_ext_feature_set(ar->hw->wiphy,
8704 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); 8880 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
8705 8881
8882 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map))
8883 wiphy_ext_feature_set(ar->hw->wiphy,
8884 NL80211_EXT_FEATURE_STA_TX_PWR);
8706 /* 8885 /*
8707 * on LL hardware queues are managed entirely by the FW 8886 * on LL hardware queues are managed entirely by the FW
8708 * so we only advertise to mac we can do the queues thing 8887 * so we only advertise to mac we can do the queues thing
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 2bd6cbad19e4..a0b4d265c6eb 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -909,7 +909,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
909 /* Host buffer address in CE space */ 909 /* Host buffer address in CE space */
910 u32 ce_data; 910 u32 ce_data;
911 dma_addr_t ce_data_base = 0; 911 dma_addr_t ce_data_base = 0;
912 void *data_buf = NULL; 912 void *data_buf;
913 int i; 913 int i;
914 914
915 mutex_lock(&ar_pci->ce_diag_mutex); 915 mutex_lock(&ar_pci->ce_diag_mutex);
@@ -923,10 +923,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
923 */ 923 */
924 alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); 924 alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
925 925
926 data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, alloc_nbytes, 926 data_buf = dma_alloc_coherent(ar->dev, alloc_nbytes, &ce_data_base,
927 &ce_data_base, 927 GFP_ATOMIC);
928 GFP_ATOMIC);
929
930 if (!data_buf) { 928 if (!data_buf) {
931 ret = -ENOMEM; 929 ret = -ENOMEM;
932 goto done; 930 goto done;
@@ -1054,7 +1052,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1054 u32 *buf; 1052 u32 *buf;
1055 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes; 1053 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes;
1056 struct ath10k_ce_pipe *ce_diag; 1054 struct ath10k_ce_pipe *ce_diag;
1057 void *data_buf = NULL; 1055 void *data_buf;
1058 dma_addr_t ce_data_base = 0; 1056 dma_addr_t ce_data_base = 0;
1059 int i; 1057 int i;
1060 1058
@@ -1069,10 +1067,8 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1069 */ 1067 */
1070 alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); 1068 alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
1071 1069
1072 data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, 1070 data_buf = dma_alloc_coherent(ar->dev, alloc_nbytes, &ce_data_base,
1073 alloc_nbytes, 1071 GFP_ATOMIC);
1074 &ce_data_base,
1075 GFP_ATOMIC);
1076 if (!data_buf) { 1072 if (!data_buf) {
1077 ret = -ENOMEM; 1073 ret = -ENOMEM;
1078 goto done; 1074 goto done;
@@ -2059,6 +2055,11 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
2059 2055
2060 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); 2056 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n");
2061 2057
2058 ath10k_pci_irq_disable(ar);
2059 ath10k_pci_irq_sync(ar);
2060 napi_synchronize(&ar->napi);
2061 napi_disable(&ar->napi);
2062
2062 /* Most likely the device has HTT Rx ring configured. The only way to 2063 /* Most likely the device has HTT Rx ring configured. The only way to
2063 * prevent the device from accessing (and possible corrupting) host 2064 * prevent the device from accessing (and possible corrupting) host
2064 * memory is to reset the chip now. 2065 * memory is to reset the chip now.
@@ -2072,10 +2073,6 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
2072 */ 2073 */
2073 ath10k_pci_safe_chip_reset(ar); 2074 ath10k_pci_safe_chip_reset(ar);
2074 2075
2075 ath10k_pci_irq_disable(ar);
2076 ath10k_pci_irq_sync(ar);
2077 napi_synchronize(&ar->napi);
2078 napi_disable(&ar->napi);
2079 ath10k_pci_flush(ar); 2076 ath10k_pci_flush(ar);
2080 2077
2081 spin_lock_irqsave(&ar_pci->ps_lock, flags); 2078 spin_lock_irqsave(&ar_pci->ps_lock, flags);
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c
index 2e678780df5d..3b63b6257c43 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -620,6 +620,51 @@ out:
620 return ret; 620 return ret;
621} 621}
622 622
623int ath10k_qmi_set_fw_log_mode(struct ath10k *ar, u8 fw_log_mode)
624{
625 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
626 struct wlfw_ini_resp_msg_v01 resp = {};
627 struct ath10k_qmi *qmi = ar_snoc->qmi;
628 struct wlfw_ini_req_msg_v01 req = {};
629 struct qmi_txn txn;
630 int ret;
631
632 req.enablefwlog_valid = 1;
633 req.enablefwlog = fw_log_mode;
634
635 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei,
636 &resp);
637 if (ret < 0)
638 goto out;
639
640 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
641 QMI_WLFW_INI_REQ_V01,
642 WLFW_INI_REQ_MSG_V01_MAX_MSG_LEN,
643 wlfw_ini_req_msg_v01_ei, &req);
644 if (ret < 0) {
645 qmi_txn_cancel(&txn);
646 ath10k_err(ar, "fail to send fw log reqest: %d\n", ret);
647 goto out;
648 }
649
650 ret = qmi_txn_wait(&txn, ATH10K_QMI_TIMEOUT * HZ);
651 if (ret < 0)
652 goto out;
653
654 if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
655 ath10k_err(ar, "fw log request rejectedr: %d\n",
656 resp.resp.error);
657 ret = -EINVAL;
658 goto out;
659 }
660 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi fw log request completed, mode: %d\n",
661 fw_log_mode);
662 return 0;
663
664out:
665 return ret;
666}
667
623static int 668static int
624ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) 669ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi)
625{ 670{
@@ -1003,6 +1048,7 @@ int ath10k_qmi_deinit(struct ath10k *ar)
1003 qmi_handle_release(&qmi->qmi_hdl); 1048 qmi_handle_release(&qmi->qmi_hdl);
1004 cancel_work_sync(&qmi->event_work); 1049 cancel_work_sync(&qmi->event_work);
1005 destroy_workqueue(qmi->event_wq); 1050 destroy_workqueue(qmi->event_wq);
1051 kfree(qmi);
1006 ar_snoc->qmi = NULL; 1052 ar_snoc->qmi = NULL;
1007 1053
1008 return 0; 1054 return 0;
diff --git a/drivers/net/wireless/ath/ath10k/qmi.h b/drivers/net/wireless/ath/ath10k/qmi.h
index e4aa20445666..40aafb875ed0 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.h
+++ b/drivers/net/wireless/ath/ath10k/qmi.h
@@ -114,5 +114,6 @@ int ath10k_qmi_wlan_disable(struct ath10k *ar);
114int ath10k_qmi_register_service_notifier(struct notifier_block *nb); 114int ath10k_qmi_register_service_notifier(struct notifier_block *nb);
115int ath10k_qmi_init(struct ath10k *ar, u32 msa_size); 115int ath10k_qmi_init(struct ath10k *ar, u32 msa_size);
116int ath10k_qmi_deinit(struct ath10k *ar); 116int ath10k_qmi_deinit(struct ath10k *ar);
117int ath10k_qmi_set_fw_log_mode(struct ath10k *ar, u8 fw_log_mode);
117 118
118#endif /* ATH10K_QMI_H */ 119#endif /* ATH10K_QMI_H */
diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
index 9bbd5b54b8ca..8ed4fbd8d6c3 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -607,6 +607,10 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar,
607 full_len, 607 full_len,
608 last_in_bundle, 608 last_in_bundle,
609 last_in_bundle); 609 last_in_bundle);
610 if (ret) {
611 ath10k_warn(ar, "alloc_rx_pkt error %d\n", ret);
612 goto err;
613 }
610 } 614 }
611 615
612 ar_sdio->n_rx_pkts = i; 616 ar_sdio->n_rx_pkts = i;
@@ -855,6 +859,10 @@ static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar)
855 859
856out: 860out:
857 mutex_unlock(&irq_data->mtx); 861 mutex_unlock(&irq_data->mtx);
862 if (cpu_int_status & MBOX_CPU_STATUS_ENABLE_ASSERT_MASK) {
863 ath10k_err(ar, "firmware crashed!\n");
864 queue_work(ar->workqueue, &ar->restart_work);
865 }
858 return ret; 866 return ret;
859} 867}
860 868
@@ -1500,8 +1508,10 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar)
1500 regs->int_status_en |= 1508 regs->int_status_en |=
1501 FIELD_PREP(MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK, 1); 1509 FIELD_PREP(MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK, 1);
1502 1510
1503 /* Set up the CPU Interrupt status Register */ 1511 /* Set up the CPU Interrupt Status Register, enable CPU sourced interrupt #0
1504 regs->cpu_int_status_en = 0; 1512 * #0 is used for report assertion from target
1513 */
1514 regs->cpu_int_status_en = FIELD_PREP(MBOX_CPU_STATUS_ENABLE_ASSERT_MASK, 1);
1505 1515
1506 /* Set up the Error Interrupt status Register */ 1516 /* Set up the Error Interrupt status Register */
1507 regs->err_int_status_en = 1517 regs->err_int_status_en =
@@ -2087,6 +2097,9 @@ static void ath10k_sdio_remove(struct sdio_func *func)
2087 2097
2088 ath10k_core_unregister(ar); 2098 ath10k_core_unregister(ar);
2089 ath10k_core_destroy(ar); 2099 ath10k_core_destroy(ar);
2100
2101 flush_workqueue(ar_sdio->workqueue);
2102 destroy_workqueue(ar_sdio->workqueue);
2090} 2103}
2091 2104
2092static const struct sdio_device_id ath10k_sdio_devices[] = { 2105static const struct sdio_device_id ath10k_sdio_devices[] = {
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index ca1186ec4129..b491361e6ed4 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1050,6 +1050,19 @@ err_wlan_enable:
1050 return ret; 1050 return ret;
1051} 1051}
1052 1052
1053static int ath10k_snoc_hif_set_target_log_mode(struct ath10k *ar,
1054 u8 fw_log_mode)
1055{
1056 u8 fw_dbg_mode;
1057
1058 if (fw_log_mode)
1059 fw_dbg_mode = ATH10K_ENABLE_FW_LOG_CE;
1060 else
1061 fw_dbg_mode = ATH10K_ENABLE_FW_LOG_DIAG;
1062
1063 return ath10k_qmi_set_fw_log_mode(ar, fw_dbg_mode);
1064}
1065
1053#ifdef CONFIG_PM 1066#ifdef CONFIG_PM
1054static int ath10k_snoc_hif_suspend(struct ath10k *ar) 1067static int ath10k_snoc_hif_suspend(struct ath10k *ar)
1055{ 1068{
@@ -1103,6 +1116,8 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
1103 .send_complete_check = ath10k_snoc_hif_send_complete_check, 1116 .send_complete_check = ath10k_snoc_hif_send_complete_check,
1104 .get_free_queue_number = ath10k_snoc_hif_get_free_queue_number, 1117 .get_free_queue_number = ath10k_snoc_hif_get_free_queue_number,
1105 .get_target_info = ath10k_snoc_hif_get_target_info, 1118 .get_target_info = ath10k_snoc_hif_get_target_info,
1119 .set_target_log_mode = ath10k_snoc_hif_set_target_log_mode,
1120
1106#ifdef CONFIG_PM 1121#ifdef CONFIG_PM
1107 .suspend = ath10k_snoc_hif_suspend, 1122 .suspend = ath10k_snoc_hif_suspend,
1108 .resume = ath10k_snoc_hif_resume, 1123 .resume = ath10k_snoc_hif_resume,
diff --git a/drivers/net/wireless/ath/ath10k/swap.c b/drivers/net/wireless/ath/ath10k/swap.c
index 4dddeee684b4..7198a386f2fb 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -106,10 +106,8 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t swap_bin_len)
106 106
107 virt_addr = dma_alloc_coherent(ar->dev, swap_bin_len, &paddr, 107 virt_addr = dma_alloc_coherent(ar->dev, swap_bin_len, &paddr,
108 GFP_KERNEL); 108 GFP_KERNEL);
109 if (!virt_addr) { 109 if (!virt_addr)
110 ath10k_err(ar, "failed to allocate dma coherent memory\n");
111 return NULL; 110 return NULL;
112 }
113 111
114 seg_info->seg_hw_info.bus_addr[0] = __cpu_to_le32(paddr); 112 seg_info->seg_hw_info.bus_addr[0] = __cpu_to_le32(paddr);
115 seg_info->seg_hw_info.size = __cpu_to_le32(swap_bin_len); 113 seg_info->seg_hw_info.size = __cpu_to_le32(swap_bin_len);
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c b/drivers/net/wireless/ath/ath10k/testmode.c
index a29cfb9c72c2..1bffe3fbea3f 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -174,8 +174,23 @@ static int ath10k_tm_fetch_firmware(struct ath10k *ar)
174{ 174{
175 struct ath10k_fw_components *utf_mode_fw; 175 struct ath10k_fw_components *utf_mode_fw;
176 int ret; 176 int ret;
177 char fw_name[100];
178 int fw_api2 = 2;
179
180 switch (ar->hif.bus) {
181 case ATH10K_BUS_SDIO:
182 case ATH10K_BUS_USB:
183 scnprintf(fw_name, sizeof(fw_name), "%s-%s-%d.bin",
184 ATH10K_FW_UTF_FILE_BASE, ath10k_bus_str(ar->hif.bus),
185 fw_api2);
186 break;
187 default:
188 scnprintf(fw_name, sizeof(fw_name), "%s-%d.bin",
189 ATH10K_FW_UTF_FILE_BASE, fw_api2);
190 break;
191 }
177 192
178 ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_UTF_API2_FILE, 193 ret = ath10k_core_fetch_firmware_api_n(ar, fw_name,
179 &ar->testmode.utf_mode_fw.fw_file); 194 &ar->testmode.utf_mode_fw.fw_file);
180 if (ret == 0) { 195 if (ret == 0) {
181 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode using fw utf api 2"); 196 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode using fw utf api 2");
diff --git a/drivers/net/wireless/ath/ath10k/trace.c b/drivers/net/wireless/ath/ath10k/trace.c
index 3ecdff17f64e..c7d4c97e6079 100644
--- a/drivers/net/wireless/ath/ath10k/trace.c
+++ b/drivers/net/wireless/ath/ath10k/trace.c
@@ -7,3 +7,4 @@
7 7
8#define CREATE_TRACE_POINTS 8#define CREATE_TRACE_POINTS
9#include "trace.h" 9#include "trace.h"
10EXPORT_SYMBOL(__tracepoint_ath10k_log_dbg);
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index ba977bbe6291..ab916459d237 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -29,7 +29,11 @@ static inline u32 ath10k_frm_hdr_len(const void *buf, size_t len)
29#if !defined(CONFIG_ATH10K_TRACING) 29#if !defined(CONFIG_ATH10K_TRACING)
30#undef TRACE_EVENT 30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, ...) \ 31#define TRACE_EVENT(name, proto, ...) \
32static inline void trace_ ## name(proto) {} 32static inline void trace_ ## name(proto) {} \
33static inline bool trace_##name##_enabled(void) \
34{ \
35 return false; \
36}
33#undef DECLARE_EVENT_CLASS 37#undef DECLARE_EVENT_CLASS
34#define DECLARE_EVENT_CLASS(...) 38#define DECLARE_EVENT_CLASS(...)
35#undef DEFINE_EVENT 39#undef DEFINE_EVENT
diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c
index 2fb0fb40e86d..e1420f67f776 100644
--- a/drivers/net/wireless/ath/ath10k/usb.c
+++ b/drivers/net/wireless/ath/ath10k/usb.c
@@ -1016,7 +1016,7 @@ static int ath10k_usb_probe(struct usb_interface *interface,
1016 } 1016 }
1017 1017
1018 /* TODO: remove this once USB support is fully implemented */ 1018 /* TODO: remove this once USB support is fully implemented */
1019 ath10k_warn(ar, "WARNING: ath10k USB support is incomplete, don't expect anything to work!\n"); 1019 ath10k_warn(ar, "Warning: ath10k USB support is incomplete, don't expect anything to work!\n");
1020 1020
1021 return 0; 1021 return 0;
1022 1022
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 34e187486c63..2985bb17decd 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
6 */ 6 */
7#include "core.h" 7#include "core.h"
8#include "debug.h" 8#include "debug.h"
@@ -212,6 +212,13 @@ static int ath10k_wmi_tlv_event_bcn_tx_status(struct ath10k *ar,
212 return 0; 212 return 0;
213} 213}
214 214
215static void ath10k_wmi_tlv_event_vdev_delete_resp(struct ath10k *ar,
216 struct sk_buff *skb)
217{
218 ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_DELETE_RESP_EVENTID\n");
219 complete(&ar->vdev_delete_done);
220}
221
215static int ath10k_wmi_tlv_event_diag_data(struct ath10k *ar, 222static int ath10k_wmi_tlv_event_diag_data(struct ath10k *ar,
216 struct sk_buff *skb) 223 struct sk_buff *skb)
217{ 224{
@@ -458,6 +465,24 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)
458 kfree(tb); 465 kfree(tb);
459} 466}
460 467
468static int ath10k_wmi_tlv_event_peer_delete_resp(struct ath10k *ar,
469 struct sk_buff *skb)
470{
471 struct wmi_peer_delete_resp_ev_arg *arg;
472 struct wmi_tlv *tlv_hdr;
473
474 tlv_hdr = (struct wmi_tlv *)skb->data;
475 arg = (struct wmi_peer_delete_resp_ev_arg *)tlv_hdr->value;
476
477 ath10k_dbg(ar, ATH10K_DBG_WMI, "vdev id %d", arg->vdev_id);
478 ath10k_dbg(ar, ATH10K_DBG_WMI, "peer mac addr %pM", &arg->peer_addr);
479 ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer delete response\n");
480
481 complete(&ar->peer_delete_done);
482
483 return 0;
484}
485
461/***********/ 486/***********/
462/* TLV ops */ 487/* TLV ops */
463/***********/ 488/***********/
@@ -514,6 +539,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
514 case WMI_TLV_VDEV_STOPPED_EVENTID: 539 case WMI_TLV_VDEV_STOPPED_EVENTID:
515 ath10k_wmi_event_vdev_stopped(ar, skb); 540 ath10k_wmi_event_vdev_stopped(ar, skb);
516 break; 541 break;
542 case WMI_TLV_VDEV_DELETE_RESP_EVENTID:
543 ath10k_wmi_tlv_event_vdev_delete_resp(ar, skb);
544 break;
517 case WMI_TLV_PEER_STA_KICKOUT_EVENTID: 545 case WMI_TLV_PEER_STA_KICKOUT_EVENTID:
518 ath10k_wmi_event_peer_sta_kickout(ar, skb); 546 ath10k_wmi_event_peer_sta_kickout(ar, skb);
519 break; 547 break;
@@ -607,6 +635,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
607 case WMI_TLV_TDLS_PEER_EVENTID: 635 case WMI_TLV_TDLS_PEER_EVENTID:
608 ath10k_wmi_event_tdls_peer(ar, skb); 636 ath10k_wmi_event_tdls_peer(ar, skb);
609 break; 637 break;
638 case WMI_TLV_PEER_DELETE_RESP_EVENTID:
639 ath10k_wmi_tlv_event_peer_delete_resp(ar, skb);
640 break;
610 case WMI_TLV_MGMT_TX_COMPLETION_EVENTID: 641 case WMI_TLV_MGMT_TX_COMPLETION_EVENTID:
611 ath10k_wmi_event_mgmt_tx_compl(ar, skb); 642 ath10k_wmi_event_mgmt_tx_compl(ar, skb);
612 break; 643 break;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index bc3198b08844..d691f06e58f2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
6 */ 6 */
7#ifndef _WMI_TLV_H 7#ifndef _WMI_TLV_H
8#define _WMI_TLV_H 8#define _WMI_TLV_H
@@ -301,11 +301,15 @@ enum wmi_tlv_event_id {
301 WMI_TLV_VDEV_STOPPED_EVENTID, 301 WMI_TLV_VDEV_STOPPED_EVENTID,
302 WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID, 302 WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID,
303 WMI_TLV_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID, 303 WMI_TLV_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID,
304 WMI_TLV_VDEV_TSF_REPORT_EVENTID,
305 WMI_TLV_VDEV_DELETE_RESP_EVENTID,
304 WMI_TLV_PEER_STA_KICKOUT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_PEER), 306 WMI_TLV_PEER_STA_KICKOUT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_PEER),
305 WMI_TLV_PEER_INFO_EVENTID, 307 WMI_TLV_PEER_INFO_EVENTID,
306 WMI_TLV_PEER_TX_FAIL_CNT_THR_EVENTID, 308 WMI_TLV_PEER_TX_FAIL_CNT_THR_EVENTID,
307 WMI_TLV_PEER_ESTIMATED_LINKSPEED_EVENTID, 309 WMI_TLV_PEER_ESTIMATED_LINKSPEED_EVENTID,
308 WMI_TLV_PEER_STATE_EVENTID, 310 WMI_TLV_PEER_STATE_EVENTID,
311 WMI_TLV_PEER_ASSOC_CONF_EVENTID,
312 WMI_TLV_PEER_DELETE_RESP_EVENTID,
309 WMI_TLV_MGMT_RX_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_MGMT), 313 WMI_TLV_MGMT_RX_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_MGMT),
310 WMI_TLV_HOST_SWBA_EVENTID, 314 WMI_TLV_HOST_SWBA_EVENTID,
311 WMI_TLV_TBTTOFFSET_UPDATE_EVENTID, 315 WMI_TLV_TBTTOFFSET_UPDATE_EVENTID,
@@ -1569,6 +1573,8 @@ wmi_tlv_svc_map(const __le32 *in, unsigned long *out, size_t len)
1569 WMI_SERVICE_MGMT_TX_WMI, len); 1573 WMI_SERVICE_MGMT_TX_WMI, len);
1570 SVCMAP(WMI_TLV_SERVICE_MESH_11S, 1574 SVCMAP(WMI_TLV_SERVICE_MESH_11S,
1571 WMI_SERVICE_MESH_11S, len); 1575 WMI_SERVICE_MESH_11S, len);
1576 SVCMAP(WMI_TLV_SERVICE_SYNC_DELETE_CMDS,
1577 WMI_SERVICE_SYNC_DELETE_CMDS, len);
1572} 1578}
1573 1579
1574static inline void 1580static inline void
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 12f57f9adbba..838768c98adc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
6 */ 6 */
7 7
8#ifndef _WMI_H_ 8#ifndef _WMI_H_
@@ -200,6 +200,8 @@ enum wmi_service {
200 WMI_SERVICE_RTT_RESPONDER_ROLE, 200 WMI_SERVICE_RTT_RESPONDER_ROLE,
201 WMI_SERVICE_PER_PACKET_SW_ENCRYPT, 201 WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
202 WMI_SERVICE_REPORT_AIRTIME, 202 WMI_SERVICE_REPORT_AIRTIME,
203 WMI_SERVICE_SYNC_DELETE_CMDS,
204 WMI_SERVICE_TX_PWR_PER_PEER,
203 205
204 /* Remember to add the new value to wmi_service_name()! */ 206 /* Remember to add the new value to wmi_service_name()! */
205 207
@@ -367,6 +369,7 @@ enum wmi_10_4_service {
367 WMI_10_4_SERVICE_RTT_RESPONDER_ROLE, 369 WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
368 WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT, 370 WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
369 WMI_10_4_SERVICE_REPORT_AIRTIME, 371 WMI_10_4_SERVICE_REPORT_AIRTIME,
372 WMI_10_4_SERVICE_TX_PWR_PER_PEER,
370}; 373};
371 374
372static inline char *wmi_service_name(enum wmi_service service_id) 375static inline char *wmi_service_name(enum wmi_service service_id)
@@ -491,6 +494,8 @@ static inline char *wmi_service_name(enum wmi_service service_id)
491 SVCSTR(WMI_SERVICE_RTT_RESPONDER_ROLE); 494 SVCSTR(WMI_SERVICE_RTT_RESPONDER_ROLE);
492 SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT); 495 SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
493 SVCSTR(WMI_SERVICE_REPORT_AIRTIME); 496 SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
497 SVCSTR(WMI_SERVICE_SYNC_DELETE_CMDS);
498 SVCSTR(WMI_SERVICE_TX_PWR_PER_PEER);
494 499
495 case WMI_SERVICE_MAX: 500 case WMI_SERVICE_MAX:
496 return NULL; 501 return NULL;
@@ -818,6 +823,8 @@ static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
818 WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len); 823 WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len);
819 SVCMAP(WMI_10_4_SERVICE_REPORT_AIRTIME, 824 SVCMAP(WMI_10_4_SERVICE_REPORT_AIRTIME,
820 WMI_SERVICE_REPORT_AIRTIME, len); 825 WMI_SERVICE_REPORT_AIRTIME, len);
826 SVCMAP(WMI_10_4_SERVICE_TX_PWR_PER_PEER,
827 WMI_SERVICE_TX_PWR_PER_PEER, len);
821} 828}
822 829
823#undef SVCMAP 830#undef SVCMAP
@@ -6260,6 +6267,8 @@ enum wmi_peer_param {
6260 WMI_PEER_CHAN_WIDTH = 0x4, 6267 WMI_PEER_CHAN_WIDTH = 0x4,
6261 WMI_PEER_NSS = 0x5, 6268 WMI_PEER_NSS = 0x5,
6262 WMI_PEER_USE_4ADDR = 0x6, 6269 WMI_PEER_USE_4ADDR = 0x6,
6270 WMI_PEER_USE_FIXED_PWR = 0x8,
6271 WMI_PEER_PARAM_FIXED_RATE = 0x9,
6263 WMI_PEER_DEBUG = 0xa, 6272 WMI_PEER_DEBUG = 0xa,
6264 WMI_PEER_PHYMODE = 0xd, 6273 WMI_PEER_PHYMODE = 0xd,
6265 WMI_PEER_DUMMY_VAR = 0xff, /* dummy parameter for STA PS workaround */ 6274 WMI_PEER_DUMMY_VAR = 0xff, /* dummy parameter for STA PS workaround */
@@ -6757,6 +6766,11 @@ struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg {
6757 const __le32 *ack_rssi; 6766 const __le32 *ack_rssi;
6758}; 6767};
6759 6768
6769struct wmi_peer_delete_resp_ev_arg {
6770 __le32 vdev_id;
6771 struct wmi_mac_addr peer_addr;
6772};
6773
6760struct wmi_mgmt_rx_ev_arg { 6774struct wmi_mgmt_rx_ev_arg {
6761 __le32 channel; 6775 __le32 channel;
6762 __le32 snr; 6776 __le32 snr;
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 4e97f7f3b2a3..06e660858766 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -815,6 +815,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
815 struct ath_common *common = ath9k_hw_common(ah); 815 struct ath_common *common = ath9k_hw_common(ah);
816 struct ieee80211_hdr *hdr; 816 struct ieee80211_hdr *hdr;
817 bool discard_current = sc->rx.discard_next; 817 bool discard_current = sc->rx.discard_next;
818 bool is_phyerr;
818 819
819 /* 820 /*
820 * Discard corrupt descriptors which are marked in 821 * Discard corrupt descriptors which are marked in
@@ -827,8 +828,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
827 828
828 /* 829 /*
829 * Discard zero-length packets and packets smaller than an ACK 830 * Discard zero-length packets and packets smaller than an ACK
831 * which are not PHY_ERROR (short radar pulses have a length of 3)
830 */ 832 */
831 if (rx_stats->rs_datalen < 10) { 833 is_phyerr = rx_stats->rs_status & ATH9K_RXERR_PHY;
834 if (!rx_stats->rs_datalen ||
835 (rx_stats->rs_datalen < 10 && !is_phyerr)) {
832 RX_STAT_INC(sc, rx_len_err); 836 RX_STAT_INC(sc, rx_len_err);
833 goto corrupt; 837 goto corrupt;
834 } 838 }
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 7f1bdea742b8..40a8054f8aa6 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1387,13 +1387,8 @@ static int carl9170_op_conf_tx(struct ieee80211_hw *hw,
1387 int ret; 1387 int ret;
1388 1388
1389 mutex_lock(&ar->mutex); 1389 mutex_lock(&ar->mutex);
1390 if (queue < ar->hw->queues) { 1390 memcpy(&ar->edcf[ar9170_qmap[queue]], param, sizeof(*param));
1391 memcpy(&ar->edcf[ar9170_qmap[queue]], param, sizeof(*param)); 1391 ret = carl9170_set_qos(ar);
1392 ret = carl9170_set_qos(ar);
1393 } else {
1394 ret = -EINVAL;
1395 }
1396
1397 mutex_unlock(&ar->mutex); 1392 mutex_unlock(&ar->mutex);
1398 return ret; 1393 return ret;
1399} 1394}
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index e7c3f3b8457d..99f1897a775d 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -128,6 +128,8 @@ static const struct usb_device_id carl9170_usb_ids[] = {
128}; 128};
129MODULE_DEVICE_TABLE(usb, carl9170_usb_ids); 129MODULE_DEVICE_TABLE(usb, carl9170_usb_ids);
130 130
131static struct usb_driver carl9170_driver;
132
131static void carl9170_usb_submit_data_urb(struct ar9170 *ar) 133static void carl9170_usb_submit_data_urb(struct ar9170 *ar)
132{ 134{
133 struct urb *urb; 135 struct urb *urb;
@@ -966,32 +968,28 @@ err_out:
966 968
967static void carl9170_usb_firmware_failed(struct ar9170 *ar) 969static void carl9170_usb_firmware_failed(struct ar9170 *ar)
968{ 970{
969 struct device *parent = ar->udev->dev.parent; 971 /* Store a copies of the usb_interface and usb_device pointer locally.
970 struct usb_device *udev; 972 * This is because release_driver initiates carl9170_usb_disconnect,
971 973 * which in turn frees our driver context (ar).
972 /*
973 * Store a copy of the usb_device pointer locally.
974 * This is because device_release_driver initiates
975 * carl9170_usb_disconnect, which in turn frees our
976 * driver context (ar).
977 */ 974 */
978 udev = ar->udev; 975 struct usb_interface *intf = ar->intf;
976 struct usb_device *udev = ar->udev;
979 977
980 complete(&ar->fw_load_wait); 978 complete(&ar->fw_load_wait);
979 /* at this point 'ar' could be already freed. Don't use it anymore */
980 ar = NULL;
981 981
982 /* unbind anything failed */ 982 /* unbind anything failed */
983 if (parent) 983 usb_lock_device(udev);
984 device_lock(parent); 984 usb_driver_release_interface(&carl9170_driver, intf);
985 985 usb_unlock_device(udev);
986 device_release_driver(&udev->dev);
987 if (parent)
988 device_unlock(parent);
989 986
990 usb_put_dev(udev); 987 usb_put_intf(intf);
991} 988}
992 989
993static void carl9170_usb_firmware_finish(struct ar9170 *ar) 990static void carl9170_usb_firmware_finish(struct ar9170 *ar)
994{ 991{
992 struct usb_interface *intf = ar->intf;
995 int err; 993 int err;
996 994
997 err = carl9170_parse_firmware(ar); 995 err = carl9170_parse_firmware(ar);
@@ -1009,7 +1007,7 @@ static void carl9170_usb_firmware_finish(struct ar9170 *ar)
1009 goto err_unrx; 1007 goto err_unrx;
1010 1008
1011 complete(&ar->fw_load_wait); 1009 complete(&ar->fw_load_wait);
1012 usb_put_dev(ar->udev); 1010 usb_put_intf(intf);
1013 return; 1011 return;
1014 1012
1015err_unrx: 1013err_unrx:
@@ -1052,7 +1050,6 @@ static int carl9170_usb_probe(struct usb_interface *intf,
1052 return PTR_ERR(ar); 1050 return PTR_ERR(ar);
1053 1051
1054 udev = interface_to_usbdev(intf); 1052 udev = interface_to_usbdev(intf);
1055 usb_get_dev(udev);
1056 ar->udev = udev; 1053 ar->udev = udev;
1057 ar->intf = intf; 1054 ar->intf = intf;
1058 ar->features = id->driver_info; 1055 ar->features = id->driver_info;
@@ -1094,15 +1091,14 @@ static int carl9170_usb_probe(struct usb_interface *intf,
1094 atomic_set(&ar->rx_anch_urbs, 0); 1091 atomic_set(&ar->rx_anch_urbs, 0);
1095 atomic_set(&ar->rx_pool_urbs, 0); 1092 atomic_set(&ar->rx_pool_urbs, 0);
1096 1093
1097 usb_get_dev(ar->udev); 1094 usb_get_intf(intf);
1098 1095
1099 carl9170_set_state(ar, CARL9170_STOPPED); 1096 carl9170_set_state(ar, CARL9170_STOPPED);
1100 1097
1101 err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, 1098 err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME,
1102 &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); 1099 &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2);
1103 if (err) { 1100 if (err) {
1104 usb_put_dev(udev); 1101 usb_put_intf(intf);
1105 usb_put_dev(udev);
1106 carl9170_free(ar); 1102 carl9170_free(ar);
1107 } 1103 }
1108 return err; 1104 return err;
@@ -1131,7 +1127,6 @@ static void carl9170_usb_disconnect(struct usb_interface *intf)
1131 1127
1132 carl9170_release_firmware(ar); 1128 carl9170_release_firmware(ar);
1133 carl9170_free(ar); 1129 carl9170_free(ar);
1134 usb_put_dev(udev);
1135} 1130}
1136 1131
1137#ifdef CONFIG_PM 1132#ifdef CONFIG_PM
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index ca77d7a48f5d..d436cc51dfd1 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -314,7 +314,8 @@ int wil_cid_fill_sinfo(struct wil6210_vif *vif, int cid,
314 memset(&reply, 0, sizeof(reply)); 314 memset(&reply, 0, sizeof(reply));
315 315
316 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid, &cmd, sizeof(cmd), 316 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid, &cmd, sizeof(cmd),
317 WMI_NOTIFY_REQ_DONE_EVENTID, &reply, sizeof(reply), 20); 317 WMI_NOTIFY_REQ_DONE_EVENTID, &reply, sizeof(reply),
318 WIL_WMI_CALL_GENERAL_TO_MS);
318 if (rc) 319 if (rc)
319 return rc; 320 return rc;
320 321
@@ -380,8 +381,8 @@ static int wil_cfg80211_get_station(struct wiphy *wiphy,
380 381
381 wil_dbg_misc(wil, "get_station: %pM CID %d MID %d\n", mac, cid, 382 wil_dbg_misc(wil, "get_station: %pM CID %d MID %d\n", mac, cid,
382 vif->mid); 383 vif->mid);
383 if (cid < 0) 384 if (!wil_cid_valid(wil, cid))
384 return cid; 385 return -ENOENT;
385 386
386 rc = wil_cid_fill_sinfo(vif, cid, sinfo); 387 rc = wil_cid_fill_sinfo(vif, cid, sinfo);
387 388
@@ -417,7 +418,7 @@ static int wil_cfg80211_dump_station(struct wiphy *wiphy,
417 int rc; 418 int rc;
418 int cid = wil_find_cid_by_idx(wil, vif->mid, idx); 419 int cid = wil_find_cid_by_idx(wil, vif->mid, idx);
419 420
420 if (cid < 0) 421 if (!wil_cid_valid(wil, cid))
421 return -ENOENT; 422 return -ENOENT;
422 423
423 ether_addr_copy(mac, wil->sta[cid].addr); 424 ether_addr_copy(mac, wil->sta[cid].addr);
@@ -643,6 +644,16 @@ out:
643 return rc; 644 return rc;
644} 645}
645 646
647static bool wil_is_safe_switch(enum nl80211_iftype from,
648 enum nl80211_iftype to)
649{
650 if (from == NL80211_IFTYPE_STATION &&
651 to == NL80211_IFTYPE_P2P_CLIENT)
652 return true;
653
654 return false;
655}
656
646static int wil_cfg80211_change_iface(struct wiphy *wiphy, 657static int wil_cfg80211_change_iface(struct wiphy *wiphy,
647 struct net_device *ndev, 658 struct net_device *ndev,
648 enum nl80211_iftype type, 659 enum nl80211_iftype type,
@@ -668,7 +679,8 @@ static int wil_cfg80211_change_iface(struct wiphy *wiphy,
668 * because it can cause significant disruption 679 * because it can cause significant disruption
669 */ 680 */
670 if (!wil_has_other_active_ifaces(wil, ndev, true, false) && 681 if (!wil_has_other_active_ifaces(wil, ndev, true, false) &&
671 netif_running(ndev) && !wil_is_recovery_blocked(wil)) { 682 netif_running(ndev) && !wil_is_recovery_blocked(wil) &&
683 !wil_is_safe_switch(wdev->iftype, type)) {
672 wil_dbg_misc(wil, "interface is up. resetting...\n"); 684 wil_dbg_misc(wil, "interface is up. resetting...\n");
673 mutex_lock(&wil->mutex); 685 mutex_lock(&wil->mutex);
674 __wil_down(wil); 686 __wil_down(wil);
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 7a2c3fdeca8c..74834131cf7c 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -422,25 +422,18 @@ static int wil_debugfs_iomem_x32_get(void *data, u64 *val)
422DEFINE_DEBUGFS_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get, 422DEFINE_DEBUGFS_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get,
423 wil_debugfs_iomem_x32_set, "0x%08llx\n"); 423 wil_debugfs_iomem_x32_set, "0x%08llx\n");
424 424
425static struct dentry *wil_debugfs_create_iomem_x32(const char *name, 425static void wil_debugfs_create_iomem_x32(const char *name, umode_t mode,
426 umode_t mode, 426 struct dentry *parent, void *value,
427 struct dentry *parent, 427 struct wil6210_priv *wil)
428 void *value,
429 struct wil6210_priv *wil)
430{ 428{
431 struct dentry *file;
432 struct wil_debugfs_iomem_data *data = &wil->dbg_data.data_arr[ 429 struct wil_debugfs_iomem_data *data = &wil->dbg_data.data_arr[
433 wil->dbg_data.iomem_data_count]; 430 wil->dbg_data.iomem_data_count];
434 431
435 data->wil = wil; 432 data->wil = wil;
436 data->offset = value; 433 data->offset = value;
437 434
438 file = debugfs_create_file_unsafe(name, mode, parent, data, 435 debugfs_create_file_unsafe(name, mode, parent, data, &fops_iomem_x32);
439 &fops_iomem_x32); 436 wil->dbg_data.iomem_data_count++;
440 if (!IS_ERR_OR_NULL(file))
441 wil->dbg_data.iomem_data_count++;
442
443 return file;
444} 437}
445 438
446static int wil_debugfs_ulong_set(void *data, u64 val) 439static int wil_debugfs_ulong_set(void *data, u64 val)
@@ -458,14 +451,6 @@ static int wil_debugfs_ulong_get(void *data, u64 *val)
458DEFINE_DEBUGFS_ATTRIBUTE(wil_fops_ulong, wil_debugfs_ulong_get, 451DEFINE_DEBUGFS_ATTRIBUTE(wil_fops_ulong, wil_debugfs_ulong_get,
459 wil_debugfs_ulong_set, "0x%llx\n"); 452 wil_debugfs_ulong_set, "0x%llx\n");
460 453
461static struct dentry *wil_debugfs_create_ulong(const char *name, umode_t mode,
462 struct dentry *parent,
463 ulong *value)
464{
465 return debugfs_create_file_unsafe(name, mode, parent, value,
466 &wil_fops_ulong);
467}
468
469/** 454/**
470 * wil6210_debugfs_init_offset - create set of debugfs files 455 * wil6210_debugfs_init_offset - create set of debugfs files
471 * @wil - driver's context, used for printing 456 * @wil - driver's context, used for printing
@@ -482,37 +467,30 @@ static void wil6210_debugfs_init_offset(struct wil6210_priv *wil,
482 int i; 467 int i;
483 468
484 for (i = 0; tbl[i].name; i++) { 469 for (i = 0; tbl[i].name; i++) {
485 struct dentry *f;
486
487 switch (tbl[i].type) { 470 switch (tbl[i].type) {
488 case doff_u32: 471 case doff_u32:
489 f = debugfs_create_u32(tbl[i].name, tbl[i].mode, dbg, 472 debugfs_create_u32(tbl[i].name, tbl[i].mode, dbg,
490 base + tbl[i].off); 473 base + tbl[i].off);
491 break; 474 break;
492 case doff_x32: 475 case doff_x32:
493 f = debugfs_create_x32(tbl[i].name, tbl[i].mode, dbg, 476 debugfs_create_x32(tbl[i].name, tbl[i].mode, dbg,
494 base + tbl[i].off); 477 base + tbl[i].off);
495 break; 478 break;
496 case doff_ulong: 479 case doff_ulong:
497 f = wil_debugfs_create_ulong(tbl[i].name, tbl[i].mode, 480 debugfs_create_file_unsafe(tbl[i].name, tbl[i].mode,
498 dbg, base + tbl[i].off); 481 dbg, base + tbl[i].off,
482 &wil_fops_ulong);
499 break; 483 break;
500 case doff_io32: 484 case doff_io32:
501 f = wil_debugfs_create_iomem_x32(tbl[i].name, 485 wil_debugfs_create_iomem_x32(tbl[i].name, tbl[i].mode,
502 tbl[i].mode, dbg, 486 dbg, base + tbl[i].off,
503 base + tbl[i].off, 487 wil);
504 wil);
505 break; 488 break;
506 case doff_u8: 489 case doff_u8:
507 f = debugfs_create_u8(tbl[i].name, tbl[i].mode, dbg, 490 debugfs_create_u8(tbl[i].name, tbl[i].mode, dbg,
508 base + tbl[i].off); 491 base + tbl[i].off);
509 break; 492 break;
510 default:
511 f = ERR_PTR(-EINVAL);
512 } 493 }
513 if (IS_ERR_OR_NULL(f))
514 wil_err(wil, "Create file \"%s\": err %ld\n",
515 tbl[i].name, PTR_ERR(f));
516 } 494 }
517} 495}
518 496
@@ -527,19 +505,14 @@ static const struct dbg_off isr_off[] = {
527 {}, 505 {},
528}; 506};
529 507
530static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil, 508static void wil6210_debugfs_create_ISR(struct wil6210_priv *wil,
531 const char *name, 509 const char *name, struct dentry *parent,
532 struct dentry *parent, u32 off) 510 u32 off)
533{ 511{
534 struct dentry *d = debugfs_create_dir(name, parent); 512 struct dentry *d = debugfs_create_dir(name, parent);
535 513
536 if (IS_ERR_OR_NULL(d))
537 return -ENODEV;
538
539 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr + off, 514 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr + off,
540 isr_off); 515 isr_off);
541
542 return 0;
543} 516}
544 517
545static const struct dbg_off pseudo_isr_off[] = { 518static const struct dbg_off pseudo_isr_off[] = {
@@ -549,18 +522,13 @@ static const struct dbg_off pseudo_isr_off[] = {
549 {}, 522 {},
550}; 523};
551 524
552static int wil6210_debugfs_create_pseudo_ISR(struct wil6210_priv *wil, 525static void wil6210_debugfs_create_pseudo_ISR(struct wil6210_priv *wil,
553 struct dentry *parent) 526 struct dentry *parent)
554{ 527{
555 struct dentry *d = debugfs_create_dir("PSEUDO_ISR", parent); 528 struct dentry *d = debugfs_create_dir("PSEUDO_ISR", parent);
556 529
557 if (IS_ERR_OR_NULL(d))
558 return -ENODEV;
559
560 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr, 530 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr,
561 pseudo_isr_off); 531 pseudo_isr_off);
562
563 return 0;
564} 532}
565 533
566static const struct dbg_off lgc_itr_cnt_off[] = { 534static const struct dbg_off lgc_itr_cnt_off[] = {
@@ -608,13 +576,9 @@ static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil,
608 struct dentry *d, *dtx, *drx; 576 struct dentry *d, *dtx, *drx;
609 577
610 d = debugfs_create_dir("ITR_CNT", parent); 578 d = debugfs_create_dir("ITR_CNT", parent);
611 if (IS_ERR_OR_NULL(d))
612 return -ENODEV;
613 579
614 dtx = debugfs_create_dir("TX", d); 580 dtx = debugfs_create_dir("TX", d);
615 drx = debugfs_create_dir("RX", d); 581 drx = debugfs_create_dir("RX", d);
616 if (IS_ERR_OR_NULL(dtx) || IS_ERR_OR_NULL(drx))
617 return -ENODEV;
618 582
619 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr, 583 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr,
620 lgc_itr_cnt_off); 584 lgc_itr_cnt_off);
@@ -777,6 +741,44 @@ static const struct file_operations fops_rxon = {
777 .open = simple_open, 741 .open = simple_open,
778}; 742};
779 743
744static ssize_t wil_write_file_rbufcap(struct file *file,
745 const char __user *buf,
746 size_t count, loff_t *ppos)
747{
748 struct wil6210_priv *wil = file->private_data;
749 int val;
750 int rc;
751
752 rc = kstrtoint_from_user(buf, count, 0, &val);
753 if (rc) {
754 wil_err(wil, "Invalid argument\n");
755 return rc;
756 }
757 /* input value: negative to disable, 0 to use system default,
758 * 1..ring size to set descriptor threshold
759 */
760 wil_info(wil, "%s RBUFCAP, descriptors threshold - %d\n",
761 val < 0 ? "Disabling" : "Enabling", val);
762
763 if (!wil->ring_rx.va || val > wil->ring_rx.size) {
764 wil_err(wil, "Invalid descriptors threshold, %d\n", val);
765 return -EINVAL;
766 }
767
768 rc = wmi_rbufcap_cfg(wil, val < 0 ? 0 : 1, val < 0 ? 0 : val);
769 if (rc) {
770 wil_err(wil, "RBUFCAP config failed: %d\n", rc);
771 return rc;
772 }
773
774 return count;
775}
776
777static const struct file_operations fops_rbufcap = {
778 .write = wil_write_file_rbufcap,
779 .open = simple_open,
780};
781
780/* block ack control, write: 782/* block ack control, write:
781 * - "add <ringid> <agg_size> <timeout>" to trigger ADDBA 783 * - "add <ringid> <agg_size> <timeout>" to trigger ADDBA
782 * - "del_tx <ringid> <reason>" to trigger DELBA for Tx side 784 * - "del_tx <ringid> <reason>" to trigger DELBA for Tx side
@@ -938,9 +940,8 @@ static ssize_t wil_read_pmccfg(struct file *file, char __user *user_buf,
938 " - \"alloc <num descriptors> <descriptor_size>\" to allocate pmc\n" 940 " - \"alloc <num descriptors> <descriptor_size>\" to allocate pmc\n"
939 " - \"free\" to free memory allocated for pmc\n"; 941 " - \"free\" to free memory allocated for pmc\n";
940 942
941 sprintf(text, "Last command status: %d\n\n%s", 943 snprintf(text, sizeof(text), "Last command status: %d\n\n%s",
942 wil_pmc_last_cmd_status(wil), 944 wil_pmc_last_cmd_status(wil), help);
943 help);
944 945
945 return simple_read_from_buffer(user_buf, count, ppos, text, 946 return simple_read_from_buffer(user_buf, count, ppos, text,
946 strlen(text) + 1); 947 strlen(text) + 1);
@@ -1297,7 +1298,7 @@ static int bf_show(struct seq_file *s, void *data)
1297 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid, 1298 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid,
1298 &cmd, sizeof(cmd), 1299 &cmd, sizeof(cmd),
1299 WMI_NOTIFY_REQ_DONE_EVENTID, &reply, 1300 WMI_NOTIFY_REQ_DONE_EVENTID, &reply,
1300 sizeof(reply), 20); 1301 sizeof(reply), WIL_WMI_CALL_GENERAL_TO_MS);
1301 /* if reply is all-0, ignore this CID */ 1302 /* if reply is all-0, ignore this CID */
1302 if (rc || is_all_zeros(&reply.evt, sizeof(reply.evt))) 1303 if (rc || is_all_zeros(&reply.evt, sizeof(reply.evt)))
1303 continue; 1304 continue;
@@ -1335,7 +1336,7 @@ static void print_temp(struct seq_file *s, const char *prefix, s32 t)
1335{ 1336{
1336 switch (t) { 1337 switch (t) {
1337 case 0: 1338 case 0:
1338 case ~(u32)0: 1339 case WMI_INVALID_TEMPERATURE:
1339 seq_printf(s, "%s N/A\n", prefix); 1340 seq_printf(s, "%s N/A\n", prefix);
1340 break; 1341 break;
1341 default: 1342 default:
@@ -1348,17 +1349,41 @@ static void print_temp(struct seq_file *s, const char *prefix, s32 t)
1348static int temp_show(struct seq_file *s, void *data) 1349static int temp_show(struct seq_file *s, void *data)
1349{ 1350{
1350 struct wil6210_priv *wil = s->private; 1351 struct wil6210_priv *wil = s->private;
1351 s32 t_m, t_r; 1352 int rc, i;
1352 int rc = wmi_get_temperature(wil, &t_m, &t_r);
1353 1353
1354 if (rc) { 1354 if (test_bit(WMI_FW_CAPABILITY_TEMPERATURE_ALL_RF,
1355 seq_puts(s, "Failed\n"); 1355 wil->fw_capabilities)) {
1356 return 0; 1356 struct wmi_temp_sense_all_done_event sense_all_evt;
1357 }
1358 1357
1359 print_temp(s, "T_mac =", t_m); 1358 wil_dbg_misc(wil,
1360 print_temp(s, "T_radio =", t_r); 1359 "WMI_FW_CAPABILITY_TEMPERATURE_ALL_RF is supported");
1360 rc = wmi_get_all_temperatures(wil, &sense_all_evt);
1361 if (rc) {
1362 seq_puts(s, "Failed\n");
1363 return 0;
1364 }
1365 print_temp(s, "T_mac =",
1366 le32_to_cpu(sense_all_evt.baseband_t1000));
1367 seq_printf(s, "Connected RFs [0x%08x]\n",
1368 sense_all_evt.rf_bitmap);
1369 for (i = 0; i < WMI_MAX_XIF_PORTS_NUM; i++) {
1370 seq_printf(s, "RF[%d] = ", i);
1371 print_temp(s, "",
1372 le32_to_cpu(sense_all_evt.rf_t1000[i]));
1373 }
1374 } else {
1375 s32 t_m, t_r;
1361 1376
1377 wil_dbg_misc(wil,
1378 "WMI_FW_CAPABILITY_TEMPERATURE_ALL_RF is not supported");
1379 rc = wmi_get_temperature(wil, &t_m, &t_r);
1380 if (rc) {
1381 seq_puts(s, "Failed\n");
1382 return 0;
1383 }
1384 print_temp(s, "T_mac =", t_m);
1385 print_temp(s, "T_radio =", t_r);
1386 }
1362 return 0; 1387 return 0;
1363} 1388}
1364DEFINE_SHOW_ATTRIBUTE(temp); 1389DEFINE_SHOW_ATTRIBUTE(temp);
@@ -2364,6 +2389,7 @@ static const struct {
2364 {"tx_latency", 0644, &fops_tx_latency}, 2389 {"tx_latency", 0644, &fops_tx_latency},
2365 {"link_stats", 0644, &fops_link_stats}, 2390 {"link_stats", 0644, &fops_link_stats},
2366 {"link_stats_global", 0644, &fops_link_stats_global}, 2391 {"link_stats_global", 0644, &fops_link_stats_global},
2392 {"rbufcap", 0244, &fops_rbufcap},
2367}; 2393};
2368 2394
2369static void wil6210_debugfs_init_files(struct wil6210_priv *wil, 2395static void wil6210_debugfs_init_files(struct wil6210_priv *wil,
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 3c30076efb64..173561fe593d 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -340,7 +340,7 @@ static void _wil6210_disconnect_complete(struct wil6210_vif *vif,
340 wil_dbg_misc(wil, 340 wil_dbg_misc(wil,
341 "Disconnect complete %pM, CID=%d, reason=%d\n", 341 "Disconnect complete %pM, CID=%d, reason=%d\n",
342 bssid, cid, reason_code); 342 bssid, cid, reason_code);
343 if (cid >= 0) /* disconnect 1 peer */ 343 if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */
344 wil_disconnect_cid_complete(vif, cid, reason_code); 344 wil_disconnect_cid_complete(vif, cid, reason_code);
345 } else { /* all */ 345 } else { /* all */
346 wil_dbg_misc(wil, "Disconnect complete all\n"); 346 wil_dbg_misc(wil, "Disconnect complete all\n");
@@ -452,7 +452,7 @@ static void _wil6210_disconnect(struct wil6210_vif *vif, const u8 *bssid,
452 cid = wil_find_cid(wil, vif->mid, bssid); 452 cid = wil_find_cid(wil, vif->mid, bssid);
453 wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n", 453 wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n",
454 bssid, cid, reason_code); 454 bssid, cid, reason_code);
455 if (cid >= 0) /* disconnect 1 peer */ 455 if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */
456 wil_disconnect_cid(vif, cid, reason_code); 456 wil_disconnect_cid(vif, cid, reason_code);
457 } else { /* all */ 457 } else { /* all */
458 wil_dbg_misc(wil, "Disconnect all\n"); 458 wil_dbg_misc(wil, "Disconnect all\n");
@@ -1522,6 +1522,7 @@ int wil_ps_update(struct wil6210_priv *wil, enum wmi_ps_profile_type ps_profile)
1522 1522
1523static void wil_pre_fw_config(struct wil6210_priv *wil) 1523static void wil_pre_fw_config(struct wil6210_priv *wil)
1524{ 1524{
1525 wil_clear_fw_log_addr(wil);
1525 /* Mark FW as loaded from host */ 1526 /* Mark FW as loaded from host */
1526 wil_s(wil, RGF_USER_USAGE_6, 1); 1527 wil_s(wil, RGF_USER_USAGE_6, 1);
1527 1528
@@ -1579,6 +1580,20 @@ static int wil_restore_vifs(struct wil6210_priv *wil)
1579} 1580}
1580 1581
1581/* 1582/*
1583 * Clear FW and ucode log start addr to indicate FW log is not ready. The host
1584 * driver clears the addresses before FW starts and FW initializes the address
1585 * when it is ready to send logs.
1586 */
1587void wil_clear_fw_log_addr(struct wil6210_priv *wil)
1588{
1589 /* FW log addr */
1590 wil_w(wil, RGF_USER_USAGE_1, 0);
1591 /* ucode log addr */
1592 wil_w(wil, RGF_USER_USAGE_2, 0);
1593 wil_dbg_misc(wil, "Cleared FW and ucode log address");
1594}
1595
1596/*
1582 * We reset all the structures, and we reset the UMAC. 1597 * We reset all the structures, and we reset the UMAC.
1583 * After calling this routine, you're expected to reload 1598 * After calling this routine, you're expected to reload
1584 * the firmware. 1599 * the firmware.
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index 4e2d9221b8e6..9f5a914abc18 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -420,6 +420,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
420 } 420 }
421 /* rollback to bus_disable */ 421 /* rollback to bus_disable */
422 422
423 wil_clear_fw_log_addr(wil);
423 rc = wil_if_add(wil); 424 rc = wil_if_add(wil);
424 if (rc) { 425 if (rc) {
425 wil_err(wil, "wil_if_add failed: %d\n", rc); 426 wil_err(wil, "wil_if_add failed: %d\n", rc);
diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c
index 1c796640d6aa..784239bcb3a6 100644
--- a/drivers/net/wireless/ath/wil6210/rx_reorder.c
+++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c
@@ -316,7 +316,7 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
316 u16 agg_timeout = le16_to_cpu(ba_timeout); 316 u16 agg_timeout = le16_to_cpu(ba_timeout);
317 u16 seq_ctrl = le16_to_cpu(ba_seq_ctrl); 317 u16 seq_ctrl = le16_to_cpu(ba_seq_ctrl);
318 struct wil_sta_info *sta; 318 struct wil_sta_info *sta;
319 u16 agg_wsize = 0; 319 u16 agg_wsize;
320 /* bit 0: A-MSDU supported 320 /* bit 0: A-MSDU supported
321 * bit 1: policy (should be 0 for us) 321 * bit 1: policy (should be 0 for us)
322 * bits 2..5: TID 322 * bits 2..5: TID
@@ -328,7 +328,6 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
328 test_bit(WMI_FW_CAPABILITY_AMSDU, wil->fw_capabilities) && 328 test_bit(WMI_FW_CAPABILITY_AMSDU, wil->fw_capabilities) &&
329 wil->amsdu_en && (param_set & BIT(0)); 329 wil->amsdu_en && (param_set & BIT(0));
330 int ba_policy = param_set & BIT(1); 330 int ba_policy = param_set & BIT(1);
331 u16 status = WLAN_STATUS_SUCCESS;
332 u16 ssn = seq_ctrl >> 4; 331 u16 ssn = seq_ctrl >> 4;
333 struct wil_tid_ampdu_rx *r; 332 struct wil_tid_ampdu_rx *r;
334 int rc = 0; 333 int rc = 0;
@@ -355,27 +354,19 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
355 agg_amsdu ? "+" : "-", !!ba_policy, dialog_token, ssn); 354 agg_amsdu ? "+" : "-", !!ba_policy, dialog_token, ssn);
356 355
357 /* apply policies */ 356 /* apply policies */
358 if (ba_policy) { 357 if (req_agg_wsize == 0) {
359 wil_err(wil, "BACK requested unsupported ba_policy == 1\n"); 358 wil_dbg_misc(wil, "Suggest BACK wsize %d\n",
360 status = WLAN_STATUS_INVALID_QOS_PARAM; 359 wil->max_agg_wsize);
361 } 360 agg_wsize = wil->max_agg_wsize;
362 if (status == WLAN_STATUS_SUCCESS) { 361 } else {
363 if (req_agg_wsize == 0) { 362 agg_wsize = min_t(u16, wil->max_agg_wsize, req_agg_wsize);
364 wil_dbg_misc(wil, "Suggest BACK wsize %d\n",
365 wil->max_agg_wsize);
366 agg_wsize = wil->max_agg_wsize;
367 } else {
368 agg_wsize = min_t(u16,
369 wil->max_agg_wsize, req_agg_wsize);
370 }
371 } 363 }
372 364
373 rc = wil->txrx_ops.wmi_addba_rx_resp(wil, mid, cid, tid, dialog_token, 365 rc = wil->txrx_ops.wmi_addba_rx_resp(wil, mid, cid, tid, dialog_token,
374 status, agg_amsdu, agg_wsize, 366 WLAN_STATUS_SUCCESS, agg_amsdu,
375 agg_timeout); 367 agg_wsize, agg_timeout);
376 if (rc || (status != WLAN_STATUS_SUCCESS)) { 368 if (rc) {
377 wil_err(wil, "do not apply ba, rc(%d), status(%d)\n", rc, 369 wil_err(wil, "do not apply ba, rc(%d)\n", rc);
378 status);
379 goto out; 370 goto out;
380 } 371 }
381 372
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 8790e5effa28..eae00aafaa88 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -1037,7 +1037,8 @@ static int wil_vring_init_tx(struct wil6210_vif *vif, int id, int size,
1037 if (!vif->privacy) 1037 if (!vif->privacy)
1038 txdata->dot1x_open = true; 1038 txdata->dot1x_open = true;
1039 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, vif->mid, &cmd, sizeof(cmd), 1039 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, vif->mid, &cmd, sizeof(cmd),
1040 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); 1040 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply),
1041 WIL_WMI_CALL_GENERAL_TO_MS);
1041 if (rc) 1042 if (rc)
1042 goto out_free; 1043 goto out_free;
1043 1044
@@ -1125,7 +1126,8 @@ static int wil_tx_vring_modify(struct wil6210_vif *vif, int ring_id, int cid,
1125 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); 1126 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
1126 1127
1127 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, vif->mid, &cmd, sizeof(cmd), 1128 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, vif->mid, &cmd, sizeof(cmd),
1128 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); 1129 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply),
1130 WIL_WMI_CALL_GENERAL_TO_MS);
1129 if (rc) 1131 if (rc)
1130 goto fail; 1132 goto fail;
1131 1133
@@ -1205,7 +1207,8 @@ int wil_vring_init_bcast(struct wil6210_vif *vif, int id, int size)
1205 txdata->dot1x_open = true; 1207 txdata->dot1x_open = true;
1206 rc = wmi_call(wil, WMI_BCAST_VRING_CFG_CMDID, vif->mid, 1208 rc = wmi_call(wil, WMI_BCAST_VRING_CFG_CMDID, vif->mid,
1207 &cmd, sizeof(cmd), 1209 &cmd, sizeof(cmd),
1208 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); 1210 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply),
1211 WIL_WMI_CALL_GENERAL_TO_MS);
1209 if (rc) 1212 if (rc)
1210 goto out_free; 1213 goto out_free;
1211 1214
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c
index 6140db5960c3..dc040cd4ab06 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.c
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c
@@ -26,6 +26,10 @@
26#include "txrx.h" 26#include "txrx.h"
27#include "trace.h" 27#include "trace.h"
28 28
29/* Max number of entries (packets to complete) to update the hwtail of tx
30 * status ring. Should be power of 2
31 */
32#define WIL_EDMA_TX_SRING_UPDATE_HW_TAIL 128
29#define WIL_EDMA_MAX_DATA_OFFSET (2) 33#define WIL_EDMA_MAX_DATA_OFFSET (2)
30/* RX buffer size must be aligned to 4 bytes */ 34/* RX buffer size must be aligned to 4 bytes */
31#define WIL_EDMA_RX_BUF_LEN_DEFAULT (2048) 35#define WIL_EDMA_RX_BUF_LEN_DEFAULT (2048)
@@ -1155,7 +1159,7 @@ int wil_tx_sring_handler(struct wil6210_priv *wil,
1155 struct wil_net_stats *stats; 1159 struct wil_net_stats *stats;
1156 struct wil_tx_enhanced_desc *_d; 1160 struct wil_tx_enhanced_desc *_d;
1157 unsigned int ring_id; 1161 unsigned int ring_id;
1158 unsigned int num_descs; 1162 unsigned int num_descs, num_statuses = 0;
1159 int i; 1163 int i;
1160 u8 dr_bit; /* Descriptor Ready bit */ 1164 u8 dr_bit; /* Descriptor Ready bit */
1161 struct wil_ring_tx_status msg; 1165 struct wil_ring_tx_status msg;
@@ -1276,6 +1280,11 @@ int wil_tx_sring_handler(struct wil6210_priv *wil,
1276 } 1280 }
1277 1281
1278again: 1282again:
1283 num_statuses++;
1284 if (num_statuses % WIL_EDMA_TX_SRING_UPDATE_HW_TAIL == 0)
1285 /* update HW tail to allow HW to push new statuses */
1286 wil_w(wil, sring->hwtail, sring->swhead);
1287
1279 wil_sring_advance_swhead(sring); 1288 wil_sring_advance_swhead(sring);
1280 1289
1281 wil_get_next_tx_status_msg(sring, &msg); 1290 wil_get_next_tx_status_msg(sring, &msg);
@@ -1286,8 +1295,9 @@ again:
1286 if (desc_cnt) 1295 if (desc_cnt)
1287 wil_update_net_queues(wil, vif, NULL, false); 1296 wil_update_net_queues(wil, vif, NULL, false);
1288 1297
1289 /* Update the HW tail ptr (RD ptr) */ 1298 if (num_statuses % WIL_EDMA_TX_SRING_UPDATE_HW_TAIL != 0)
1290 wil_w(wil, sring->hwtail, (sring->swhead - 1) % sring->size); 1299 /* Update the HW tail ptr (RD ptr) */
1300 wil_w(wil, sring->hwtail, (sring->swhead - 1) % sring->size);
1291 1301
1292 return desc_cnt; 1302 return desc_cnt;
1293} 1303}
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.h b/drivers/net/wireless/ath/wil6210/txrx_edma.h
index bb4ff28b73e5..e9e6ea9b16b9 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.h
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.h
@@ -24,7 +24,7 @@
24#define WIL_SRING_SIZE_ORDER_MAX (WIL_RING_SIZE_ORDER_MAX) 24#define WIL_SRING_SIZE_ORDER_MAX (WIL_RING_SIZE_ORDER_MAX)
25/* RX sring order should be bigger than RX ring order */ 25/* RX sring order should be bigger than RX ring order */
26#define WIL_RX_SRING_SIZE_ORDER_DEFAULT (12) 26#define WIL_RX_SRING_SIZE_ORDER_DEFAULT (12)
27#define WIL_TX_SRING_SIZE_ORDER_DEFAULT (12) 27#define WIL_TX_SRING_SIZE_ORDER_DEFAULT (14)
28#define WIL_RX_BUFF_ARR_SIZE_DEFAULT (2600) 28#define WIL_RX_BUFF_ARR_SIZE_DEFAULT (2600)
29 29
30#define WIL_DEFAULT_RX_STATUS_RING_ID 0 30#define WIL_DEFAULT_RX_STATUS_RING_ID 0
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 44984031ce54..6f456b311a39 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -99,6 +99,7 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
99#define WIL_MAX_AMPDU_SIZE_128 (128 * 1024) /* FW/HW limit */ 99#define WIL_MAX_AMPDU_SIZE_128 (128 * 1024) /* FW/HW limit */
100#define WIL_MAX_AGG_WSIZE_64 (64) /* FW/HW limit */ 100#define WIL_MAX_AGG_WSIZE_64 (64) /* FW/HW limit */
101#define WIL6210_MAX_STATUS_RINGS (8) 101#define WIL6210_MAX_STATUS_RINGS (8)
102#define WIL_WMI_CALL_GENERAL_TO_MS 100
102 103
103/* Hardware offload block adds the following: 104/* Hardware offload block adds the following:
104 * 26 bytes - 3-address QoS data header 105 * 26 bytes - 3-address QoS data header
@@ -1252,6 +1253,9 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct wil_ring *vring);
1252int wmi_update_ft_ies(struct wil6210_vif *vif, u16 ie_len, const void *ie); 1253int wmi_update_ft_ies(struct wil6210_vif *vif, u16 ie_len, const void *ie);
1253int wmi_rxon(struct wil6210_priv *wil, bool on); 1254int wmi_rxon(struct wil6210_priv *wil, bool on);
1254int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r); 1255int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r);
1256int wmi_get_all_temperatures(struct wil6210_priv *wil,
1257 struct wmi_temp_sense_all_done_event
1258 *sense_all_evt);
1255int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason, 1259int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason,
1256 bool del_sta); 1260 bool del_sta);
1257int wmi_addba(struct wil6210_priv *wil, u8 mid, 1261int wmi_addba(struct wil6210_priv *wil, u8 mid,
@@ -1406,6 +1410,7 @@ int wmi_stop_sched_scan(struct wil6210_priv *wil);
1406int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len); 1410int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len);
1407int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len, 1411int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len,
1408 u8 channel, u16 duration_ms); 1412 u8 channel, u16 duration_ms);
1413int wmi_rbufcap_cfg(struct wil6210_priv *wil, bool enable, u16 threshold);
1409 1414
1410int reverse_memcmp(const void *cs, const void *ct, size_t count); 1415int reverse_memcmp(const void *cs, const void *ct, size_t count);
1411 1416
@@ -1424,4 +1429,5 @@ int wmi_addba_rx_resp_edma(struct wil6210_priv *wil, u8 mid, u8 cid,
1424 1429
1425void update_supported_bands(struct wil6210_priv *wil); 1430void update_supported_bands(struct wil6210_priv *wil);
1426 1431
1432void wil_clear_fw_log_addr(struct wil6210_priv *wil);
1427#endif /* __WIL6210_H__ */ 1433#endif /* __WIL6210_H__ */
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 0a0818f1df28..475b1a233cc9 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -40,7 +40,6 @@ MODULE_PARM_DESC(led_id,
40 " 60G device led enablement. Set the led ID (0-2) to enable"); 40 " 60G device led enablement. Set the led ID (0-2) to enable");
41 41
42#define WIL_WAIT_FOR_SUSPEND_RESUME_COMP 200 42#define WIL_WAIT_FOR_SUSPEND_RESUME_COMP 200
43#define WIL_WMI_CALL_GENERAL_TO_MS 100
44#define WIL_WMI_PCP_STOP_TO_MS 5000 43#define WIL_WMI_PCP_STOP_TO_MS 5000
45 44
46/** 45/**
@@ -484,6 +483,10 @@ static const char *cmdid2name(u16 cmdid)
484 return "WMI_FT_REASSOC_CMD"; 483 return "WMI_FT_REASSOC_CMD";
485 case WMI_UPDATE_FT_IES_CMDID: 484 case WMI_UPDATE_FT_IES_CMDID:
486 return "WMI_UPDATE_FT_IES_CMD"; 485 return "WMI_UPDATE_FT_IES_CMD";
486 case WMI_RBUFCAP_CFG_CMDID:
487 return "WMI_RBUFCAP_CFG_CMD";
488 case WMI_TEMP_SENSE_ALL_CMDID:
489 return "WMI_TEMP_SENSE_ALL_CMDID";
487 default: 490 default:
488 return "Untracked CMD"; 491 return "Untracked CMD";
489 } 492 }
@@ -628,6 +631,10 @@ static const char *eventid2name(u16 eventid)
628 return "WMI_FT_AUTH_STATUS_EVENT"; 631 return "WMI_FT_AUTH_STATUS_EVENT";
629 case WMI_FT_REASSOC_STATUS_EVENTID: 632 case WMI_FT_REASSOC_STATUS_EVENTID:
630 return "WMI_FT_REASSOC_STATUS_EVENT"; 633 return "WMI_FT_REASSOC_STATUS_EVENT";
634 case WMI_RBUFCAP_CFG_EVENTID:
635 return "WMI_RBUFCAP_CFG_EVENT";
636 case WMI_TEMP_SENSE_ALL_DONE_EVENTID:
637 return "WMI_TEMP_SENSE_ALL_DONE_EVENTID";
631 default: 638 default:
632 return "Untracked EVENT"; 639 return "Untracked EVENT";
633 } 640 }
@@ -2051,7 +2058,8 @@ int wmi_echo(struct wil6210_priv *wil)
2051 }; 2058 };
2052 2059
2053 return wmi_call(wil, WMI_ECHO_CMDID, vif->mid, &cmd, sizeof(cmd), 2060 return wmi_call(wil, WMI_ECHO_CMDID, vif->mid, &cmd, sizeof(cmd),
2054 WMI_ECHO_RSP_EVENTID, NULL, 0, 50); 2061 WMI_ECHO_RSP_EVENTID, NULL, 0,
2062 WIL_WMI_CALL_GENERAL_TO_MS);
2055} 2063}
2056 2064
2057int wmi_set_mac_address(struct wil6210_priv *wil, void *addr) 2065int wmi_set_mac_address(struct wil6210_priv *wil, void *addr)
@@ -2110,7 +2118,7 @@ int wmi_led_cfg(struct wil6210_priv *wil, bool enable)
2110 2118
2111 rc = wmi_call(wil, WMI_LED_CFG_CMDID, vif->mid, &cmd, sizeof(cmd), 2119 rc = wmi_call(wil, WMI_LED_CFG_CMDID, vif->mid, &cmd, sizeof(cmd),
2112 WMI_LED_CFG_DONE_EVENTID, &reply, sizeof(reply), 2120 WMI_LED_CFG_DONE_EVENTID, &reply, sizeof(reply),
2113 100); 2121 WIL_WMI_CALL_GENERAL_TO_MS);
2114 if (rc) 2122 if (rc)
2115 goto out; 2123 goto out;
2116 2124
@@ -2124,6 +2132,37 @@ out:
2124 return rc; 2132 return rc;
2125} 2133}
2126 2134
2135int wmi_rbufcap_cfg(struct wil6210_priv *wil, bool enable, u16 threshold)
2136{
2137 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
2138 int rc;
2139
2140 struct wmi_rbufcap_cfg_cmd cmd = {
2141 .enable = enable,
2142 .rx_desc_threshold = cpu_to_le16(threshold),
2143 };
2144 struct {
2145 struct wmi_cmd_hdr wmi;
2146 struct wmi_rbufcap_cfg_event evt;
2147 } __packed reply = {
2148 .evt = {.status = WMI_FW_STATUS_FAILURE},
2149 };
2150
2151 rc = wmi_call(wil, WMI_RBUFCAP_CFG_CMDID, vif->mid, &cmd, sizeof(cmd),
2152 WMI_RBUFCAP_CFG_EVENTID, &reply, sizeof(reply),
2153 WIL_WMI_CALL_GENERAL_TO_MS);
2154 if (rc)
2155 return rc;
2156
2157 if (reply.evt.status != WMI_FW_STATUS_SUCCESS) {
2158 wil_err(wil, "RBUFCAP_CFG failed. status %d\n",
2159 reply.evt.status);
2160 rc = -EINVAL;
2161 }
2162
2163 return rc;
2164}
2165
2127int wmi_pcp_start(struct wil6210_vif *vif, 2166int wmi_pcp_start(struct wil6210_vif *vif,
2128 int bi, u8 wmi_nettype, u8 chan, u8 hidden_ssid, u8 is_go) 2167 int bi, u8 wmi_nettype, u8 chan, u8 hidden_ssid, u8 is_go)
2129{ 2168{
@@ -2228,7 +2267,8 @@ int wmi_get_ssid(struct wil6210_vif *vif, u8 *ssid_len, void *ssid)
2228 memset(&reply, 0, sizeof(reply)); 2267 memset(&reply, 0, sizeof(reply));
2229 2268
2230 rc = wmi_call(wil, WMI_GET_SSID_CMDID, vif->mid, NULL, 0, 2269 rc = wmi_call(wil, WMI_GET_SSID_CMDID, vif->mid, NULL, 0,
2231 WMI_GET_SSID_EVENTID, &reply, sizeof(reply), 20); 2270 WMI_GET_SSID_EVENTID, &reply, sizeof(reply),
2271 WIL_WMI_CALL_GENERAL_TO_MS);
2232 if (rc) 2272 if (rc)
2233 return rc; 2273 return rc;
2234 2274
@@ -2265,7 +2305,8 @@ int wmi_get_channel(struct wil6210_priv *wil, int *channel)
2265 memset(&reply, 0, sizeof(reply)); 2305 memset(&reply, 0, sizeof(reply));
2266 2306
2267 rc = wmi_call(wil, WMI_GET_PCP_CHANNEL_CMDID, vif->mid, NULL, 0, 2307 rc = wmi_call(wil, WMI_GET_PCP_CHANNEL_CMDID, vif->mid, NULL, 0,
2268 WMI_GET_PCP_CHANNEL_EVENTID, &reply, sizeof(reply), 20); 2308 WMI_GET_PCP_CHANNEL_EVENTID, &reply, sizeof(reply),
2309 WIL_WMI_CALL_GENERAL_TO_MS);
2269 if (rc) 2310 if (rc)
2270 return rc; 2311 return rc;
2271 2312
@@ -2361,7 +2402,8 @@ int wmi_stop_discovery(struct wil6210_vif *vif)
2361 wil_dbg_wmi(wil, "sending WMI_DISCOVERY_STOP_CMDID\n"); 2402 wil_dbg_wmi(wil, "sending WMI_DISCOVERY_STOP_CMDID\n");
2362 2403
2363 rc = wmi_call(wil, WMI_DISCOVERY_STOP_CMDID, vif->mid, NULL, 0, 2404 rc = wmi_call(wil, WMI_DISCOVERY_STOP_CMDID, vif->mid, NULL, 0,
2364 WMI_DISCOVERY_STOPPED_EVENTID, NULL, 0, 100); 2405 WMI_DISCOVERY_STOPPED_EVENTID, NULL, 0,
2406 WIL_WMI_CALL_GENERAL_TO_MS);
2365 2407
2366 if (rc) 2408 if (rc)
2367 wil_err(wil, "Failed to stop discovery\n"); 2409 wil_err(wil, "Failed to stop discovery\n");
@@ -2507,12 +2549,14 @@ int wmi_rxon(struct wil6210_priv *wil, bool on)
2507 if (on) { 2549 if (on) {
2508 rc = wmi_call(wil, WMI_START_LISTEN_CMDID, vif->mid, NULL, 0, 2550 rc = wmi_call(wil, WMI_START_LISTEN_CMDID, vif->mid, NULL, 0,
2509 WMI_LISTEN_STARTED_EVENTID, 2551 WMI_LISTEN_STARTED_EVENTID,
2510 &reply, sizeof(reply), 100); 2552 &reply, sizeof(reply),
2553 WIL_WMI_CALL_GENERAL_TO_MS);
2511 if ((rc == 0) && (reply.evt.status != WMI_FW_STATUS_SUCCESS)) 2554 if ((rc == 0) && (reply.evt.status != WMI_FW_STATUS_SUCCESS))
2512 rc = -EINVAL; 2555 rc = -EINVAL;
2513 } else { 2556 } else {
2514 rc = wmi_call(wil, WMI_DISCOVERY_STOP_CMDID, vif->mid, NULL, 0, 2557 rc = wmi_call(wil, WMI_DISCOVERY_STOP_CMDID, vif->mid, NULL, 0,
2515 WMI_DISCOVERY_STOPPED_EVENTID, NULL, 0, 20); 2558 WMI_DISCOVERY_STOPPED_EVENTID, NULL, 0,
2559 WIL_WMI_CALL_GENERAL_TO_MS);
2516 } 2560 }
2517 2561
2518 return rc; 2562 return rc;
@@ -2601,7 +2645,8 @@ int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_bb, u32 *t_rf)
2601 memset(&reply, 0, sizeof(reply)); 2645 memset(&reply, 0, sizeof(reply));
2602 2646
2603 rc = wmi_call(wil, WMI_TEMP_SENSE_CMDID, vif->mid, &cmd, sizeof(cmd), 2647 rc = wmi_call(wil, WMI_TEMP_SENSE_CMDID, vif->mid, &cmd, sizeof(cmd),
2604 WMI_TEMP_SENSE_DONE_EVENTID, &reply, sizeof(reply), 100); 2648 WMI_TEMP_SENSE_DONE_EVENTID, &reply, sizeof(reply),
2649 WIL_WMI_CALL_GENERAL_TO_MS);
2605 if (rc) 2650 if (rc)
2606 return rc; 2651 return rc;
2607 2652
@@ -2613,6 +2658,44 @@ int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_bb, u32 *t_rf)
2613 return 0; 2658 return 0;
2614} 2659}
2615 2660
2661int wmi_get_all_temperatures(struct wil6210_priv *wil,
2662 struct wmi_temp_sense_all_done_event
2663 *sense_all_evt)
2664{
2665 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
2666 int rc;
2667 struct wmi_temp_sense_all_cmd cmd = {
2668 .measure_baseband_en = true,
2669 .measure_rf_en = true,
2670 .measure_mode = TEMPERATURE_MEASURE_NOW,
2671 };
2672 struct {
2673 struct wmi_cmd_hdr wmi;
2674 struct wmi_temp_sense_all_done_event evt;
2675 } __packed reply;
2676
2677 if (!sense_all_evt) {
2678 wil_err(wil, "Invalid sense_all_evt value\n");
2679 return -EINVAL;
2680 }
2681
2682 memset(&reply, 0, sizeof(reply));
2683 reply.evt.status = WMI_FW_STATUS_FAILURE;
2684 rc = wmi_call(wil, WMI_TEMP_SENSE_ALL_CMDID, vif->mid, &cmd,
2685 sizeof(cmd), WMI_TEMP_SENSE_ALL_DONE_EVENTID,
2686 &reply, sizeof(reply), WIL_WMI_CALL_GENERAL_TO_MS);
2687 if (rc)
2688 return rc;
2689
2690 if (reply.evt.status == WMI_FW_STATUS_FAILURE) {
2691 wil_err(wil, "Failed geting TEMP_SENSE_ALL\n");
2692 return -EINVAL;
2693 }
2694
2695 memcpy(sense_all_evt, &reply.evt, sizeof(reply.evt));
2696 return 0;
2697}
2698
2616int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason, 2699int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason,
2617 bool del_sta) 2700 bool del_sta)
2618{ 2701{
@@ -2715,7 +2798,7 @@ int wmi_addba_rx_resp(struct wil6210_priv *wil,
2715 .dialog_token = token, 2798 .dialog_token = token,
2716 .status_code = cpu_to_le16(status), 2799 .status_code = cpu_to_le16(status),
2717 /* bit 0: A-MSDU supported 2800 /* bit 0: A-MSDU supported
2718 * bit 1: policy (should be 0 for us) 2801 * bit 1: policy (controlled by FW)
2719 * bits 2..5: TID 2802 * bits 2..5: TID
2720 * bits 6..15: buffer size 2803 * bits 6..15: buffer size
2721 */ 2804 */
@@ -2745,7 +2828,7 @@ int wmi_addba_rx_resp(struct wil6210_priv *wil,
2745 2828
2746 rc = wmi_call(wil, WMI_RCP_ADDBA_RESP_CMDID, mid, &cmd, sizeof(cmd), 2829 rc = wmi_call(wil, WMI_RCP_ADDBA_RESP_CMDID, mid, &cmd, sizeof(cmd),
2747 WMI_RCP_ADDBA_RESP_SENT_EVENTID, &reply, sizeof(reply), 2830 WMI_RCP_ADDBA_RESP_SENT_EVENTID, &reply, sizeof(reply),
2748 100); 2831 WIL_WMI_CALL_GENERAL_TO_MS);
2749 if (rc) 2832 if (rc)
2750 return rc; 2833 return rc;
2751 2834
@@ -2769,7 +2852,7 @@ int wmi_addba_rx_resp_edma(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid,
2769 .dialog_token = token, 2852 .dialog_token = token,
2770 .status_code = cpu_to_le16(status), 2853 .status_code = cpu_to_le16(status),
2771 /* bit 0: A-MSDU supported 2854 /* bit 0: A-MSDU supported
2772 * bit 1: policy (should be 0 for us) 2855 * bit 1: policy (controlled by FW)
2773 * bits 2..5: TID 2856 * bits 2..5: TID
2774 * bits 6..15: buffer size 2857 * bits 6..15: buffer size
2775 */ 2858 */
@@ -2827,7 +2910,7 @@ int wmi_ps_dev_profile_cfg(struct wil6210_priv *wil,
2827 rc = wmi_call(wil, WMI_PS_DEV_PROFILE_CFG_CMDID, vif->mid, 2910 rc = wmi_call(wil, WMI_PS_DEV_PROFILE_CFG_CMDID, vif->mid,
2828 &cmd, sizeof(cmd), 2911 &cmd, sizeof(cmd),
2829 WMI_PS_DEV_PROFILE_CFG_EVENTID, &reply, sizeof(reply), 2912 WMI_PS_DEV_PROFILE_CFG_EVENTID, &reply, sizeof(reply),
2830 100); 2913 WIL_WMI_CALL_GENERAL_TO_MS);
2831 if (rc) 2914 if (rc)
2832 return rc; 2915 return rc;
2833 2916
@@ -2864,7 +2947,7 @@ int wmi_set_mgmt_retry(struct wil6210_priv *wil, u8 retry_short)
2864 rc = wmi_call(wil, WMI_SET_MGMT_RETRY_LIMIT_CMDID, vif->mid, 2947 rc = wmi_call(wil, WMI_SET_MGMT_RETRY_LIMIT_CMDID, vif->mid,
2865 &cmd, sizeof(cmd), 2948 &cmd, sizeof(cmd),
2866 WMI_SET_MGMT_RETRY_LIMIT_EVENTID, &reply, sizeof(reply), 2949 WMI_SET_MGMT_RETRY_LIMIT_EVENTID, &reply, sizeof(reply),
2867 100); 2950 WIL_WMI_CALL_GENERAL_TO_MS);
2868 if (rc) 2951 if (rc)
2869 return rc; 2952 return rc;
2870 2953
@@ -2894,7 +2977,7 @@ int wmi_get_mgmt_retry(struct wil6210_priv *wil, u8 *retry_short)
2894 memset(&reply, 0, sizeof(reply)); 2977 memset(&reply, 0, sizeof(reply));
2895 rc = wmi_call(wil, WMI_GET_MGMT_RETRY_LIMIT_CMDID, vif->mid, NULL, 0, 2978 rc = wmi_call(wil, WMI_GET_MGMT_RETRY_LIMIT_CMDID, vif->mid, NULL, 0,
2896 WMI_GET_MGMT_RETRY_LIMIT_EVENTID, &reply, sizeof(reply), 2979 WMI_GET_MGMT_RETRY_LIMIT_EVENTID, &reply, sizeof(reply),
2897 100); 2980 WIL_WMI_CALL_GENERAL_TO_MS);
2898 if (rc) 2981 if (rc)
2899 return rc; 2982 return rc;
2900 2983
@@ -3220,7 +3303,18 @@ static void wmi_event_handle(struct wil6210_priv *wil,
3220 /* check if someone waits for this event */ 3303 /* check if someone waits for this event */
3221 if (wil->reply_id && wil->reply_id == id && 3304 if (wil->reply_id && wil->reply_id == id &&
3222 wil->reply_mid == mid) { 3305 wil->reply_mid == mid) {
3223 WARN_ON(wil->reply_buf); 3306 if (wil->reply_buf) {
3307 /* event received while wmi_call is waiting
3308 * with a buffer. Such event should be handled
3309 * in wmi_recv_cmd function. Handling the event
3310 * here means a previous wmi_call was timeout.
3311 * Drop the event and do not handle it.
3312 */
3313 wil_err(wil,
3314 "Old event (%d, %s) while wmi_call is waiting. Drop it and Continue waiting\n",
3315 id, eventid2name(id));
3316 return;
3317 }
3224 3318
3225 wmi_evt_call_handler(vif, id, evt_data, 3319 wmi_evt_call_handler(vif, id, evt_data,
3226 len - sizeof(*wmi)); 3320 len - sizeof(*wmi));
@@ -3800,6 +3894,7 @@ int wil_wmi_bcast_desc_ring_add(struct wil6210_vif *vif, int ring_id)
3800 .ring_size = cpu_to_le16(ring->size), 3894 .ring_size = cpu_to_le16(ring->size),
3801 .ring_id = ring_id, 3895 .ring_id = ring_id,
3802 }, 3896 },
3897 .max_msdu_size = cpu_to_le16(wil_mtu2macbuf(mtu_max)),
3803 .status_ring_id = wil->tx_sring_idx, 3898 .status_ring_id = wil->tx_sring_idx,
3804 .encap_trans_type = WMI_VRING_ENC_TYPE_802_3, 3899 .encap_trans_type = WMI_VRING_ENC_TYPE_802_3,
3805 }; 3900 };
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
index da46fc8d39cf..3e37229b36b5 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -35,6 +35,7 @@
35#define WMI_PROX_RANGE_NUM (3) 35#define WMI_PROX_RANGE_NUM (3)
36#define WMI_MAX_LOSS_DMG_BEACONS (20) 36#define WMI_MAX_LOSS_DMG_BEACONS (20)
37#define MAX_NUM_OF_SECTORS (128) 37#define MAX_NUM_OF_SECTORS (128)
38#define WMI_INVALID_TEMPERATURE (0xFFFFFFFF)
38#define WMI_SCHED_MAX_ALLOCS_PER_CMD (4) 39#define WMI_SCHED_MAX_ALLOCS_PER_CMD (4)
39#define WMI_RF_DTYPE_LENGTH (3) 40#define WMI_RF_DTYPE_LENGTH (3)
40#define WMI_RF_ETYPE_LENGTH (3) 41#define WMI_RF_ETYPE_LENGTH (3)
@@ -64,6 +65,7 @@
64#define WMI_QOS_MAX_WEIGHT 50 65#define WMI_QOS_MAX_WEIGHT 50
65#define WMI_QOS_SET_VIF_PRIORITY (0xFF) 66#define WMI_QOS_SET_VIF_PRIORITY (0xFF)
66#define WMI_QOS_DEFAULT_PRIORITY (WMI_QOS_NUM_OF_PRIORITY) 67#define WMI_QOS_DEFAULT_PRIORITY (WMI_QOS_NUM_OF_PRIORITY)
68#define WMI_MAX_XIF_PORTS_NUM (8)
67 69
68/* Mailbox interface 70/* Mailbox interface
69 * used for commands and events 71 * used for commands and events
@@ -105,6 +107,7 @@ enum wmi_fw_capability {
105 WMI_FW_CAPABILITY_TX_REQ_EXT = 25, 107 WMI_FW_CAPABILITY_TX_REQ_EXT = 25,
106 WMI_FW_CAPABILITY_CHANNEL_4 = 26, 108 WMI_FW_CAPABILITY_CHANNEL_4 = 26,
107 WMI_FW_CAPABILITY_IPA = 27, 109 WMI_FW_CAPABILITY_IPA = 27,
110 WMI_FW_CAPABILITY_TEMPERATURE_ALL_RF = 30,
108 WMI_FW_CAPABILITY_MAX, 111 WMI_FW_CAPABILITY_MAX,
109}; 112};
110 113
@@ -296,6 +299,7 @@ enum wmi_command_id {
296 WMI_SET_VRING_PRIORITY_WEIGHT_CMDID = 0xA10, 299 WMI_SET_VRING_PRIORITY_WEIGHT_CMDID = 0xA10,
297 WMI_SET_VRING_PRIORITY_CMDID = 0xA11, 300 WMI_SET_VRING_PRIORITY_CMDID = 0xA11,
298 WMI_RBUFCAP_CFG_CMDID = 0xA12, 301 WMI_RBUFCAP_CFG_CMDID = 0xA12,
302 WMI_TEMP_SENSE_ALL_CMDID = 0xA13,
299 WMI_SET_MAC_ADDRESS_CMDID = 0xF003, 303 WMI_SET_MAC_ADDRESS_CMDID = 0xF003,
300 WMI_ABORT_SCAN_CMDID = 0xF007, 304 WMI_ABORT_SCAN_CMDID = 0xF007,
301 WMI_SET_PROMISCUOUS_MODE_CMDID = 0xF041, 305 WMI_SET_PROMISCUOUS_MODE_CMDID = 0xF041,
@@ -1411,12 +1415,7 @@ struct wmi_rf_xpm_write_cmd {
1411 u8 data_bytes[0]; 1415 u8 data_bytes[0];
1412} __packed; 1416} __packed;
1413 1417
1414/* WMI_TEMP_SENSE_CMDID 1418/* Possible modes for temperature measurement */
1415 *
1416 * Measure MAC and radio temperatures
1417 *
1418 * Possible modes for temperature measurement
1419 */
1420enum wmi_temperature_measure_mode { 1419enum wmi_temperature_measure_mode {
1421 TEMPERATURE_USE_OLD_VALUE = 0x01, 1420 TEMPERATURE_USE_OLD_VALUE = 0x01,
1422 TEMPERATURE_MEASURE_NOW = 0x02, 1421 TEMPERATURE_MEASURE_NOW = 0x02,
@@ -1942,6 +1941,14 @@ struct wmi_set_ap_slot_size_cmd {
1942 __le32 slot_size; 1941 __le32 slot_size;
1943} __packed; 1942} __packed;
1944 1943
1944/* WMI_TEMP_SENSE_ALL_CMDID */
1945struct wmi_temp_sense_all_cmd {
1946 u8 measure_baseband_en;
1947 u8 measure_rf_en;
1948 u8 measure_mode;
1949 u8 reserved;
1950} __packed;
1951
1945/* WMI Events 1952/* WMI Events
1946 * List of Events (target to host) 1953 * List of Events (target to host)
1947 */ 1954 */
@@ -2101,6 +2108,7 @@ enum wmi_event_id {
2101 WMI_SET_VRING_PRIORITY_WEIGHT_EVENTID = 0x1A10, 2108 WMI_SET_VRING_PRIORITY_WEIGHT_EVENTID = 0x1A10,
2102 WMI_SET_VRING_PRIORITY_EVENTID = 0x1A11, 2109 WMI_SET_VRING_PRIORITY_EVENTID = 0x1A11,
2103 WMI_RBUFCAP_CFG_EVENTID = 0x1A12, 2110 WMI_RBUFCAP_CFG_EVENTID = 0x1A12,
2111 WMI_TEMP_SENSE_ALL_DONE_EVENTID = 0x1A13,
2104 WMI_SET_CHANNEL_EVENTID = 0x9000, 2112 WMI_SET_CHANNEL_EVENTID = 0x9000,
2105 WMI_ASSOC_REQ_EVENTID = 0x9001, 2113 WMI_ASSOC_REQ_EVENTID = 0x9001,
2106 WMI_EAPOL_RX_EVENTID = 0x9002, 2114 WMI_EAPOL_RX_EVENTID = 0x9002,
@@ -2784,11 +2792,13 @@ struct wmi_fixed_scheduling_ul_config_event {
2784 */ 2792 */
2785struct wmi_temp_sense_done_event { 2793struct wmi_temp_sense_done_event {
2786 /* Temperature times 1000 (actual temperature will be achieved by 2794 /* Temperature times 1000 (actual temperature will be achieved by
2787 * dividing the value by 1000) 2795 * dividing the value by 1000). When temperature cannot be read from
2796 * device return WMI_INVALID_TEMPERATURE
2788 */ 2797 */
2789 __le32 baseband_t1000; 2798 __le32 baseband_t1000;
2790 /* Temperature times 1000 (actual temperature will be achieved by 2799 /* Temperature times 1000 (actual temperature will be achieved by
2791 * dividing the value by 1000) 2800 * dividing the value by 1000). When temperature cannot be read from
2801 * device return WMI_INVALID_TEMPERATURE
2792 */ 2802 */
2793 __le32 rf_t1000; 2803 __le32 rf_t1000;
2794} __packed; 2804} __packed;
@@ -4140,4 +4150,25 @@ struct wmi_rbufcap_cfg_event {
4140 u8 reserved[3]; 4150 u8 reserved[3];
4141} __packed; 4151} __packed;
4142 4152
4153/* WMI_TEMP_SENSE_ALL_DONE_EVENTID
4154 * Measure MAC and all radio temperatures
4155 */
4156struct wmi_temp_sense_all_done_event {
4157 /* enum wmi_fw_status */
4158 u8 status;
4159 /* Bitmap of connected RFs */
4160 u8 rf_bitmap;
4161 u8 reserved[2];
4162 /* Temperature times 1000 (actual temperature will be achieved by
4163 * dividing the value by 1000). When temperature cannot be read from
4164 * device return WMI_INVALID_TEMPERATURE
4165 */
4166 __le32 rf_t1000[WMI_MAX_XIF_PORTS_NUM];
4167 /* Temperature times 1000 (actual temperature will be achieved by
4168 * dividing the value by 1000). When temperature cannot be read from
4169 * device return WMI_INVALID_TEMPERATURE
4170 */
4171 __le32 baseband_t1000;
4172} __packed;
4173
4143#endif /* __WILOCITY_WMI_H__ */ 4174#endif /* __WILOCITY_WMI_H__ */