diff options
author | Kalle Valo <kvalo@codeaurora.org> | 2015-01-09 11:38:46 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-09 11:45:35 -0500 |
commit | 350b193ebd50f6c70ba4a82541300cf236c904d8 (patch) | |
tree | 444564ac88a80dfd6bf566c4152ff49c7fe2f577 | |
parent | ed0fb7eb2b2d27a07610b75d1f3a68cc22716347 (diff) | |
parent | 96bba98393f97e4c4bfe29341b3ad2adef32bde2 (diff) |
Merge ath-next from ath.git
Major changes in ath10k:
* Device tree support
* Major restructuring how to handle different WMI interface versions
* Add WMI TLV interface in preparation for new firmware interface support
* Support new firmware branch 10.2.4
* Add thermal cooling interface
* Add hwmon interface to read temparture from the device
And of course lots of small fixes and cleanups.
20 files changed, 6730 insertions, 728 deletions
diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt new file mode 100644 index 000000000000..edefc26c6204 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * Qualcomm Atheros ath10k wireless devices | ||
2 | |||
3 | For ath10k devices the calibration data can be provided through Device | ||
4 | Tree. The node is a child node of the PCI controller. | ||
5 | |||
6 | Required properties: | ||
7 | -compatible : Should be "qcom,ath10k" | ||
8 | |||
9 | Optional properties: | ||
10 | - qcom,ath10k-calibration-data : calibration data as an array, the | ||
11 | length can vary between hw versions | ||
12 | |||
13 | |||
14 | Example: | ||
15 | |||
16 | pci { | ||
17 | pcie@0 { | ||
18 | reg = <0 0 0 0 0>; | ||
19 | #interrupt-cells = <1>; | ||
20 | #size-cells = <2>; | ||
21 | #address-cells = <3>; | ||
22 | device_type = "pci"; | ||
23 | |||
24 | ath10k@0,0 { | ||
25 | reg = <0 0 0 0 0>; | ||
26 | device_type = "pci"; | ||
27 | qcom,ath10k-calibration-data = [ 01 02 03 ... ]; | ||
28 | }; | ||
29 | }; | ||
30 | }; | ||
diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile index 8b1b1adb477a..ffa3b1a8745f 100644 --- a/drivers/net/wireless/ath/ath10k/Makefile +++ b/drivers/net/wireless/ath/ath10k/Makefile | |||
@@ -8,11 +8,13 @@ ath10k_core-y += mac.o \ | |||
8 | htt_tx.o \ | 8 | htt_tx.o \ |
9 | txrx.o \ | 9 | txrx.o \ |
10 | wmi.o \ | 10 | wmi.o \ |
11 | wmi-tlv.o \ | ||
11 | bmi.o | 12 | bmi.o |
12 | 13 | ||
13 | ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o | 14 | ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o |
14 | ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o | 15 | ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o |
15 | ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o | 16 | ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o |
17 | ath10k_core-$(CONFIG_THERMAL) += thermal.o | ||
16 | 18 | ||
17 | obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o | 19 | obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o |
18 | ath10k_pci-y += pci.o \ | 20 | ath10k_pci-y += pci.o \ |
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index a156e6e48708..42ec79327943 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c | |||
@@ -1093,6 +1093,8 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id, | |||
1093 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); | 1093 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); |
1094 | BUILD_BUG_ON(2*TARGET_10X_NUM_MSDU_DESC > | 1094 | BUILD_BUG_ON(2*TARGET_10X_NUM_MSDU_DESC > |
1095 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); | 1095 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); |
1096 | BUILD_BUG_ON(2*TARGET_TLV_NUM_MSDU_DESC > | ||
1097 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); | ||
1096 | 1098 | ||
1097 | ce_state->ar = ar; | 1099 | ce_state->ar = ar; |
1098 | ce_state->id = ce_id; | 1100 | ce_state->id = ce_id; |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 7762061a1944..2d0671ebcf2b 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #include "core.h" | 22 | #include "core.h" |
22 | #include "mac.h" | 23 | #include "mac.h" |
@@ -27,20 +28,18 @@ | |||
27 | #include "debug.h" | 28 | #include "debug.h" |
28 | #include "htt.h" | 29 | #include "htt.h" |
29 | #include "testmode.h" | 30 | #include "testmode.h" |
31 | #include "wmi-ops.h" | ||
30 | 32 | ||
31 | unsigned int ath10k_debug_mask; | 33 | unsigned int ath10k_debug_mask; |
32 | static bool uart_print; | 34 | static bool uart_print; |
33 | static unsigned int ath10k_p2p; | ||
34 | static bool skip_otp; | 35 | static bool skip_otp; |
35 | 36 | ||
36 | module_param_named(debug_mask, ath10k_debug_mask, uint, 0644); | 37 | module_param_named(debug_mask, ath10k_debug_mask, uint, 0644); |
37 | module_param(uart_print, bool, 0644); | 38 | module_param(uart_print, bool, 0644); |
38 | module_param_named(p2p, ath10k_p2p, uint, 0644); | ||
39 | module_param(skip_otp, bool, 0644); | 39 | module_param(skip_otp, bool, 0644); |
40 | 40 | ||
41 | MODULE_PARM_DESC(debug_mask, "Debugging mask"); | 41 | MODULE_PARM_DESC(debug_mask, "Debugging mask"); |
42 | MODULE_PARM_DESC(uart_print, "Uart target debugging"); | 42 | MODULE_PARM_DESC(uart_print, "Uart target debugging"); |
43 | MODULE_PARM_DESC(p2p, "Enable ath10k P2P support"); | ||
44 | MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); | 43 | MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); |
45 | 44 | ||
46 | static const struct ath10k_hw_params ath10k_hw_params_list[] = { | 45 | static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
@@ -48,11 +47,14 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
48 | .id = QCA988X_HW_2_0_VERSION, | 47 | .id = QCA988X_HW_2_0_VERSION, |
49 | .name = "qca988x hw2.0", | 48 | .name = "qca988x hw2.0", |
50 | .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, | 49 | .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, |
50 | .uart_pin = 7, | ||
51 | .fw = { | 51 | .fw = { |
52 | .dir = QCA988X_HW_2_0_FW_DIR, | 52 | .dir = QCA988X_HW_2_0_FW_DIR, |
53 | .fw = QCA988X_HW_2_0_FW_FILE, | 53 | .fw = QCA988X_HW_2_0_FW_FILE, |
54 | .otp = QCA988X_HW_2_0_OTP_FILE, | 54 | .otp = QCA988X_HW_2_0_OTP_FILE, |
55 | .board = QCA988X_HW_2_0_BOARD_DATA_FILE, | 55 | .board = QCA988X_HW_2_0_BOARD_DATA_FILE, |
56 | .board_size = QCA988X_BOARD_DATA_SZ, | ||
57 | .board_ext_size = QCA988X_BOARD_EXT_DATA_SZ, | ||
56 | }, | 58 | }, |
57 | }, | 59 | }, |
58 | }; | 60 | }; |
@@ -146,8 +148,8 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, | |||
146 | static int ath10k_push_board_ext_data(struct ath10k *ar, const void *data, | 148 | static int ath10k_push_board_ext_data(struct ath10k *ar, const void *data, |
147 | size_t data_len) | 149 | size_t data_len) |
148 | { | 150 | { |
149 | u32 board_data_size = QCA988X_BOARD_DATA_SZ; | 151 | u32 board_data_size = ar->hw_params.fw.board_size; |
150 | u32 board_ext_data_size = QCA988X_BOARD_EXT_DATA_SZ; | 152 | u32 board_ext_data_size = ar->hw_params.fw.board_ext_size; |
151 | u32 board_ext_data_addr; | 153 | u32 board_ext_data_addr; |
152 | int ret; | 154 | int ret; |
153 | 155 | ||
@@ -193,7 +195,7 @@ static int ath10k_push_board_ext_data(struct ath10k *ar, const void *data, | |||
193 | static int ath10k_download_board_data(struct ath10k *ar, const void *data, | 195 | static int ath10k_download_board_data(struct ath10k *ar, const void *data, |
194 | size_t data_len) | 196 | size_t data_len) |
195 | { | 197 | { |
196 | u32 board_data_size = QCA988X_BOARD_DATA_SZ; | 198 | u32 board_data_size = ar->hw_params.fw.board_size; |
197 | u32 address; | 199 | u32 address; |
198 | int ret; | 200 | int ret; |
199 | 201 | ||
@@ -249,6 +251,63 @@ static int ath10k_download_cal_file(struct ath10k *ar) | |||
249 | return 0; | 251 | return 0; |
250 | } | 252 | } |
251 | 253 | ||
254 | static int ath10k_download_cal_dt(struct ath10k *ar) | ||
255 | { | ||
256 | struct device_node *node; | ||
257 | int data_len; | ||
258 | void *data; | ||
259 | int ret; | ||
260 | |||
261 | node = ar->dev->of_node; | ||
262 | if (!node) | ||
263 | /* Device Tree is optional, don't print any warnings if | ||
264 | * there's no node for ath10k. | ||
265 | */ | ||
266 | return -ENOENT; | ||
267 | |||
268 | if (!of_get_property(node, "qcom,ath10k-calibration-data", | ||
269 | &data_len)) { | ||
270 | /* The calibration data node is optional */ | ||
271 | return -ENOENT; | ||
272 | } | ||
273 | |||
274 | if (data_len != QCA988X_CAL_DATA_LEN) { | ||
275 | ath10k_warn(ar, "invalid calibration data length in DT: %d\n", | ||
276 | data_len); | ||
277 | ret = -EMSGSIZE; | ||
278 | goto out; | ||
279 | } | ||
280 | |||
281 | data = kmalloc(data_len, GFP_KERNEL); | ||
282 | if (!data) { | ||
283 | ret = -ENOMEM; | ||
284 | goto out; | ||
285 | } | ||
286 | |||
287 | ret = of_property_read_u8_array(node, "qcom,ath10k-calibration-data", | ||
288 | data, data_len); | ||
289 | if (ret) { | ||
290 | ath10k_warn(ar, "failed to read calibration data from DT: %d\n", | ||
291 | ret); | ||
292 | goto out_free; | ||
293 | } | ||
294 | |||
295 | ret = ath10k_download_board_data(ar, data, data_len); | ||
296 | if (ret) { | ||
297 | ath10k_warn(ar, "failed to download calibration data from Device Tree: %d\n", | ||
298 | ret); | ||
299 | goto out_free; | ||
300 | } | ||
301 | |||
302 | ret = 0; | ||
303 | |||
304 | out_free: | ||
305 | kfree(data); | ||
306 | |||
307 | out: | ||
308 | return ret; | ||
309 | } | ||
310 | |||
252 | static int ath10k_download_and_run_otp(struct ath10k *ar) | 311 | static int ath10k_download_and_run_otp(struct ath10k *ar) |
253 | { | 312 | { |
254 | u32 result, address = ar->hw_params.patch_load_addr; | 313 | u32 result, address = ar->hw_params.patch_load_addr; |
@@ -447,7 +506,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
447 | int ie_id, i, index, bit, ret; | 506 | int ie_id, i, index, bit, ret; |
448 | struct ath10k_fw_ie *hdr; | 507 | struct ath10k_fw_ie *hdr; |
449 | const u8 *data; | 508 | const u8 *data; |
450 | __le32 *timestamp; | 509 | __le32 *timestamp, *version; |
451 | 510 | ||
452 | /* first fetch the firmware file (firmware-*.bin) */ | 511 | /* first fetch the firmware file (firmware-*.bin) */ |
453 | ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); | 512 | ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); |
@@ -562,6 +621,17 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
562 | ar->otp_len = ie_len; | 621 | ar->otp_len = ie_len; |
563 | 622 | ||
564 | break; | 623 | break; |
624 | case ATH10K_FW_IE_WMI_OP_VERSION: | ||
625 | if (ie_len != sizeof(u32)) | ||
626 | break; | ||
627 | |||
628 | version = (__le32 *)data; | ||
629 | |||
630 | ar->wmi.op_version = le32_to_cpup(version); | ||
631 | |||
632 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie wmi op version %d\n", | ||
633 | ar->wmi.op_version); | ||
634 | break; | ||
565 | default: | 635 | default: |
566 | ath10k_warn(ar, "Unknown FW IE: %u\n", | 636 | ath10k_warn(ar, "Unknown FW IE: %u\n", |
567 | le32_to_cpu(hdr->id)); | 637 | le32_to_cpu(hdr->id)); |
@@ -582,13 +652,6 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
582 | goto err; | 652 | goto err; |
583 | } | 653 | } |
584 | 654 | ||
585 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features) && | ||
586 | !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
587 | ath10k_err(ar, "feature bits corrupted: 10.2 feature requires 10.x feature to be set as well"); | ||
588 | ret = -EINVAL; | ||
589 | goto err; | ||
590 | } | ||
591 | |||
592 | /* now fetch the board file */ | 655 | /* now fetch the board file */ |
593 | if (ar->hw_params.fw.board == NULL) { | 656 | if (ar->hw_params.fw.board == NULL) { |
594 | ath10k_err(ar, "board data file not defined"); | 657 | ath10k_err(ar, "board data file not defined"); |
@@ -624,6 +687,13 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) | |||
624 | /* calibration file is optional, don't check for any errors */ | 687 | /* calibration file is optional, don't check for any errors */ |
625 | ath10k_fetch_cal_file(ar); | 688 | ath10k_fetch_cal_file(ar); |
626 | 689 | ||
690 | ar->fw_api = 4; | ||
691 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); | ||
692 | |||
693 | ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API4_FILE); | ||
694 | if (ret == 0) | ||
695 | goto success; | ||
696 | |||
627 | ar->fw_api = 3; | 697 | ar->fw_api = 3; |
628 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); | 698 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); |
629 | 699 | ||
@@ -662,7 +732,17 @@ static int ath10k_download_cal_data(struct ath10k *ar) | |||
662 | } | 732 | } |
663 | 733 | ||
664 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | 734 | ath10k_dbg(ar, ATH10K_DBG_BOOT, |
665 | "boot did not find a calibration file, try OTP next: %d\n", | 735 | "boot did not find a calibration file, try DT next: %d\n", |
736 | ret); | ||
737 | |||
738 | ret = ath10k_download_cal_dt(ar); | ||
739 | if (ret == 0) { | ||
740 | ar->cal_mode = ATH10K_CAL_MODE_DT; | ||
741 | goto done; | ||
742 | } | ||
743 | |||
744 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
745 | "boot did not find DT entry, try OTP next: %d\n", | ||
666 | ret); | 746 | ret); |
667 | 747 | ||
668 | ret = ath10k_download_and_run_otp(ar); | 748 | ret = ath10k_download_and_run_otp(ar); |
@@ -696,7 +776,7 @@ static int ath10k_init_uart(struct ath10k *ar) | |||
696 | if (!uart_print) | 776 | if (!uart_print) |
697 | return 0; | 777 | return 0; |
698 | 778 | ||
699 | ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, 7); | 779 | ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, ar->hw_params.uart_pin); |
700 | if (ret) { | 780 | if (ret) { |
701 | ath10k_warn(ar, "could not enable UART prints (%d)\n", ret); | 781 | ath10k_warn(ar, "could not enable UART prints (%d)\n", ret); |
702 | return ret; | 782 | return ret; |
@@ -764,6 +844,7 @@ static void ath10k_core_restart(struct work_struct *work) | |||
764 | complete_all(&ar->offchan_tx_completed); | 844 | complete_all(&ar->offchan_tx_completed); |
765 | complete_all(&ar->install_key_done); | 845 | complete_all(&ar->install_key_done); |
766 | complete_all(&ar->vdev_setup_done); | 846 | complete_all(&ar->vdev_setup_done); |
847 | complete_all(&ar->thermal.wmi_sync); | ||
767 | wake_up(&ar->htt.empty_tx_wq); | 848 | wake_up(&ar->htt.empty_tx_wq); |
768 | wake_up(&ar->wmi.tx_credits_wq); | 849 | wake_up(&ar->wmi.tx_credits_wq); |
769 | wake_up(&ar->peer_mapping_wq); | 850 | wake_up(&ar->peer_mapping_wq); |
@@ -799,15 +880,62 @@ static void ath10k_core_restart(struct work_struct *work) | |||
799 | mutex_unlock(&ar->conf_mutex); | 880 | mutex_unlock(&ar->conf_mutex); |
800 | } | 881 | } |
801 | 882 | ||
802 | static void ath10k_core_init_max_sta_count(struct ath10k *ar) | 883 | static int ath10k_core_init_firmware_features(struct ath10k *ar) |
803 | { | 884 | { |
804 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 885 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features) && |
805 | ar->max_num_peers = TARGET_10X_NUM_PEERS; | 886 | !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { |
806 | ar->max_num_stations = TARGET_10X_NUM_STATIONS; | 887 | ath10k_err(ar, "feature bits corrupted: 10.2 feature requires 10.x feature to be set as well"); |
807 | } else { | 888 | return -EINVAL; |
889 | } | ||
890 | |||
891 | if (ar->wmi.op_version >= ATH10K_FW_WMI_OP_VERSION_MAX) { | ||
892 | ath10k_err(ar, "unsupported WMI OP version (max %d): %d\n", | ||
893 | ATH10K_FW_WMI_OP_VERSION_MAX, ar->wmi.op_version); | ||
894 | return -EINVAL; | ||
895 | } | ||
896 | |||
897 | /* Backwards compatibility for firmwares without | ||
898 | * ATH10K_FW_IE_WMI_OP_VERSION. | ||
899 | */ | ||
900 | if (ar->wmi.op_version == ATH10K_FW_WMI_OP_VERSION_UNSET) { | ||
901 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
902 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, | ||
903 | ar->fw_features)) | ||
904 | ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_2; | ||
905 | else | ||
906 | ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_1; | ||
907 | } else { | ||
908 | ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_MAIN; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | switch (ar->wmi.op_version) { | ||
913 | case ATH10K_FW_WMI_OP_VERSION_MAIN: | ||
808 | ar->max_num_peers = TARGET_NUM_PEERS; | 914 | ar->max_num_peers = TARGET_NUM_PEERS; |
809 | ar->max_num_stations = TARGET_NUM_STATIONS; | 915 | ar->max_num_stations = TARGET_NUM_STATIONS; |
916 | ar->max_num_vdevs = TARGET_NUM_VDEVS; | ||
917 | ar->htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC; | ||
918 | break; | ||
919 | case ATH10K_FW_WMI_OP_VERSION_10_1: | ||
920 | case ATH10K_FW_WMI_OP_VERSION_10_2: | ||
921 | case ATH10K_FW_WMI_OP_VERSION_10_2_4: | ||
922 | ar->max_num_peers = TARGET_10X_NUM_PEERS; | ||
923 | ar->max_num_stations = TARGET_10X_NUM_STATIONS; | ||
924 | ar->max_num_vdevs = TARGET_10X_NUM_VDEVS; | ||
925 | ar->htt.max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC; | ||
926 | break; | ||
927 | case ATH10K_FW_WMI_OP_VERSION_TLV: | ||
928 | ar->max_num_peers = TARGET_TLV_NUM_PEERS; | ||
929 | ar->max_num_stations = TARGET_TLV_NUM_STATIONS; | ||
930 | ar->htt.max_num_pending_tx = TARGET_TLV_NUM_MSDU_DESC; | ||
931 | break; | ||
932 | case ATH10K_FW_WMI_OP_VERSION_UNSET: | ||
933 | case ATH10K_FW_WMI_OP_VERSION_MAX: | ||
934 | WARN_ON(1); | ||
935 | return -EINVAL; | ||
810 | } | 936 | } |
937 | |||
938 | return 0; | ||
811 | } | 939 | } |
812 | 940 | ||
813 | int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode) | 941 | int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode) |
@@ -945,10 +1073,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode) | |||
945 | if (status) | 1073 | if (status) |
946 | goto err_hif_stop; | 1074 | goto err_hif_stop; |
947 | 1075 | ||
948 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) | 1076 | ar->free_vdev_map = (1LL << ar->max_num_vdevs) - 1; |
949 | ar->free_vdev_map = (1LL << TARGET_10X_NUM_VDEVS) - 1; | ||
950 | else | ||
951 | ar->free_vdev_map = (1LL << TARGET_NUM_VDEVS) - 1; | ||
952 | 1077 | ||
953 | INIT_LIST_HEAD(&ar->arvifs); | 1078 | INIT_LIST_HEAD(&ar->arvifs); |
954 | 1079 | ||
@@ -1025,8 +1150,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar) | |||
1025 | ret = ath10k_bmi_get_target_info(ar, &target_info); | 1150 | ret = ath10k_bmi_get_target_info(ar, &target_info); |
1026 | if (ret) { | 1151 | if (ret) { |
1027 | ath10k_err(ar, "could not get target info (%d)\n", ret); | 1152 | ath10k_err(ar, "could not get target info (%d)\n", ret); |
1028 | ath10k_hif_power_down(ar); | 1153 | goto err_power_down; |
1029 | return ret; | ||
1030 | } | 1154 | } |
1031 | 1155 | ||
1032 | ar->target_version = target_info.version; | 1156 | ar->target_version = target_info.version; |
@@ -1035,28 +1159,28 @@ static int ath10k_core_probe_fw(struct ath10k *ar) | |||
1035 | ret = ath10k_init_hw_params(ar); | 1159 | ret = ath10k_init_hw_params(ar); |
1036 | if (ret) { | 1160 | if (ret) { |
1037 | ath10k_err(ar, "could not get hw params (%d)\n", ret); | 1161 | ath10k_err(ar, "could not get hw params (%d)\n", ret); |
1038 | ath10k_hif_power_down(ar); | 1162 | goto err_power_down; |
1039 | return ret; | ||
1040 | } | 1163 | } |
1041 | 1164 | ||
1042 | ret = ath10k_core_fetch_firmware_files(ar); | 1165 | ret = ath10k_core_fetch_firmware_files(ar); |
1043 | if (ret) { | 1166 | if (ret) { |
1044 | ath10k_err(ar, "could not fetch firmware files (%d)\n", ret); | 1167 | ath10k_err(ar, "could not fetch firmware files (%d)\n", ret); |
1045 | ath10k_hif_power_down(ar); | 1168 | goto err_power_down; |
1046 | return ret; | ||
1047 | } | 1169 | } |
1048 | 1170 | ||
1049 | ath10k_core_init_max_sta_count(ar); | 1171 | ret = ath10k_core_init_firmware_features(ar); |
1172 | if (ret) { | ||
1173 | ath10k_err(ar, "fatal problem with firmware features: %d\n", | ||
1174 | ret); | ||
1175 | goto err_free_firmware_files; | ||
1176 | } | ||
1050 | 1177 | ||
1051 | mutex_lock(&ar->conf_mutex); | 1178 | mutex_lock(&ar->conf_mutex); |
1052 | 1179 | ||
1053 | ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL); | 1180 | ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL); |
1054 | if (ret) { | 1181 | if (ret) { |
1055 | ath10k_err(ar, "could not init core (%d)\n", ret); | 1182 | ath10k_err(ar, "could not init core (%d)\n", ret); |
1056 | ath10k_core_free_firmware_files(ar); | 1183 | goto err_unlock; |
1057 | ath10k_hif_power_down(ar); | ||
1058 | mutex_unlock(&ar->conf_mutex); | ||
1059 | return ret; | ||
1060 | } | 1184 | } |
1061 | 1185 | ||
1062 | ath10k_print_driver_info(ar); | 1186 | ath10k_print_driver_info(ar); |
@@ -1066,34 +1190,17 @@ static int ath10k_core_probe_fw(struct ath10k *ar) | |||
1066 | 1190 | ||
1067 | ath10k_hif_power_down(ar); | 1191 | ath10k_hif_power_down(ar); |
1068 | return 0; | 1192 | return 0; |
1069 | } | ||
1070 | |||
1071 | static int ath10k_core_check_chip_id(struct ath10k *ar) | ||
1072 | { | ||
1073 | u32 hw_revision = MS(ar->chip_id, SOC_CHIP_ID_REV); | ||
1074 | |||
1075 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip_id 0x%08x hw_revision 0x%x\n", | ||
1076 | ar->chip_id, hw_revision); | ||
1077 | 1193 | ||
1078 | /* Check that we are not using hw1.0 (some of them have same pci id | 1194 | err_unlock: |
1079 | * as hw2.0) before doing anything else as ath10k crashes horribly | 1195 | mutex_unlock(&ar->conf_mutex); |
1080 | * due to missing hw1.0 workarounds. */ | ||
1081 | switch (hw_revision) { | ||
1082 | case QCA988X_HW_1_0_CHIP_ID_REV: | ||
1083 | ath10k_err(ar, "ERROR: qca988x hw1.0 is not supported\n"); | ||
1084 | return -EOPNOTSUPP; | ||
1085 | 1196 | ||
1086 | case QCA988X_HW_2_0_CHIP_ID_REV: | 1197 | err_free_firmware_files: |
1087 | /* known hardware revision, continue normally */ | 1198 | ath10k_core_free_firmware_files(ar); |
1088 | return 0; | ||
1089 | 1199 | ||
1090 | default: | 1200 | err_power_down: |
1091 | ath10k_warn(ar, "Warning: hardware revision unknown (0x%x), expect problems\n", | 1201 | ath10k_hif_power_down(ar); |
1092 | ar->chip_id); | ||
1093 | return 0; | ||
1094 | } | ||
1095 | 1202 | ||
1096 | return 0; | 1203 | return ret; |
1097 | } | 1204 | } |
1098 | 1205 | ||
1099 | static void ath10k_core_register_work(struct work_struct *work) | 1206 | static void ath10k_core_register_work(struct work_struct *work) |
@@ -1125,9 +1232,18 @@ static void ath10k_core_register_work(struct work_struct *work) | |||
1125 | goto err_debug_destroy; | 1232 | goto err_debug_destroy; |
1126 | } | 1233 | } |
1127 | 1234 | ||
1235 | status = ath10k_thermal_register(ar); | ||
1236 | if (status) { | ||
1237 | ath10k_err(ar, "could not register thermal device: %d\n", | ||
1238 | status); | ||
1239 | goto err_spectral_destroy; | ||
1240 | } | ||
1241 | |||
1128 | set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); | 1242 | set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); |
1129 | return; | 1243 | return; |
1130 | 1244 | ||
1245 | err_spectral_destroy: | ||
1246 | ath10k_spectral_destroy(ar); | ||
1131 | err_debug_destroy: | 1247 | err_debug_destroy: |
1132 | ath10k_debug_destroy(ar); | 1248 | ath10k_debug_destroy(ar); |
1133 | err_unregister_mac: | 1249 | err_unregister_mac: |
@@ -1143,16 +1259,7 @@ err: | |||
1143 | 1259 | ||
1144 | int ath10k_core_register(struct ath10k *ar, u32 chip_id) | 1260 | int ath10k_core_register(struct ath10k *ar, u32 chip_id) |
1145 | { | 1261 | { |
1146 | int status; | ||
1147 | |||
1148 | ar->chip_id = chip_id; | 1262 | ar->chip_id = chip_id; |
1149 | |||
1150 | status = ath10k_core_check_chip_id(ar); | ||
1151 | if (status) { | ||
1152 | ath10k_err(ar, "Unsupported chip id 0x%08x\n", ar->chip_id); | ||
1153 | return status; | ||
1154 | } | ||
1155 | |||
1156 | queue_work(ar->workqueue, &ar->register_work); | 1263 | queue_work(ar->workqueue, &ar->register_work); |
1157 | 1264 | ||
1158 | return 0; | 1265 | return 0; |
@@ -1166,6 +1273,7 @@ void ath10k_core_unregister(struct ath10k *ar) | |||
1166 | if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) | 1273 | if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) |
1167 | return; | 1274 | return; |
1168 | 1275 | ||
1276 | ath10k_thermal_unregister(ar); | ||
1169 | /* Stop spectral before unregistering from mac80211 to remove the | 1277 | /* Stop spectral before unregistering from mac80211 to remove the |
1170 | * relayfs debugfs file cleanly. Otherwise the parent debugfs tree | 1278 | * relayfs debugfs file cleanly. Otherwise the parent debugfs tree |
1171 | * would be already be free'd recursively, leading to a double free. | 1279 | * would be already be free'd recursively, leading to a double free. |
@@ -1198,10 +1306,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, | |||
1198 | 1306 | ||
1199 | ar->ath_common.priv = ar; | 1307 | ar->ath_common.priv = ar; |
1200 | ar->ath_common.hw = ar->hw; | 1308 | ar->ath_common.hw = ar->hw; |
1201 | |||
1202 | ar->p2p = !!ath10k_p2p; | ||
1203 | ar->dev = dev; | 1309 | ar->dev = dev; |
1204 | |||
1205 | ar->hif.ops = hif_ops; | 1310 | ar->hif.ops = hif_ops; |
1206 | ar->hif.bus = bus; | 1311 | ar->hif.bus = bus; |
1207 | 1312 | ||
@@ -1212,6 +1317,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, | |||
1212 | 1317 | ||
1213 | init_completion(&ar->install_key_done); | 1318 | init_completion(&ar->install_key_done); |
1214 | init_completion(&ar->vdev_setup_done); | 1319 | init_completion(&ar->vdev_setup_done); |
1320 | init_completion(&ar->thermal.wmi_sync); | ||
1215 | 1321 | ||
1216 | INIT_DELAYED_WORK(&ar->scan.timeout, ath10k_scan_timeout_work); | 1322 | INIT_DELAYED_WORK(&ar->scan.timeout, ath10k_scan_timeout_work); |
1217 | 1323 | ||
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 514c219263a5..7b6d9e4567a3 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "../regd.h" | 34 | #include "../regd.h" |
35 | #include "../dfs_pattern_detector.h" | 35 | #include "../dfs_pattern_detector.h" |
36 | #include "spectral.h" | 36 | #include "spectral.h" |
37 | #include "thermal.h" | ||
37 | 38 | ||
38 | #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) | 39 | #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) |
39 | #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) | 40 | #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) |
@@ -120,6 +121,7 @@ struct ath10k_mem_chunk { | |||
120 | }; | 121 | }; |
121 | 122 | ||
122 | struct ath10k_wmi { | 123 | struct ath10k_wmi { |
124 | enum ath10k_fw_wmi_op_version op_version; | ||
123 | enum ath10k_htc_ep_id eid; | 125 | enum ath10k_htc_ep_id eid; |
124 | struct completion service_ready; | 126 | struct completion service_ready; |
125 | struct completion unified_ready; | 127 | struct completion unified_ready; |
@@ -128,6 +130,7 @@ struct ath10k_wmi { | |||
128 | struct wmi_cmd_map *cmd; | 130 | struct wmi_cmd_map *cmd; |
129 | struct wmi_vdev_param_map *vdev_param; | 131 | struct wmi_vdev_param_map *vdev_param; |
130 | struct wmi_pdev_param_map *pdev_param; | 132 | struct wmi_pdev_param_map *pdev_param; |
133 | const struct wmi_ops *ops; | ||
131 | 134 | ||
132 | u32 num_mem_chunks; | 135 | u32 num_mem_chunks; |
133 | struct ath10k_mem_chunk mem_chunks[WMI_MAX_MEM_REQS]; | 136 | struct ath10k_mem_chunk mem_chunks[WMI_MAX_MEM_REQS]; |
@@ -325,6 +328,7 @@ struct ath10k_debug { | |||
325 | u32 fw_dbglog_mask; | 328 | u32 fw_dbglog_mask; |
326 | u32 pktlog_filter; | 329 | u32 pktlog_filter; |
327 | u32 reg_addr; | 330 | u32 reg_addr; |
331 | u32 nf_cal_period; | ||
328 | 332 | ||
329 | u8 htt_max_amsdu; | 333 | u8 htt_max_amsdu; |
330 | u8 htt_max_ampdu; | 334 | u8 htt_max_ampdu; |
@@ -369,7 +373,7 @@ enum ath10k_fw_features { | |||
369 | /* wmi_mgmt_rx_hdr contains extra RSSI information */ | 373 | /* wmi_mgmt_rx_hdr contains extra RSSI information */ |
370 | ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0, | 374 | ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0, |
371 | 375 | ||
372 | /* firmware from 10X branch */ | 376 | /* Firmware from 10X branch. Deprecated, don't use in new code. */ |
373 | ATH10K_FW_FEATURE_WMI_10X = 1, | 377 | ATH10K_FW_FEATURE_WMI_10X = 1, |
374 | 378 | ||
375 | /* firmware support tx frame management over WMI, otherwise it's HTT */ | 379 | /* firmware support tx frame management over WMI, otherwise it's HTT */ |
@@ -378,8 +382,9 @@ enum ath10k_fw_features { | |||
378 | /* Firmware does not support P2P */ | 382 | /* Firmware does not support P2P */ |
379 | ATH10K_FW_FEATURE_NO_P2P = 3, | 383 | ATH10K_FW_FEATURE_NO_P2P = 3, |
380 | 384 | ||
381 | /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature bit | 385 | /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature |
382 | * is required to be set as well. | 386 | * bit is required to be set as well. Deprecated, don't use in new |
387 | * code. | ||
383 | */ | 388 | */ |
384 | ATH10K_FW_FEATURE_WMI_10_2 = 4, | 389 | ATH10K_FW_FEATURE_WMI_10_2 = 4, |
385 | 390 | ||
@@ -401,6 +406,7 @@ enum ath10k_dev_flags { | |||
401 | enum ath10k_cal_mode { | 406 | enum ath10k_cal_mode { |
402 | ATH10K_CAL_MODE_FILE, | 407 | ATH10K_CAL_MODE_FILE, |
403 | ATH10K_CAL_MODE_OTP, | 408 | ATH10K_CAL_MODE_OTP, |
409 | ATH10K_CAL_MODE_DT, | ||
404 | }; | 410 | }; |
405 | 411 | ||
406 | static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode) | 412 | static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode) |
@@ -410,6 +416,8 @@ static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode) | |||
410 | return "file"; | 416 | return "file"; |
411 | case ATH10K_CAL_MODE_OTP: | 417 | case ATH10K_CAL_MODE_OTP: |
412 | return "otp"; | 418 | return "otp"; |
419 | case ATH10K_CAL_MODE_DT: | ||
420 | return "dt"; | ||
413 | } | 421 | } |
414 | 422 | ||
415 | return "unknown"; | 423 | return "unknown"; |
@@ -480,12 +488,15 @@ struct ath10k { | |||
480 | u32 id; | 488 | u32 id; |
481 | const char *name; | 489 | const char *name; |
482 | u32 patch_load_addr; | 490 | u32 patch_load_addr; |
491 | int uart_pin; | ||
483 | 492 | ||
484 | struct ath10k_hw_params_fw { | 493 | struct ath10k_hw_params_fw { |
485 | const char *dir; | 494 | const char *dir; |
486 | const char *fw; | 495 | const char *fw; |
487 | const char *otp; | 496 | const char *otp; |
488 | const char *board; | 497 | const char *board; |
498 | size_t board_size; | ||
499 | size_t board_ext_size; | ||
489 | } fw; | 500 | } fw; |
490 | } hw_params; | 501 | } hw_params; |
491 | 502 | ||
@@ -571,6 +582,7 @@ struct ath10k { | |||
571 | 582 | ||
572 | int max_num_peers; | 583 | int max_num_peers; |
573 | int max_num_stations; | 584 | int max_num_stations; |
585 | int max_num_vdevs; | ||
574 | 586 | ||
575 | struct work_struct offchan_tx_work; | 587 | struct work_struct offchan_tx_work; |
576 | struct sk_buff_head offchan_tx_queue; | 588 | struct sk_buff_head offchan_tx_queue; |
@@ -610,6 +622,7 @@ struct ath10k { | |||
610 | /* protected by conf_mutex */ | 622 | /* protected by conf_mutex */ |
611 | const struct firmware *utf; | 623 | const struct firmware *utf; |
612 | DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT); | 624 | DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT); |
625 | enum ath10k_fw_wmi_op_version orig_wmi_op_version; | ||
613 | 626 | ||
614 | /* protected by data_lock */ | 627 | /* protected by data_lock */ |
615 | bool utf_monitor; | 628 | bool utf_monitor; |
@@ -622,6 +635,8 @@ struct ath10k { | |||
622 | u32 fw_cold_reset_counter; | 635 | u32 fw_cold_reset_counter; |
623 | } stats; | 636 | } stats; |
624 | 637 | ||
638 | struct ath10k_thermal thermal; | ||
639 | |||
625 | /* must be last */ | 640 | /* must be last */ |
626 | u8 drv_priv[0] __aligned(sizeof(void *)); | 641 | u8 drv_priv[0] __aligned(sizeof(void *)); |
627 | }; | 642 | }; |
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index a716758f14b0..6ca24427e184 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "core.h" | 23 | #include "core.h" |
24 | #include "debug.h" | 24 | #include "debug.h" |
25 | #include "hif.h" | 25 | #include "hif.h" |
26 | #include "wmi-ops.h" | ||
26 | 27 | ||
27 | /* ms */ | 28 | /* ms */ |
28 | #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000 | 29 | #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000 |
@@ -123,7 +124,7 @@ EXPORT_SYMBOL(ath10k_info); | |||
123 | 124 | ||
124 | void ath10k_print_driver_info(struct ath10k *ar) | 125 | void ath10k_print_driver_info(struct ath10k *ar) |
125 | { | 126 | { |
126 | ath10k_info(ar, "%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d wmi %d.%d.%d.%d cal %s max_sta %d\n", | 127 | ath10k_info(ar, "%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d wmi %d cal %s max_sta %d\n", |
127 | ar->hw_params.name, | 128 | ar->hw_params.name, |
128 | ar->target_version, | 129 | ar->target_version, |
129 | ar->chip_id, | 130 | ar->chip_id, |
@@ -131,10 +132,7 @@ void ath10k_print_driver_info(struct ath10k *ar) | |||
131 | ar->fw_api, | 132 | ar->fw_api, |
132 | ar->htt.target_version_major, | 133 | ar->htt.target_version_major, |
133 | ar->htt.target_version_minor, | 134 | ar->htt.target_version_minor, |
134 | ar->fw_version_major, | 135 | ar->wmi.op_version, |
135 | ar->fw_version_minor, | ||
136 | ar->fw_version_release, | ||
137 | ar->fw_version_build, | ||
138 | ath10k_cal_mode_str(ar->cal_mode), | 136 | ath10k_cal_mode_str(ar->cal_mode), |
139 | ar->max_num_stations); | 137 | ar->max_num_stations); |
140 | ath10k_info(ar, "debug %d debugfs %d tracing %d dfs %d testmode %d\n", | 138 | ath10k_info(ar, "debug %d debugfs %d tracing %d dfs %d testmode %d\n", |
@@ -1607,6 +1605,73 @@ static const struct file_operations fops_cal_data = { | |||
1607 | .llseek = default_llseek, | 1605 | .llseek = default_llseek, |
1608 | }; | 1606 | }; |
1609 | 1607 | ||
1608 | static ssize_t ath10k_read_nf_cal_period(struct file *file, | ||
1609 | char __user *user_buf, | ||
1610 | size_t count, loff_t *ppos) | ||
1611 | { | ||
1612 | struct ath10k *ar = file->private_data; | ||
1613 | unsigned int len; | ||
1614 | char buf[32]; | ||
1615 | |||
1616 | len = scnprintf(buf, sizeof(buf), "%d\n", | ||
1617 | ar->debug.nf_cal_period); | ||
1618 | |||
1619 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1620 | } | ||
1621 | |||
1622 | static ssize_t ath10k_write_nf_cal_period(struct file *file, | ||
1623 | const char __user *user_buf, | ||
1624 | size_t count, loff_t *ppos) | ||
1625 | { | ||
1626 | struct ath10k *ar = file->private_data; | ||
1627 | unsigned long period; | ||
1628 | int ret; | ||
1629 | |||
1630 | ret = kstrtoul_from_user(user_buf, count, 0, &period); | ||
1631 | if (ret) | ||
1632 | return ret; | ||
1633 | |||
1634 | if (period > WMI_PDEV_PARAM_CAL_PERIOD_MAX) | ||
1635 | return -EINVAL; | ||
1636 | |||
1637 | /* there's no way to switch back to the firmware default */ | ||
1638 | if (period == 0) | ||
1639 | return -EINVAL; | ||
1640 | |||
1641 | mutex_lock(&ar->conf_mutex); | ||
1642 | |||
1643 | ar->debug.nf_cal_period = period; | ||
1644 | |||
1645 | if (ar->state != ATH10K_STATE_ON) { | ||
1646 | /* firmware is not running, nothing else to do */ | ||
1647 | ret = count; | ||
1648 | goto exit; | ||
1649 | } | ||
1650 | |||
1651 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->cal_period, | ||
1652 | ar->debug.nf_cal_period); | ||
1653 | if (ret) { | ||
1654 | ath10k_warn(ar, "cal period cfg failed from debugfs: %d\n", | ||
1655 | ret); | ||
1656 | goto exit; | ||
1657 | } | ||
1658 | |||
1659 | ret = count; | ||
1660 | |||
1661 | exit: | ||
1662 | mutex_unlock(&ar->conf_mutex); | ||
1663 | |||
1664 | return ret; | ||
1665 | } | ||
1666 | |||
1667 | static const struct file_operations fops_nf_cal_period = { | ||
1668 | .read = ath10k_read_nf_cal_period, | ||
1669 | .write = ath10k_write_nf_cal_period, | ||
1670 | .open = simple_open, | ||
1671 | .owner = THIS_MODULE, | ||
1672 | .llseek = default_llseek, | ||
1673 | }; | ||
1674 | |||
1610 | int ath10k_debug_start(struct ath10k *ar) | 1675 | int ath10k_debug_start(struct ath10k *ar) |
1611 | { | 1676 | { |
1612 | int ret; | 1677 | int ret; |
@@ -1642,6 +1707,16 @@ int ath10k_debug_start(struct ath10k *ar) | |||
1642 | ath10k_warn(ar, "failed to disable pktlog: %d\n", ret); | 1707 | ath10k_warn(ar, "failed to disable pktlog: %d\n", ret); |
1643 | } | 1708 | } |
1644 | 1709 | ||
1710 | if (ar->debug.nf_cal_period) { | ||
1711 | ret = ath10k_wmi_pdev_set_param(ar, | ||
1712 | ar->wmi.pdev_param->cal_period, | ||
1713 | ar->debug.nf_cal_period); | ||
1714 | if (ret) | ||
1715 | /* not serious */ | ||
1716 | ath10k_warn(ar, "cal period cfg failed from debug start: %d\n", | ||
1717 | ret); | ||
1718 | } | ||
1719 | |||
1645 | return ret; | 1720 | return ret; |
1646 | } | 1721 | } |
1647 | 1722 | ||
@@ -1880,6 +1955,9 @@ int ath10k_debug_register(struct ath10k *ar) | |||
1880 | debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy, | 1955 | debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy, |
1881 | ar, &fops_cal_data); | 1956 | ar, &fops_cal_data); |
1882 | 1957 | ||
1958 | debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR, | ||
1959 | ar->debug.debugfs_phy, ar, &fops_nf_cal_period); | ||
1960 | |||
1883 | if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { | 1961 | if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { |
1884 | debugfs_create_file("dfs_simulate_radar", S_IWUSR, | 1962 | debugfs_create_file("dfs_simulate_radar", S_IWUSR, |
1885 | ar->debug.debugfs_phy, ar, | 1963 | ar->debug.debugfs_phy, ar, |
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 4bc51d8a14a3..a1bda41fb543 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c | |||
@@ -93,11 +93,6 @@ int ath10k_htt_tx_alloc(struct ath10k_htt *htt) | |||
93 | 93 | ||
94 | spin_lock_init(&htt->tx_lock); | 94 | spin_lock_init(&htt->tx_lock); |
95 | 95 | ||
96 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, htt->ar->fw_features)) | ||
97 | htt->max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC; | ||
98 | else | ||
99 | htt->max_num_pending_tx = TARGET_NUM_MSDU_DESC; | ||
100 | |||
101 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt tx max num pending tx %d\n", | 96 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt tx max num pending tx %d\n", |
102 | htt->max_num_pending_tx); | 97 | htt->max_num_pending_tx); |
103 | 98 | ||
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index dfedfd0e0f34..5729901923ac 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h | |||
@@ -37,6 +37,9 @@ | |||
37 | #define ATH10K_FW_API2_FILE "firmware-2.bin" | 37 | #define ATH10K_FW_API2_FILE "firmware-2.bin" |
38 | #define ATH10K_FW_API3_FILE "firmware-3.bin" | 38 | #define ATH10K_FW_API3_FILE "firmware-3.bin" |
39 | 39 | ||
40 | /* added support for ATH10K_FW_IE_WMI_OP_VERSION */ | ||
41 | #define ATH10K_FW_API4_FILE "firmware-4.bin" | ||
42 | |||
40 | #define ATH10K_FW_UTF_FILE "utf.bin" | 43 | #define ATH10K_FW_UTF_FILE "utf.bin" |
41 | 44 | ||
42 | /* includes also the null byte */ | 45 | /* includes also the null byte */ |
@@ -58,6 +61,24 @@ enum ath10k_fw_ie_type { | |||
58 | ATH10K_FW_IE_FEATURES = 2, | 61 | ATH10K_FW_IE_FEATURES = 2, |
59 | ATH10K_FW_IE_FW_IMAGE = 3, | 62 | ATH10K_FW_IE_FW_IMAGE = 3, |
60 | ATH10K_FW_IE_OTP_IMAGE = 4, | 63 | ATH10K_FW_IE_OTP_IMAGE = 4, |
64 | |||
65 | /* WMI "operations" interface version, 32 bit value. Supported from | ||
66 | * FW API 4 and above. | ||
67 | */ | ||
68 | ATH10K_FW_IE_WMI_OP_VERSION = 5, | ||
69 | }; | ||
70 | |||
71 | enum ath10k_fw_wmi_op_version { | ||
72 | ATH10K_FW_WMI_OP_VERSION_UNSET = 0, | ||
73 | |||
74 | ATH10K_FW_WMI_OP_VERSION_MAIN = 1, | ||
75 | ATH10K_FW_WMI_OP_VERSION_10_1 = 2, | ||
76 | ATH10K_FW_WMI_OP_VERSION_10_2 = 3, | ||
77 | ATH10K_FW_WMI_OP_VERSION_TLV = 4, | ||
78 | ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5, | ||
79 | |||
80 | /* keep last */ | ||
81 | ATH10K_FW_WMI_OP_VERSION_MAX, | ||
61 | }; | 82 | }; |
62 | 83 | ||
63 | /* Known pecularities: | 84 | /* Known pecularities: |
@@ -162,6 +183,15 @@ struct ath10k_pktlog_hdr { | |||
162 | #define TARGET_10X_NUM_MSDU_DESC (1024 + 400) | 183 | #define TARGET_10X_NUM_MSDU_DESC (1024 + 400) |
163 | #define TARGET_10X_MAX_FRAG_ENTRIES 0 | 184 | #define TARGET_10X_MAX_FRAG_ENTRIES 0 |
164 | 185 | ||
186 | /* Target specific defines for WMI-TLV firmware */ | ||
187 | #define TARGET_TLV_NUM_VDEVS 3 | ||
188 | #define TARGET_TLV_NUM_STATIONS 32 | ||
189 | #define TARGET_TLV_NUM_PEERS ((TARGET_TLV_NUM_STATIONS) + \ | ||
190 | (TARGET_TLV_NUM_VDEVS) + \ | ||
191 | 2) | ||
192 | #define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2) | ||
193 | #define TARGET_TLV_NUM_MSDU_DESC (1024 + 32) | ||
194 | |||
165 | /* Number of Copy Engines supported */ | 195 | /* Number of Copy Engines supported */ |
166 | #define CE_COUNT 8 | 196 | #define CE_COUNT 8 |
167 | 197 | ||
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c4005670cba2..5085f558d010 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include "htt.h" | 27 | #include "htt.h" |
28 | #include "txrx.h" | 28 | #include "txrx.h" |
29 | #include "testmode.h" | 29 | #include "testmode.h" |
30 | #include "wmi.h" | ||
31 | #include "wmi-ops.h" | ||
30 | 32 | ||
31 | /**********/ | 33 | /**********/ |
32 | /* Crypto */ | 34 | /* Crypto */ |
@@ -267,7 +269,10 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef) | |||
267 | case IEEE80211_BAND_2GHZ: | 269 | case IEEE80211_BAND_2GHZ: |
268 | switch (chandef->width) { | 270 | switch (chandef->width) { |
269 | case NL80211_CHAN_WIDTH_20_NOHT: | 271 | case NL80211_CHAN_WIDTH_20_NOHT: |
270 | phymode = MODE_11G; | 272 | if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) |
273 | phymode = MODE_11B; | ||
274 | else | ||
275 | phymode = MODE_11G; | ||
271 | break; | 276 | break; |
272 | case NL80211_CHAN_WIDTH_20: | 277 | case NL80211_CHAN_WIDTH_20: |
273 | phymode = MODE_11NG_HT20; | 278 | phymode = MODE_11NG_HT20; |
@@ -1046,28 +1051,85 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif, | |||
1046 | arvif->vdev_id, ret); | 1051 | arvif->vdev_id, ret); |
1047 | } | 1052 | } |
1048 | 1053 | ||
1049 | /* | 1054 | static int ath10k_mac_vif_recalc_ps_wake_threshold(struct ath10k_vif *arvif) |
1050 | * Review this when mac80211 gains per-interface powersave support. | 1055 | { |
1051 | */ | 1056 | struct ath10k *ar = arvif->ar; |
1057 | u32 param; | ||
1058 | u32 value; | ||
1059 | int ret; | ||
1060 | |||
1061 | lockdep_assert_held(&arvif->ar->conf_mutex); | ||
1062 | |||
1063 | if (arvif->u.sta.uapsd) | ||
1064 | value = WMI_STA_PS_TX_WAKE_THRESHOLD_NEVER; | ||
1065 | else | ||
1066 | value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS; | ||
1067 | |||
1068 | param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD; | ||
1069 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); | ||
1070 | if (ret) { | ||
1071 | ath10k_warn(ar, "failed to submit ps wake threshold %u on vdev %i: %d\n", | ||
1072 | value, arvif->vdev_id, ret); | ||
1073 | return ret; | ||
1074 | } | ||
1075 | |||
1076 | return 0; | ||
1077 | } | ||
1078 | |||
1079 | static int ath10k_mac_vif_recalc_ps_poll_count(struct ath10k_vif *arvif) | ||
1080 | { | ||
1081 | struct ath10k *ar = arvif->ar; | ||
1082 | u32 param; | ||
1083 | u32 value; | ||
1084 | int ret; | ||
1085 | |||
1086 | lockdep_assert_held(&arvif->ar->conf_mutex); | ||
1087 | |||
1088 | if (arvif->u.sta.uapsd) | ||
1089 | value = WMI_STA_PS_PSPOLL_COUNT_UAPSD; | ||
1090 | else | ||
1091 | value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX; | ||
1092 | |||
1093 | param = WMI_STA_PS_PARAM_PSPOLL_COUNT; | ||
1094 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | ||
1095 | param, value); | ||
1096 | if (ret) { | ||
1097 | ath10k_warn(ar, "failed to submit ps poll count %u on vdev %i: %d\n", | ||
1098 | value, arvif->vdev_id, ret); | ||
1099 | return ret; | ||
1100 | } | ||
1101 | |||
1102 | return 0; | ||
1103 | } | ||
1104 | |||
1052 | static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif) | 1105 | static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif) |
1053 | { | 1106 | { |
1054 | struct ath10k *ar = arvif->ar; | 1107 | struct ath10k *ar = arvif->ar; |
1108 | struct ieee80211_vif *vif = arvif->vif; | ||
1055 | struct ieee80211_conf *conf = &ar->hw->conf; | 1109 | struct ieee80211_conf *conf = &ar->hw->conf; |
1056 | enum wmi_sta_powersave_param param; | 1110 | enum wmi_sta_powersave_param param; |
1057 | enum wmi_sta_ps_mode psmode; | 1111 | enum wmi_sta_ps_mode psmode; |
1058 | int ret; | 1112 | int ret; |
1113 | int ps_timeout; | ||
1059 | 1114 | ||
1060 | lockdep_assert_held(&arvif->ar->conf_mutex); | 1115 | lockdep_assert_held(&arvif->ar->conf_mutex); |
1061 | 1116 | ||
1062 | if (arvif->vif->type != NL80211_IFTYPE_STATION) | 1117 | if (arvif->vif->type != NL80211_IFTYPE_STATION) |
1063 | return 0; | 1118 | return 0; |
1064 | 1119 | ||
1065 | if (conf->flags & IEEE80211_CONF_PS) { | 1120 | if (vif->bss_conf.ps) { |
1066 | psmode = WMI_STA_PS_MODE_ENABLED; | 1121 | psmode = WMI_STA_PS_MODE_ENABLED; |
1067 | param = WMI_STA_PS_PARAM_INACTIVITY_TIME; | 1122 | param = WMI_STA_PS_PARAM_INACTIVITY_TIME; |
1068 | 1123 | ||
1124 | ps_timeout = conf->dynamic_ps_timeout; | ||
1125 | if (ps_timeout == 0) { | ||
1126 | /* Firmware doesn't like 0 */ | ||
1127 | ps_timeout = ieee80211_tu_to_usec( | ||
1128 | vif->bss_conf.beacon_int) / 1000; | ||
1129 | } | ||
1130 | |||
1069 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, | 1131 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, |
1070 | conf->dynamic_ps_timeout); | 1132 | ps_timeout); |
1071 | if (ret) { | 1133 | if (ret) { |
1072 | ath10k_warn(ar, "failed to set inactivity time for vdev %d: %i\n", | 1134 | ath10k_warn(ar, "failed to set inactivity time for vdev %d: %i\n", |
1073 | arvif->vdev_id, ret); | 1135 | arvif->vdev_id, ret); |
@@ -1409,9 +1471,22 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar, | |||
1409 | if (vif->bss_conf.qos) | 1471 | if (vif->bss_conf.qos) |
1410 | arg->peer_flags |= WMI_PEER_QOS; | 1472 | arg->peer_flags |= WMI_PEER_QOS; |
1411 | break; | 1473 | break; |
1474 | case WMI_VDEV_TYPE_IBSS: | ||
1475 | if (sta->wme) | ||
1476 | arg->peer_flags |= WMI_PEER_QOS; | ||
1477 | break; | ||
1412 | default: | 1478 | default: |
1413 | break; | 1479 | break; |
1414 | } | 1480 | } |
1481 | |||
1482 | ath10k_dbg(ar, ATH10K_DBG_MAC, "mac peer %pM qos %d\n", | ||
1483 | sta->addr, !!(arg->peer_flags & WMI_PEER_QOS)); | ||
1484 | } | ||
1485 | |||
1486 | static bool ath10k_mac_sta_has_11g_rates(struct ieee80211_sta *sta) | ||
1487 | { | ||
1488 | /* First 4 rates in ath10k_rates are CCK (11b) rates. */ | ||
1489 | return sta->supp_rates[IEEE80211_BAND_2GHZ] >> 4; | ||
1415 | } | 1490 | } |
1416 | 1491 | ||
1417 | static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, | 1492 | static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, |
@@ -1428,8 +1503,10 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, | |||
1428 | phymode = MODE_11NG_HT40; | 1503 | phymode = MODE_11NG_HT40; |
1429 | else | 1504 | else |
1430 | phymode = MODE_11NG_HT20; | 1505 | phymode = MODE_11NG_HT20; |
1431 | } else { | 1506 | } else if (ath10k_mac_sta_has_11g_rates(sta)) { |
1432 | phymode = MODE_11G; | 1507 | phymode = MODE_11G; |
1508 | } else { | ||
1509 | phymode = MODE_11B; | ||
1433 | } | 1510 | } |
1434 | 1511 | ||
1435 | break; | 1512 | break; |
@@ -2894,10 +2971,11 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2894 | arvif->vdev_id = bit; | 2971 | arvif->vdev_id = bit; |
2895 | arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; | 2972 | arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; |
2896 | 2973 | ||
2897 | if (ar->p2p) | ||
2898 | arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE; | ||
2899 | |||
2900 | switch (vif->type) { | 2974 | switch (vif->type) { |
2975 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2976 | arvif->vdev_type = WMI_VDEV_TYPE_STA; | ||
2977 | arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE; | ||
2978 | break; | ||
2901 | case NL80211_IFTYPE_UNSPECIFIED: | 2979 | case NL80211_IFTYPE_UNSPECIFIED: |
2902 | case NL80211_IFTYPE_STATION: | 2980 | case NL80211_IFTYPE_STATION: |
2903 | arvif->vdev_type = WMI_VDEV_TYPE_STA; | 2981 | arvif->vdev_type = WMI_VDEV_TYPE_STA; |
@@ -3026,22 +3104,16 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
3026 | goto err_peer_delete; | 3104 | goto err_peer_delete; |
3027 | } | 3105 | } |
3028 | 3106 | ||
3029 | param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD; | 3107 | ret = ath10k_mac_vif_recalc_ps_wake_threshold(arvif); |
3030 | value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS; | ||
3031 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | ||
3032 | param, value); | ||
3033 | if (ret) { | 3108 | if (ret) { |
3034 | ath10k_warn(ar, "failed to set vdev %i TX wake thresh: %d\n", | 3109 | ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n", |
3035 | arvif->vdev_id, ret); | 3110 | arvif->vdev_id, ret); |
3036 | goto err_peer_delete; | 3111 | goto err_peer_delete; |
3037 | } | 3112 | } |
3038 | 3113 | ||
3039 | param = WMI_STA_PS_PARAM_PSPOLL_COUNT; | 3114 | ret = ath10k_mac_vif_recalc_ps_poll_count(arvif); |
3040 | value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX; | ||
3041 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | ||
3042 | param, value); | ||
3043 | if (ret) { | 3115 | if (ret) { |
3044 | ath10k_warn(ar, "failed to set vdev %i PSPOLL count: %d\n", | 3116 | ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", |
3045 | arvif->vdev_id, ret); | 3117 | arvif->vdev_id, ret); |
3046 | goto err_peer_delete; | 3118 | goto err_peer_delete; |
3047 | } | 3119 | } |
@@ -3314,6 +3386,13 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
3314 | ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); | 3386 | ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); |
3315 | } | 3387 | } |
3316 | 3388 | ||
3389 | if (changed & BSS_CHANGED_PS) { | ||
3390 | ret = ath10k_mac_vif_setup_ps(arvif); | ||
3391 | if (ret) | ||
3392 | ath10k_warn(ar, "failed to setup ps on vdev %i: %d\n", | ||
3393 | arvif->vdev_id, ret); | ||
3394 | } | ||
3395 | |||
3317 | mutex_unlock(&ar->conf_mutex); | 3396 | mutex_unlock(&ar->conf_mutex); |
3318 | } | 3397 | } |
3319 | 3398 | ||
@@ -3583,8 +3662,9 @@ static void ath10k_sta_rc_update_wk(struct work_struct *wk) | |||
3583 | sta->addr, smps, err); | 3662 | sta->addr, smps, err); |
3584 | } | 3663 | } |
3585 | 3664 | ||
3586 | if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { | 3665 | if (changed & IEEE80211_RC_SUPP_RATES_CHANGED || |
3587 | ath10k_dbg(ar, ATH10K_DBG_MAC, "mac update sta %pM supp rates\n", | 3666 | changed & IEEE80211_RC_NSS_CHANGED) { |
3667 | ath10k_dbg(ar, ATH10K_DBG_MAC, "mac update sta %pM supp rates/nss\n", | ||
3588 | sta->addr); | 3668 | sta->addr); |
3589 | 3669 | ||
3590 | err = ath10k_station_assoc(ar, arvif->vif, sta, true); | 3670 | err = ath10k_station_assoc(ar, arvif->vif, sta, true); |
@@ -3808,6 +3888,20 @@ static int ath10k_conf_tx_uapsd(struct ath10k *ar, struct ieee80211_vif *vif, | |||
3808 | if (ret) | 3888 | if (ret) |
3809 | ath10k_warn(ar, "failed to set rx wake param: %d\n", ret); | 3889 | ath10k_warn(ar, "failed to set rx wake param: %d\n", ret); |
3810 | 3890 | ||
3891 | ret = ath10k_mac_vif_recalc_ps_wake_threshold(arvif); | ||
3892 | if (ret) { | ||
3893 | ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n", | ||
3894 | arvif->vdev_id, ret); | ||
3895 | return ret; | ||
3896 | } | ||
3897 | |||
3898 | ret = ath10k_mac_vif_recalc_ps_poll_count(arvif); | ||
3899 | if (ret) { | ||
3900 | ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", | ||
3901 | arvif->vdev_id, ret); | ||
3902 | return ret; | ||
3903 | } | ||
3904 | |||
3811 | exit: | 3905 | exit: |
3812 | return ret; | 3906 | return ret; |
3813 | } | 3907 | } |
@@ -3989,29 +4083,6 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
3989 | return ret; | 4083 | return ret; |
3990 | } | 4084 | } |
3991 | 4085 | ||
3992 | static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | ||
3993 | { | ||
3994 | struct ath10k *ar = hw->priv; | ||
3995 | struct ath10k_vif *arvif; | ||
3996 | int ret = 0; | ||
3997 | |||
3998 | mutex_lock(&ar->conf_mutex); | ||
3999 | list_for_each_entry(arvif, &ar->arvifs, list) { | ||
4000 | ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n", | ||
4001 | arvif->vdev_id, value); | ||
4002 | |||
4003 | ret = ath10k_mac_set_frag(arvif, value); | ||
4004 | if (ret) { | ||
4005 | ath10k_warn(ar, "failed to set fragmentation threshold for vdev %d: %d\n", | ||
4006 | arvif->vdev_id, ret); | ||
4007 | break; | ||
4008 | } | ||
4009 | } | ||
4010 | mutex_unlock(&ar->conf_mutex); | ||
4011 | |||
4012 | return ret; | ||
4013 | } | ||
4014 | |||
4015 | static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 4086 | static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
4016 | u32 queues, bool drop) | 4087 | u32 queues, bool drop) |
4017 | { | 4088 | { |
@@ -4655,7 +4726,6 @@ static const struct ieee80211_ops ath10k_ops = { | |||
4655 | .remain_on_channel = ath10k_remain_on_channel, | 4726 | .remain_on_channel = ath10k_remain_on_channel, |
4656 | .cancel_remain_on_channel = ath10k_cancel_remain_on_channel, | 4727 | .cancel_remain_on_channel = ath10k_cancel_remain_on_channel, |
4657 | .set_rts_threshold = ath10k_set_rts_threshold, | 4728 | .set_rts_threshold = ath10k_set_rts_threshold, |
4658 | .set_frag_threshold = ath10k_set_frag_threshold, | ||
4659 | .flush = ath10k_flush, | 4729 | .flush = ath10k_flush, |
4660 | .tx_last_beacon = ath10k_tx_last_beacon, | 4730 | .tx_last_beacon = ath10k_tx_last_beacon, |
4661 | .set_antenna = ath10k_set_antenna, | 4731 | .set_antenna = ath10k_set_antenna, |
@@ -4746,6 +4816,9 @@ static const struct ieee80211_channel ath10k_5ghz_channels[] = { | |||
4746 | CHAN5G(165, 5825, 0), | 4816 | CHAN5G(165, 5825, 0), |
4747 | }; | 4817 | }; |
4748 | 4818 | ||
4819 | /* Note: Be careful if you re-order these. There is code which depends on this | ||
4820 | * ordering. | ||
4821 | */ | ||
4749 | static struct ieee80211_rate ath10k_rates[] = { | 4822 | static struct ieee80211_rate ath10k_rates[] = { |
4750 | /* CCK */ | 4823 | /* CCK */ |
4751 | RATETAB_ENT(10, 0x82, 0), | 4824 | RATETAB_ENT(10, 0x82, 0), |
@@ -4799,6 +4872,10 @@ static const struct ieee80211_iface_limit ath10k_if_limits[] = { | |||
4799 | .types = BIT(NL80211_IFTYPE_P2P_GO) | 4872 | .types = BIT(NL80211_IFTYPE_P2P_GO) |
4800 | }, | 4873 | }, |
4801 | { | 4874 | { |
4875 | .max = 1, | ||
4876 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | ||
4877 | }, | ||
4878 | { | ||
4802 | .max = 7, | 4879 | .max = 7, |
4803 | .types = BIT(NL80211_IFTYPE_AP) | 4880 | .types = BIT(NL80211_IFTYPE_AP) |
4804 | }, | 4881 | }, |
@@ -5018,6 +5095,7 @@ int ath10k_mac_register(struct ath10k *ar) | |||
5018 | 5095 | ||
5019 | if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->fw_features)) | 5096 | if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->fw_features)) |
5020 | ar->hw->wiphy->interface_modes |= | 5097 | ar->hw->wiphy->interface_modes |= |
5098 | BIT(NL80211_IFTYPE_P2P_DEVICE) | | ||
5021 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 5099 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
5022 | BIT(NL80211_IFTYPE_P2P_GO); | 5100 | BIT(NL80211_IFTYPE_P2P_GO); |
5023 | 5101 | ||
@@ -5062,16 +5140,26 @@ int ath10k_mac_register(struct ath10k *ar) | |||
5062 | */ | 5140 | */ |
5063 | ar->hw->queues = 4; | 5141 | ar->hw->queues = 4; |
5064 | 5142 | ||
5065 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 5143 | switch (ar->wmi.op_version) { |
5066 | ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; | 5144 | case ATH10K_FW_WMI_OP_VERSION_MAIN: |
5067 | ar->hw->wiphy->n_iface_combinations = | 5145 | case ATH10K_FW_WMI_OP_VERSION_TLV: |
5068 | ARRAY_SIZE(ath10k_10x_if_comb); | ||
5069 | } else { | ||
5070 | ar->hw->wiphy->iface_combinations = ath10k_if_comb; | 5146 | ar->hw->wiphy->iface_combinations = ath10k_if_comb; |
5071 | ar->hw->wiphy->n_iface_combinations = | 5147 | ar->hw->wiphy->n_iface_combinations = |
5072 | ARRAY_SIZE(ath10k_if_comb); | 5148 | ARRAY_SIZE(ath10k_if_comb); |
5073 | |||
5074 | ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); | 5149 | ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); |
5150 | break; | ||
5151 | case ATH10K_FW_WMI_OP_VERSION_10_1: | ||
5152 | case ATH10K_FW_WMI_OP_VERSION_10_2: | ||
5153 | case ATH10K_FW_WMI_OP_VERSION_10_2_4: | ||
5154 | ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; | ||
5155 | ar->hw->wiphy->n_iface_combinations = | ||
5156 | ARRAY_SIZE(ath10k_10x_if_comb); | ||
5157 | break; | ||
5158 | case ATH10K_FW_WMI_OP_VERSION_UNSET: | ||
5159 | case ATH10K_FW_WMI_OP_VERSION_MAX: | ||
5160 | WARN_ON(1); | ||
5161 | ret = -EINVAL; | ||
5162 | goto err_free; | ||
5075 | } | 5163 | } |
5076 | 5164 | ||
5077 | ar->hw->netdev_features = NETIF_F_HW_CSUM; | 5165 | ar->hw->netdev_features = NETIF_F_HW_CSUM; |
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 7abb8367119a..5e50214246f8 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -64,6 +64,14 @@ static const struct pci_device_id ath10k_pci_id_table[] = { | |||
64 | {0} | 64 | {0} |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static const struct ath10k_pci_supp_chip ath10k_pci_supp_chips[] = { | ||
68 | /* QCA988X pre 2.0 chips are not supported because they need some nasty | ||
69 | * hacks. ath10k doesn't have them and these devices crash horribly | ||
70 | * because of that. | ||
71 | */ | ||
72 | { QCA988X_2_0_DEVICE_ID, QCA988X_HW_2_0_CHIP_ID_REV }, | ||
73 | }; | ||
74 | |||
67 | static void ath10k_pci_buffer_cleanup(struct ath10k *ar); | 75 | static void ath10k_pci_buffer_cleanup(struct ath10k *ar); |
68 | static int ath10k_pci_cold_reset(struct ath10k *ar); | 76 | static int ath10k_pci_cold_reset(struct ath10k *ar); |
69 | static int ath10k_pci_warm_reset(struct ath10k *ar); | 77 | static int ath10k_pci_warm_reset(struct ath10k *ar); |
@@ -2476,6 +2484,23 @@ static void ath10k_pci_release(struct ath10k *ar) | |||
2476 | pci_disable_device(pdev); | 2484 | pci_disable_device(pdev); |
2477 | } | 2485 | } |
2478 | 2486 | ||
2487 | static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 chip_id) | ||
2488 | { | ||
2489 | const struct ath10k_pci_supp_chip *supp_chip; | ||
2490 | int i; | ||
2491 | u32 rev_id = MS(chip_id, SOC_CHIP_ID_REV); | ||
2492 | |||
2493 | for (i = 0; i < ARRAY_SIZE(ath10k_pci_supp_chips); i++) { | ||
2494 | supp_chip = &ath10k_pci_supp_chips[i]; | ||
2495 | |||
2496 | if (supp_chip->dev_id == dev_id && | ||
2497 | supp_chip->rev_id == rev_id) | ||
2498 | return true; | ||
2499 | } | ||
2500 | |||
2501 | return false; | ||
2502 | } | ||
2503 | |||
2479 | static int ath10k_pci_probe(struct pci_dev *pdev, | 2504 | static int ath10k_pci_probe(struct pci_dev *pdev, |
2480 | const struct pci_device_id *pci_dev) | 2505 | const struct pci_device_id *pci_dev) |
2481 | { | 2506 | { |
@@ -2521,6 +2546,12 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2521 | goto err_sleep; | 2546 | goto err_sleep; |
2522 | } | 2547 | } |
2523 | 2548 | ||
2549 | if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) { | ||
2550 | ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", | ||
2551 | pdev->device, chip_id); | ||
2552 | goto err_sleep; | ||
2553 | } | ||
2554 | |||
2524 | ret = ath10k_pci_alloc_pipes(ar); | 2555 | ret = ath10k_pci_alloc_pipes(ar); |
2525 | if (ret) { | 2556 | if (ret) { |
2526 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", | 2557 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", |
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index cf36511c7f4d..ce4a1ef89961 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h | |||
@@ -152,6 +152,11 @@ struct ath10k_pci_pipe { | |||
152 | struct tasklet_struct intr; | 152 | struct tasklet_struct intr; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | struct ath10k_pci_supp_chip { | ||
156 | u32 dev_id; | ||
157 | u32 rev_id; | ||
158 | }; | ||
159 | |||
155 | struct ath10k_pci { | 160 | struct ath10k_pci { |
156 | struct pci_dev *pdev; | 161 | struct pci_dev *pdev; |
157 | struct device *dev; | 162 | struct device *dev; |
diff --git a/drivers/net/wireless/ath/ath10k/spectral.c b/drivers/net/wireless/ath/ath10k/spectral.c index 63ce61fcdac8..d22addf6118b 100644 --- a/drivers/net/wireless/ath/ath10k/spectral.c +++ b/drivers/net/wireless/ath/ath10k/spectral.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/relay.h> | 17 | #include <linux/relay.h> |
18 | #include "core.h" | 18 | #include "core.h" |
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | #include "wmi-ops.h" | ||
20 | 21 | ||
21 | static void send_fft_sample(struct ath10k *ar, | 22 | static void send_fft_sample(struct ath10k *ar, |
22 | const struct fft_sample_tlv *fft_sample_tlv) | 23 | const struct fft_sample_tlv *fft_sample_tlv) |
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c b/drivers/net/wireless/ath/ath10k/testmode.c index 483db9cb8c96..b084f88da102 100644 --- a/drivers/net/wireless/ath/ath10k/testmode.c +++ b/drivers/net/wireless/ath/ath10k/testmode.c | |||
@@ -187,13 +187,14 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[]) | |||
187 | 187 | ||
188 | memcpy(ar->testmode.orig_fw_features, ar->fw_features, | 188 | memcpy(ar->testmode.orig_fw_features, ar->fw_features, |
189 | sizeof(ar->fw_features)); | 189 | sizeof(ar->fw_features)); |
190 | ar->testmode.orig_wmi_op_version = ar->wmi.op_version; | ||
190 | 191 | ||
191 | /* utf.bin firmware image does not advertise firmware features. Do | 192 | /* utf.bin firmware image does not advertise firmware features. Do |
192 | * an ugly hack where we force the firmware features so that wmi.c | 193 | * an ugly hack where we force the firmware features so that wmi.c |
193 | * will use the correct WMI interface. | 194 | * will use the correct WMI interface. |
194 | */ | 195 | */ |
195 | memset(ar->fw_features, 0, sizeof(ar->fw_features)); | 196 | memset(ar->fw_features, 0, sizeof(ar->fw_features)); |
196 | __set_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features); | 197 | ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_1; |
197 | 198 | ||
198 | ret = ath10k_hif_power_up(ar); | 199 | ret = ath10k_hif_power_up(ar); |
199 | if (ret) { | 200 | if (ret) { |
@@ -224,6 +225,7 @@ err_fw_features: | |||
224 | /* return the original firmware features */ | 225 | /* return the original firmware features */ |
225 | memcpy(ar->fw_features, ar->testmode.orig_fw_features, | 226 | memcpy(ar->fw_features, ar->testmode.orig_fw_features, |
226 | sizeof(ar->fw_features)); | 227 | sizeof(ar->fw_features)); |
228 | ar->wmi.op_version = ar->testmode.orig_wmi_op_version; | ||
227 | 229 | ||
228 | release_firmware(ar->testmode.utf); | 230 | release_firmware(ar->testmode.utf); |
229 | ar->testmode.utf = NULL; | 231 | ar->testmode.utf = NULL; |
@@ -250,6 +252,7 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar) | |||
250 | /* return the original firmware features */ | 252 | /* return the original firmware features */ |
251 | memcpy(ar->fw_features, ar->testmode.orig_fw_features, | 253 | memcpy(ar->fw_features, ar->testmode.orig_fw_features, |
252 | sizeof(ar->fw_features)); | 254 | sizeof(ar->fw_features)); |
255 | ar->wmi.op_version = ar->testmode.orig_wmi_op_version; | ||
253 | 256 | ||
254 | release_firmware(ar->testmode.utf); | 257 | release_firmware(ar->testmode.utf); |
255 | ar->testmode.utf = NULL; | 258 | ar->testmode.utf = NULL; |
diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c new file mode 100644 index 000000000000..b14ae8d135f6 --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/thermal.c | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Qualcomm Atheros, Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include <linux/device.h> | ||
18 | #include <linux/sysfs.h> | ||
19 | #include <linux/thermal.h> | ||
20 | #include <linux/hwmon.h> | ||
21 | #include <linux/hwmon-sysfs.h> | ||
22 | #include "core.h" | ||
23 | #include "debug.h" | ||
24 | #include "wmi-ops.h" | ||
25 | |||
26 | static int ath10k_thermal_get_active_vifs(struct ath10k *ar, | ||
27 | enum wmi_vdev_type type) | ||
28 | { | ||
29 | struct ath10k_vif *arvif; | ||
30 | int count = 0; | ||
31 | |||
32 | lockdep_assert_held(&ar->conf_mutex); | ||
33 | |||
34 | list_for_each_entry(arvif, &ar->arvifs, list) { | ||
35 | if (!arvif->is_started) | ||
36 | continue; | ||
37 | |||
38 | if (!arvif->is_up) | ||
39 | continue; | ||
40 | |||
41 | if (arvif->vdev_type != type) | ||
42 | continue; | ||
43 | |||
44 | count++; | ||
45 | } | ||
46 | return count; | ||
47 | } | ||
48 | |||
49 | static int ath10k_thermal_get_max_dutycycle(struct thermal_cooling_device *cdev, | ||
50 | unsigned long *state) | ||
51 | { | ||
52 | *state = ATH10K_QUIET_DUTY_CYCLE_MAX; | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static int ath10k_thermal_get_cur_dutycycle(struct thermal_cooling_device *cdev, | ||
58 | unsigned long *state) | ||
59 | { | ||
60 | struct ath10k *ar = cdev->devdata; | ||
61 | |||
62 | mutex_lock(&ar->conf_mutex); | ||
63 | *state = ar->thermal.duty_cycle; | ||
64 | mutex_unlock(&ar->conf_mutex); | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static int ath10k_thermal_set_cur_dutycycle(struct thermal_cooling_device *cdev, | ||
70 | unsigned long duty_cycle) | ||
71 | { | ||
72 | struct ath10k *ar = cdev->devdata; | ||
73 | u32 period, duration, enabled; | ||
74 | int num_bss, ret = 0; | ||
75 | |||
76 | mutex_lock(&ar->conf_mutex); | ||
77 | if (ar->state != ATH10K_STATE_ON) { | ||
78 | ret = -ENETDOWN; | ||
79 | goto out; | ||
80 | } | ||
81 | |||
82 | if (duty_cycle > ATH10K_QUIET_DUTY_CYCLE_MAX) { | ||
83 | ath10k_warn(ar, "duty cycle %ld is exceeding the limit %d\n", | ||
84 | duty_cycle, ATH10K_QUIET_DUTY_CYCLE_MAX); | ||
85 | ret = -EINVAL; | ||
86 | goto out; | ||
87 | } | ||
88 | /* TODO: Right now, thermal mitigation is handled only for single/multi | ||
89 | * vif AP mode. Since quiet param is not validated in STA mode, it needs | ||
90 | * to be investigated further to handle multi STA and multi-vif (AP+STA) | ||
91 | * mode properly. | ||
92 | */ | ||
93 | num_bss = ath10k_thermal_get_active_vifs(ar, WMI_VDEV_TYPE_AP); | ||
94 | if (!num_bss) { | ||
95 | ath10k_warn(ar, "no active AP interfaces\n"); | ||
96 | ret = -ENETDOWN; | ||
97 | goto out; | ||
98 | } | ||
99 | period = max(ATH10K_QUIET_PERIOD_MIN, | ||
100 | (ATH10K_QUIET_PERIOD_DEFAULT / num_bss)); | ||
101 | duration = period * (duty_cycle / 100); | ||
102 | enabled = duration ? 1 : 0; | ||
103 | |||
104 | ret = ath10k_wmi_pdev_set_quiet_mode(ar, period, duration, | ||
105 | ATH10K_QUIET_START_OFFSET, | ||
106 | enabled); | ||
107 | if (ret) { | ||
108 | ath10k_warn(ar, "failed to set quiet mode period %u duarion %u enabled %u ret %d\n", | ||
109 | period, duration, enabled, ret); | ||
110 | goto out; | ||
111 | } | ||
112 | ar->thermal.duty_cycle = duty_cycle; | ||
113 | out: | ||
114 | mutex_unlock(&ar->conf_mutex); | ||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | static struct thermal_cooling_device_ops ath10k_thermal_ops = { | ||
119 | .get_max_state = ath10k_thermal_get_max_dutycycle, | ||
120 | .get_cur_state = ath10k_thermal_get_cur_dutycycle, | ||
121 | .set_cur_state = ath10k_thermal_set_cur_dutycycle, | ||
122 | }; | ||
123 | |||
124 | static ssize_t ath10k_thermal_show_temp(struct device *dev, | ||
125 | struct device_attribute *attr, | ||
126 | char *buf) | ||
127 | { | ||
128 | struct ath10k *ar = dev_get_drvdata(dev); | ||
129 | int ret, temperature; | ||
130 | |||
131 | mutex_lock(&ar->conf_mutex); | ||
132 | |||
133 | /* Can't get temperature when the card is off */ | ||
134 | if (ar->state != ATH10K_STATE_ON) { | ||
135 | ret = -ENETDOWN; | ||
136 | goto out; | ||
137 | } | ||
138 | |||
139 | reinit_completion(&ar->thermal.wmi_sync); | ||
140 | ret = ath10k_wmi_pdev_get_temperature(ar); | ||
141 | if (ret) { | ||
142 | ath10k_warn(ar, "failed to read temperature %d\n", ret); | ||
143 | goto out; | ||
144 | } | ||
145 | |||
146 | if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) { | ||
147 | ret = -ESHUTDOWN; | ||
148 | goto out; | ||
149 | } | ||
150 | |||
151 | ret = wait_for_completion_timeout(&ar->thermal.wmi_sync, | ||
152 | ATH10K_THERMAL_SYNC_TIMEOUT_HZ); | ||
153 | if (ret == 0) { | ||
154 | ath10k_warn(ar, "failed to synchronize thermal read\n"); | ||
155 | ret = -ETIMEDOUT; | ||
156 | goto out; | ||
157 | } | ||
158 | |||
159 | spin_lock_bh(&ar->data_lock); | ||
160 | temperature = ar->thermal.temperature; | ||
161 | spin_unlock_bh(&ar->data_lock); | ||
162 | |||
163 | ret = snprintf(buf, PAGE_SIZE, "%d", temperature); | ||
164 | out: | ||
165 | mutex_unlock(&ar->conf_mutex); | ||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature) | ||
170 | { | ||
171 | spin_lock_bh(&ar->data_lock); | ||
172 | ar->thermal.temperature = temperature; | ||
173 | spin_unlock_bh(&ar->data_lock); | ||
174 | complete(&ar->thermal.wmi_sync); | ||
175 | } | ||
176 | |||
177 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, ath10k_thermal_show_temp, | ||
178 | NULL, 0); | ||
179 | |||
180 | static struct attribute *ath10k_hwmon_attrs[] = { | ||
181 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
182 | NULL, | ||
183 | }; | ||
184 | ATTRIBUTE_GROUPS(ath10k_hwmon); | ||
185 | |||
186 | int ath10k_thermal_register(struct ath10k *ar) | ||
187 | { | ||
188 | struct thermal_cooling_device *cdev; | ||
189 | struct device *hwmon_dev; | ||
190 | int ret; | ||
191 | |||
192 | cdev = thermal_cooling_device_register("ath10k_thermal", ar, | ||
193 | &ath10k_thermal_ops); | ||
194 | |||
195 | if (IS_ERR(cdev)) { | ||
196 | ath10k_err(ar, "failed to setup thermal device result: %ld\n", | ||
197 | PTR_ERR(cdev)); | ||
198 | return -EINVAL; | ||
199 | } | ||
200 | |||
201 | ret = sysfs_create_link(&ar->dev->kobj, &cdev->device.kobj, | ||
202 | "cooling_device"); | ||
203 | if (ret) { | ||
204 | ath10k_err(ar, "failed to create thermal symlink\n"); | ||
205 | goto err_cooling_destroy; | ||
206 | } | ||
207 | |||
208 | ar->thermal.cdev = cdev; | ||
209 | |||
210 | /* Do not register hwmon device when temperature reading is not | ||
211 | * supported by firmware | ||
212 | */ | ||
213 | if (ar->wmi.op_version != ATH10K_FW_WMI_OP_VERSION_10_2_4) | ||
214 | return 0; | ||
215 | |||
216 | /* Avoid linking error on devm_hwmon_device_register_with_groups, I | ||
217 | * guess linux/hwmon.h is missing proper stubs. */ | ||
218 | if (!config_enabled(HWMON)) | ||
219 | return 0; | ||
220 | |||
221 | hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev, | ||
222 | "ath10k_hwmon", ar, | ||
223 | ath10k_hwmon_groups); | ||
224 | if (IS_ERR(hwmon_dev)) { | ||
225 | ath10k_err(ar, "failed to register hwmon device: %ld\n", | ||
226 | PTR_ERR(hwmon_dev)); | ||
227 | ret = -EINVAL; | ||
228 | goto err_remove_link; | ||
229 | } | ||
230 | return 0; | ||
231 | |||
232 | err_remove_link: | ||
233 | sysfs_remove_link(&ar->dev->kobj, "thermal_sensor"); | ||
234 | err_cooling_destroy: | ||
235 | thermal_cooling_device_unregister(cdev); | ||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | void ath10k_thermal_unregister(struct ath10k *ar) | ||
240 | { | ||
241 | thermal_cooling_device_unregister(ar->thermal.cdev); | ||
242 | sysfs_remove_link(&ar->dev->kobj, "cooling_device"); | ||
243 | } | ||
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h new file mode 100644 index 000000000000..bccc17ae0fde --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/thermal.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Qualcomm Atheros, Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | #ifndef _THERMAL_ | ||
17 | #define _THERMAL_ | ||
18 | |||
19 | #define ATH10K_QUIET_PERIOD_DEFAULT 100 | ||
20 | #define ATH10K_QUIET_PERIOD_MIN 25 | ||
21 | #define ATH10K_QUIET_START_OFFSET 10 | ||
22 | #define ATH10K_QUIET_DUTY_CYCLE_MAX 70 | ||
23 | #define ATH10K_HWMON_NAME_LEN 15 | ||
24 | #define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5*HZ) | ||
25 | |||
26 | struct ath10k_thermal { | ||
27 | struct thermal_cooling_device *cdev; | ||
28 | struct completion wmi_sync; | ||
29 | |||
30 | /* protected by conf_mutex */ | ||
31 | u32 duty_cycle; | ||
32 | /* temperature value in Celcius degree | ||
33 | * protected by data_lock | ||
34 | */ | ||
35 | int temperature; | ||
36 | }; | ||
37 | |||
38 | #ifdef CONFIG_THERMAL | ||
39 | int ath10k_thermal_register(struct ath10k *ar); | ||
40 | void ath10k_thermal_unregister(struct ath10k *ar); | ||
41 | void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); | ||
42 | #else | ||
43 | static inline int ath10k_thermal_register(struct ath10k *ar) | ||
44 | { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static inline void ath10k_thermal_unregister(struct ath10k *ar) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | static inline void ath10k_thermal_event_temperature(struct ath10k *ar, | ||
53 | int temperature) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | #endif | ||
58 | #endif /* _THERMAL_ */ | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h new file mode 100644 index 000000000000..20e2c3002bb5 --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h | |||
@@ -0,0 +1,860 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2011 Atheros Communications Inc. | ||
3 | * Copyright (c) 2011-2014 Qualcomm Atheros, Inc. | ||
4 | * | ||
5 | * Permission to use, copy, modify, and/or distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #ifndef _WMI_OPS_H_ | ||
19 | #define _WMI_OPS_H_ | ||
20 | |||
21 | struct ath10k; | ||
22 | struct sk_buff; | ||
23 | |||
24 | struct wmi_ops { | ||
25 | void (*rx)(struct ath10k *ar, struct sk_buff *skb); | ||
26 | void (*map_svc)(const __le32 *in, unsigned long *out, size_t len); | ||
27 | |||
28 | int (*pull_scan)(struct ath10k *ar, struct sk_buff *skb, | ||
29 | struct wmi_scan_ev_arg *arg); | ||
30 | int (*pull_mgmt_rx)(struct ath10k *ar, struct sk_buff *skb, | ||
31 | struct wmi_mgmt_rx_ev_arg *arg); | ||
32 | int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb, | ||
33 | struct wmi_ch_info_ev_arg *arg); | ||
34 | int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb, | ||
35 | struct wmi_vdev_start_ev_arg *arg); | ||
36 | int (*pull_peer_kick)(struct ath10k *ar, struct sk_buff *skb, | ||
37 | struct wmi_peer_kick_ev_arg *arg); | ||
38 | int (*pull_swba)(struct ath10k *ar, struct sk_buff *skb, | ||
39 | struct wmi_swba_ev_arg *arg); | ||
40 | int (*pull_phyerr)(struct ath10k *ar, struct sk_buff *skb, | ||
41 | struct wmi_phyerr_ev_arg *arg); | ||
42 | int (*pull_svc_rdy)(struct ath10k *ar, struct sk_buff *skb, | ||
43 | struct wmi_svc_rdy_ev_arg *arg); | ||
44 | int (*pull_rdy)(struct ath10k *ar, struct sk_buff *skb, | ||
45 | struct wmi_rdy_ev_arg *arg); | ||
46 | int (*pull_fw_stats)(struct ath10k *ar, struct sk_buff *skb, | ||
47 | struct ath10k_fw_stats *stats); | ||
48 | |||
49 | struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt); | ||
50 | struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar); | ||
51 | struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g, | ||
52 | u16 rd5g, u16 ctl2g, u16 ctl5g, | ||
53 | enum wmi_dfs_region dfs_reg); | ||
54 | struct sk_buff *(*gen_pdev_set_param)(struct ath10k *ar, u32 id, | ||
55 | u32 value); | ||
56 | struct sk_buff *(*gen_init)(struct ath10k *ar); | ||
57 | struct sk_buff *(*gen_start_scan)(struct ath10k *ar, | ||
58 | const struct wmi_start_scan_arg *arg); | ||
59 | struct sk_buff *(*gen_stop_scan)(struct ath10k *ar, | ||
60 | const struct wmi_stop_scan_arg *arg); | ||
61 | struct sk_buff *(*gen_vdev_create)(struct ath10k *ar, u32 vdev_id, | ||
62 | enum wmi_vdev_type type, | ||
63 | enum wmi_vdev_subtype subtype, | ||
64 | const u8 macaddr[ETH_ALEN]); | ||
65 | struct sk_buff *(*gen_vdev_delete)(struct ath10k *ar, u32 vdev_id); | ||
66 | struct sk_buff *(*gen_vdev_start)(struct ath10k *ar, | ||
67 | const struct wmi_vdev_start_request_arg *arg, | ||
68 | bool restart); | ||
69 | struct sk_buff *(*gen_vdev_stop)(struct ath10k *ar, u32 vdev_id); | ||
70 | struct sk_buff *(*gen_vdev_up)(struct ath10k *ar, u32 vdev_id, u32 aid, | ||
71 | const u8 *bssid); | ||
72 | struct sk_buff *(*gen_vdev_down)(struct ath10k *ar, u32 vdev_id); | ||
73 | struct sk_buff *(*gen_vdev_set_param)(struct ath10k *ar, u32 vdev_id, | ||
74 | u32 param_id, u32 param_value); | ||
75 | struct sk_buff *(*gen_vdev_install_key)(struct ath10k *ar, | ||
76 | const struct wmi_vdev_install_key_arg *arg); | ||
77 | struct sk_buff *(*gen_vdev_spectral_conf)(struct ath10k *ar, | ||
78 | const struct wmi_vdev_spectral_conf_arg *arg); | ||
79 | struct sk_buff *(*gen_vdev_spectral_enable)(struct ath10k *ar, u32 vdev_id, | ||
80 | u32 trigger, u32 enable); | ||
81 | struct sk_buff *(*gen_peer_create)(struct ath10k *ar, u32 vdev_id, | ||
82 | const u8 peer_addr[ETH_ALEN]); | ||
83 | struct sk_buff *(*gen_peer_delete)(struct ath10k *ar, u32 vdev_id, | ||
84 | const u8 peer_addr[ETH_ALEN]); | ||
85 | struct sk_buff *(*gen_peer_flush)(struct ath10k *ar, u32 vdev_id, | ||
86 | const u8 peer_addr[ETH_ALEN], | ||
87 | u32 tid_bitmap); | ||
88 | struct sk_buff *(*gen_peer_set_param)(struct ath10k *ar, u32 vdev_id, | ||
89 | const u8 *peer_addr, | ||
90 | enum wmi_peer_param param_id, | ||
91 | u32 param_value); | ||
92 | struct sk_buff *(*gen_peer_assoc)(struct ath10k *ar, | ||
93 | const struct wmi_peer_assoc_complete_arg *arg); | ||
94 | struct sk_buff *(*gen_set_psmode)(struct ath10k *ar, u32 vdev_id, | ||
95 | enum wmi_sta_ps_mode psmode); | ||
96 | struct sk_buff *(*gen_set_sta_ps)(struct ath10k *ar, u32 vdev_id, | ||
97 | enum wmi_sta_powersave_param param_id, | ||
98 | u32 value); | ||
99 | struct sk_buff *(*gen_set_ap_ps)(struct ath10k *ar, u32 vdev_id, | ||
100 | const u8 *mac, | ||
101 | enum wmi_ap_ps_peer_param param_id, | ||
102 | u32 value); | ||
103 | struct sk_buff *(*gen_scan_chan_list)(struct ath10k *ar, | ||
104 | const struct wmi_scan_chan_list_arg *arg); | ||
105 | struct sk_buff *(*gen_beacon_dma)(struct ath10k_vif *arvif); | ||
106 | struct sk_buff *(*gen_pdev_set_wmm)(struct ath10k *ar, | ||
107 | const struct wmi_pdev_set_wmm_params_arg *arg); | ||
108 | struct sk_buff *(*gen_request_stats)(struct ath10k *ar, | ||
109 | enum wmi_stats_id stats_id); | ||
110 | struct sk_buff *(*gen_force_fw_hang)(struct ath10k *ar, | ||
111 | enum wmi_force_fw_hang_type type, | ||
112 | u32 delay_ms); | ||
113 | struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb); | ||
114 | struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u32 module_enable); | ||
115 | struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter); | ||
116 | struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar); | ||
117 | struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar, | ||
118 | u32 period, u32 duration, | ||
119 | u32 next_offset, | ||
120 | u32 enabled); | ||
121 | struct sk_buff *(*gen_pdev_get_temperature)(struct ath10k *ar); | ||
122 | }; | ||
123 | |||
124 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); | ||
125 | |||
126 | static inline int | ||
127 | ath10k_wmi_rx(struct ath10k *ar, struct sk_buff *skb) | ||
128 | { | ||
129 | if (WARN_ON_ONCE(!ar->wmi.ops->rx)) | ||
130 | return -EOPNOTSUPP; | ||
131 | |||
132 | ar->wmi.ops->rx(ar, skb); | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static inline int | ||
137 | ath10k_wmi_map_svc(struct ath10k *ar, const __le32 *in, unsigned long *out, | ||
138 | size_t len) | ||
139 | { | ||
140 | if (!ar->wmi.ops->map_svc) | ||
141 | return -EOPNOTSUPP; | ||
142 | |||
143 | ar->wmi.ops->map_svc(in, out, len); | ||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | static inline int | ||
148 | ath10k_wmi_pull_scan(struct ath10k *ar, struct sk_buff *skb, | ||
149 | struct wmi_scan_ev_arg *arg) | ||
150 | { | ||
151 | if (!ar->wmi.ops->pull_scan) | ||
152 | return -EOPNOTSUPP; | ||
153 | |||
154 | return ar->wmi.ops->pull_scan(ar, skb, arg); | ||
155 | } | ||
156 | |||
157 | static inline int | ||
158 | ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb, | ||
159 | struct wmi_mgmt_rx_ev_arg *arg) | ||
160 | { | ||
161 | if (!ar->wmi.ops->pull_mgmt_rx) | ||
162 | return -EOPNOTSUPP; | ||
163 | |||
164 | return ar->wmi.ops->pull_mgmt_rx(ar, skb, arg); | ||
165 | } | ||
166 | |||
167 | static inline int | ||
168 | ath10k_wmi_pull_ch_info(struct ath10k *ar, struct sk_buff *skb, | ||
169 | struct wmi_ch_info_ev_arg *arg) | ||
170 | { | ||
171 | if (!ar->wmi.ops->pull_ch_info) | ||
172 | return -EOPNOTSUPP; | ||
173 | |||
174 | return ar->wmi.ops->pull_ch_info(ar, skb, arg); | ||
175 | } | ||
176 | |||
177 | static inline int | ||
178 | ath10k_wmi_pull_vdev_start(struct ath10k *ar, struct sk_buff *skb, | ||
179 | struct wmi_vdev_start_ev_arg *arg) | ||
180 | { | ||
181 | if (!ar->wmi.ops->pull_vdev_start) | ||
182 | return -EOPNOTSUPP; | ||
183 | |||
184 | return ar->wmi.ops->pull_vdev_start(ar, skb, arg); | ||
185 | } | ||
186 | |||
187 | static inline int | ||
188 | ath10k_wmi_pull_peer_kick(struct ath10k *ar, struct sk_buff *skb, | ||
189 | struct wmi_peer_kick_ev_arg *arg) | ||
190 | { | ||
191 | if (!ar->wmi.ops->pull_peer_kick) | ||
192 | return -EOPNOTSUPP; | ||
193 | |||
194 | return ar->wmi.ops->pull_peer_kick(ar, skb, arg); | ||
195 | } | ||
196 | |||
197 | static inline int | ||
198 | ath10k_wmi_pull_swba(struct ath10k *ar, struct sk_buff *skb, | ||
199 | struct wmi_swba_ev_arg *arg) | ||
200 | { | ||
201 | if (!ar->wmi.ops->pull_swba) | ||
202 | return -EOPNOTSUPP; | ||
203 | |||
204 | return ar->wmi.ops->pull_swba(ar, skb, arg); | ||
205 | } | ||
206 | |||
207 | static inline int | ||
208 | ath10k_wmi_pull_phyerr(struct ath10k *ar, struct sk_buff *skb, | ||
209 | struct wmi_phyerr_ev_arg *arg) | ||
210 | { | ||
211 | if (!ar->wmi.ops->pull_phyerr) | ||
212 | return -EOPNOTSUPP; | ||
213 | |||
214 | return ar->wmi.ops->pull_phyerr(ar, skb, arg); | ||
215 | } | ||
216 | |||
217 | static inline int | ||
218 | ath10k_wmi_pull_svc_rdy(struct ath10k *ar, struct sk_buff *skb, | ||
219 | struct wmi_svc_rdy_ev_arg *arg) | ||
220 | { | ||
221 | if (!ar->wmi.ops->pull_svc_rdy) | ||
222 | return -EOPNOTSUPP; | ||
223 | |||
224 | return ar->wmi.ops->pull_svc_rdy(ar, skb, arg); | ||
225 | } | ||
226 | |||
227 | static inline int | ||
228 | ath10k_wmi_pull_rdy(struct ath10k *ar, struct sk_buff *skb, | ||
229 | struct wmi_rdy_ev_arg *arg) | ||
230 | { | ||
231 | if (!ar->wmi.ops->pull_rdy) | ||
232 | return -EOPNOTSUPP; | ||
233 | |||
234 | return ar->wmi.ops->pull_rdy(ar, skb, arg); | ||
235 | } | ||
236 | |||
237 | static inline int | ||
238 | ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, | ||
239 | struct ath10k_fw_stats *stats) | ||
240 | { | ||
241 | if (!ar->wmi.ops->pull_fw_stats) | ||
242 | return -EOPNOTSUPP; | ||
243 | |||
244 | return ar->wmi.ops->pull_fw_stats(ar, skb, stats); | ||
245 | } | ||
246 | |||
247 | static inline int | ||
248 | ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) | ||
249 | { | ||
250 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); | ||
251 | struct sk_buff *skb; | ||
252 | int ret; | ||
253 | |||
254 | if (!ar->wmi.ops->gen_mgmt_tx) | ||
255 | return -EOPNOTSUPP; | ||
256 | |||
257 | skb = ar->wmi.ops->gen_mgmt_tx(ar, msdu); | ||
258 | if (IS_ERR(skb)) | ||
259 | return PTR_ERR(skb); | ||
260 | |||
261 | ret = ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->mgmt_tx_cmdid); | ||
262 | if (ret) | ||
263 | return ret; | ||
264 | |||
265 | /* FIXME There's no ACK event for Management Tx. This probably | ||
266 | * shouldn't be called here either. */ | ||
267 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
268 | ieee80211_tx_status_irqsafe(ar->hw, msdu); | ||
269 | |||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static inline int | ||
274 | ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, | ||
275 | u16 ctl2g, u16 ctl5g, | ||
276 | enum wmi_dfs_region dfs_reg) | ||
277 | { | ||
278 | struct sk_buff *skb; | ||
279 | |||
280 | if (!ar->wmi.ops->gen_pdev_set_rd) | ||
281 | return -EOPNOTSUPP; | ||
282 | |||
283 | skb = ar->wmi.ops->gen_pdev_set_rd(ar, rd, rd2g, rd5g, ctl2g, ctl5g, | ||
284 | dfs_reg); | ||
285 | if (IS_ERR(skb)) | ||
286 | return PTR_ERR(skb); | ||
287 | |||
288 | return ath10k_wmi_cmd_send(ar, skb, | ||
289 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | ||
290 | } | ||
291 | |||
292 | static inline int | ||
293 | ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) | ||
294 | { | ||
295 | struct sk_buff *skb; | ||
296 | |||
297 | if (!ar->wmi.ops->gen_pdev_suspend) | ||
298 | return -EOPNOTSUPP; | ||
299 | |||
300 | skb = ar->wmi.ops->gen_pdev_suspend(ar, suspend_opt); | ||
301 | if (IS_ERR(skb)) | ||
302 | return PTR_ERR(skb); | ||
303 | |||
304 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_suspend_cmdid); | ||
305 | } | ||
306 | |||
307 | static inline int | ||
308 | ath10k_wmi_pdev_resume_target(struct ath10k *ar) | ||
309 | { | ||
310 | struct sk_buff *skb; | ||
311 | |||
312 | if (!ar->wmi.ops->gen_pdev_resume) | ||
313 | return -EOPNOTSUPP; | ||
314 | |||
315 | skb = ar->wmi.ops->gen_pdev_resume(ar); | ||
316 | if (IS_ERR(skb)) | ||
317 | return PTR_ERR(skb); | ||
318 | |||
319 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_resume_cmdid); | ||
320 | } | ||
321 | |||
322 | static inline int | ||
323 | ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | ||
324 | { | ||
325 | struct sk_buff *skb; | ||
326 | |||
327 | if (!ar->wmi.ops->gen_pdev_set_param) | ||
328 | return -EOPNOTSUPP; | ||
329 | |||
330 | skb = ar->wmi.ops->gen_pdev_set_param(ar, id, value); | ||
331 | if (IS_ERR(skb)) | ||
332 | return PTR_ERR(skb); | ||
333 | |||
334 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_set_param_cmdid); | ||
335 | } | ||
336 | |||
337 | static inline int | ||
338 | ath10k_wmi_cmd_init(struct ath10k *ar) | ||
339 | { | ||
340 | struct sk_buff *skb; | ||
341 | |||
342 | if (!ar->wmi.ops->gen_init) | ||
343 | return -EOPNOTSUPP; | ||
344 | |||
345 | skb = ar->wmi.ops->gen_init(ar); | ||
346 | if (IS_ERR(skb)) | ||
347 | return PTR_ERR(skb); | ||
348 | |||
349 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->init_cmdid); | ||
350 | } | ||
351 | |||
352 | static inline int | ||
353 | ath10k_wmi_start_scan(struct ath10k *ar, | ||
354 | const struct wmi_start_scan_arg *arg) | ||
355 | { | ||
356 | struct sk_buff *skb; | ||
357 | |||
358 | if (!ar->wmi.ops->gen_start_scan) | ||
359 | return -EOPNOTSUPP; | ||
360 | |||
361 | skb = ar->wmi.ops->gen_start_scan(ar, arg); | ||
362 | if (IS_ERR(skb)) | ||
363 | return PTR_ERR(skb); | ||
364 | |||
365 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->start_scan_cmdid); | ||
366 | } | ||
367 | |||
368 | static inline int | ||
369 | ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) | ||
370 | { | ||
371 | struct sk_buff *skb; | ||
372 | |||
373 | if (!ar->wmi.ops->gen_stop_scan) | ||
374 | return -EOPNOTSUPP; | ||
375 | |||
376 | skb = ar->wmi.ops->gen_stop_scan(ar, arg); | ||
377 | if (IS_ERR(skb)) | ||
378 | return PTR_ERR(skb); | ||
379 | |||
380 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->stop_scan_cmdid); | ||
381 | } | ||
382 | |||
383 | static inline int | ||
384 | ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, | ||
385 | enum wmi_vdev_type type, | ||
386 | enum wmi_vdev_subtype subtype, | ||
387 | const u8 macaddr[ETH_ALEN]) | ||
388 | { | ||
389 | struct sk_buff *skb; | ||
390 | |||
391 | if (!ar->wmi.ops->gen_vdev_create) | ||
392 | return -EOPNOTSUPP; | ||
393 | |||
394 | skb = ar->wmi.ops->gen_vdev_create(ar, vdev_id, type, subtype, macaddr); | ||
395 | if (IS_ERR(skb)) | ||
396 | return PTR_ERR(skb); | ||
397 | |||
398 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_create_cmdid); | ||
399 | } | ||
400 | |||
401 | static inline int | ||
402 | ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id) | ||
403 | { | ||
404 | struct sk_buff *skb; | ||
405 | |||
406 | if (!ar->wmi.ops->gen_vdev_delete) | ||
407 | return -EOPNOTSUPP; | ||
408 | |||
409 | skb = ar->wmi.ops->gen_vdev_delete(ar, vdev_id); | ||
410 | if (IS_ERR(skb)) | ||
411 | return PTR_ERR(skb); | ||
412 | |||
413 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_delete_cmdid); | ||
414 | } | ||
415 | |||
416 | static inline int | ||
417 | ath10k_wmi_vdev_start(struct ath10k *ar, | ||
418 | const struct wmi_vdev_start_request_arg *arg) | ||
419 | { | ||
420 | struct sk_buff *skb; | ||
421 | |||
422 | if (!ar->wmi.ops->gen_vdev_start) | ||
423 | return -EOPNOTSUPP; | ||
424 | |||
425 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, false); | ||
426 | if (IS_ERR(skb)) | ||
427 | return PTR_ERR(skb); | ||
428 | |||
429 | return ath10k_wmi_cmd_send(ar, skb, | ||
430 | ar->wmi.cmd->vdev_start_request_cmdid); | ||
431 | } | ||
432 | |||
433 | static inline int | ||
434 | ath10k_wmi_vdev_restart(struct ath10k *ar, | ||
435 | const struct wmi_vdev_start_request_arg *arg) | ||
436 | { | ||
437 | struct sk_buff *skb; | ||
438 | |||
439 | if (!ar->wmi.ops->gen_vdev_start) | ||
440 | return -EOPNOTSUPP; | ||
441 | |||
442 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, true); | ||
443 | if (IS_ERR(skb)) | ||
444 | return PTR_ERR(skb); | ||
445 | |||
446 | return ath10k_wmi_cmd_send(ar, skb, | ||
447 | ar->wmi.cmd->vdev_restart_request_cmdid); | ||
448 | } | ||
449 | |||
450 | static inline int | ||
451 | ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id) | ||
452 | { | ||
453 | struct sk_buff *skb; | ||
454 | |||
455 | if (!ar->wmi.ops->gen_vdev_stop) | ||
456 | return -EOPNOTSUPP; | ||
457 | |||
458 | skb = ar->wmi.ops->gen_vdev_stop(ar, vdev_id); | ||
459 | if (IS_ERR(skb)) | ||
460 | return PTR_ERR(skb); | ||
461 | |||
462 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_stop_cmdid); | ||
463 | } | ||
464 | |||
465 | static inline int | ||
466 | ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) | ||
467 | { | ||
468 | struct sk_buff *skb; | ||
469 | |||
470 | if (!ar->wmi.ops->gen_vdev_up) | ||
471 | return -EOPNOTSUPP; | ||
472 | |||
473 | skb = ar->wmi.ops->gen_vdev_up(ar, vdev_id, aid, bssid); | ||
474 | if (IS_ERR(skb)) | ||
475 | return PTR_ERR(skb); | ||
476 | |||
477 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_up_cmdid); | ||
478 | } | ||
479 | |||
480 | static inline int | ||
481 | ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id) | ||
482 | { | ||
483 | struct sk_buff *skb; | ||
484 | |||
485 | if (!ar->wmi.ops->gen_vdev_down) | ||
486 | return -EOPNOTSUPP; | ||
487 | |||
488 | skb = ar->wmi.ops->gen_vdev_down(ar, vdev_id); | ||
489 | if (IS_ERR(skb)) | ||
490 | return PTR_ERR(skb); | ||
491 | |||
492 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_down_cmdid); | ||
493 | } | ||
494 | |||
495 | static inline int | ||
496 | ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, u32 param_id, | ||
497 | u32 param_value) | ||
498 | { | ||
499 | struct sk_buff *skb; | ||
500 | |||
501 | if (!ar->wmi.ops->gen_vdev_set_param) | ||
502 | return -EOPNOTSUPP; | ||
503 | |||
504 | skb = ar->wmi.ops->gen_vdev_set_param(ar, vdev_id, param_id, | ||
505 | param_value); | ||
506 | if (IS_ERR(skb)) | ||
507 | return PTR_ERR(skb); | ||
508 | |||
509 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_set_param_cmdid); | ||
510 | } | ||
511 | |||
512 | static inline int | ||
513 | ath10k_wmi_vdev_install_key(struct ath10k *ar, | ||
514 | const struct wmi_vdev_install_key_arg *arg) | ||
515 | { | ||
516 | struct sk_buff *skb; | ||
517 | |||
518 | if (!ar->wmi.ops->gen_vdev_install_key) | ||
519 | return -EOPNOTSUPP; | ||
520 | |||
521 | skb = ar->wmi.ops->gen_vdev_install_key(ar, arg); | ||
522 | if (IS_ERR(skb)) | ||
523 | return PTR_ERR(skb); | ||
524 | |||
525 | return ath10k_wmi_cmd_send(ar, skb, | ||
526 | ar->wmi.cmd->vdev_install_key_cmdid); | ||
527 | } | ||
528 | |||
529 | static inline int | ||
530 | ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, | ||
531 | const struct wmi_vdev_spectral_conf_arg *arg) | ||
532 | { | ||
533 | struct sk_buff *skb; | ||
534 | u32 cmd_id; | ||
535 | |||
536 | skb = ar->wmi.ops->gen_vdev_spectral_conf(ar, arg); | ||
537 | if (IS_ERR(skb)) | ||
538 | return PTR_ERR(skb); | ||
539 | |||
540 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_configure_cmdid; | ||
541 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | ||
542 | } | ||
543 | |||
544 | static inline int | ||
545 | ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, | ||
546 | u32 enable) | ||
547 | { | ||
548 | struct sk_buff *skb; | ||
549 | u32 cmd_id; | ||
550 | |||
551 | skb = ar->wmi.ops->gen_vdev_spectral_enable(ar, vdev_id, trigger, | ||
552 | enable); | ||
553 | if (IS_ERR(skb)) | ||
554 | return PTR_ERR(skb); | ||
555 | |||
556 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_enable_cmdid; | ||
557 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | ||
558 | } | ||
559 | |||
560 | static inline int | ||
561 | ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, | ||
562 | const u8 peer_addr[ETH_ALEN]) | ||
563 | { | ||
564 | struct sk_buff *skb; | ||
565 | |||
566 | if (!ar->wmi.ops->gen_peer_create) | ||
567 | return -EOPNOTSUPP; | ||
568 | |||
569 | skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr); | ||
570 | if (IS_ERR(skb)) | ||
571 | return PTR_ERR(skb); | ||
572 | |||
573 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_create_cmdid); | ||
574 | } | ||
575 | |||
576 | static inline int | ||
577 | ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, | ||
578 | const u8 peer_addr[ETH_ALEN]) | ||
579 | { | ||
580 | struct sk_buff *skb; | ||
581 | |||
582 | if (!ar->wmi.ops->gen_peer_delete) | ||
583 | return -EOPNOTSUPP; | ||
584 | |||
585 | skb = ar->wmi.ops->gen_peer_delete(ar, vdev_id, peer_addr); | ||
586 | if (IS_ERR(skb)) | ||
587 | return PTR_ERR(skb); | ||
588 | |||
589 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_delete_cmdid); | ||
590 | } | ||
591 | |||
592 | static inline int | ||
593 | ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, | ||
594 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) | ||
595 | { | ||
596 | struct sk_buff *skb; | ||
597 | |||
598 | if (!ar->wmi.ops->gen_peer_flush) | ||
599 | return -EOPNOTSUPP; | ||
600 | |||
601 | skb = ar->wmi.ops->gen_peer_flush(ar, vdev_id, peer_addr, tid_bitmap); | ||
602 | if (IS_ERR(skb)) | ||
603 | return PTR_ERR(skb); | ||
604 | |||
605 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_flush_tids_cmdid); | ||
606 | } | ||
607 | |||
608 | static inline int | ||
609 | ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, const u8 *peer_addr, | ||
610 | enum wmi_peer_param param_id, u32 param_value) | ||
611 | { | ||
612 | struct sk_buff *skb; | ||
613 | |||
614 | if (!ar->wmi.ops->gen_peer_set_param) | ||
615 | return -EOPNOTSUPP; | ||
616 | |||
617 | skb = ar->wmi.ops->gen_peer_set_param(ar, vdev_id, peer_addr, param_id, | ||
618 | param_value); | ||
619 | if (IS_ERR(skb)) | ||
620 | return PTR_ERR(skb); | ||
621 | |||
622 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_set_param_cmdid); | ||
623 | } | ||
624 | |||
625 | static inline int | ||
626 | ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, | ||
627 | enum wmi_sta_ps_mode psmode) | ||
628 | { | ||
629 | struct sk_buff *skb; | ||
630 | |||
631 | if (!ar->wmi.ops->gen_set_psmode) | ||
632 | return -EOPNOTSUPP; | ||
633 | |||
634 | skb = ar->wmi.ops->gen_set_psmode(ar, vdev_id, psmode); | ||
635 | if (IS_ERR(skb)) | ||
636 | return PTR_ERR(skb); | ||
637 | |||
638 | return ath10k_wmi_cmd_send(ar, skb, | ||
639 | ar->wmi.cmd->sta_powersave_mode_cmdid); | ||
640 | } | ||
641 | |||
642 | static inline int | ||
643 | ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, | ||
644 | enum wmi_sta_powersave_param param_id, u32 value) | ||
645 | { | ||
646 | struct sk_buff *skb; | ||
647 | |||
648 | if (!ar->wmi.ops->gen_set_sta_ps) | ||
649 | return -EOPNOTSUPP; | ||
650 | |||
651 | skb = ar->wmi.ops->gen_set_sta_ps(ar, vdev_id, param_id, value); | ||
652 | if (IS_ERR(skb)) | ||
653 | return PTR_ERR(skb); | ||
654 | |||
655 | return ath10k_wmi_cmd_send(ar, skb, | ||
656 | ar->wmi.cmd->sta_powersave_param_cmdid); | ||
657 | } | ||
658 | |||
659 | static inline int | ||
660 | ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, | ||
661 | enum wmi_ap_ps_peer_param param_id, u32 value) | ||
662 | { | ||
663 | struct sk_buff *skb; | ||
664 | |||
665 | if (!ar->wmi.ops->gen_set_ap_ps) | ||
666 | return -EOPNOTSUPP; | ||
667 | |||
668 | skb = ar->wmi.ops->gen_set_ap_ps(ar, vdev_id, mac, param_id, value); | ||
669 | if (IS_ERR(skb)) | ||
670 | return PTR_ERR(skb); | ||
671 | |||
672 | return ath10k_wmi_cmd_send(ar, skb, | ||
673 | ar->wmi.cmd->ap_ps_peer_param_cmdid); | ||
674 | } | ||
675 | |||
676 | static inline int | ||
677 | ath10k_wmi_scan_chan_list(struct ath10k *ar, | ||
678 | const struct wmi_scan_chan_list_arg *arg) | ||
679 | { | ||
680 | struct sk_buff *skb; | ||
681 | |||
682 | if (!ar->wmi.ops->gen_scan_chan_list) | ||
683 | return -EOPNOTSUPP; | ||
684 | |||
685 | skb = ar->wmi.ops->gen_scan_chan_list(ar, arg); | ||
686 | if (IS_ERR(skb)) | ||
687 | return PTR_ERR(skb); | ||
688 | |||
689 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->scan_chan_list_cmdid); | ||
690 | } | ||
691 | |||
692 | static inline int | ||
693 | ath10k_wmi_peer_assoc(struct ath10k *ar, | ||
694 | const struct wmi_peer_assoc_complete_arg *arg) | ||
695 | { | ||
696 | struct sk_buff *skb; | ||
697 | |||
698 | if (!ar->wmi.ops->gen_peer_assoc) | ||
699 | return -EOPNOTSUPP; | ||
700 | |||
701 | skb = ar->wmi.ops->gen_peer_assoc(ar, arg); | ||
702 | if (IS_ERR(skb)) | ||
703 | return PTR_ERR(skb); | ||
704 | |||
705 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); | ||
706 | } | ||
707 | |||
708 | static inline int | ||
709 | ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif) | ||
710 | { | ||
711 | struct ath10k *ar = arvif->ar; | ||
712 | struct sk_buff *skb; | ||
713 | int ret; | ||
714 | |||
715 | if (!ar->wmi.ops->gen_beacon_dma) | ||
716 | return -EOPNOTSUPP; | ||
717 | |||
718 | skb = ar->wmi.ops->gen_beacon_dma(arvif); | ||
719 | if (IS_ERR(skb)) | ||
720 | return PTR_ERR(skb); | ||
721 | |||
722 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, | ||
723 | ar->wmi.cmd->pdev_send_bcn_cmdid); | ||
724 | if (ret) { | ||
725 | dev_kfree_skb(skb); | ||
726 | return ret; | ||
727 | } | ||
728 | |||
729 | return 0; | ||
730 | } | ||
731 | |||
732 | static inline int | ||
733 | ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, | ||
734 | const struct wmi_pdev_set_wmm_params_arg *arg) | ||
735 | { | ||
736 | struct sk_buff *skb; | ||
737 | |||
738 | if (!ar->wmi.ops->gen_pdev_set_wmm) | ||
739 | return -EOPNOTSUPP; | ||
740 | |||
741 | skb = ar->wmi.ops->gen_pdev_set_wmm(ar, arg); | ||
742 | if (IS_ERR(skb)) | ||
743 | return PTR_ERR(skb); | ||
744 | |||
745 | return ath10k_wmi_cmd_send(ar, skb, | ||
746 | ar->wmi.cmd->pdev_set_wmm_params_cmdid); | ||
747 | } | ||
748 | |||
749 | static inline int | ||
750 | ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id) | ||
751 | { | ||
752 | struct sk_buff *skb; | ||
753 | |||
754 | if (!ar->wmi.ops->gen_request_stats) | ||
755 | return -EOPNOTSUPP; | ||
756 | |||
757 | skb = ar->wmi.ops->gen_request_stats(ar, stats_id); | ||
758 | if (IS_ERR(skb)) | ||
759 | return PTR_ERR(skb); | ||
760 | |||
761 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); | ||
762 | } | ||
763 | |||
764 | static inline int | ||
765 | ath10k_wmi_force_fw_hang(struct ath10k *ar, | ||
766 | enum wmi_force_fw_hang_type type, u32 delay_ms) | ||
767 | { | ||
768 | struct sk_buff *skb; | ||
769 | |||
770 | if (!ar->wmi.ops->gen_force_fw_hang) | ||
771 | return -EOPNOTSUPP; | ||
772 | |||
773 | skb = ar->wmi.ops->gen_force_fw_hang(ar, type, delay_ms); | ||
774 | if (IS_ERR(skb)) | ||
775 | return PTR_ERR(skb); | ||
776 | |||
777 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); | ||
778 | } | ||
779 | |||
780 | static inline int | ||
781 | ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) | ||
782 | { | ||
783 | struct sk_buff *skb; | ||
784 | |||
785 | if (!ar->wmi.ops->gen_dbglog_cfg) | ||
786 | return -EOPNOTSUPP; | ||
787 | |||
788 | skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable); | ||
789 | if (IS_ERR(skb)) | ||
790 | return PTR_ERR(skb); | ||
791 | |||
792 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid); | ||
793 | } | ||
794 | |||
795 | static inline int | ||
796 | ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 filter) | ||
797 | { | ||
798 | struct sk_buff *skb; | ||
799 | |||
800 | if (!ar->wmi.ops->gen_pktlog_enable) | ||
801 | return -EOPNOTSUPP; | ||
802 | |||
803 | skb = ar->wmi.ops->gen_pktlog_enable(ar, filter); | ||
804 | if (IS_ERR(skb)) | ||
805 | return PTR_ERR(skb); | ||
806 | |||
807 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_pktlog_enable_cmdid); | ||
808 | } | ||
809 | |||
810 | static inline int | ||
811 | ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar) | ||
812 | { | ||
813 | struct sk_buff *skb; | ||
814 | |||
815 | if (!ar->wmi.ops->gen_pktlog_disable) | ||
816 | return -EOPNOTSUPP; | ||
817 | |||
818 | skb = ar->wmi.ops->gen_pktlog_disable(ar); | ||
819 | if (IS_ERR(skb)) | ||
820 | return PTR_ERR(skb); | ||
821 | |||
822 | return ath10k_wmi_cmd_send(ar, skb, | ||
823 | ar->wmi.cmd->pdev_pktlog_disable_cmdid); | ||
824 | } | ||
825 | |||
826 | static inline int | ||
827 | ath10k_wmi_pdev_set_quiet_mode(struct ath10k *ar, u32 period, u32 duration, | ||
828 | u32 next_offset, u32 enabled) | ||
829 | { | ||
830 | struct sk_buff *skb; | ||
831 | |||
832 | if (!ar->wmi.ops->gen_pdev_set_quiet_mode) | ||
833 | return -EOPNOTSUPP; | ||
834 | |||
835 | skb = ar->wmi.ops->gen_pdev_set_quiet_mode(ar, period, duration, | ||
836 | next_offset, enabled); | ||
837 | if (IS_ERR(skb)) | ||
838 | return PTR_ERR(skb); | ||
839 | |||
840 | return ath10k_wmi_cmd_send(ar, skb, | ||
841 | ar->wmi.cmd->pdev_set_quiet_mode_cmdid); | ||
842 | } | ||
843 | |||
844 | static inline int | ||
845 | ath10k_wmi_pdev_get_temperature(struct ath10k *ar) | ||
846 | { | ||
847 | struct sk_buff *skb; | ||
848 | |||
849 | if (!ar->wmi.ops->gen_pdev_get_temperature) | ||
850 | return -EOPNOTSUPP; | ||
851 | |||
852 | skb = ar->wmi.ops->gen_pdev_get_temperature(ar); | ||
853 | if (IS_ERR(skb)) | ||
854 | return PTR_ERR(skb); | ||
855 | |||
856 | return ath10k_wmi_cmd_send(ar, skb, | ||
857 | ar->wmi.cmd->pdev_get_temperature_cmdid); | ||
858 | } | ||
859 | |||
860 | #endif | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c new file mode 100644 index 000000000000..4c050cec3966 --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c | |||
@@ -0,0 +1,2222 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2011 Atheros Communications Inc. | ||
3 | * Copyright (c) 2011-2014 Qualcomm Atheros, Inc. | ||
4 | * | ||
5 | * Permission to use, copy, modify, and/or distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | #include "core.h" | ||
18 | #include "debug.h" | ||
19 | #include "hw.h" | ||
20 | #include "wmi.h" | ||
21 | #include "wmi-ops.h" | ||
22 | #include "wmi-tlv.h" | ||
23 | |||
24 | /***************/ | ||
25 | /* TLV helpers */ | ||
26 | /**************/ | ||
27 | |||
28 | struct wmi_tlv_policy { | ||
29 | size_t min_len; | ||
30 | }; | ||
31 | |||
32 | static const struct wmi_tlv_policy wmi_tlv_policies[] = { | ||
33 | [WMI_TLV_TAG_ARRAY_BYTE] | ||
34 | = { .min_len = sizeof(u8) }, | ||
35 | [WMI_TLV_TAG_ARRAY_UINT32] | ||
36 | = { .min_len = sizeof(u32) }, | ||
37 | [WMI_TLV_TAG_STRUCT_SCAN_EVENT] | ||
38 | = { .min_len = sizeof(struct wmi_scan_event) }, | ||
39 | [WMI_TLV_TAG_STRUCT_MGMT_RX_HDR] | ||
40 | = { .min_len = sizeof(struct wmi_tlv_mgmt_rx_ev) }, | ||
41 | [WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT] | ||
42 | = { .min_len = sizeof(struct wmi_chan_info_event) }, | ||
43 | [WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT] | ||
44 | = { .min_len = sizeof(struct wmi_vdev_start_response_event) }, | ||
45 | [WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT] | ||
46 | = { .min_len = sizeof(struct wmi_peer_sta_kickout_event) }, | ||
47 | [WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT] | ||
48 | = { .min_len = sizeof(struct wmi_host_swba_event) }, | ||
49 | [WMI_TLV_TAG_STRUCT_TIM_INFO] | ||
50 | = { .min_len = sizeof(struct wmi_tim_info) }, | ||
51 | [WMI_TLV_TAG_STRUCT_P2P_NOA_INFO] | ||
52 | = { .min_len = sizeof(struct wmi_p2p_noa_info) }, | ||
53 | [WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT] | ||
54 | = { .min_len = sizeof(struct wmi_tlv_svc_rdy_ev) }, | ||
55 | [WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES] | ||
56 | = { .min_len = sizeof(struct hal_reg_capabilities) }, | ||
57 | [WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ] | ||
58 | = { .min_len = sizeof(struct wlan_host_mem_req) }, | ||
59 | [WMI_TLV_TAG_STRUCT_READY_EVENT] | ||
60 | = { .min_len = sizeof(struct wmi_tlv_rdy_ev) }, | ||
61 | }; | ||
62 | |||
63 | static int | ||
64 | ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len, | ||
65 | int (*iter)(struct ath10k *ar, u16 tag, u16 len, | ||
66 | const void *ptr, void *data), | ||
67 | void *data) | ||
68 | { | ||
69 | const void *begin = ptr; | ||
70 | const struct wmi_tlv *tlv; | ||
71 | u16 tlv_tag, tlv_len; | ||
72 | int ret; | ||
73 | |||
74 | while (len > 0) { | ||
75 | if (len < sizeof(*tlv)) { | ||
76 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
77 | "wmi tlv parse failure at byte %zd (%zu bytes left, %zu expected)\n", | ||
78 | ptr - begin, len, sizeof(*tlv)); | ||
79 | return -EINVAL; | ||
80 | } | ||
81 | |||
82 | tlv = ptr; | ||
83 | tlv_tag = __le16_to_cpu(tlv->tag); | ||
84 | tlv_len = __le16_to_cpu(tlv->len); | ||
85 | ptr += sizeof(*tlv); | ||
86 | len -= sizeof(*tlv); | ||
87 | |||
88 | if (tlv_len > len) { | ||
89 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
90 | "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n", | ||
91 | tlv_tag, ptr - begin, len, tlv_len); | ||
92 | return -EINVAL; | ||
93 | } | ||
94 | |||
95 | if (tlv_tag < ARRAY_SIZE(wmi_tlv_policies) && | ||
96 | wmi_tlv_policies[tlv_tag].min_len && | ||
97 | wmi_tlv_policies[tlv_tag].min_len > tlv_len) { | ||
98 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
99 | "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n", | ||
100 | tlv_tag, ptr - begin, tlv_len, | ||
101 | wmi_tlv_policies[tlv_tag].min_len); | ||
102 | return -EINVAL; | ||
103 | } | ||
104 | |||
105 | ret = iter(ar, tlv_tag, tlv_len, ptr, data); | ||
106 | if (ret) | ||
107 | return ret; | ||
108 | |||
109 | ptr += tlv_len; | ||
110 | len -= tlv_len; | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int ath10k_wmi_tlv_iter_parse(struct ath10k *ar, u16 tag, u16 len, | ||
117 | const void *ptr, void *data) | ||
118 | { | ||
119 | const void **tb = data; | ||
120 | |||
121 | if (tag < WMI_TLV_TAG_MAX) | ||
122 | tb[tag] = ptr; | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static int ath10k_wmi_tlv_parse(struct ath10k *ar, const void **tb, | ||
128 | const void *ptr, size_t len) | ||
129 | { | ||
130 | return ath10k_wmi_tlv_iter(ar, ptr, len, ath10k_wmi_tlv_iter_parse, | ||
131 | (void *)tb); | ||
132 | } | ||
133 | |||
134 | static const void ** | ||
135 | ath10k_wmi_tlv_parse_alloc(struct ath10k *ar, const void *ptr, | ||
136 | size_t len, gfp_t gfp) | ||
137 | { | ||
138 | const void **tb; | ||
139 | int ret; | ||
140 | |||
141 | tb = kzalloc(sizeof(*tb) * WMI_TLV_TAG_MAX, gfp); | ||
142 | if (!tb) | ||
143 | return ERR_PTR(-ENOMEM); | ||
144 | |||
145 | ret = ath10k_wmi_tlv_parse(ar, tb, ptr, len); | ||
146 | if (ret) { | ||
147 | kfree(tb); | ||
148 | return ERR_PTR(ret); | ||
149 | } | ||
150 | |||
151 | return tb; | ||
152 | } | ||
153 | |||
154 | static u16 ath10k_wmi_tlv_len(const void *ptr) | ||
155 | { | ||
156 | return __le16_to_cpu((((const struct wmi_tlv *)ptr) - 1)->len); | ||
157 | } | ||
158 | |||
159 | /***********/ | ||
160 | /* TLV ops */ | ||
161 | /***********/ | ||
162 | |||
163 | static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb) | ||
164 | { | ||
165 | struct wmi_cmd_hdr *cmd_hdr; | ||
166 | enum wmi_tlv_event_id id; | ||
167 | |||
168 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; | ||
169 | id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); | ||
170 | |||
171 | if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL) | ||
172 | return; | ||
173 | |||
174 | trace_ath10k_wmi_event(ar, id, skb->data, skb->len); | ||
175 | |||
176 | switch (id) { | ||
177 | case WMI_TLV_MGMT_RX_EVENTID: | ||
178 | ath10k_wmi_event_mgmt_rx(ar, skb); | ||
179 | /* mgmt_rx() owns the skb now! */ | ||
180 | return; | ||
181 | case WMI_TLV_SCAN_EVENTID: | ||
182 | ath10k_wmi_event_scan(ar, skb); | ||
183 | break; | ||
184 | case WMI_TLV_CHAN_INFO_EVENTID: | ||
185 | ath10k_wmi_event_chan_info(ar, skb); | ||
186 | break; | ||
187 | case WMI_TLV_ECHO_EVENTID: | ||
188 | ath10k_wmi_event_echo(ar, skb); | ||
189 | break; | ||
190 | case WMI_TLV_DEBUG_MESG_EVENTID: | ||
191 | ath10k_wmi_event_debug_mesg(ar, skb); | ||
192 | break; | ||
193 | case WMI_TLV_UPDATE_STATS_EVENTID: | ||
194 | ath10k_wmi_event_update_stats(ar, skb); | ||
195 | break; | ||
196 | case WMI_TLV_VDEV_START_RESP_EVENTID: | ||
197 | ath10k_wmi_event_vdev_start_resp(ar, skb); | ||
198 | break; | ||
199 | case WMI_TLV_VDEV_STOPPED_EVENTID: | ||
200 | ath10k_wmi_event_vdev_stopped(ar, skb); | ||
201 | break; | ||
202 | case WMI_TLV_PEER_STA_KICKOUT_EVENTID: | ||
203 | ath10k_wmi_event_peer_sta_kickout(ar, skb); | ||
204 | break; | ||
205 | case WMI_TLV_HOST_SWBA_EVENTID: | ||
206 | ath10k_wmi_event_host_swba(ar, skb); | ||
207 | break; | ||
208 | case WMI_TLV_TBTTOFFSET_UPDATE_EVENTID: | ||
209 | ath10k_wmi_event_tbttoffset_update(ar, skb); | ||
210 | break; | ||
211 | case WMI_TLV_PHYERR_EVENTID: | ||
212 | ath10k_wmi_event_phyerr(ar, skb); | ||
213 | break; | ||
214 | case WMI_TLV_ROAM_EVENTID: | ||
215 | ath10k_wmi_event_roam(ar, skb); | ||
216 | break; | ||
217 | case WMI_TLV_PROFILE_MATCH: | ||
218 | ath10k_wmi_event_profile_match(ar, skb); | ||
219 | break; | ||
220 | case WMI_TLV_DEBUG_PRINT_EVENTID: | ||
221 | ath10k_wmi_event_debug_print(ar, skb); | ||
222 | break; | ||
223 | case WMI_TLV_PDEV_QVIT_EVENTID: | ||
224 | ath10k_wmi_event_pdev_qvit(ar, skb); | ||
225 | break; | ||
226 | case WMI_TLV_WLAN_PROFILE_DATA_EVENTID: | ||
227 | ath10k_wmi_event_wlan_profile_data(ar, skb); | ||
228 | break; | ||
229 | case WMI_TLV_RTT_MEASUREMENT_REPORT_EVENTID: | ||
230 | ath10k_wmi_event_rtt_measurement_report(ar, skb); | ||
231 | break; | ||
232 | case WMI_TLV_TSF_MEASUREMENT_REPORT_EVENTID: | ||
233 | ath10k_wmi_event_tsf_measurement_report(ar, skb); | ||
234 | break; | ||
235 | case WMI_TLV_RTT_ERROR_REPORT_EVENTID: | ||
236 | ath10k_wmi_event_rtt_error_report(ar, skb); | ||
237 | break; | ||
238 | case WMI_TLV_WOW_WAKEUP_HOST_EVENTID: | ||
239 | ath10k_wmi_event_wow_wakeup_host(ar, skb); | ||
240 | break; | ||
241 | case WMI_TLV_DCS_INTERFERENCE_EVENTID: | ||
242 | ath10k_wmi_event_dcs_interference(ar, skb); | ||
243 | break; | ||
244 | case WMI_TLV_PDEV_TPC_CONFIG_EVENTID: | ||
245 | ath10k_wmi_event_pdev_tpc_config(ar, skb); | ||
246 | break; | ||
247 | case WMI_TLV_PDEV_FTM_INTG_EVENTID: | ||
248 | ath10k_wmi_event_pdev_ftm_intg(ar, skb); | ||
249 | break; | ||
250 | case WMI_TLV_GTK_OFFLOAD_STATUS_EVENTID: | ||
251 | ath10k_wmi_event_gtk_offload_status(ar, skb); | ||
252 | break; | ||
253 | case WMI_TLV_GTK_REKEY_FAIL_EVENTID: | ||
254 | ath10k_wmi_event_gtk_rekey_fail(ar, skb); | ||
255 | break; | ||
256 | case WMI_TLV_TX_DELBA_COMPLETE_EVENTID: | ||
257 | ath10k_wmi_event_delba_complete(ar, skb); | ||
258 | break; | ||
259 | case WMI_TLV_TX_ADDBA_COMPLETE_EVENTID: | ||
260 | ath10k_wmi_event_addba_complete(ar, skb); | ||
261 | break; | ||
262 | case WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID: | ||
263 | ath10k_wmi_event_vdev_install_key_complete(ar, skb); | ||
264 | break; | ||
265 | case WMI_TLV_SERVICE_READY_EVENTID: | ||
266 | ath10k_wmi_event_service_ready(ar, skb); | ||
267 | break; | ||
268 | case WMI_TLV_READY_EVENTID: | ||
269 | ath10k_wmi_event_ready(ar, skb); | ||
270 | break; | ||
271 | default: | ||
272 | ath10k_warn(ar, "Unknown eventid: %d\n", id); | ||
273 | break; | ||
274 | } | ||
275 | |||
276 | dev_kfree_skb(skb); | ||
277 | } | ||
278 | |||
279 | static int ath10k_wmi_tlv_op_pull_scan_ev(struct ath10k *ar, | ||
280 | struct sk_buff *skb, | ||
281 | struct wmi_scan_ev_arg *arg) | ||
282 | { | ||
283 | const void **tb; | ||
284 | const struct wmi_scan_event *ev; | ||
285 | int ret; | ||
286 | |||
287 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
288 | if (IS_ERR(tb)) { | ||
289 | ret = PTR_ERR(tb); | ||
290 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
291 | return ret; | ||
292 | } | ||
293 | |||
294 | ev = tb[WMI_TLV_TAG_STRUCT_SCAN_EVENT]; | ||
295 | if (!ev) { | ||
296 | kfree(tb); | ||
297 | return -EPROTO; | ||
298 | } | ||
299 | |||
300 | arg->event_type = ev->event_type; | ||
301 | arg->reason = ev->reason; | ||
302 | arg->channel_freq = ev->channel_freq; | ||
303 | arg->scan_req_id = ev->scan_req_id; | ||
304 | arg->scan_id = ev->scan_id; | ||
305 | arg->vdev_id = ev->vdev_id; | ||
306 | |||
307 | kfree(tb); | ||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | static int ath10k_wmi_tlv_op_pull_mgmt_rx_ev(struct ath10k *ar, | ||
312 | struct sk_buff *skb, | ||
313 | struct wmi_mgmt_rx_ev_arg *arg) | ||
314 | { | ||
315 | const void **tb; | ||
316 | const struct wmi_tlv_mgmt_rx_ev *ev; | ||
317 | const u8 *frame; | ||
318 | u32 msdu_len; | ||
319 | int ret; | ||
320 | |||
321 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
322 | if (IS_ERR(tb)) { | ||
323 | ret = PTR_ERR(tb); | ||
324 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
325 | return ret; | ||
326 | } | ||
327 | |||
328 | ev = tb[WMI_TLV_TAG_STRUCT_MGMT_RX_HDR]; | ||
329 | frame = tb[WMI_TLV_TAG_ARRAY_BYTE]; | ||
330 | |||
331 | if (!ev || !frame) { | ||
332 | kfree(tb); | ||
333 | return -EPROTO; | ||
334 | } | ||
335 | |||
336 | arg->channel = ev->channel; | ||
337 | arg->buf_len = ev->buf_len; | ||
338 | arg->status = ev->status; | ||
339 | arg->snr = ev->snr; | ||
340 | arg->phy_mode = ev->phy_mode; | ||
341 | arg->rate = ev->rate; | ||
342 | |||
343 | msdu_len = __le32_to_cpu(arg->buf_len); | ||
344 | |||
345 | if (skb->len < (frame - skb->data) + msdu_len) { | ||
346 | kfree(tb); | ||
347 | return -EPROTO; | ||
348 | } | ||
349 | |||
350 | /* shift the sk_buff to point to `frame` */ | ||
351 | skb_trim(skb, 0); | ||
352 | skb_put(skb, frame - skb->data); | ||
353 | skb_pull(skb, frame - skb->data); | ||
354 | skb_put(skb, msdu_len); | ||
355 | |||
356 | kfree(tb); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static int ath10k_wmi_tlv_op_pull_ch_info_ev(struct ath10k *ar, | ||
361 | struct sk_buff *skb, | ||
362 | struct wmi_ch_info_ev_arg *arg) | ||
363 | { | ||
364 | const void **tb; | ||
365 | const struct wmi_chan_info_event *ev; | ||
366 | int ret; | ||
367 | |||
368 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
369 | if (IS_ERR(tb)) { | ||
370 | ret = PTR_ERR(tb); | ||
371 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
372 | return ret; | ||
373 | } | ||
374 | |||
375 | ev = tb[WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT]; | ||
376 | if (!ev) { | ||
377 | kfree(tb); | ||
378 | return -EPROTO; | ||
379 | } | ||
380 | |||
381 | arg->err_code = ev->err_code; | ||
382 | arg->freq = ev->freq; | ||
383 | arg->cmd_flags = ev->cmd_flags; | ||
384 | arg->noise_floor = ev->noise_floor; | ||
385 | arg->rx_clear_count = ev->rx_clear_count; | ||
386 | arg->cycle_count = ev->cycle_count; | ||
387 | |||
388 | kfree(tb); | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static int | ||
393 | ath10k_wmi_tlv_op_pull_vdev_start_ev(struct ath10k *ar, struct sk_buff *skb, | ||
394 | struct wmi_vdev_start_ev_arg *arg) | ||
395 | { | ||
396 | const void **tb; | ||
397 | const struct wmi_vdev_start_response_event *ev; | ||
398 | int ret; | ||
399 | |||
400 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
401 | if (IS_ERR(tb)) { | ||
402 | ret = PTR_ERR(tb); | ||
403 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
404 | return ret; | ||
405 | } | ||
406 | |||
407 | ev = tb[WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT]; | ||
408 | if (!ev) { | ||
409 | kfree(tb); | ||
410 | return -EPROTO; | ||
411 | } | ||
412 | |||
413 | skb_pull(skb, sizeof(*ev)); | ||
414 | arg->vdev_id = ev->vdev_id; | ||
415 | arg->req_id = ev->req_id; | ||
416 | arg->resp_type = ev->resp_type; | ||
417 | arg->status = ev->status; | ||
418 | |||
419 | kfree(tb); | ||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int ath10k_wmi_tlv_op_pull_peer_kick_ev(struct ath10k *ar, | ||
424 | struct sk_buff *skb, | ||
425 | struct wmi_peer_kick_ev_arg *arg) | ||
426 | { | ||
427 | const void **tb; | ||
428 | const struct wmi_peer_sta_kickout_event *ev; | ||
429 | int ret; | ||
430 | |||
431 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
432 | if (IS_ERR(tb)) { | ||
433 | ret = PTR_ERR(tb); | ||
434 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
438 | ev = tb[WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT]; | ||
439 | if (!ev) { | ||
440 | kfree(tb); | ||
441 | return -EPROTO; | ||
442 | } | ||
443 | |||
444 | arg->mac_addr = ev->peer_macaddr.addr; | ||
445 | |||
446 | kfree(tb); | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | struct wmi_tlv_swba_parse { | ||
451 | const struct wmi_host_swba_event *ev; | ||
452 | bool tim_done; | ||
453 | bool noa_done; | ||
454 | size_t n_tim; | ||
455 | size_t n_noa; | ||
456 | struct wmi_swba_ev_arg *arg; | ||
457 | }; | ||
458 | |||
459 | static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k *ar, u16 tag, u16 len, | ||
460 | const void *ptr, void *data) | ||
461 | { | ||
462 | struct wmi_tlv_swba_parse *swba = data; | ||
463 | |||
464 | if (tag != WMI_TLV_TAG_STRUCT_TIM_INFO) | ||
465 | return -EPROTO; | ||
466 | |||
467 | if (swba->n_tim >= ARRAY_SIZE(swba->arg->tim_info)) | ||
468 | return -ENOBUFS; | ||
469 | |||
470 | swba->arg->tim_info[swba->n_tim++] = ptr; | ||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static int ath10k_wmi_tlv_swba_noa_parse(struct ath10k *ar, u16 tag, u16 len, | ||
475 | const void *ptr, void *data) | ||
476 | { | ||
477 | struct wmi_tlv_swba_parse *swba = data; | ||
478 | |||
479 | if (tag != WMI_TLV_TAG_STRUCT_P2P_NOA_INFO) | ||
480 | return -EPROTO; | ||
481 | |||
482 | if (swba->n_noa >= ARRAY_SIZE(swba->arg->noa_info)) | ||
483 | return -ENOBUFS; | ||
484 | |||
485 | swba->arg->noa_info[swba->n_noa++] = ptr; | ||
486 | return 0; | ||
487 | } | ||
488 | |||
489 | static int ath10k_wmi_tlv_swba_parse(struct ath10k *ar, u16 tag, u16 len, | ||
490 | const void *ptr, void *data) | ||
491 | { | ||
492 | struct wmi_tlv_swba_parse *swba = data; | ||
493 | int ret; | ||
494 | |||
495 | switch (tag) { | ||
496 | case WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT: | ||
497 | swba->ev = ptr; | ||
498 | break; | ||
499 | case WMI_TLV_TAG_ARRAY_STRUCT: | ||
500 | if (!swba->tim_done) { | ||
501 | swba->tim_done = true; | ||
502 | ret = ath10k_wmi_tlv_iter(ar, ptr, len, | ||
503 | ath10k_wmi_tlv_swba_tim_parse, | ||
504 | swba); | ||
505 | if (ret) | ||
506 | return ret; | ||
507 | } else if (!swba->noa_done) { | ||
508 | swba->noa_done = true; | ||
509 | ret = ath10k_wmi_tlv_iter(ar, ptr, len, | ||
510 | ath10k_wmi_tlv_swba_noa_parse, | ||
511 | swba); | ||
512 | if (ret) | ||
513 | return ret; | ||
514 | } | ||
515 | break; | ||
516 | default: | ||
517 | break; | ||
518 | } | ||
519 | return 0; | ||
520 | } | ||
521 | |||
522 | static int ath10k_wmi_tlv_op_pull_swba_ev(struct ath10k *ar, | ||
523 | struct sk_buff *skb, | ||
524 | struct wmi_swba_ev_arg *arg) | ||
525 | { | ||
526 | struct wmi_tlv_swba_parse swba = { .arg = arg }; | ||
527 | u32 map; | ||
528 | size_t n_vdevs; | ||
529 | int ret; | ||
530 | |||
531 | ret = ath10k_wmi_tlv_iter(ar, skb->data, skb->len, | ||
532 | ath10k_wmi_tlv_swba_parse, &swba); | ||
533 | if (ret) { | ||
534 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
535 | return ret; | ||
536 | } | ||
537 | |||
538 | if (!swba.ev) | ||
539 | return -EPROTO; | ||
540 | |||
541 | arg->vdev_map = swba.ev->vdev_map; | ||
542 | |||
543 | for (map = __le32_to_cpu(arg->vdev_map), n_vdevs = 0; map; map >>= 1) | ||
544 | if (map & BIT(0)) | ||
545 | n_vdevs++; | ||
546 | |||
547 | if (n_vdevs != swba.n_tim || | ||
548 | n_vdevs != swba.n_noa) | ||
549 | return -EPROTO; | ||
550 | |||
551 | return 0; | ||
552 | } | ||
553 | |||
554 | static int ath10k_wmi_tlv_op_pull_phyerr_ev(struct ath10k *ar, | ||
555 | struct sk_buff *skb, | ||
556 | struct wmi_phyerr_ev_arg *arg) | ||
557 | { | ||
558 | const void **tb; | ||
559 | const struct wmi_tlv_phyerr_ev *ev; | ||
560 | const void *phyerrs; | ||
561 | int ret; | ||
562 | |||
563 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
564 | if (IS_ERR(tb)) { | ||
565 | ret = PTR_ERR(tb); | ||
566 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
567 | return ret; | ||
568 | } | ||
569 | |||
570 | ev = tb[WMI_TLV_TAG_STRUCT_COMB_PHYERR_RX_HDR]; | ||
571 | phyerrs = tb[WMI_TLV_TAG_ARRAY_BYTE]; | ||
572 | |||
573 | if (!ev || !phyerrs) { | ||
574 | kfree(tb); | ||
575 | return -EPROTO; | ||
576 | } | ||
577 | |||
578 | arg->num_phyerrs = ev->num_phyerrs; | ||
579 | arg->tsf_l32 = ev->tsf_l32; | ||
580 | arg->tsf_u32 = ev->tsf_u32; | ||
581 | arg->buf_len = ev->buf_len; | ||
582 | arg->phyerrs = phyerrs; | ||
583 | |||
584 | kfree(tb); | ||
585 | return 0; | ||
586 | } | ||
587 | |||
588 | #define WMI_TLV_ABI_VER_NS0 0x5F414351 | ||
589 | #define WMI_TLV_ABI_VER_NS1 0x00004C4D | ||
590 | #define WMI_TLV_ABI_VER_NS2 0x00000000 | ||
591 | #define WMI_TLV_ABI_VER_NS3 0x00000000 | ||
592 | |||
593 | #define WMI_TLV_ABI_VER0_MAJOR 1 | ||
594 | #define WMI_TLV_ABI_VER0_MINOR 0 | ||
595 | #define WMI_TLV_ABI_VER0 ((((WMI_TLV_ABI_VER0_MAJOR) << 24) & 0xFF000000) | \ | ||
596 | (((WMI_TLV_ABI_VER0_MINOR) << 0) & 0x00FFFFFF)) | ||
597 | #define WMI_TLV_ABI_VER1 53 | ||
598 | |||
599 | static int | ||
600 | ath10k_wmi_tlv_parse_mem_reqs(struct ath10k *ar, u16 tag, u16 len, | ||
601 | const void *ptr, void *data) | ||
602 | { | ||
603 | struct wmi_svc_rdy_ev_arg *arg = data; | ||
604 | int i; | ||
605 | |||
606 | if (tag != WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ) | ||
607 | return -EPROTO; | ||
608 | |||
609 | for (i = 0; i < ARRAY_SIZE(arg->mem_reqs); i++) { | ||
610 | if (!arg->mem_reqs[i]) { | ||
611 | arg->mem_reqs[i] = ptr; | ||
612 | return 0; | ||
613 | } | ||
614 | } | ||
615 | |||
616 | return -ENOMEM; | ||
617 | } | ||
618 | |||
619 | static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct ath10k *ar, | ||
620 | struct sk_buff *skb, | ||
621 | struct wmi_svc_rdy_ev_arg *arg) | ||
622 | { | ||
623 | const void **tb; | ||
624 | const struct hal_reg_capabilities *reg; | ||
625 | const struct wmi_tlv_svc_rdy_ev *ev; | ||
626 | const __le32 *svc_bmap; | ||
627 | const struct wlan_host_mem_req *mem_reqs; | ||
628 | int ret; | ||
629 | |||
630 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
631 | if (IS_ERR(tb)) { | ||
632 | ret = PTR_ERR(tb); | ||
633 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
634 | return ret; | ||
635 | } | ||
636 | |||
637 | ev = tb[WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT]; | ||
638 | reg = tb[WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES]; | ||
639 | svc_bmap = tb[WMI_TLV_TAG_ARRAY_UINT32]; | ||
640 | mem_reqs = tb[WMI_TLV_TAG_ARRAY_STRUCT]; | ||
641 | |||
642 | if (!ev || !reg || !svc_bmap || !mem_reqs) { | ||
643 | kfree(tb); | ||
644 | return -EPROTO; | ||
645 | } | ||
646 | |||
647 | /* This is an internal ABI compatibility check for WMI TLV so check it | ||
648 | * here instead of the generic WMI code. | ||
649 | */ | ||
650 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
651 | "wmi tlv abi 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x, 0x%08x ?= 0x%08x\n", | ||
652 | __le32_to_cpu(ev->abi.abi_ver0), WMI_TLV_ABI_VER0, | ||
653 | __le32_to_cpu(ev->abi.abi_ver_ns0), WMI_TLV_ABI_VER_NS0, | ||
654 | __le32_to_cpu(ev->abi.abi_ver_ns1), WMI_TLV_ABI_VER_NS1, | ||
655 | __le32_to_cpu(ev->abi.abi_ver_ns2), WMI_TLV_ABI_VER_NS2, | ||
656 | __le32_to_cpu(ev->abi.abi_ver_ns3), WMI_TLV_ABI_VER_NS3); | ||
657 | |||
658 | if (__le32_to_cpu(ev->abi.abi_ver0) != WMI_TLV_ABI_VER0 || | ||
659 | __le32_to_cpu(ev->abi.abi_ver_ns0) != WMI_TLV_ABI_VER_NS0 || | ||
660 | __le32_to_cpu(ev->abi.abi_ver_ns1) != WMI_TLV_ABI_VER_NS1 || | ||
661 | __le32_to_cpu(ev->abi.abi_ver_ns2) != WMI_TLV_ABI_VER_NS2 || | ||
662 | __le32_to_cpu(ev->abi.abi_ver_ns3) != WMI_TLV_ABI_VER_NS3) { | ||
663 | kfree(tb); | ||
664 | return -ENOTSUPP; | ||
665 | } | ||
666 | |||
667 | arg->min_tx_power = ev->hw_min_tx_power; | ||
668 | arg->max_tx_power = ev->hw_max_tx_power; | ||
669 | arg->ht_cap = ev->ht_cap_info; | ||
670 | arg->vht_cap = ev->vht_cap_info; | ||
671 | arg->sw_ver0 = ev->abi.abi_ver0; | ||
672 | arg->sw_ver1 = ev->abi.abi_ver1; | ||
673 | arg->fw_build = ev->fw_build_vers; | ||
674 | arg->phy_capab = ev->phy_capability; | ||
675 | arg->num_rf_chains = ev->num_rf_chains; | ||
676 | arg->eeprom_rd = reg->eeprom_rd; | ||
677 | arg->num_mem_reqs = ev->num_mem_reqs; | ||
678 | arg->service_map = svc_bmap; | ||
679 | arg->service_map_len = ath10k_wmi_tlv_len(svc_bmap); | ||
680 | |||
681 | ret = ath10k_wmi_tlv_iter(ar, mem_reqs, ath10k_wmi_tlv_len(mem_reqs), | ||
682 | ath10k_wmi_tlv_parse_mem_reqs, arg); | ||
683 | if (ret) { | ||
684 | kfree(tb); | ||
685 | ath10k_warn(ar, "failed to parse mem_reqs tlv: %d\n", ret); | ||
686 | return ret; | ||
687 | } | ||
688 | |||
689 | kfree(tb); | ||
690 | return 0; | ||
691 | } | ||
692 | |||
693 | static int ath10k_wmi_tlv_op_pull_rdy_ev(struct ath10k *ar, | ||
694 | struct sk_buff *skb, | ||
695 | struct wmi_rdy_ev_arg *arg) | ||
696 | { | ||
697 | const void **tb; | ||
698 | const struct wmi_tlv_rdy_ev *ev; | ||
699 | int ret; | ||
700 | |||
701 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
702 | if (IS_ERR(tb)) { | ||
703 | ret = PTR_ERR(tb); | ||
704 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
705 | return ret; | ||
706 | } | ||
707 | |||
708 | ev = tb[WMI_TLV_TAG_STRUCT_READY_EVENT]; | ||
709 | if (!ev) { | ||
710 | kfree(tb); | ||
711 | return -EPROTO; | ||
712 | } | ||
713 | |||
714 | arg->sw_version = ev->abi.abi_ver0; | ||
715 | arg->abi_version = ev->abi.abi_ver1; | ||
716 | arg->status = ev->status; | ||
717 | arg->mac_addr = ev->mac_addr.addr; | ||
718 | |||
719 | kfree(tb); | ||
720 | return 0; | ||
721 | } | ||
722 | |||
723 | static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, | ||
724 | struct sk_buff *skb, | ||
725 | struct ath10k_fw_stats *stats) | ||
726 | { | ||
727 | const void **tb; | ||
728 | const struct wmi_stats_event *ev; | ||
729 | const void *data; | ||
730 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; | ||
731 | size_t data_len; | ||
732 | int ret; | ||
733 | |||
734 | tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC); | ||
735 | if (IS_ERR(tb)) { | ||
736 | ret = PTR_ERR(tb); | ||
737 | ath10k_warn(ar, "failed to parse tlv: %d\n", ret); | ||
738 | return ret; | ||
739 | } | ||
740 | |||
741 | ev = tb[WMI_TLV_TAG_STRUCT_STATS_EVENT]; | ||
742 | data = tb[WMI_TLV_TAG_ARRAY_BYTE]; | ||
743 | |||
744 | if (!ev || !data) { | ||
745 | kfree(tb); | ||
746 | return -EPROTO; | ||
747 | } | ||
748 | |||
749 | data_len = ath10k_wmi_tlv_len(data); | ||
750 | num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); | ||
751 | num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); | ||
752 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); | ||
753 | |||
754 | WARN_ON(1); /* FIXME: not implemented yet */ | ||
755 | |||
756 | kfree(tb); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | static struct sk_buff * | ||
761 | ath10k_wmi_tlv_op_gen_pdev_suspend(struct ath10k *ar, u32 opt) | ||
762 | { | ||
763 | struct wmi_tlv_pdev_suspend *cmd; | ||
764 | struct wmi_tlv *tlv; | ||
765 | struct sk_buff *skb; | ||
766 | |||
767 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
768 | if (!skb) | ||
769 | return ERR_PTR(-ENOMEM); | ||
770 | |||
771 | tlv = (void *)skb->data; | ||
772 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SUSPEND_CMD); | ||
773 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
774 | cmd = (void *)tlv->value; | ||
775 | cmd->opt = __cpu_to_le32(opt); | ||
776 | |||
777 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pdev suspend\n"); | ||
778 | return skb; | ||
779 | } | ||
780 | |||
781 | static struct sk_buff * | ||
782 | ath10k_wmi_tlv_op_gen_pdev_resume(struct ath10k *ar) | ||
783 | { | ||
784 | struct wmi_tlv_resume_cmd *cmd; | ||
785 | struct wmi_tlv *tlv; | ||
786 | struct sk_buff *skb; | ||
787 | |||
788 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
789 | if (!skb) | ||
790 | return ERR_PTR(-ENOMEM); | ||
791 | |||
792 | tlv = (void *)skb->data; | ||
793 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_RESUME_CMD); | ||
794 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
795 | cmd = (void *)tlv->value; | ||
796 | cmd->reserved = __cpu_to_le32(0); | ||
797 | |||
798 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pdev resume\n"); | ||
799 | return skb; | ||
800 | } | ||
801 | |||
802 | static struct sk_buff * | ||
803 | ath10k_wmi_tlv_op_gen_pdev_set_rd(struct ath10k *ar, | ||
804 | u16 rd, u16 rd2g, u16 rd5g, | ||
805 | u16 ctl2g, u16 ctl5g, | ||
806 | enum wmi_dfs_region dfs_reg) | ||
807 | { | ||
808 | struct wmi_tlv_pdev_set_rd_cmd *cmd; | ||
809 | struct wmi_tlv *tlv; | ||
810 | struct sk_buff *skb; | ||
811 | |||
812 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
813 | if (!skb) | ||
814 | return ERR_PTR(-ENOMEM); | ||
815 | |||
816 | tlv = (void *)skb->data; | ||
817 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_REGDOMAIN_CMD); | ||
818 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
819 | cmd = (void *)tlv->value; | ||
820 | cmd->regd = __cpu_to_le32(rd); | ||
821 | cmd->regd_2ghz = __cpu_to_le32(rd2g); | ||
822 | cmd->regd_5ghz = __cpu_to_le32(rd5g); | ||
823 | cmd->conform_limit_2ghz = __cpu_to_le32(rd2g); | ||
824 | cmd->conform_limit_5ghz = __cpu_to_le32(rd5g); | ||
825 | |||
826 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pdev set rd\n"); | ||
827 | return skb; | ||
828 | } | ||
829 | |||
830 | static struct sk_buff * | ||
831 | ath10k_wmi_tlv_op_gen_pdev_set_param(struct ath10k *ar, u32 param_id, | ||
832 | u32 param_value) | ||
833 | { | ||
834 | struct wmi_tlv_pdev_set_param_cmd *cmd; | ||
835 | struct wmi_tlv *tlv; | ||
836 | struct sk_buff *skb; | ||
837 | |||
838 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
839 | if (!skb) | ||
840 | return ERR_PTR(-ENOMEM); | ||
841 | |||
842 | tlv = (void *)skb->data; | ||
843 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_PARAM_CMD); | ||
844 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
845 | cmd = (void *)tlv->value; | ||
846 | cmd->param_id = __cpu_to_le32(param_id); | ||
847 | cmd->param_value = __cpu_to_le32(param_value); | ||
848 | |||
849 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pdev set param\n"); | ||
850 | return skb; | ||
851 | } | ||
852 | |||
853 | static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar) | ||
854 | { | ||
855 | struct sk_buff *skb; | ||
856 | struct wmi_tlv *tlv; | ||
857 | struct wmi_tlv_init_cmd *cmd; | ||
858 | struct wmi_tlv_resource_config *cfg; | ||
859 | struct wmi_host_mem_chunks *chunks; | ||
860 | size_t len, chunks_len; | ||
861 | void *ptr; | ||
862 | |||
863 | chunks_len = ar->wmi.num_mem_chunks * sizeof(struct host_memory_chunk); | ||
864 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
865 | (sizeof(*tlv) + sizeof(*cfg)) + | ||
866 | (sizeof(*tlv) + chunks_len); | ||
867 | |||
868 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
869 | if (!skb) | ||
870 | return ERR_PTR(-ENOMEM); | ||
871 | |||
872 | ptr = skb->data; | ||
873 | |||
874 | tlv = ptr; | ||
875 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_INIT_CMD); | ||
876 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
877 | cmd = (void *)tlv->value; | ||
878 | ptr += sizeof(*tlv); | ||
879 | ptr += sizeof(*cmd); | ||
880 | |||
881 | tlv = ptr; | ||
882 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_RESOURCE_CONFIG); | ||
883 | tlv->len = __cpu_to_le16(sizeof(*cfg)); | ||
884 | cfg = (void *)tlv->value; | ||
885 | ptr += sizeof(*tlv); | ||
886 | ptr += sizeof(*cfg); | ||
887 | |||
888 | tlv = ptr; | ||
889 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT); | ||
890 | tlv->len = __cpu_to_le16(chunks_len); | ||
891 | chunks = (void *)tlv->value; | ||
892 | |||
893 | ptr += sizeof(*tlv); | ||
894 | ptr += chunks_len; | ||
895 | |||
896 | cmd->abi.abi_ver0 = __cpu_to_le32(WMI_TLV_ABI_VER0); | ||
897 | cmd->abi.abi_ver1 = __cpu_to_le32(WMI_TLV_ABI_VER1); | ||
898 | cmd->abi.abi_ver_ns0 = __cpu_to_le32(WMI_TLV_ABI_VER_NS0); | ||
899 | cmd->abi.abi_ver_ns1 = __cpu_to_le32(WMI_TLV_ABI_VER_NS1); | ||
900 | cmd->abi.abi_ver_ns2 = __cpu_to_le32(WMI_TLV_ABI_VER_NS2); | ||
901 | cmd->abi.abi_ver_ns3 = __cpu_to_le32(WMI_TLV_ABI_VER_NS3); | ||
902 | cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks); | ||
903 | |||
904 | cfg->num_vdevs = __cpu_to_le32(TARGET_TLV_NUM_VDEVS); | ||
905 | cfg->num_peers = __cpu_to_le32(TARGET_TLV_NUM_PEERS); | ||
906 | cfg->num_offload_peers = __cpu_to_le32(0); | ||
907 | cfg->num_offload_reorder_bufs = __cpu_to_le32(0); | ||
908 | cfg->num_peer_keys = __cpu_to_le32(2); | ||
909 | cfg->num_tids = __cpu_to_le32(TARGET_TLV_NUM_TIDS); | ||
910 | cfg->ast_skid_limit = __cpu_to_le32(0x10); | ||
911 | cfg->tx_chain_mask = __cpu_to_le32(0x7); | ||
912 | cfg->rx_chain_mask = __cpu_to_le32(0x7); | ||
913 | cfg->rx_timeout_pri[0] = __cpu_to_le32(0x64); | ||
914 | cfg->rx_timeout_pri[1] = __cpu_to_le32(0x64); | ||
915 | cfg->rx_timeout_pri[2] = __cpu_to_le32(0x64); | ||
916 | cfg->rx_timeout_pri[3] = __cpu_to_le32(0x28); | ||
917 | cfg->rx_decap_mode = __cpu_to_le32(1); | ||
918 | cfg->scan_max_pending_reqs = __cpu_to_le32(4); | ||
919 | cfg->bmiss_offload_max_vdev = __cpu_to_le32(3); | ||
920 | cfg->roam_offload_max_vdev = __cpu_to_le32(3); | ||
921 | cfg->roam_offload_max_ap_profiles = __cpu_to_le32(8); | ||
922 | cfg->num_mcast_groups = __cpu_to_le32(0); | ||
923 | cfg->num_mcast_table_elems = __cpu_to_le32(0); | ||
924 | cfg->mcast2ucast_mode = __cpu_to_le32(0); | ||
925 | cfg->tx_dbg_log_size = __cpu_to_le32(0x400); | ||
926 | cfg->num_wds_entries = __cpu_to_le32(0x20); | ||
927 | cfg->dma_burst_size = __cpu_to_le32(0); | ||
928 | cfg->mac_aggr_delim = __cpu_to_le32(0); | ||
929 | cfg->rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(0); | ||
930 | cfg->vow_config = __cpu_to_le32(0); | ||
931 | cfg->gtk_offload_max_vdev = __cpu_to_le32(2); | ||
932 | cfg->num_msdu_desc = __cpu_to_le32(TARGET_TLV_NUM_MSDU_DESC); | ||
933 | cfg->max_frag_entries = __cpu_to_le32(2); | ||
934 | cfg->num_tdls_vdevs = __cpu_to_le32(1); | ||
935 | cfg->num_tdls_conn_table_entries = __cpu_to_le32(0x20); | ||
936 | cfg->beacon_tx_offload_max_vdev = __cpu_to_le32(2); | ||
937 | cfg->num_multicast_filter_entries = __cpu_to_le32(5); | ||
938 | cfg->num_wow_filters = __cpu_to_le32(0x16); | ||
939 | cfg->num_keep_alive_pattern = __cpu_to_le32(6); | ||
940 | cfg->keep_alive_pattern_size = __cpu_to_le32(0); | ||
941 | cfg->max_tdls_concurrent_sleep_sta = __cpu_to_le32(1); | ||
942 | cfg->max_tdls_concurrent_buffer_sta = __cpu_to_le32(1); | ||
943 | |||
944 | ath10k_wmi_put_host_mem_chunks(ar, chunks); | ||
945 | |||
946 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv init\n"); | ||
947 | return skb; | ||
948 | } | ||
949 | |||
950 | static struct sk_buff * | ||
951 | ath10k_wmi_tlv_op_gen_start_scan(struct ath10k *ar, | ||
952 | const struct wmi_start_scan_arg *arg) | ||
953 | { | ||
954 | struct wmi_tlv_start_scan_cmd *cmd; | ||
955 | struct wmi_tlv *tlv; | ||
956 | struct sk_buff *skb; | ||
957 | size_t len, chan_len, ssid_len, bssid_len, ie_len; | ||
958 | __le32 *chans; | ||
959 | struct wmi_ssid *ssids; | ||
960 | struct wmi_mac_addr *addrs; | ||
961 | void *ptr; | ||
962 | int i, ret; | ||
963 | |||
964 | ret = ath10k_wmi_start_scan_verify(arg); | ||
965 | if (ret) | ||
966 | return ERR_PTR(ret); | ||
967 | |||
968 | chan_len = arg->n_channels * sizeof(__le32); | ||
969 | ssid_len = arg->n_ssids * sizeof(struct wmi_ssid); | ||
970 | bssid_len = arg->n_bssids * sizeof(struct wmi_mac_addr); | ||
971 | ie_len = roundup(arg->ie_len, 4); | ||
972 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
973 | (arg->n_channels ? sizeof(*tlv) + chan_len : 0) + | ||
974 | (arg->n_ssids ? sizeof(*tlv) + ssid_len : 0) + | ||
975 | (arg->n_bssids ? sizeof(*tlv) + bssid_len : 0) + | ||
976 | (arg->ie_len ? sizeof(*tlv) + ie_len : 0); | ||
977 | |||
978 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
979 | if (!skb) | ||
980 | return ERR_PTR(-ENOMEM); | ||
981 | |||
982 | ptr = (void *)skb->data; | ||
983 | tlv = ptr; | ||
984 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_START_SCAN_CMD); | ||
985 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
986 | cmd = (void *)tlv->value; | ||
987 | |||
988 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); | ||
989 | cmd->burst_duration_ms = __cpu_to_le32(0); | ||
990 | cmd->num_channels = __cpu_to_le32(arg->n_channels); | ||
991 | cmd->num_ssids = __cpu_to_le32(arg->n_ssids); | ||
992 | cmd->num_bssids = __cpu_to_le32(arg->n_bssids); | ||
993 | cmd->ie_len = __cpu_to_le32(arg->ie_len); | ||
994 | cmd->num_probes = __cpu_to_le32(3); | ||
995 | |||
996 | /* FIXME: There are some scan flag inconsistencies across firmwares, | ||
997 | * e.g. WMI-TLV inverts the logic behind the following flag. | ||
998 | */ | ||
999 | cmd->common.scan_ctrl_flags ^= __cpu_to_le32(WMI_SCAN_FILTER_PROBE_REQ); | ||
1000 | |||
1001 | ptr += sizeof(*tlv); | ||
1002 | ptr += sizeof(*cmd); | ||
1003 | |||
1004 | tlv = ptr; | ||
1005 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32); | ||
1006 | tlv->len = __cpu_to_le16(chan_len); | ||
1007 | chans = (void *)tlv->value; | ||
1008 | for (i = 0; i < arg->n_channels; i++) | ||
1009 | chans[i] = __cpu_to_le32(arg->channels[i]); | ||
1010 | |||
1011 | ptr += sizeof(*tlv); | ||
1012 | ptr += chan_len; | ||
1013 | |||
1014 | tlv = ptr; | ||
1015 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_FIXED_STRUCT); | ||
1016 | tlv->len = __cpu_to_le16(ssid_len); | ||
1017 | ssids = (void *)tlv->value; | ||
1018 | for (i = 0; i < arg->n_ssids; i++) { | ||
1019 | ssids[i].ssid_len = __cpu_to_le32(arg->ssids[i].len); | ||
1020 | memcpy(ssids[i].ssid, arg->ssids[i].ssid, arg->ssids[i].len); | ||
1021 | } | ||
1022 | |||
1023 | ptr += sizeof(*tlv); | ||
1024 | ptr += ssid_len; | ||
1025 | |||
1026 | tlv = ptr; | ||
1027 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_FIXED_STRUCT); | ||
1028 | tlv->len = __cpu_to_le16(bssid_len); | ||
1029 | addrs = (void *)tlv->value; | ||
1030 | for (i = 0; i < arg->n_bssids; i++) | ||
1031 | ether_addr_copy(addrs[i].addr, arg->bssids[i].bssid); | ||
1032 | |||
1033 | ptr += sizeof(*tlv); | ||
1034 | ptr += bssid_len; | ||
1035 | |||
1036 | tlv = ptr; | ||
1037 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); | ||
1038 | tlv->len = __cpu_to_le16(ie_len); | ||
1039 | memcpy(tlv->value, arg->ie, arg->ie_len); | ||
1040 | |||
1041 | ptr += sizeof(*tlv); | ||
1042 | ptr += ie_len; | ||
1043 | |||
1044 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv start scan\n"); | ||
1045 | return skb; | ||
1046 | } | ||
1047 | |||
1048 | static struct sk_buff * | ||
1049 | ath10k_wmi_tlv_op_gen_stop_scan(struct ath10k *ar, | ||
1050 | const struct wmi_stop_scan_arg *arg) | ||
1051 | { | ||
1052 | struct wmi_stop_scan_cmd *cmd; | ||
1053 | struct wmi_tlv *tlv; | ||
1054 | struct sk_buff *skb; | ||
1055 | u32 scan_id; | ||
1056 | u32 req_id; | ||
1057 | |||
1058 | if (arg->req_id > 0xFFF) | ||
1059 | return ERR_PTR(-EINVAL); | ||
1060 | if (arg->req_type == WMI_SCAN_STOP_ONE && arg->u.scan_id > 0xFFF) | ||
1061 | return ERR_PTR(-EINVAL); | ||
1062 | |||
1063 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1064 | if (!skb) | ||
1065 | return ERR_PTR(-ENOMEM); | ||
1066 | |||
1067 | scan_id = arg->u.scan_id; | ||
1068 | scan_id |= WMI_HOST_SCAN_REQ_ID_PREFIX; | ||
1069 | |||
1070 | req_id = arg->req_id; | ||
1071 | req_id |= WMI_HOST_SCAN_REQUESTOR_ID_PREFIX; | ||
1072 | |||
1073 | tlv = (void *)skb->data; | ||
1074 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_STOP_SCAN_CMD); | ||
1075 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1076 | cmd = (void *)tlv->value; | ||
1077 | cmd->req_type = __cpu_to_le32(arg->req_type); | ||
1078 | cmd->vdev_id = __cpu_to_le32(arg->u.vdev_id); | ||
1079 | cmd->scan_id = __cpu_to_le32(scan_id); | ||
1080 | cmd->scan_req_id = __cpu_to_le32(req_id); | ||
1081 | |||
1082 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv stop scan\n"); | ||
1083 | return skb; | ||
1084 | } | ||
1085 | |||
1086 | static struct sk_buff * | ||
1087 | ath10k_wmi_tlv_op_gen_vdev_create(struct ath10k *ar, | ||
1088 | u32 vdev_id, | ||
1089 | enum wmi_vdev_type vdev_type, | ||
1090 | enum wmi_vdev_subtype vdev_subtype, | ||
1091 | const u8 mac_addr[ETH_ALEN]) | ||
1092 | { | ||
1093 | struct wmi_vdev_create_cmd *cmd; | ||
1094 | struct wmi_tlv *tlv; | ||
1095 | struct sk_buff *skb; | ||
1096 | |||
1097 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1098 | if (!skb) | ||
1099 | return ERR_PTR(-ENOMEM); | ||
1100 | |||
1101 | tlv = (void *)skb->data; | ||
1102 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_CREATE_CMD); | ||
1103 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1104 | cmd = (void *)tlv->value; | ||
1105 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1106 | cmd->vdev_type = __cpu_to_le32(vdev_type); | ||
1107 | cmd->vdev_subtype = __cpu_to_le32(vdev_subtype); | ||
1108 | ether_addr_copy(cmd->vdev_macaddr.addr, mac_addr); | ||
1109 | |||
1110 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev create\n"); | ||
1111 | return skb; | ||
1112 | } | ||
1113 | |||
1114 | static struct sk_buff * | ||
1115 | ath10k_wmi_tlv_op_gen_vdev_delete(struct ath10k *ar, u32 vdev_id) | ||
1116 | { | ||
1117 | struct wmi_vdev_delete_cmd *cmd; | ||
1118 | struct wmi_tlv *tlv; | ||
1119 | struct sk_buff *skb; | ||
1120 | |||
1121 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1122 | if (!skb) | ||
1123 | return ERR_PTR(-ENOMEM); | ||
1124 | |||
1125 | tlv = (void *)skb->data; | ||
1126 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_DELETE_CMD); | ||
1127 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1128 | cmd = (void *)tlv->value; | ||
1129 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1130 | |||
1131 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev delete\n"); | ||
1132 | return skb; | ||
1133 | } | ||
1134 | |||
1135 | static struct sk_buff * | ||
1136 | ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar, | ||
1137 | const struct wmi_vdev_start_request_arg *arg, | ||
1138 | bool restart) | ||
1139 | { | ||
1140 | struct wmi_tlv_vdev_start_cmd *cmd; | ||
1141 | struct wmi_channel *ch; | ||
1142 | struct wmi_p2p_noa_descriptor *noa; | ||
1143 | struct wmi_tlv *tlv; | ||
1144 | struct sk_buff *skb; | ||
1145 | size_t len; | ||
1146 | void *ptr; | ||
1147 | u32 flags = 0; | ||
1148 | |||
1149 | if (WARN_ON(arg->ssid && arg->ssid_len == 0)) | ||
1150 | return ERR_PTR(-EINVAL); | ||
1151 | if (WARN_ON(arg->hidden_ssid && !arg->ssid)) | ||
1152 | return ERR_PTR(-EINVAL); | ||
1153 | if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid))) | ||
1154 | return ERR_PTR(-EINVAL); | ||
1155 | |||
1156 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
1157 | (sizeof(*tlv) + sizeof(*ch)) + | ||
1158 | (sizeof(*tlv) + 0); | ||
1159 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1160 | if (!skb) | ||
1161 | return ERR_PTR(-ENOMEM); | ||
1162 | |||
1163 | if (arg->hidden_ssid) | ||
1164 | flags |= WMI_VDEV_START_HIDDEN_SSID; | ||
1165 | if (arg->pmf_enabled) | ||
1166 | flags |= WMI_VDEV_START_PMF_ENABLED; | ||
1167 | |||
1168 | ptr = (void *)skb->data; | ||
1169 | |||
1170 | tlv = ptr; | ||
1171 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_START_REQUEST_CMD); | ||
1172 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1173 | cmd = (void *)tlv->value; | ||
1174 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); | ||
1175 | cmd->bcn_intval = __cpu_to_le32(arg->bcn_intval); | ||
1176 | cmd->dtim_period = __cpu_to_le32(arg->dtim_period); | ||
1177 | cmd->flags = __cpu_to_le32(flags); | ||
1178 | cmd->bcn_tx_rate = __cpu_to_le32(arg->bcn_tx_rate); | ||
1179 | cmd->bcn_tx_power = __cpu_to_le32(arg->bcn_tx_power); | ||
1180 | cmd->disable_hw_ack = __cpu_to_le32(arg->disable_hw_ack); | ||
1181 | |||
1182 | if (arg->ssid) { | ||
1183 | cmd->ssid.ssid_len = __cpu_to_le32(arg->ssid_len); | ||
1184 | memcpy(cmd->ssid.ssid, arg->ssid, arg->ssid_len); | ||
1185 | } | ||
1186 | |||
1187 | ptr += sizeof(*tlv); | ||
1188 | ptr += sizeof(*cmd); | ||
1189 | |||
1190 | tlv = ptr; | ||
1191 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_CHANNEL); | ||
1192 | tlv->len = __cpu_to_le16(sizeof(*ch)); | ||
1193 | ch = (void *)tlv->value; | ||
1194 | ath10k_wmi_put_wmi_channel(ch, &arg->channel); | ||
1195 | |||
1196 | ptr += sizeof(*tlv); | ||
1197 | ptr += sizeof(*ch); | ||
1198 | |||
1199 | tlv = ptr; | ||
1200 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT); | ||
1201 | tlv->len = 0; | ||
1202 | noa = (void *)tlv->value; | ||
1203 | |||
1204 | /* Note: This is a nested TLV containing: | ||
1205 | * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv].. | ||
1206 | */ | ||
1207 | |||
1208 | ptr += sizeof(*tlv); | ||
1209 | ptr += 0; | ||
1210 | |||
1211 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev start\n"); | ||
1212 | return skb; | ||
1213 | } | ||
1214 | |||
1215 | static struct sk_buff * | ||
1216 | ath10k_wmi_tlv_op_gen_vdev_stop(struct ath10k *ar, u32 vdev_id) | ||
1217 | { | ||
1218 | struct wmi_vdev_stop_cmd *cmd; | ||
1219 | struct wmi_tlv *tlv; | ||
1220 | struct sk_buff *skb; | ||
1221 | |||
1222 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1223 | if (!skb) | ||
1224 | return ERR_PTR(-ENOMEM); | ||
1225 | |||
1226 | tlv = (void *)skb->data; | ||
1227 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_STOP_CMD); | ||
1228 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1229 | cmd = (void *)tlv->value; | ||
1230 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1231 | |||
1232 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev stop\n"); | ||
1233 | return skb; | ||
1234 | } | ||
1235 | |||
1236 | static struct sk_buff * | ||
1237 | ath10k_wmi_tlv_op_gen_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, | ||
1238 | const u8 *bssid) | ||
1239 | |||
1240 | { | ||
1241 | struct wmi_vdev_up_cmd *cmd; | ||
1242 | struct wmi_tlv *tlv; | ||
1243 | struct sk_buff *skb; | ||
1244 | |||
1245 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1246 | if (!skb) | ||
1247 | return ERR_PTR(-ENOMEM); | ||
1248 | |||
1249 | tlv = (void *)skb->data; | ||
1250 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_UP_CMD); | ||
1251 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1252 | cmd = (void *)tlv->value; | ||
1253 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1254 | cmd->vdev_assoc_id = __cpu_to_le32(aid); | ||
1255 | ether_addr_copy(cmd->vdev_bssid.addr, bssid); | ||
1256 | |||
1257 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev up\n"); | ||
1258 | return skb; | ||
1259 | } | ||
1260 | |||
1261 | static struct sk_buff * | ||
1262 | ath10k_wmi_tlv_op_gen_vdev_down(struct ath10k *ar, u32 vdev_id) | ||
1263 | { | ||
1264 | struct wmi_vdev_down_cmd *cmd; | ||
1265 | struct wmi_tlv *tlv; | ||
1266 | struct sk_buff *skb; | ||
1267 | |||
1268 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1269 | if (!skb) | ||
1270 | return ERR_PTR(-ENOMEM); | ||
1271 | |||
1272 | tlv = (void *)skb->data; | ||
1273 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_DOWN_CMD); | ||
1274 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1275 | cmd = (void *)tlv->value; | ||
1276 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1277 | |||
1278 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev down\n"); | ||
1279 | return skb; | ||
1280 | } | ||
1281 | |||
1282 | static struct sk_buff * | ||
1283 | ath10k_wmi_tlv_op_gen_vdev_set_param(struct ath10k *ar, u32 vdev_id, | ||
1284 | u32 param_id, u32 param_value) | ||
1285 | { | ||
1286 | struct wmi_vdev_set_param_cmd *cmd; | ||
1287 | struct wmi_tlv *tlv; | ||
1288 | struct sk_buff *skb; | ||
1289 | |||
1290 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1291 | if (!skb) | ||
1292 | return ERR_PTR(-ENOMEM); | ||
1293 | |||
1294 | tlv = (void *)skb->data; | ||
1295 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SET_PARAM_CMD); | ||
1296 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1297 | cmd = (void *)tlv->value; | ||
1298 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1299 | cmd->param_id = __cpu_to_le32(param_id); | ||
1300 | cmd->param_value = __cpu_to_le32(param_value); | ||
1301 | |||
1302 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev set param\n"); | ||
1303 | return skb; | ||
1304 | } | ||
1305 | |||
1306 | static struct sk_buff * | ||
1307 | ath10k_wmi_tlv_op_gen_vdev_install_key(struct ath10k *ar, | ||
1308 | const struct wmi_vdev_install_key_arg *arg) | ||
1309 | { | ||
1310 | struct wmi_vdev_install_key_cmd *cmd; | ||
1311 | struct wmi_tlv *tlv; | ||
1312 | struct sk_buff *skb; | ||
1313 | size_t len; | ||
1314 | void *ptr; | ||
1315 | |||
1316 | if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL) | ||
1317 | return ERR_PTR(-EINVAL); | ||
1318 | if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL) | ||
1319 | return ERR_PTR(-EINVAL); | ||
1320 | |||
1321 | len = sizeof(*tlv) + sizeof(*cmd) + | ||
1322 | sizeof(*tlv) + roundup(arg->key_len, sizeof(__le32)); | ||
1323 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1324 | if (!skb) | ||
1325 | return ERR_PTR(-ENOMEM); | ||
1326 | |||
1327 | ptr = (void *)skb->data; | ||
1328 | tlv = ptr; | ||
1329 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_INSTALL_KEY_CMD); | ||
1330 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1331 | cmd = (void *)tlv->value; | ||
1332 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); | ||
1333 | cmd->key_idx = __cpu_to_le32(arg->key_idx); | ||
1334 | cmd->key_flags = __cpu_to_le32(arg->key_flags); | ||
1335 | cmd->key_cipher = __cpu_to_le32(arg->key_cipher); | ||
1336 | cmd->key_len = __cpu_to_le32(arg->key_len); | ||
1337 | cmd->key_txmic_len = __cpu_to_le32(arg->key_txmic_len); | ||
1338 | cmd->key_rxmic_len = __cpu_to_le32(arg->key_rxmic_len); | ||
1339 | |||
1340 | if (arg->macaddr) | ||
1341 | ether_addr_copy(cmd->peer_macaddr.addr, arg->macaddr); | ||
1342 | |||
1343 | ptr += sizeof(*tlv); | ||
1344 | ptr += sizeof(*cmd); | ||
1345 | |||
1346 | tlv = ptr; | ||
1347 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); | ||
1348 | tlv->len = __cpu_to_le16(roundup(arg->key_len, sizeof(__le32))); | ||
1349 | if (arg->key_data) | ||
1350 | memcpy(tlv->value, arg->key_data, arg->key_len); | ||
1351 | |||
1352 | ptr += sizeof(*tlv); | ||
1353 | ptr += roundup(arg->key_len, sizeof(__le32)); | ||
1354 | |||
1355 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv vdev install key\n"); | ||
1356 | return skb; | ||
1357 | } | ||
1358 | |||
1359 | static struct sk_buff * | ||
1360 | ath10k_wmi_tlv_op_gen_peer_create(struct ath10k *ar, u32 vdev_id, | ||
1361 | const u8 peer_addr[ETH_ALEN]) | ||
1362 | { | ||
1363 | struct wmi_tlv_peer_create_cmd *cmd; | ||
1364 | struct wmi_tlv *tlv; | ||
1365 | struct sk_buff *skb; | ||
1366 | |||
1367 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1368 | if (!skb) | ||
1369 | return ERR_PTR(-ENOMEM); | ||
1370 | |||
1371 | tlv = (void *)skb->data; | ||
1372 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_CREATE_CMD); | ||
1373 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1374 | cmd = (void *)tlv->value; | ||
1375 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1376 | cmd->peer_type = __cpu_to_le32(WMI_TLV_PEER_TYPE_DEFAULT); /* FIXME */ | ||
1377 | ether_addr_copy(cmd->peer_addr.addr, peer_addr); | ||
1378 | |||
1379 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer create\n"); | ||
1380 | return skb; | ||
1381 | } | ||
1382 | |||
1383 | static struct sk_buff * | ||
1384 | ath10k_wmi_tlv_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id, | ||
1385 | const u8 peer_addr[ETH_ALEN]) | ||
1386 | { | ||
1387 | struct wmi_peer_delete_cmd *cmd; | ||
1388 | struct wmi_tlv *tlv; | ||
1389 | struct sk_buff *skb; | ||
1390 | |||
1391 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1392 | if (!skb) | ||
1393 | return ERR_PTR(-ENOMEM); | ||
1394 | |||
1395 | tlv = (void *)skb->data; | ||
1396 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_DELETE_CMD); | ||
1397 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1398 | cmd = (void *)tlv->value; | ||
1399 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1400 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); | ||
1401 | |||
1402 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer delete\n"); | ||
1403 | return skb; | ||
1404 | } | ||
1405 | |||
1406 | static struct sk_buff * | ||
1407 | ath10k_wmi_tlv_op_gen_peer_flush(struct ath10k *ar, u32 vdev_id, | ||
1408 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) | ||
1409 | { | ||
1410 | struct wmi_peer_flush_tids_cmd *cmd; | ||
1411 | struct wmi_tlv *tlv; | ||
1412 | struct sk_buff *skb; | ||
1413 | |||
1414 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1415 | if (!skb) | ||
1416 | return ERR_PTR(-ENOMEM); | ||
1417 | |||
1418 | tlv = (void *)skb->data; | ||
1419 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_FLUSH_TIDS_CMD); | ||
1420 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1421 | cmd = (void *)tlv->value; | ||
1422 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1423 | cmd->peer_tid_bitmap = __cpu_to_le32(tid_bitmap); | ||
1424 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); | ||
1425 | |||
1426 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer flush\n"); | ||
1427 | return skb; | ||
1428 | } | ||
1429 | |||
1430 | static struct sk_buff * | ||
1431 | ath10k_wmi_tlv_op_gen_peer_set_param(struct ath10k *ar, u32 vdev_id, | ||
1432 | const u8 *peer_addr, | ||
1433 | enum wmi_peer_param param_id, | ||
1434 | u32 param_value) | ||
1435 | { | ||
1436 | struct wmi_peer_set_param_cmd *cmd; | ||
1437 | struct wmi_tlv *tlv; | ||
1438 | struct sk_buff *skb; | ||
1439 | |||
1440 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1441 | if (!skb) | ||
1442 | return ERR_PTR(-ENOMEM); | ||
1443 | |||
1444 | tlv = (void *)skb->data; | ||
1445 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_SET_PARAM_CMD); | ||
1446 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1447 | cmd = (void *)tlv->value; | ||
1448 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1449 | cmd->param_id = __cpu_to_le32(param_id); | ||
1450 | cmd->param_value = __cpu_to_le32(param_value); | ||
1451 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); | ||
1452 | |||
1453 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer set param\n"); | ||
1454 | return skb; | ||
1455 | } | ||
1456 | |||
1457 | static struct sk_buff * | ||
1458 | ath10k_wmi_tlv_op_gen_peer_assoc(struct ath10k *ar, | ||
1459 | const struct wmi_peer_assoc_complete_arg *arg) | ||
1460 | { | ||
1461 | struct wmi_tlv_peer_assoc_cmd *cmd; | ||
1462 | struct wmi_vht_rate_set *vht_rate; | ||
1463 | struct wmi_tlv *tlv; | ||
1464 | struct sk_buff *skb; | ||
1465 | size_t len, legacy_rate_len, ht_rate_len; | ||
1466 | void *ptr; | ||
1467 | |||
1468 | if (arg->peer_mpdu_density > 16) | ||
1469 | return ERR_PTR(-EINVAL); | ||
1470 | if (arg->peer_legacy_rates.num_rates > MAX_SUPPORTED_RATES) | ||
1471 | return ERR_PTR(-EINVAL); | ||
1472 | if (arg->peer_ht_rates.num_rates > MAX_SUPPORTED_RATES) | ||
1473 | return ERR_PTR(-EINVAL); | ||
1474 | |||
1475 | legacy_rate_len = roundup(arg->peer_legacy_rates.num_rates, | ||
1476 | sizeof(__le32)); | ||
1477 | ht_rate_len = roundup(arg->peer_ht_rates.num_rates, sizeof(__le32)); | ||
1478 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
1479 | (sizeof(*tlv) + legacy_rate_len) + | ||
1480 | (sizeof(*tlv) + ht_rate_len) + | ||
1481 | (sizeof(*tlv) + sizeof(*vht_rate)); | ||
1482 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1483 | if (!skb) | ||
1484 | return ERR_PTR(-ENOMEM); | ||
1485 | |||
1486 | ptr = (void *)skb->data; | ||
1487 | tlv = ptr; | ||
1488 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PEER_ASSOC_COMPLETE_CMD); | ||
1489 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1490 | cmd = (void *)tlv->value; | ||
1491 | |||
1492 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); | ||
1493 | cmd->new_assoc = __cpu_to_le32(arg->peer_reassoc ? 0 : 1); | ||
1494 | cmd->assoc_id = __cpu_to_le32(arg->peer_aid); | ||
1495 | cmd->flags = __cpu_to_le32(arg->peer_flags); | ||
1496 | cmd->caps = __cpu_to_le32(arg->peer_caps); | ||
1497 | cmd->listen_intval = __cpu_to_le32(arg->peer_listen_intval); | ||
1498 | cmd->ht_caps = __cpu_to_le32(arg->peer_ht_caps); | ||
1499 | cmd->max_mpdu = __cpu_to_le32(arg->peer_max_mpdu); | ||
1500 | cmd->mpdu_density = __cpu_to_le32(arg->peer_mpdu_density); | ||
1501 | cmd->rate_caps = __cpu_to_le32(arg->peer_rate_caps); | ||
1502 | cmd->nss = __cpu_to_le32(arg->peer_num_spatial_streams); | ||
1503 | cmd->vht_caps = __cpu_to_le32(arg->peer_vht_caps); | ||
1504 | cmd->phy_mode = __cpu_to_le32(arg->peer_phymode); | ||
1505 | cmd->num_legacy_rates = __cpu_to_le32(arg->peer_legacy_rates.num_rates); | ||
1506 | cmd->num_ht_rates = __cpu_to_le32(arg->peer_ht_rates.num_rates); | ||
1507 | ether_addr_copy(cmd->mac_addr.addr, arg->addr); | ||
1508 | |||
1509 | ptr += sizeof(*tlv); | ||
1510 | ptr += sizeof(*cmd); | ||
1511 | |||
1512 | tlv = ptr; | ||
1513 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); | ||
1514 | tlv->len = __cpu_to_le16(legacy_rate_len); | ||
1515 | memcpy(tlv->value, arg->peer_legacy_rates.rates, | ||
1516 | arg->peer_legacy_rates.num_rates); | ||
1517 | |||
1518 | ptr += sizeof(*tlv); | ||
1519 | ptr += legacy_rate_len; | ||
1520 | |||
1521 | tlv = ptr; | ||
1522 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); | ||
1523 | tlv->len = __cpu_to_le16(ht_rate_len); | ||
1524 | memcpy(tlv->value, arg->peer_ht_rates.rates, | ||
1525 | arg->peer_ht_rates.num_rates); | ||
1526 | |||
1527 | ptr += sizeof(*tlv); | ||
1528 | ptr += ht_rate_len; | ||
1529 | |||
1530 | tlv = ptr; | ||
1531 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VHT_RATE_SET); | ||
1532 | tlv->len = __cpu_to_le16(sizeof(*vht_rate)); | ||
1533 | vht_rate = (void *)tlv->value; | ||
1534 | |||
1535 | vht_rate->rx_max_rate = __cpu_to_le32(arg->peer_vht_rates.rx_max_rate); | ||
1536 | vht_rate->rx_mcs_set = __cpu_to_le32(arg->peer_vht_rates.rx_mcs_set); | ||
1537 | vht_rate->tx_max_rate = __cpu_to_le32(arg->peer_vht_rates.tx_max_rate); | ||
1538 | vht_rate->tx_mcs_set = __cpu_to_le32(arg->peer_vht_rates.tx_mcs_set); | ||
1539 | |||
1540 | ptr += sizeof(*tlv); | ||
1541 | ptr += sizeof(*vht_rate); | ||
1542 | |||
1543 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer assoc\n"); | ||
1544 | return skb; | ||
1545 | } | ||
1546 | |||
1547 | static struct sk_buff * | ||
1548 | ath10k_wmi_tlv_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, | ||
1549 | enum wmi_sta_ps_mode psmode) | ||
1550 | { | ||
1551 | struct wmi_sta_powersave_mode_cmd *cmd; | ||
1552 | struct wmi_tlv *tlv; | ||
1553 | struct sk_buff *skb; | ||
1554 | |||
1555 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1556 | if (!skb) | ||
1557 | return ERR_PTR(-ENOMEM); | ||
1558 | |||
1559 | tlv = (void *)skb->data; | ||
1560 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_POWERSAVE_MODE_CMD); | ||
1561 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1562 | cmd = (void *)tlv->value; | ||
1563 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1564 | cmd->sta_ps_mode = __cpu_to_le32(psmode); | ||
1565 | |||
1566 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv set psmode\n"); | ||
1567 | return skb; | ||
1568 | } | ||
1569 | |||
1570 | static struct sk_buff * | ||
1571 | ath10k_wmi_tlv_op_gen_set_sta_ps(struct ath10k *ar, u32 vdev_id, | ||
1572 | enum wmi_sta_powersave_param param_id, | ||
1573 | u32 param_value) | ||
1574 | { | ||
1575 | struct wmi_sta_powersave_param_cmd *cmd; | ||
1576 | struct wmi_tlv *tlv; | ||
1577 | struct sk_buff *skb; | ||
1578 | |||
1579 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1580 | if (!skb) | ||
1581 | return ERR_PTR(-ENOMEM); | ||
1582 | |||
1583 | tlv = (void *)skb->data; | ||
1584 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_STA_POWERSAVE_PARAM_CMD); | ||
1585 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1586 | cmd = (void *)tlv->value; | ||
1587 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1588 | cmd->param_id = __cpu_to_le32(param_id); | ||
1589 | cmd->param_value = __cpu_to_le32(param_value); | ||
1590 | |||
1591 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv set sta ps\n"); | ||
1592 | return skb; | ||
1593 | } | ||
1594 | |||
1595 | static struct sk_buff * | ||
1596 | ath10k_wmi_tlv_op_gen_set_ap_ps(struct ath10k *ar, u32 vdev_id, const u8 *mac, | ||
1597 | enum wmi_ap_ps_peer_param param_id, u32 value) | ||
1598 | { | ||
1599 | struct wmi_ap_ps_peer_cmd *cmd; | ||
1600 | struct wmi_tlv *tlv; | ||
1601 | struct sk_buff *skb; | ||
1602 | |||
1603 | if (!mac) | ||
1604 | return ERR_PTR(-EINVAL); | ||
1605 | |||
1606 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | ||
1607 | if (!skb) | ||
1608 | return ERR_PTR(-ENOMEM); | ||
1609 | |||
1610 | tlv = (void *)skb->data; | ||
1611 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_AP_PS_PEER_CMD); | ||
1612 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1613 | cmd = (void *)tlv->value; | ||
1614 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
1615 | cmd->param_id = __cpu_to_le32(param_id); | ||
1616 | cmd->param_value = __cpu_to_le32(value); | ||
1617 | ether_addr_copy(cmd->peer_macaddr.addr, mac); | ||
1618 | |||
1619 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv ap ps param\n"); | ||
1620 | return skb; | ||
1621 | } | ||
1622 | |||
1623 | static struct sk_buff * | ||
1624 | ath10k_wmi_tlv_op_gen_scan_chan_list(struct ath10k *ar, | ||
1625 | const struct wmi_scan_chan_list_arg *arg) | ||
1626 | { | ||
1627 | struct wmi_tlv_scan_chan_list_cmd *cmd; | ||
1628 | struct wmi_channel *ci; | ||
1629 | struct wmi_channel_arg *ch; | ||
1630 | struct wmi_tlv *tlv; | ||
1631 | struct sk_buff *skb; | ||
1632 | size_t chans_len, len; | ||
1633 | int i; | ||
1634 | void *ptr, *chans; | ||
1635 | |||
1636 | chans_len = arg->n_channels * (sizeof(*tlv) + sizeof(*ci)); | ||
1637 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
1638 | (sizeof(*tlv) + chans_len); | ||
1639 | |||
1640 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1641 | if (!skb) | ||
1642 | return ERR_PTR(-ENOMEM); | ||
1643 | |||
1644 | ptr = (void *)skb->data; | ||
1645 | tlv = ptr; | ||
1646 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_SCAN_CHAN_LIST_CMD); | ||
1647 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1648 | cmd = (void *)tlv->value; | ||
1649 | cmd->num_scan_chans = __cpu_to_le32(arg->n_channels); | ||
1650 | |||
1651 | ptr += sizeof(*tlv); | ||
1652 | ptr += sizeof(*cmd); | ||
1653 | |||
1654 | tlv = ptr; | ||
1655 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT); | ||
1656 | tlv->len = __cpu_to_le16(chans_len); | ||
1657 | chans = (void *)tlv->value; | ||
1658 | |||
1659 | for (i = 0; i < arg->n_channels; i++) { | ||
1660 | ch = &arg->channels[i]; | ||
1661 | |||
1662 | tlv = chans; | ||
1663 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_CHANNEL); | ||
1664 | tlv->len = __cpu_to_le16(sizeof(*ci)); | ||
1665 | ci = (void *)tlv->value; | ||
1666 | |||
1667 | ath10k_wmi_put_wmi_channel(ci, ch); | ||
1668 | |||
1669 | chans += sizeof(*tlv); | ||
1670 | chans += sizeof(*ci); | ||
1671 | } | ||
1672 | |||
1673 | ptr += sizeof(*tlv); | ||
1674 | ptr += chans_len; | ||
1675 | |||
1676 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv scan chan list\n"); | ||
1677 | return skb; | ||
1678 | } | ||
1679 | |||
1680 | static struct sk_buff * | ||
1681 | ath10k_wmi_tlv_op_gen_beacon_dma(struct ath10k_vif *arvif) | ||
1682 | { | ||
1683 | struct ath10k *ar = arvif->ar; | ||
1684 | struct wmi_bcn_tx_ref_cmd *cmd; | ||
1685 | struct wmi_tlv *tlv; | ||
1686 | struct sk_buff *skb; | ||
1687 | struct sk_buff *beacon = arvif->beacon; | ||
1688 | struct ieee80211_hdr *hdr; | ||
1689 | u16 fc; | ||
1690 | |||
1691 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1692 | if (!skb) | ||
1693 | return ERR_PTR(-ENOMEM); | ||
1694 | |||
1695 | hdr = (struct ieee80211_hdr *)beacon->data; | ||
1696 | fc = le16_to_cpu(hdr->frame_control); | ||
1697 | |||
1698 | tlv = (void *)skb->data; | ||
1699 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_SEND_FROM_HOST_CMD); | ||
1700 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1701 | cmd = (void *)tlv->value; | ||
1702 | cmd->vdev_id = __cpu_to_le32(arvif->vdev_id); | ||
1703 | cmd->data_len = __cpu_to_le32(beacon->len); | ||
1704 | cmd->data_ptr = __cpu_to_le32(ATH10K_SKB_CB(beacon)->paddr); | ||
1705 | cmd->msdu_id = 0; | ||
1706 | cmd->frame_control = __cpu_to_le32(fc); | ||
1707 | cmd->flags = 0; | ||
1708 | |||
1709 | if (ATH10K_SKB_CB(beacon)->bcn.dtim_zero) | ||
1710 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO); | ||
1711 | |||
1712 | if (ATH10K_SKB_CB(beacon)->bcn.deliver_cab) | ||
1713 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB); | ||
1714 | |||
1715 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv beacon dma\n"); | ||
1716 | return skb; | ||
1717 | } | ||
1718 | |||
1719 | static void *ath10k_wmi_tlv_put_wmm(void *ptr, | ||
1720 | const struct wmi_wmm_params_arg *arg) | ||
1721 | { | ||
1722 | struct wmi_wmm_params *wmm; | ||
1723 | struct wmi_tlv *tlv; | ||
1724 | |||
1725 | tlv = ptr; | ||
1726 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_WMM_PARAMS); | ||
1727 | tlv->len = __cpu_to_le16(sizeof(*wmm)); | ||
1728 | wmm = (void *)tlv->value; | ||
1729 | ath10k_wmi_pdev_set_wmm_param(wmm, arg); | ||
1730 | |||
1731 | return ptr + sizeof(*tlv) + sizeof(*wmm); | ||
1732 | } | ||
1733 | |||
1734 | static struct sk_buff * | ||
1735 | ath10k_wmi_tlv_op_gen_pdev_set_wmm(struct ath10k *ar, | ||
1736 | const struct wmi_pdev_set_wmm_params_arg *arg) | ||
1737 | { | ||
1738 | struct wmi_tlv_pdev_set_wmm_cmd *cmd; | ||
1739 | struct wmi_wmm_params *wmm; | ||
1740 | struct wmi_tlv *tlv; | ||
1741 | struct sk_buff *skb; | ||
1742 | size_t len; | ||
1743 | void *ptr; | ||
1744 | |||
1745 | len = (sizeof(*tlv) + sizeof(*cmd)) + | ||
1746 | (4 * (sizeof(*tlv) + sizeof(*wmm))); | ||
1747 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1748 | if (!skb) | ||
1749 | return ERR_PTR(-ENOMEM); | ||
1750 | |||
1751 | ptr = (void *)skb->data; | ||
1752 | |||
1753 | tlv = ptr; | ||
1754 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_WMM_PARAMS_CMD); | ||
1755 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1756 | cmd = (void *)tlv->value; | ||
1757 | |||
1758 | /* nothing to set here */ | ||
1759 | |||
1760 | ptr += sizeof(*tlv); | ||
1761 | ptr += sizeof(*cmd); | ||
1762 | |||
1763 | ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_be); | ||
1764 | ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_bk); | ||
1765 | ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_vi); | ||
1766 | ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_vo); | ||
1767 | |||
1768 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pdev set wmm\n"); | ||
1769 | return skb; | ||
1770 | } | ||
1771 | |||
1772 | static struct sk_buff * | ||
1773 | ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, | ||
1774 | enum wmi_stats_id stats_id) | ||
1775 | { | ||
1776 | struct wmi_request_stats_cmd *cmd; | ||
1777 | struct wmi_tlv *tlv; | ||
1778 | struct sk_buff *skb; | ||
1779 | |||
1780 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1781 | if (!skb) | ||
1782 | return ERR_PTR(-ENOMEM); | ||
1783 | |||
1784 | tlv = (void *)skb->data; | ||
1785 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_REQUEST_STATS_CMD); | ||
1786 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1787 | cmd = (void *)tlv->value; | ||
1788 | cmd->stats_id = __cpu_to_le32(stats_id); | ||
1789 | |||
1790 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv request stats\n"); | ||
1791 | return skb; | ||
1792 | } | ||
1793 | |||
1794 | static struct sk_buff * | ||
1795 | ath10k_wmi_tlv_op_gen_force_fw_hang(struct ath10k *ar, | ||
1796 | enum wmi_force_fw_hang_type type, | ||
1797 | u32 delay_ms) | ||
1798 | { | ||
1799 | struct wmi_force_fw_hang_cmd *cmd; | ||
1800 | struct wmi_tlv *tlv; | ||
1801 | struct sk_buff *skb; | ||
1802 | |||
1803 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd)); | ||
1804 | if (!skb) | ||
1805 | return ERR_PTR(-ENOMEM); | ||
1806 | |||
1807 | tlv = (void *)skb->data; | ||
1808 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_FORCE_FW_HANG_CMD); | ||
1809 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1810 | cmd = (void *)tlv->value; | ||
1811 | cmd->type = __cpu_to_le32(type); | ||
1812 | cmd->delay_ms = __cpu_to_le32(delay_ms); | ||
1813 | |||
1814 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv force fw hang\n"); | ||
1815 | return skb; | ||
1816 | } | ||
1817 | |||
1818 | static struct sk_buff * | ||
1819 | ath10k_wmi_tlv_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable) | ||
1820 | { | ||
1821 | struct wmi_tlv_dbglog_cmd *cmd; | ||
1822 | struct wmi_tlv *tlv; | ||
1823 | struct sk_buff *skb; | ||
1824 | size_t len, bmap_len; | ||
1825 | u32 value; | ||
1826 | void *ptr; | ||
1827 | |||
1828 | if (module_enable) { | ||
1829 | value = WMI_TLV_DBGLOG_LOG_LEVEL_VALUE( | ||
1830 | module_enable, | ||
1831 | WMI_TLV_DBGLOG_LOG_LEVEL_VERBOSE); | ||
1832 | } else { | ||
1833 | value = WMI_TLV_DBGLOG_LOG_LEVEL_VALUE( | ||
1834 | WMI_TLV_DBGLOG_ALL_MODULES, | ||
1835 | WMI_TLV_DBGLOG_LOG_LEVEL_WARN); | ||
1836 | } | ||
1837 | |||
1838 | bmap_len = 0; | ||
1839 | len = sizeof(*tlv) + sizeof(*cmd) + sizeof(*tlv) + bmap_len; | ||
1840 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1841 | if (!skb) | ||
1842 | return ERR_PTR(-ENOMEM); | ||
1843 | |||
1844 | ptr = (void *)skb->data; | ||
1845 | |||
1846 | tlv = ptr; | ||
1847 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_DEBUG_LOG_CONFIG_CMD); | ||
1848 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1849 | cmd = (void *)tlv->value; | ||
1850 | cmd->param = __cpu_to_le32(WMI_TLV_DBGLOG_PARAM_LOG_LEVEL); | ||
1851 | cmd->value = __cpu_to_le32(value); | ||
1852 | |||
1853 | ptr += sizeof(*tlv); | ||
1854 | ptr += sizeof(*cmd); | ||
1855 | |||
1856 | tlv = ptr; | ||
1857 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32); | ||
1858 | tlv->len = __cpu_to_le16(bmap_len); | ||
1859 | |||
1860 | /* nothing to do here */ | ||
1861 | |||
1862 | ptr += sizeof(*tlv); | ||
1863 | ptr += sizeof(bmap_len); | ||
1864 | |||
1865 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv dbglog value 0x%08x\n", value); | ||
1866 | return skb; | ||
1867 | } | ||
1868 | |||
1869 | static struct sk_buff * | ||
1870 | ath10k_wmi_tlv_op_gen_pktlog_enable(struct ath10k *ar, u32 filter) | ||
1871 | { | ||
1872 | struct wmi_tlv_pktlog_enable *cmd; | ||
1873 | struct wmi_tlv *tlv; | ||
1874 | struct sk_buff *skb; | ||
1875 | void *ptr; | ||
1876 | size_t len; | ||
1877 | |||
1878 | len = sizeof(*tlv) + sizeof(*cmd); | ||
1879 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1880 | if (!skb) | ||
1881 | return ERR_PTR(-ENOMEM); | ||
1882 | |||
1883 | ptr = (void *)skb->data; | ||
1884 | tlv = ptr; | ||
1885 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_ENABLE_CMD); | ||
1886 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1887 | cmd = (void *)tlv->value; | ||
1888 | cmd->filter = __cpu_to_le32(filter); | ||
1889 | |||
1890 | ptr += sizeof(*tlv); | ||
1891 | ptr += sizeof(*cmd); | ||
1892 | |||
1893 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pktlog enable filter 0x%08x\n", | ||
1894 | filter); | ||
1895 | return skb; | ||
1896 | } | ||
1897 | |||
1898 | static struct sk_buff * | ||
1899 | ath10k_wmi_tlv_op_gen_pktlog_disable(struct ath10k *ar) | ||
1900 | { | ||
1901 | struct wmi_tlv_pktlog_disable *cmd; | ||
1902 | struct wmi_tlv *tlv; | ||
1903 | struct sk_buff *skb; | ||
1904 | void *ptr; | ||
1905 | size_t len; | ||
1906 | |||
1907 | len = sizeof(*tlv) + sizeof(*cmd); | ||
1908 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1909 | if (!skb) | ||
1910 | return ERR_PTR(-ENOMEM); | ||
1911 | |||
1912 | ptr = (void *)skb->data; | ||
1913 | tlv = ptr; | ||
1914 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_DISABLE_CMD); | ||
1915 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
1916 | cmd = (void *)tlv->value; | ||
1917 | |||
1918 | ptr += sizeof(*tlv); | ||
1919 | ptr += sizeof(*cmd); | ||
1920 | |||
1921 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv pktlog disable\n"); | ||
1922 | return skb; | ||
1923 | } | ||
1924 | |||
1925 | /****************/ | ||
1926 | /* TLV mappings */ | ||
1927 | /****************/ | ||
1928 | |||
1929 | static struct wmi_cmd_map wmi_tlv_cmd_map = { | ||
1930 | .init_cmdid = WMI_TLV_INIT_CMDID, | ||
1931 | .start_scan_cmdid = WMI_TLV_START_SCAN_CMDID, | ||
1932 | .stop_scan_cmdid = WMI_TLV_STOP_SCAN_CMDID, | ||
1933 | .scan_chan_list_cmdid = WMI_TLV_SCAN_CHAN_LIST_CMDID, | ||
1934 | .scan_sch_prio_tbl_cmdid = WMI_TLV_SCAN_SCH_PRIO_TBL_CMDID, | ||
1935 | .pdev_set_regdomain_cmdid = WMI_TLV_PDEV_SET_REGDOMAIN_CMDID, | ||
1936 | .pdev_set_channel_cmdid = WMI_TLV_PDEV_SET_CHANNEL_CMDID, | ||
1937 | .pdev_set_param_cmdid = WMI_TLV_PDEV_SET_PARAM_CMDID, | ||
1938 | .pdev_pktlog_enable_cmdid = WMI_TLV_PDEV_PKTLOG_ENABLE_CMDID, | ||
1939 | .pdev_pktlog_disable_cmdid = WMI_TLV_PDEV_PKTLOG_DISABLE_CMDID, | ||
1940 | .pdev_set_wmm_params_cmdid = WMI_TLV_PDEV_SET_WMM_PARAMS_CMDID, | ||
1941 | .pdev_set_ht_cap_ie_cmdid = WMI_TLV_PDEV_SET_HT_CAP_IE_CMDID, | ||
1942 | .pdev_set_vht_cap_ie_cmdid = WMI_TLV_PDEV_SET_VHT_CAP_IE_CMDID, | ||
1943 | .pdev_set_dscp_tid_map_cmdid = WMI_TLV_PDEV_SET_DSCP_TID_MAP_CMDID, | ||
1944 | .pdev_set_quiet_mode_cmdid = WMI_TLV_PDEV_SET_QUIET_MODE_CMDID, | ||
1945 | .pdev_green_ap_ps_enable_cmdid = WMI_TLV_PDEV_GREEN_AP_PS_ENABLE_CMDID, | ||
1946 | .pdev_get_tpc_config_cmdid = WMI_TLV_PDEV_GET_TPC_CONFIG_CMDID, | ||
1947 | .pdev_set_base_macaddr_cmdid = WMI_TLV_PDEV_SET_BASE_MACADDR_CMDID, | ||
1948 | .vdev_create_cmdid = WMI_TLV_VDEV_CREATE_CMDID, | ||
1949 | .vdev_delete_cmdid = WMI_TLV_VDEV_DELETE_CMDID, | ||
1950 | .vdev_start_request_cmdid = WMI_TLV_VDEV_START_REQUEST_CMDID, | ||
1951 | .vdev_restart_request_cmdid = WMI_TLV_VDEV_RESTART_REQUEST_CMDID, | ||
1952 | .vdev_up_cmdid = WMI_TLV_VDEV_UP_CMDID, | ||
1953 | .vdev_stop_cmdid = WMI_TLV_VDEV_STOP_CMDID, | ||
1954 | .vdev_down_cmdid = WMI_TLV_VDEV_DOWN_CMDID, | ||
1955 | .vdev_set_param_cmdid = WMI_TLV_VDEV_SET_PARAM_CMDID, | ||
1956 | .vdev_install_key_cmdid = WMI_TLV_VDEV_INSTALL_KEY_CMDID, | ||
1957 | .peer_create_cmdid = WMI_TLV_PEER_CREATE_CMDID, | ||
1958 | .peer_delete_cmdid = WMI_TLV_PEER_DELETE_CMDID, | ||
1959 | .peer_flush_tids_cmdid = WMI_TLV_PEER_FLUSH_TIDS_CMDID, | ||
1960 | .peer_set_param_cmdid = WMI_TLV_PEER_SET_PARAM_CMDID, | ||
1961 | .peer_assoc_cmdid = WMI_TLV_PEER_ASSOC_CMDID, | ||
1962 | .peer_add_wds_entry_cmdid = WMI_TLV_PEER_ADD_WDS_ENTRY_CMDID, | ||
1963 | .peer_remove_wds_entry_cmdid = WMI_TLV_PEER_REMOVE_WDS_ENTRY_CMDID, | ||
1964 | .peer_mcast_group_cmdid = WMI_TLV_PEER_MCAST_GROUP_CMDID, | ||
1965 | .bcn_tx_cmdid = WMI_TLV_BCN_TX_CMDID, | ||
1966 | .pdev_send_bcn_cmdid = WMI_TLV_PDEV_SEND_BCN_CMDID, | ||
1967 | .bcn_tmpl_cmdid = WMI_TLV_BCN_TMPL_CMDID, | ||
1968 | .bcn_filter_rx_cmdid = WMI_TLV_BCN_FILTER_RX_CMDID, | ||
1969 | .prb_req_filter_rx_cmdid = WMI_TLV_PRB_REQ_FILTER_RX_CMDID, | ||
1970 | .mgmt_tx_cmdid = WMI_TLV_MGMT_TX_CMDID, | ||
1971 | .prb_tmpl_cmdid = WMI_TLV_PRB_TMPL_CMDID, | ||
1972 | .addba_clear_resp_cmdid = WMI_TLV_ADDBA_CLEAR_RESP_CMDID, | ||
1973 | .addba_send_cmdid = WMI_TLV_ADDBA_SEND_CMDID, | ||
1974 | .addba_status_cmdid = WMI_TLV_ADDBA_STATUS_CMDID, | ||
1975 | .delba_send_cmdid = WMI_TLV_DELBA_SEND_CMDID, | ||
1976 | .addba_set_resp_cmdid = WMI_TLV_ADDBA_SET_RESP_CMDID, | ||
1977 | .send_singleamsdu_cmdid = WMI_TLV_SEND_SINGLEAMSDU_CMDID, | ||
1978 | .sta_powersave_mode_cmdid = WMI_TLV_STA_POWERSAVE_MODE_CMDID, | ||
1979 | .sta_powersave_param_cmdid = WMI_TLV_STA_POWERSAVE_PARAM_CMDID, | ||
1980 | .sta_mimo_ps_mode_cmdid = WMI_TLV_STA_MIMO_PS_MODE_CMDID, | ||
1981 | .pdev_dfs_enable_cmdid = WMI_TLV_PDEV_DFS_ENABLE_CMDID, | ||
1982 | .pdev_dfs_disable_cmdid = WMI_TLV_PDEV_DFS_DISABLE_CMDID, | ||
1983 | .roam_scan_mode = WMI_TLV_ROAM_SCAN_MODE, | ||
1984 | .roam_scan_rssi_threshold = WMI_TLV_ROAM_SCAN_RSSI_THRESHOLD, | ||
1985 | .roam_scan_period = WMI_TLV_ROAM_SCAN_PERIOD, | ||
1986 | .roam_scan_rssi_change_threshold = | ||
1987 | WMI_TLV_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, | ||
1988 | .roam_ap_profile = WMI_TLV_ROAM_AP_PROFILE, | ||
1989 | .ofl_scan_add_ap_profile = WMI_TLV_ROAM_AP_PROFILE, | ||
1990 | .ofl_scan_remove_ap_profile = WMI_TLV_OFL_SCAN_REMOVE_AP_PROFILE, | ||
1991 | .ofl_scan_period = WMI_TLV_OFL_SCAN_PERIOD, | ||
1992 | .p2p_dev_set_device_info = WMI_TLV_P2P_DEV_SET_DEVICE_INFO, | ||
1993 | .p2p_dev_set_discoverability = WMI_TLV_P2P_DEV_SET_DISCOVERABILITY, | ||
1994 | .p2p_go_set_beacon_ie = WMI_TLV_P2P_GO_SET_BEACON_IE, | ||
1995 | .p2p_go_set_probe_resp_ie = WMI_TLV_P2P_GO_SET_PROBE_RESP_IE, | ||
1996 | .p2p_set_vendor_ie_data_cmdid = WMI_TLV_P2P_SET_VENDOR_IE_DATA_CMDID, | ||
1997 | .ap_ps_peer_param_cmdid = WMI_TLV_AP_PS_PEER_PARAM_CMDID, | ||
1998 | .ap_ps_peer_uapsd_coex_cmdid = WMI_TLV_AP_PS_PEER_UAPSD_COEX_CMDID, | ||
1999 | .peer_rate_retry_sched_cmdid = WMI_TLV_PEER_RATE_RETRY_SCHED_CMDID, | ||
2000 | .wlan_profile_trigger_cmdid = WMI_TLV_WLAN_PROFILE_TRIGGER_CMDID, | ||
2001 | .wlan_profile_set_hist_intvl_cmdid = | ||
2002 | WMI_TLV_WLAN_PROFILE_SET_HIST_INTVL_CMDID, | ||
2003 | .wlan_profile_get_profile_data_cmdid = | ||
2004 | WMI_TLV_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, | ||
2005 | .wlan_profile_enable_profile_id_cmdid = | ||
2006 | WMI_TLV_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, | ||
2007 | .wlan_profile_list_profile_id_cmdid = | ||
2008 | WMI_TLV_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, | ||
2009 | .pdev_suspend_cmdid = WMI_TLV_PDEV_SUSPEND_CMDID, | ||
2010 | .pdev_resume_cmdid = WMI_TLV_PDEV_RESUME_CMDID, | ||
2011 | .add_bcn_filter_cmdid = WMI_TLV_ADD_BCN_FILTER_CMDID, | ||
2012 | .rmv_bcn_filter_cmdid = WMI_TLV_RMV_BCN_FILTER_CMDID, | ||
2013 | .wow_add_wake_pattern_cmdid = WMI_TLV_WOW_ADD_WAKE_PATTERN_CMDID, | ||
2014 | .wow_del_wake_pattern_cmdid = WMI_TLV_WOW_DEL_WAKE_PATTERN_CMDID, | ||
2015 | .wow_enable_disable_wake_event_cmdid = | ||
2016 | WMI_TLV_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, | ||
2017 | .wow_enable_cmdid = WMI_TLV_WOW_ENABLE_CMDID, | ||
2018 | .wow_hostwakeup_from_sleep_cmdid = | ||
2019 | WMI_TLV_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, | ||
2020 | .rtt_measreq_cmdid = WMI_TLV_RTT_MEASREQ_CMDID, | ||
2021 | .rtt_tsf_cmdid = WMI_TLV_RTT_TSF_CMDID, | ||
2022 | .vdev_spectral_scan_configure_cmdid = WMI_TLV_SPECTRAL_SCAN_CONF_CMDID, | ||
2023 | .vdev_spectral_scan_enable_cmdid = WMI_TLV_SPECTRAL_SCAN_ENABLE_CMDID, | ||
2024 | .request_stats_cmdid = WMI_TLV_REQUEST_STATS_CMDID, | ||
2025 | .set_arp_ns_offload_cmdid = WMI_TLV_SET_ARP_NS_OFFLOAD_CMDID, | ||
2026 | .network_list_offload_config_cmdid = | ||
2027 | WMI_TLV_NETWORK_LIST_OFFLOAD_CONFIG_CMDID, | ||
2028 | .gtk_offload_cmdid = WMI_TLV_GTK_OFFLOAD_CMDID, | ||
2029 | .csa_offload_enable_cmdid = WMI_TLV_CSA_OFFLOAD_ENABLE_CMDID, | ||
2030 | .csa_offload_chanswitch_cmdid = WMI_TLV_CSA_OFFLOAD_CHANSWITCH_CMDID, | ||
2031 | .chatter_set_mode_cmdid = WMI_TLV_CHATTER_SET_MODE_CMDID, | ||
2032 | .peer_tid_addba_cmdid = WMI_TLV_PEER_TID_ADDBA_CMDID, | ||
2033 | .peer_tid_delba_cmdid = WMI_TLV_PEER_TID_DELBA_CMDID, | ||
2034 | .sta_dtim_ps_method_cmdid = WMI_TLV_STA_DTIM_PS_METHOD_CMDID, | ||
2035 | .sta_uapsd_auto_trig_cmdid = WMI_TLV_STA_UAPSD_AUTO_TRIG_CMDID, | ||
2036 | .sta_keepalive_cmd = WMI_TLV_STA_KEEPALIVE_CMDID, | ||
2037 | .echo_cmdid = WMI_TLV_ECHO_CMDID, | ||
2038 | .pdev_utf_cmdid = WMI_TLV_PDEV_UTF_CMDID, | ||
2039 | .dbglog_cfg_cmdid = WMI_TLV_DBGLOG_CFG_CMDID, | ||
2040 | .pdev_qvit_cmdid = WMI_TLV_PDEV_QVIT_CMDID, | ||
2041 | .pdev_ftm_intg_cmdid = WMI_TLV_PDEV_FTM_INTG_CMDID, | ||
2042 | .vdev_set_keepalive_cmdid = WMI_TLV_VDEV_SET_KEEPALIVE_CMDID, | ||
2043 | .vdev_get_keepalive_cmdid = WMI_TLV_VDEV_GET_KEEPALIVE_CMDID, | ||
2044 | .force_fw_hang_cmdid = WMI_TLV_FORCE_FW_HANG_CMDID, | ||
2045 | .gpio_config_cmdid = WMI_TLV_GPIO_CONFIG_CMDID, | ||
2046 | .gpio_output_cmdid = WMI_TLV_GPIO_OUTPUT_CMDID, | ||
2047 | .pdev_get_temperature_cmdid = WMI_TLV_CMD_UNSUPPORTED, | ||
2048 | }; | ||
2049 | |||
2050 | static struct wmi_pdev_param_map wmi_tlv_pdev_param_map = { | ||
2051 | .tx_chain_mask = WMI_TLV_PDEV_PARAM_TX_CHAIN_MASK, | ||
2052 | .rx_chain_mask = WMI_TLV_PDEV_PARAM_RX_CHAIN_MASK, | ||
2053 | .txpower_limit2g = WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT2G, | ||
2054 | .txpower_limit5g = WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT5G, | ||
2055 | .txpower_scale = WMI_TLV_PDEV_PARAM_TXPOWER_SCALE, | ||
2056 | .beacon_gen_mode = WMI_TLV_PDEV_PARAM_BEACON_GEN_MODE, | ||
2057 | .beacon_tx_mode = WMI_TLV_PDEV_PARAM_BEACON_TX_MODE, | ||
2058 | .resmgr_offchan_mode = WMI_TLV_PDEV_PARAM_RESMGR_OFFCHAN_MODE, | ||
2059 | .protection_mode = WMI_TLV_PDEV_PARAM_PROTECTION_MODE, | ||
2060 | .dynamic_bw = WMI_TLV_PDEV_PARAM_DYNAMIC_BW, | ||
2061 | .non_agg_sw_retry_th = WMI_TLV_PDEV_PARAM_NON_AGG_SW_RETRY_TH, | ||
2062 | .agg_sw_retry_th = WMI_TLV_PDEV_PARAM_AGG_SW_RETRY_TH, | ||
2063 | .sta_kickout_th = WMI_TLV_PDEV_PARAM_STA_KICKOUT_TH, | ||
2064 | .ac_aggrsize_scaling = WMI_TLV_PDEV_PARAM_AC_AGGRSIZE_SCALING, | ||
2065 | .ltr_enable = WMI_TLV_PDEV_PARAM_LTR_ENABLE, | ||
2066 | .ltr_ac_latency_be = WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BE, | ||
2067 | .ltr_ac_latency_bk = WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BK, | ||
2068 | .ltr_ac_latency_vi = WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VI, | ||
2069 | .ltr_ac_latency_vo = WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VO, | ||
2070 | .ltr_ac_latency_timeout = WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, | ||
2071 | .ltr_sleep_override = WMI_TLV_PDEV_PARAM_LTR_SLEEP_OVERRIDE, | ||
2072 | .ltr_rx_override = WMI_TLV_PDEV_PARAM_LTR_RX_OVERRIDE, | ||
2073 | .ltr_tx_activity_timeout = WMI_TLV_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, | ||
2074 | .l1ss_enable = WMI_TLV_PDEV_PARAM_L1SS_ENABLE, | ||
2075 | .dsleep_enable = WMI_TLV_PDEV_PARAM_DSLEEP_ENABLE, | ||
2076 | .pcielp_txbuf_flush = WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_FLUSH, | ||
2077 | .pcielp_txbuf_watermark = WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, | ||
2078 | .pcielp_txbuf_tmo_en = WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, | ||
2079 | .pcielp_txbuf_tmo_value = WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE, | ||
2080 | .pdev_stats_update_period = WMI_TLV_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, | ||
2081 | .vdev_stats_update_period = WMI_TLV_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, | ||
2082 | .peer_stats_update_period = WMI_TLV_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, | ||
2083 | .bcnflt_stats_update_period = | ||
2084 | WMI_TLV_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, | ||
2085 | .pmf_qos = WMI_TLV_PDEV_PARAM_PMF_QOS, | ||
2086 | .arp_ac_override = WMI_TLV_PDEV_PARAM_ARP_AC_OVERRIDE, | ||
2087 | .dcs = WMI_TLV_PDEV_PARAM_DCS, | ||
2088 | .ani_enable = WMI_TLV_PDEV_PARAM_ANI_ENABLE, | ||
2089 | .ani_poll_period = WMI_TLV_PDEV_PARAM_ANI_POLL_PERIOD, | ||
2090 | .ani_listen_period = WMI_TLV_PDEV_PARAM_ANI_LISTEN_PERIOD, | ||
2091 | .ani_ofdm_level = WMI_TLV_PDEV_PARAM_ANI_OFDM_LEVEL, | ||
2092 | .ani_cck_level = WMI_TLV_PDEV_PARAM_ANI_CCK_LEVEL, | ||
2093 | .dyntxchain = WMI_TLV_PDEV_PARAM_DYNTXCHAIN, | ||
2094 | .proxy_sta = WMI_TLV_PDEV_PARAM_PROXY_STA, | ||
2095 | .idle_ps_config = WMI_TLV_PDEV_PARAM_IDLE_PS_CONFIG, | ||
2096 | .power_gating_sleep = WMI_TLV_PDEV_PARAM_POWER_GATING_SLEEP, | ||
2097 | .fast_channel_reset = WMI_TLV_PDEV_PARAM_UNSUPPORTED, | ||
2098 | .burst_dur = WMI_TLV_PDEV_PARAM_BURST_DUR, | ||
2099 | .burst_enable = WMI_TLV_PDEV_PARAM_BURST_ENABLE, | ||
2100 | .cal_period = WMI_PDEV_PARAM_UNSUPPORTED, | ||
2101 | }; | ||
2102 | |||
2103 | static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = { | ||
2104 | .rts_threshold = WMI_TLV_VDEV_PARAM_RTS_THRESHOLD, | ||
2105 | .fragmentation_threshold = WMI_TLV_VDEV_PARAM_FRAGMENTATION_THRESHOLD, | ||
2106 | .beacon_interval = WMI_TLV_VDEV_PARAM_BEACON_INTERVAL, | ||
2107 | .listen_interval = WMI_TLV_VDEV_PARAM_LISTEN_INTERVAL, | ||
2108 | .multicast_rate = WMI_TLV_VDEV_PARAM_MULTICAST_RATE, | ||
2109 | .mgmt_tx_rate = WMI_TLV_VDEV_PARAM_MGMT_TX_RATE, | ||
2110 | .slot_time = WMI_TLV_VDEV_PARAM_SLOT_TIME, | ||
2111 | .preamble = WMI_TLV_VDEV_PARAM_PREAMBLE, | ||
2112 | .swba_time = WMI_TLV_VDEV_PARAM_SWBA_TIME, | ||
2113 | .wmi_vdev_stats_update_period = WMI_TLV_VDEV_STATS_UPDATE_PERIOD, | ||
2114 | .wmi_vdev_pwrsave_ageout_time = WMI_TLV_VDEV_PWRSAVE_AGEOUT_TIME, | ||
2115 | .wmi_vdev_host_swba_interval = WMI_TLV_VDEV_HOST_SWBA_INTERVAL, | ||
2116 | .dtim_period = WMI_TLV_VDEV_PARAM_DTIM_PERIOD, | ||
2117 | .wmi_vdev_oc_scheduler_air_time_limit = | ||
2118 | WMI_TLV_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, | ||
2119 | .wds = WMI_TLV_VDEV_PARAM_WDS, | ||
2120 | .atim_window = WMI_TLV_VDEV_PARAM_ATIM_WINDOW, | ||
2121 | .bmiss_count_max = WMI_TLV_VDEV_PARAM_BMISS_COUNT_MAX, | ||
2122 | .bmiss_first_bcnt = WMI_TLV_VDEV_PARAM_BMISS_FIRST_BCNT, | ||
2123 | .bmiss_final_bcnt = WMI_TLV_VDEV_PARAM_BMISS_FINAL_BCNT, | ||
2124 | .feature_wmm = WMI_TLV_VDEV_PARAM_FEATURE_WMM, | ||
2125 | .chwidth = WMI_TLV_VDEV_PARAM_CHWIDTH, | ||
2126 | .chextoffset = WMI_TLV_VDEV_PARAM_CHEXTOFFSET, | ||
2127 | .disable_htprotection = WMI_TLV_VDEV_PARAM_DISABLE_HTPROTECTION, | ||
2128 | .sta_quickkickout = WMI_TLV_VDEV_PARAM_STA_QUICKKICKOUT, | ||
2129 | .mgmt_rate = WMI_TLV_VDEV_PARAM_MGMT_RATE, | ||
2130 | .protection_mode = WMI_TLV_VDEV_PARAM_PROTECTION_MODE, | ||
2131 | .fixed_rate = WMI_TLV_VDEV_PARAM_FIXED_RATE, | ||
2132 | .sgi = WMI_TLV_VDEV_PARAM_SGI, | ||
2133 | .ldpc = WMI_TLV_VDEV_PARAM_LDPC, | ||
2134 | .tx_stbc = WMI_TLV_VDEV_PARAM_TX_STBC, | ||
2135 | .rx_stbc = WMI_TLV_VDEV_PARAM_RX_STBC, | ||
2136 | .intra_bss_fwd = WMI_TLV_VDEV_PARAM_INTRA_BSS_FWD, | ||
2137 | .def_keyid = WMI_TLV_VDEV_PARAM_DEF_KEYID, | ||
2138 | .nss = WMI_TLV_VDEV_PARAM_NSS, | ||
2139 | .bcast_data_rate = WMI_TLV_VDEV_PARAM_BCAST_DATA_RATE, | ||
2140 | .mcast_data_rate = WMI_TLV_VDEV_PARAM_MCAST_DATA_RATE, | ||
2141 | .mcast_indicate = WMI_TLV_VDEV_PARAM_MCAST_INDICATE, | ||
2142 | .dhcp_indicate = WMI_TLV_VDEV_PARAM_DHCP_INDICATE, | ||
2143 | .unknown_dest_indicate = WMI_TLV_VDEV_PARAM_UNKNOWN_DEST_INDICATE, | ||
2144 | .ap_keepalive_min_idle_inactive_time_secs = | ||
2145 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, | ||
2146 | .ap_keepalive_max_idle_inactive_time_secs = | ||
2147 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, | ||
2148 | .ap_keepalive_max_unresponsive_time_secs = | ||
2149 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, | ||
2150 | .ap_enable_nawds = WMI_TLV_VDEV_PARAM_AP_ENABLE_NAWDS, | ||
2151 | .mcast2ucast_set = WMI_TLV_VDEV_PARAM_UNSUPPORTED, | ||
2152 | .enable_rtscts = WMI_TLV_VDEV_PARAM_ENABLE_RTSCTS, | ||
2153 | .txbf = WMI_TLV_VDEV_PARAM_TXBF, | ||
2154 | .packet_powersave = WMI_TLV_VDEV_PARAM_PACKET_POWERSAVE, | ||
2155 | .drop_unencry = WMI_TLV_VDEV_PARAM_DROP_UNENCRY, | ||
2156 | .tx_encap_type = WMI_TLV_VDEV_PARAM_TX_ENCAP_TYPE, | ||
2157 | .ap_detect_out_of_sync_sleeping_sta_time_secs = | ||
2158 | WMI_TLV_VDEV_PARAM_UNSUPPORTED, | ||
2159 | }; | ||
2160 | |||
2161 | static const struct wmi_ops wmi_tlv_ops = { | ||
2162 | .rx = ath10k_wmi_tlv_op_rx, | ||
2163 | .map_svc = wmi_tlv_svc_map, | ||
2164 | |||
2165 | .pull_scan = ath10k_wmi_tlv_op_pull_scan_ev, | ||
2166 | .pull_mgmt_rx = ath10k_wmi_tlv_op_pull_mgmt_rx_ev, | ||
2167 | .pull_ch_info = ath10k_wmi_tlv_op_pull_ch_info_ev, | ||
2168 | .pull_vdev_start = ath10k_wmi_tlv_op_pull_vdev_start_ev, | ||
2169 | .pull_peer_kick = ath10k_wmi_tlv_op_pull_peer_kick_ev, | ||
2170 | .pull_swba = ath10k_wmi_tlv_op_pull_swba_ev, | ||
2171 | .pull_phyerr = ath10k_wmi_tlv_op_pull_phyerr_ev, | ||
2172 | .pull_svc_rdy = ath10k_wmi_tlv_op_pull_svc_rdy_ev, | ||
2173 | .pull_rdy = ath10k_wmi_tlv_op_pull_rdy_ev, | ||
2174 | .pull_fw_stats = ath10k_wmi_tlv_op_pull_fw_stats, | ||
2175 | |||
2176 | .gen_pdev_suspend = ath10k_wmi_tlv_op_gen_pdev_suspend, | ||
2177 | .gen_pdev_resume = ath10k_wmi_tlv_op_gen_pdev_resume, | ||
2178 | .gen_pdev_set_rd = ath10k_wmi_tlv_op_gen_pdev_set_rd, | ||
2179 | .gen_pdev_set_param = ath10k_wmi_tlv_op_gen_pdev_set_param, | ||
2180 | .gen_init = ath10k_wmi_tlv_op_gen_init, | ||
2181 | .gen_start_scan = ath10k_wmi_tlv_op_gen_start_scan, | ||
2182 | .gen_stop_scan = ath10k_wmi_tlv_op_gen_stop_scan, | ||
2183 | .gen_vdev_create = ath10k_wmi_tlv_op_gen_vdev_create, | ||
2184 | .gen_vdev_delete = ath10k_wmi_tlv_op_gen_vdev_delete, | ||
2185 | .gen_vdev_start = ath10k_wmi_tlv_op_gen_vdev_start, | ||
2186 | .gen_vdev_stop = ath10k_wmi_tlv_op_gen_vdev_stop, | ||
2187 | .gen_vdev_up = ath10k_wmi_tlv_op_gen_vdev_up, | ||
2188 | .gen_vdev_down = ath10k_wmi_tlv_op_gen_vdev_down, | ||
2189 | .gen_vdev_set_param = ath10k_wmi_tlv_op_gen_vdev_set_param, | ||
2190 | .gen_vdev_install_key = ath10k_wmi_tlv_op_gen_vdev_install_key, | ||
2191 | .gen_peer_create = ath10k_wmi_tlv_op_gen_peer_create, | ||
2192 | .gen_peer_delete = ath10k_wmi_tlv_op_gen_peer_delete, | ||
2193 | .gen_peer_flush = ath10k_wmi_tlv_op_gen_peer_flush, | ||
2194 | .gen_peer_set_param = ath10k_wmi_tlv_op_gen_peer_set_param, | ||
2195 | .gen_peer_assoc = ath10k_wmi_tlv_op_gen_peer_assoc, | ||
2196 | .gen_set_psmode = ath10k_wmi_tlv_op_gen_set_psmode, | ||
2197 | .gen_set_sta_ps = ath10k_wmi_tlv_op_gen_set_sta_ps, | ||
2198 | .gen_set_ap_ps = ath10k_wmi_tlv_op_gen_set_ap_ps, | ||
2199 | .gen_scan_chan_list = ath10k_wmi_tlv_op_gen_scan_chan_list, | ||
2200 | .gen_beacon_dma = ath10k_wmi_tlv_op_gen_beacon_dma, | ||
2201 | .gen_pdev_set_wmm = ath10k_wmi_tlv_op_gen_pdev_set_wmm, | ||
2202 | .gen_request_stats = ath10k_wmi_tlv_op_gen_request_stats, | ||
2203 | .gen_force_fw_hang = ath10k_wmi_tlv_op_gen_force_fw_hang, | ||
2204 | /* .gen_mgmt_tx = not implemented; HTT is used */ | ||
2205 | .gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg, | ||
2206 | .gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable, | ||
2207 | .gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable, | ||
2208 | /* .gen_pdev_set_quiet_mode not implemented */ | ||
2209 | /* .gen_pdev_get_temperature not implemented */ | ||
2210 | }; | ||
2211 | |||
2212 | /************/ | ||
2213 | /* TLV init */ | ||
2214 | /************/ | ||
2215 | |||
2216 | void ath10k_wmi_tlv_attach(struct ath10k *ar) | ||
2217 | { | ||
2218 | ar->wmi.cmd = &wmi_tlv_cmd_map; | ||
2219 | ar->wmi.vdev_param = &wmi_tlv_vdev_param_map; | ||
2220 | ar->wmi.pdev_param = &wmi_tlv_pdev_param_map; | ||
2221 | ar->wmi.ops = &wmi_tlv_ops; | ||
2222 | } | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h new file mode 100644 index 000000000000..54ffa120cd60 --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h | |||
@@ -0,0 +1,1380 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2011 Atheros Communications Inc. | ||
3 | * Copyright (c) 2011-2014 Qualcomm Atheros, Inc. | ||
4 | * | ||
5 | * Permission to use, copy, modify, and/or distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | #ifndef _WMI_TLV_H | ||
18 | #define _WMI_TLV_H | ||
19 | |||
20 | #define WMI_TLV_CMD(grp_id) (((grp_id) << 12) | 0x1) | ||
21 | #define WMI_TLV_EV(grp_id) (((grp_id) << 12) | 0x1) | ||
22 | #define WMI_TLV_CMD_UNSUPPORTED 0 | ||
23 | #define WMI_TLV_PDEV_PARAM_UNSUPPORTED 0 | ||
24 | #define WMI_TLV_VDEV_PARAM_UNSUPPORTED 0 | ||
25 | |||
26 | enum wmi_tlv_grp_id { | ||
27 | WMI_TLV_GRP_START = 0x3, | ||
28 | WMI_TLV_GRP_SCAN = WMI_TLV_GRP_START, | ||
29 | WMI_TLV_GRP_PDEV, | ||
30 | WMI_TLV_GRP_VDEV, | ||
31 | WMI_TLV_GRP_PEER, | ||
32 | WMI_TLV_GRP_MGMT, | ||
33 | WMI_TLV_GRP_BA_NEG, | ||
34 | WMI_TLV_GRP_STA_PS, | ||
35 | WMI_TLV_GRP_DFS, | ||
36 | WMI_TLV_GRP_ROAM, | ||
37 | WMI_TLV_GRP_OFL_SCAN, | ||
38 | WMI_TLV_GRP_P2P, | ||
39 | WMI_TLV_GRP_AP_PS, | ||
40 | WMI_TLV_GRP_RATECTL, | ||
41 | WMI_TLV_GRP_PROFILE, | ||
42 | WMI_TLV_GRP_SUSPEND, | ||
43 | WMI_TLV_GRP_BCN_FILTER, | ||
44 | WMI_TLV_GRP_WOW, | ||
45 | WMI_TLV_GRP_RTT, | ||
46 | WMI_TLV_GRP_SPECTRAL, | ||
47 | WMI_TLV_GRP_STATS, | ||
48 | WMI_TLV_GRP_ARP_NS_OFL, | ||
49 | WMI_TLV_GRP_NLO_OFL, | ||
50 | WMI_TLV_GRP_GTK_OFL, | ||
51 | WMI_TLV_GRP_CSA_OFL, | ||
52 | WMI_TLV_GRP_CHATTER, | ||
53 | WMI_TLV_GRP_TID_ADDBA, | ||
54 | WMI_TLV_GRP_MISC, | ||
55 | WMI_TLV_GRP_GPIO, | ||
56 | WMI_TLV_GRP_FWTEST, | ||
57 | WMI_TLV_GRP_TDLS, | ||
58 | WMI_TLV_GRP_RESMGR, | ||
59 | WMI_TLV_GRP_STA_SMPS, | ||
60 | WMI_TLV_GRP_WLAN_HB, | ||
61 | WMI_TLV_GRP_RMC, | ||
62 | WMI_TLV_GRP_MHF_OFL, | ||
63 | WMI_TLV_GRP_LOCATION_SCAN, | ||
64 | WMI_TLV_GRP_OEM, | ||
65 | WMI_TLV_GRP_NAN, | ||
66 | WMI_TLV_GRP_COEX, | ||
67 | WMI_TLV_GRP_OBSS_OFL, | ||
68 | WMI_TLV_GRP_LPI, | ||
69 | WMI_TLV_GRP_EXTSCAN, | ||
70 | WMI_TLV_GRP_DHCP_OFL, | ||
71 | WMI_TLV_GRP_IPA, | ||
72 | WMI_TLV_GRP_MDNS_OFL, | ||
73 | WMI_TLV_GRP_SAP_OFL, | ||
74 | }; | ||
75 | |||
76 | enum wmi_tlv_cmd_id { | ||
77 | WMI_TLV_INIT_CMDID = 0x1, | ||
78 | WMI_TLV_START_SCAN_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_SCAN), | ||
79 | WMI_TLV_STOP_SCAN_CMDID, | ||
80 | WMI_TLV_SCAN_CHAN_LIST_CMDID, | ||
81 | WMI_TLV_SCAN_SCH_PRIO_TBL_CMDID, | ||
82 | WMI_TLV_SCAN_UPDATE_REQUEST_CMDID, | ||
83 | WMI_TLV_SCAN_PROB_REQ_OUI_CMDID, | ||
84 | WMI_TLV_PDEV_SET_REGDOMAIN_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_PDEV), | ||
85 | WMI_TLV_PDEV_SET_CHANNEL_CMDID, | ||
86 | WMI_TLV_PDEV_SET_PARAM_CMDID, | ||
87 | WMI_TLV_PDEV_PKTLOG_ENABLE_CMDID, | ||
88 | WMI_TLV_PDEV_PKTLOG_DISABLE_CMDID, | ||
89 | WMI_TLV_PDEV_SET_WMM_PARAMS_CMDID, | ||
90 | WMI_TLV_PDEV_SET_HT_CAP_IE_CMDID, | ||
91 | WMI_TLV_PDEV_SET_VHT_CAP_IE_CMDID, | ||
92 | WMI_TLV_PDEV_SET_DSCP_TID_MAP_CMDID, | ||
93 | WMI_TLV_PDEV_SET_QUIET_MODE_CMDID, | ||
94 | WMI_TLV_PDEV_GREEN_AP_PS_ENABLE_CMDID, | ||
95 | WMI_TLV_PDEV_GET_TPC_CONFIG_CMDID, | ||
96 | WMI_TLV_PDEV_SET_BASE_MACADDR_CMDID, | ||
97 | WMI_TLV_PDEV_DUMP_CMDID, | ||
98 | WMI_TLV_PDEV_SET_LED_CONFIG_CMDID, | ||
99 | WMI_TLV_PDEV_GET_TEMPERATURE_CMDID, | ||
100 | WMI_TLV_PDEV_SET_LED_FLASHING_CMDID, | ||
101 | WMI_TLV_VDEV_CREATE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_VDEV), | ||
102 | WMI_TLV_VDEV_DELETE_CMDID, | ||
103 | WMI_TLV_VDEV_START_REQUEST_CMDID, | ||
104 | WMI_TLV_VDEV_RESTART_REQUEST_CMDID, | ||
105 | WMI_TLV_VDEV_UP_CMDID, | ||
106 | WMI_TLV_VDEV_STOP_CMDID, | ||
107 | WMI_TLV_VDEV_DOWN_CMDID, | ||
108 | WMI_TLV_VDEV_SET_PARAM_CMDID, | ||
109 | WMI_TLV_VDEV_INSTALL_KEY_CMDID, | ||
110 | WMI_TLV_VDEV_WNM_SLEEPMODE_CMDID, | ||
111 | WMI_TLV_VDEV_WMM_ADDTS_CMDID, | ||
112 | WMI_TLV_VDEV_WMM_DELTS_CMDID, | ||
113 | WMI_TLV_VDEV_SET_WMM_PARAMS_CMDID, | ||
114 | WMI_TLV_VDEV_SET_GTX_PARAMS_CMDID, | ||
115 | WMI_TLV_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID, | ||
116 | WMI_TLV_VDEV_PLMREQ_START_CMDID, | ||
117 | WMI_TLV_VDEV_PLMREQ_STOP_CMDID, | ||
118 | WMI_TLV_PEER_CREATE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_PEER), | ||
119 | WMI_TLV_PEER_DELETE_CMDID, | ||
120 | WMI_TLV_PEER_FLUSH_TIDS_CMDID, | ||
121 | WMI_TLV_PEER_SET_PARAM_CMDID, | ||
122 | WMI_TLV_PEER_ASSOC_CMDID, | ||
123 | WMI_TLV_PEER_ADD_WDS_ENTRY_CMDID, | ||
124 | WMI_TLV_PEER_REMOVE_WDS_ENTRY_CMDID, | ||
125 | WMI_TLV_PEER_MCAST_GROUP_CMDID, | ||
126 | WMI_TLV_PEER_INFO_REQ_CMDID, | ||
127 | WMI_TLV_PEER_GET_ESTIMATED_LINKSPEED_CMDID, | ||
128 | WMI_TLV_BCN_TX_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_MGMT), | ||
129 | WMI_TLV_PDEV_SEND_BCN_CMDID, | ||
130 | WMI_TLV_BCN_TMPL_CMDID, | ||
131 | WMI_TLV_BCN_FILTER_RX_CMDID, | ||
132 | WMI_TLV_PRB_REQ_FILTER_RX_CMDID, | ||
133 | WMI_TLV_MGMT_TX_CMDID, | ||
134 | WMI_TLV_PRB_TMPL_CMDID, | ||
135 | WMI_TLV_ADDBA_CLEAR_RESP_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_BA_NEG), | ||
136 | WMI_TLV_ADDBA_SEND_CMDID, | ||
137 | WMI_TLV_ADDBA_STATUS_CMDID, | ||
138 | WMI_TLV_DELBA_SEND_CMDID, | ||
139 | WMI_TLV_ADDBA_SET_RESP_CMDID, | ||
140 | WMI_TLV_SEND_SINGLEAMSDU_CMDID, | ||
141 | WMI_TLV_STA_POWERSAVE_MODE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_STA_PS), | ||
142 | WMI_TLV_STA_POWERSAVE_PARAM_CMDID, | ||
143 | WMI_TLV_STA_MIMO_PS_MODE_CMDID, | ||
144 | WMI_TLV_PDEV_DFS_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_DFS), | ||
145 | WMI_TLV_PDEV_DFS_DISABLE_CMDID, | ||
146 | WMI_TLV_DFS_PHYERR_FILTER_ENA_CMDID, | ||
147 | WMI_TLV_DFS_PHYERR_FILTER_DIS_CMDID, | ||
148 | WMI_TLV_ROAM_SCAN_MODE = WMI_TLV_CMD(WMI_TLV_GRP_ROAM), | ||
149 | WMI_TLV_ROAM_SCAN_RSSI_THRESHOLD, | ||
150 | WMI_TLV_ROAM_SCAN_PERIOD, | ||
151 | WMI_TLV_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, | ||
152 | WMI_TLV_ROAM_AP_PROFILE, | ||
153 | WMI_TLV_ROAM_CHAN_LIST, | ||
154 | WMI_TLV_ROAM_SCAN_CMD, | ||
155 | WMI_TLV_ROAM_SYNCH_COMPLETE, | ||
156 | WMI_TLV_ROAM_SET_RIC_REQUEST_CMDID, | ||
157 | WMI_TLV_ROAM_INVOKE_CMDID, | ||
158 | WMI_TLV_OFL_SCAN_ADD_AP_PROFILE = WMI_TLV_CMD(WMI_TLV_GRP_OFL_SCAN), | ||
159 | WMI_TLV_OFL_SCAN_REMOVE_AP_PROFILE, | ||
160 | WMI_TLV_OFL_SCAN_PERIOD, | ||
161 | WMI_TLV_P2P_DEV_SET_DEVICE_INFO = WMI_TLV_CMD(WMI_TLV_GRP_P2P), | ||
162 | WMI_TLV_P2P_DEV_SET_DISCOVERABILITY, | ||
163 | WMI_TLV_P2P_GO_SET_BEACON_IE, | ||
164 | WMI_TLV_P2P_GO_SET_PROBE_RESP_IE, | ||
165 | WMI_TLV_P2P_SET_VENDOR_IE_DATA_CMDID, | ||
166 | WMI_TLV_P2P_DISC_OFFLOAD_CONFIG_CMDID, | ||
167 | WMI_TLV_P2P_DISC_OFFLOAD_APPIE_CMDID, | ||
168 | WMI_TLV_P2P_DISC_OFFLOAD_PATTERN_CMDID, | ||
169 | WMI_TLV_P2P_SET_OPPPS_PARAM_CMDID, | ||
170 | WMI_TLV_AP_PS_PEER_PARAM_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_AP_PS), | ||
171 | WMI_TLV_AP_PS_PEER_UAPSD_COEX_CMDID, | ||
172 | WMI_TLV_PEER_RATE_RETRY_SCHED_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_RATECTL), | ||
173 | WMI_TLV_WLAN_PROFILE_TRIGGER_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_PROFILE), | ||
174 | WMI_TLV_WLAN_PROFILE_SET_HIST_INTVL_CMDID, | ||
175 | WMI_TLV_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, | ||
176 | WMI_TLV_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, | ||
177 | WMI_TLV_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, | ||
178 | WMI_TLV_PDEV_SUSPEND_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_SUSPEND), | ||
179 | WMI_TLV_PDEV_RESUME_CMDID, | ||
180 | WMI_TLV_ADD_BCN_FILTER_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_BCN_FILTER), | ||
181 | WMI_TLV_RMV_BCN_FILTER_CMDID, | ||
182 | WMI_TLV_WOW_ADD_WAKE_PATTERN_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_WOW), | ||
183 | WMI_TLV_WOW_DEL_WAKE_PATTERN_CMDID, | ||
184 | WMI_TLV_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, | ||
185 | WMI_TLV_WOW_ENABLE_CMDID, | ||
186 | WMI_TLV_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, | ||
187 | WMI_TLV_WOW_ACER_IOAC_ADD_KEEPALIVE_CMDID, | ||
188 | WMI_TLV_WOW_ACER_IOAC_DEL_KEEPALIVE_CMDID, | ||
189 | WMI_TLV_WOW_ACER_IOAC_ADD_WAKE_PATTERN_CMDID, | ||
190 | WMI_TLV_WOW_ACER_IOAC_DEL_WAKE_PATTERN_CMDID, | ||
191 | WMI_TLV_D0_WOW_ENABLE_DISABLE_CMDID, | ||
192 | WMI_TLV_EXTWOW_ENABLE_CMDID, | ||
193 | WMI_TLV_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID, | ||
194 | WMI_TLV_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID, | ||
195 | WMI_TLV_RTT_MEASREQ_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_RTT), | ||
196 | WMI_TLV_RTT_TSF_CMDID, | ||
197 | WMI_TLV_SPECTRAL_SCAN_CONF_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_SPECTRAL), | ||
198 | WMI_TLV_SPECTRAL_SCAN_ENABLE_CMDID, | ||
199 | WMI_TLV_REQUEST_STATS_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_STATS), | ||
200 | WMI_TLV_MCC_SCHED_TRAFFIC_STATS_CMDID, | ||
201 | WMI_TLV_REQUEST_STATS_EXT_CMDID, | ||
202 | WMI_TLV_REQUEST_LINK_STATS_CMDID, | ||
203 | WMI_TLV_START_LINK_STATS_CMDID, | ||
204 | WMI_TLV_CLEAR_LINK_STATS_CMDID, | ||
205 | WMI_TLV_SET_ARP_NS_OFFLOAD_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_ARP_NS_OFL), | ||
206 | WMI_TLV_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID, | ||
207 | WMI_TLV_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID, | ||
208 | WMI_TLV_NETWORK_LIST_OFFLOAD_CONFIG_CMDID = | ||
209 | WMI_TLV_CMD(WMI_TLV_GRP_NLO_OFL), | ||
210 | WMI_TLV_APFIND_CMDID, | ||
211 | WMI_TLV_GTK_OFFLOAD_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_GTK_OFL), | ||
212 | WMI_TLV_CSA_OFFLOAD_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_CSA_OFL), | ||
213 | WMI_TLV_CSA_OFFLOAD_CHANSWITCH_CMDID, | ||
214 | WMI_TLV_CHATTER_SET_MODE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_CHATTER), | ||
215 | WMI_TLV_CHATTER_ADD_COALESCING_FILTER_CMDID, | ||
216 | WMI_TLV_CHATTER_DELETE_COALESCING_FILTER_CMDID, | ||
217 | WMI_TLV_CHATTER_COALESCING_QUERY_CMDID, | ||
218 | WMI_TLV_PEER_TID_ADDBA_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_TID_ADDBA), | ||
219 | WMI_TLV_PEER_TID_DELBA_CMDID, | ||
220 | WMI_TLV_STA_DTIM_PS_METHOD_CMDID, | ||
221 | WMI_TLV_STA_UAPSD_AUTO_TRIG_CMDID, | ||
222 | WMI_TLV_STA_KEEPALIVE_CMDID, | ||
223 | WMI_TLV_BA_REQ_SSN_CMDID, | ||
224 | WMI_TLV_ECHO_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_MISC), | ||
225 | WMI_TLV_PDEV_UTF_CMDID, | ||
226 | WMI_TLV_DBGLOG_CFG_CMDID, | ||
227 | WMI_TLV_PDEV_QVIT_CMDID, | ||
228 | WMI_TLV_PDEV_FTM_INTG_CMDID, | ||
229 | WMI_TLV_VDEV_SET_KEEPALIVE_CMDID, | ||
230 | WMI_TLV_VDEV_GET_KEEPALIVE_CMDID, | ||
231 | WMI_TLV_FORCE_FW_HANG_CMDID, | ||
232 | WMI_TLV_SET_MCASTBCAST_FILTER_CMDID, | ||
233 | WMI_TLV_THERMAL_MGMT_CMDID, | ||
234 | WMI_TLV_HOST_AUTO_SHUTDOWN_CFG_CMDID, | ||
235 | WMI_TLV_TPC_CHAINMASK_CONFIG_CMDID, | ||
236 | WMI_TLV_SET_ANTENNA_DIVERSITY_CMDID, | ||
237 | WMI_TLV_GPIO_CONFIG_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_GPIO), | ||
238 | WMI_TLV_GPIO_OUTPUT_CMDID, | ||
239 | WMI_TLV_TXBF_CMDID, | ||
240 | WMI_TLV_FWTEST_VDEV_MCC_SET_TBTT_MODE_CMDID = | ||
241 | WMI_TLV_CMD(WMI_TLV_GRP_FWTEST), | ||
242 | WMI_TLV_FWTEST_P2P_SET_NOA_PARAM_CMDID, | ||
243 | WMI_TLV_UNIT_TEST_CMDID, | ||
244 | WMI_TLV_TDLS_SET_STATE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_TDLS), | ||
245 | WMI_TLV_TDLS_PEER_UPDATE_CMDID, | ||
246 | WMI_TLV_TDLS_SET_OFFCHAN_MODE_CMDID, | ||
247 | WMI_TLV_RESMGR_ADAPTIVE_OCS_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_RESMGR), | ||
248 | WMI_TLV_RESMGR_SET_CHAN_TIME_QUOTA_CMDID, | ||
249 | WMI_TLV_RESMGR_SET_CHAN_LATENCY_CMDID, | ||
250 | WMI_TLV_STA_SMPS_FORCE_MODE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_STA_SMPS), | ||
251 | WMI_TLV_STA_SMPS_PARAM_CMDID, | ||
252 | WMI_TLV_HB_SET_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_WLAN_HB), | ||
253 | WMI_TLV_HB_SET_TCP_PARAMS_CMDID, | ||
254 | WMI_TLV_HB_SET_TCP_PKT_FILTER_CMDID, | ||
255 | WMI_TLV_HB_SET_UDP_PARAMS_CMDID, | ||
256 | WMI_TLV_HB_SET_UDP_PKT_FILTER_CMDID, | ||
257 | WMI_TLV_RMC_SET_MODE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_RMC), | ||
258 | WMI_TLV_RMC_SET_ACTION_PERIOD_CMDID, | ||
259 | WMI_TLV_RMC_CONFIG_CMDID, | ||
260 | WMI_TLV_MHF_OFFLOAD_SET_MODE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_MHF_OFL), | ||
261 | WMI_TLV_MHF_OFFLOAD_PLUMB_ROUTING_TBL_CMDID, | ||
262 | WMI_TLV_BATCH_SCAN_ENABLE_CMDID = | ||
263 | WMI_TLV_CMD(WMI_TLV_GRP_LOCATION_SCAN), | ||
264 | WMI_TLV_BATCH_SCAN_DISABLE_CMDID, | ||
265 | WMI_TLV_BATCH_SCAN_TRIGGER_RESULT_CMDID, | ||
266 | WMI_TLV_OEM_REQ_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_OEM), | ||
267 | WMI_TLV_NAN_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_NAN), | ||
268 | WMI_TLV_MODEM_POWER_STATE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_COEX), | ||
269 | WMI_TLV_CHAN_AVOID_UPDATE_CMDID, | ||
270 | WMI_TLV_OBSS_SCAN_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_OBSS_OFL), | ||
271 | WMI_TLV_OBSS_SCAN_DISABLE_CMDID, | ||
272 | WMI_TLV_LPI_MGMT_SNOOPING_CONFIG_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_LPI), | ||
273 | WMI_TLV_LPI_START_SCAN_CMDID, | ||
274 | WMI_TLV_LPI_STOP_SCAN_CMDID, | ||
275 | WMI_TLV_EXTSCAN_START_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_EXTSCAN), | ||
276 | WMI_TLV_EXTSCAN_STOP_CMDID, | ||
277 | WMI_TLV_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID, | ||
278 | WMI_TLV_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID, | ||
279 | WMI_TLV_EXTSCAN_GET_CACHED_RESULTS_CMDID, | ||
280 | WMI_TLV_EXTSCAN_GET_WLAN_CHANGE_RESULTS_CMDID, | ||
281 | WMI_TLV_EXTSCAN_SET_CAPABILITIES_CMDID, | ||
282 | WMI_TLV_EXTSCAN_GET_CAPABILITIES_CMDID, | ||
283 | WMI_TLV_SET_DHCP_SERVER_OFFLOAD_CMDID = | ||
284 | WMI_TLV_CMD(WMI_TLV_GRP_DHCP_OFL), | ||
285 | WMI_TLV_IPA_OFFLOAD_ENABLE_DISABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_IPA), | ||
286 | WMI_TLV_MDNS_OFFLOAD_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_MDNS_OFL), | ||
287 | WMI_TLV_MDNS_SET_FQDN_CMDID, | ||
288 | WMI_TLV_MDNS_SET_RESPONSE_CMDID, | ||
289 | WMI_TLV_MDNS_GET_STATS_CMDID, | ||
290 | WMI_TLV_SAP_OFL_ENABLE_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_SAP_OFL), | ||
291 | }; | ||
292 | |||
293 | enum wmi_tlv_event_id { | ||
294 | WMI_TLV_SERVICE_READY_EVENTID = 0x1, | ||
295 | WMI_TLV_READY_EVENTID, | ||
296 | WMI_TLV_SCAN_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_SCAN), | ||
297 | WMI_TLV_PDEV_TPC_CONFIG_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_PDEV), | ||
298 | WMI_TLV_CHAN_INFO_EVENTID, | ||
299 | WMI_TLV_PHYERR_EVENTID, | ||
300 | WMI_TLV_PDEV_DUMP_EVENTID, | ||
301 | WMI_TLV_TX_PAUSE_EVENTID, | ||
302 | WMI_TLV_DFS_RADAR_EVENTID, | ||
303 | WMI_TLV_PDEV_L1SS_TRACK_EVENTID, | ||
304 | WMI_TLV_PDEV_TEMPERATURE_EVENTID, | ||
305 | WMI_TLV_VDEV_START_RESP_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_VDEV), | ||
306 | WMI_TLV_VDEV_STOPPED_EVENTID, | ||
307 | WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID, | ||
308 | WMI_TLV_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID, | ||
309 | WMI_TLV_PEER_STA_KICKOUT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_PEER), | ||
310 | WMI_TLV_PEER_INFO_EVENTID, | ||
311 | WMI_TLV_PEER_TX_FAIL_CNT_THR_EVENTID, | ||
312 | WMI_TLV_PEER_ESTIMATED_LINKSPEED_EVENTID, | ||
313 | WMI_TLV_PEER_STATE_EVENTID, | ||
314 | WMI_TLV_MGMT_RX_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_MGMT), | ||
315 | WMI_TLV_HOST_SWBA_EVENTID, | ||
316 | WMI_TLV_TBTTOFFSET_UPDATE_EVENTID, | ||
317 | WMI_TLV_OFFLOAD_BCN_TX_STATUS_EVENTID, | ||
318 | WMI_TLV_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID, | ||
319 | WMI_TLV_TX_DELBA_COMPLETE_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_BA_NEG), | ||
320 | WMI_TLV_TX_ADDBA_COMPLETE_EVENTID, | ||
321 | WMI_TLV_BA_RSP_SSN_EVENTID, | ||
322 | WMI_TLV_AGGR_STATE_TRIG_EVENTID, | ||
323 | WMI_TLV_ROAM_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_ROAM), | ||
324 | WMI_TLV_PROFILE_MATCH, | ||
325 | WMI_TLV_ROAM_SYNCH_EVENTID, | ||
326 | WMI_TLV_P2P_DISC_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_P2P), | ||
327 | WMI_TLV_P2P_NOA_EVENTID, | ||
328 | WMI_TLV_PDEV_RESUME_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_SUSPEND), | ||
329 | WMI_TLV_WOW_WAKEUP_HOST_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_WOW), | ||
330 | WMI_TLV_D0_WOW_DISABLE_ACK_EVENTID, | ||
331 | WMI_TLV_RTT_MEASUREMENT_REPORT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_RTT), | ||
332 | WMI_TLV_TSF_MEASUREMENT_REPORT_EVENTID, | ||
333 | WMI_TLV_RTT_ERROR_REPORT_EVENTID, | ||
334 | WMI_TLV_STATS_EXT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_STATS), | ||
335 | WMI_TLV_IFACE_LINK_STATS_EVENTID, | ||
336 | WMI_TLV_PEER_LINK_STATS_EVENTID, | ||
337 | WMI_TLV_RADIO_LINK_STATS_EVENTID, | ||
338 | WMI_TLV_NLO_MATCH_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_NLO_OFL), | ||
339 | WMI_TLV_NLO_SCAN_COMPLETE_EVENTID, | ||
340 | WMI_TLV_APFIND_EVENTID, | ||
341 | WMI_TLV_GTK_OFFLOAD_STATUS_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_GTK_OFL), | ||
342 | WMI_TLV_GTK_REKEY_FAIL_EVENTID, | ||
343 | WMI_TLV_CSA_HANDLING_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_CSA_OFL), | ||
344 | WMI_TLV_CHATTER_PC_QUERY_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_CHATTER), | ||
345 | WMI_TLV_ECHO_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_MISC), | ||
346 | WMI_TLV_PDEV_UTF_EVENTID, | ||
347 | WMI_TLV_DEBUG_MESG_EVENTID, | ||
348 | WMI_TLV_UPDATE_STATS_EVENTID, | ||
349 | WMI_TLV_DEBUG_PRINT_EVENTID, | ||
350 | WMI_TLV_DCS_INTERFERENCE_EVENTID, | ||
351 | WMI_TLV_PDEV_QVIT_EVENTID, | ||
352 | WMI_TLV_WLAN_PROFILE_DATA_EVENTID, | ||
353 | WMI_TLV_PDEV_FTM_INTG_EVENTID, | ||
354 | WMI_TLV_WLAN_FREQ_AVOID_EVENTID, | ||
355 | WMI_TLV_VDEV_GET_KEEPALIVE_EVENTID, | ||
356 | WMI_TLV_THERMAL_MGMT_EVENTID, | ||
357 | WMI_TLV_DIAG_DATA_CONTAINER_EVENTID, | ||
358 | WMI_TLV_HOST_AUTO_SHUTDOWN_EVENTID, | ||
359 | WMI_TLV_UPDATE_WHAL_MIB_STATS_EVENTID, | ||
360 | WMI_TLV_UPDATE_VDEV_RATE_STATS_EVENTID, | ||
361 | WMI_TLV_DIAG_EVENTID, | ||
362 | WMI_TLV_GPIO_INPUT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_GPIO), | ||
363 | WMI_TLV_UPLOADH_EVENTID, | ||
364 | WMI_TLV_CAPTUREH_EVENTID, | ||
365 | WMI_TLV_RFKILL_STATE_CHANGE_EVENTID, | ||
366 | WMI_TLV_TDLS_PEER_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_TDLS), | ||
367 | WMI_TLV_BATCH_SCAN_ENABLED_EVENTID = | ||
368 | WMI_TLV_EV(WMI_TLV_GRP_LOCATION_SCAN), | ||
369 | WMI_TLV_BATCH_SCAN_RESULT_EVENTID, | ||
370 | WMI_TLV_OEM_CAPABILITY_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_OEM), | ||
371 | WMI_TLV_OEM_MEASUREMENT_REPORT_EVENTID, | ||
372 | WMI_TLV_OEM_ERROR_REPORT_EVENTID, | ||
373 | WMI_TLV_NAN_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_NAN), | ||
374 | WMI_TLV_LPI_RESULT_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_LPI), | ||
375 | WMI_TLV_LPI_STATUS_EVENTID, | ||
376 | WMI_TLV_LPI_HANDOFF_EVENTID, | ||
377 | WMI_TLV_EXTSCAN_START_STOP_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_EXTSCAN), | ||
378 | WMI_TLV_EXTSCAN_OPERATION_EVENTID, | ||
379 | WMI_TLV_EXTSCAN_TABLE_USAGE_EVENTID, | ||
380 | WMI_TLV_EXTSCAN_CACHED_RESULTS_EVENTID, | ||
381 | WMI_TLV_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID, | ||
382 | WMI_TLV_EXTSCAN_HOTLIST_MATCH_EVENTID, | ||
383 | WMI_TLV_EXTSCAN_CAPABILITIES_EVENTID, | ||
384 | WMI_TLV_MDNS_STATS_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_MDNS_OFL), | ||
385 | WMI_TLV_SAP_OFL_ADD_STA_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_SAP_OFL), | ||
386 | WMI_TLV_SAP_OFL_DEL_STA_EVENTID, | ||
387 | }; | ||
388 | |||
389 | enum wmi_tlv_pdev_param { | ||
390 | WMI_TLV_PDEV_PARAM_TX_CHAIN_MASK = 0x1, | ||
391 | WMI_TLV_PDEV_PARAM_RX_CHAIN_MASK, | ||
392 | WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT2G, | ||
393 | WMI_TLV_PDEV_PARAM_TXPOWER_LIMIT5G, | ||
394 | WMI_TLV_PDEV_PARAM_TXPOWER_SCALE, | ||
395 | WMI_TLV_PDEV_PARAM_BEACON_GEN_MODE, | ||
396 | WMI_TLV_PDEV_PARAM_BEACON_TX_MODE, | ||
397 | WMI_TLV_PDEV_PARAM_RESMGR_OFFCHAN_MODE, | ||
398 | WMI_TLV_PDEV_PARAM_PROTECTION_MODE, | ||
399 | WMI_TLV_PDEV_PARAM_DYNAMIC_BW, | ||
400 | WMI_TLV_PDEV_PARAM_NON_AGG_SW_RETRY_TH, | ||
401 | WMI_TLV_PDEV_PARAM_AGG_SW_RETRY_TH, | ||
402 | WMI_TLV_PDEV_PARAM_STA_KICKOUT_TH, | ||
403 | WMI_TLV_PDEV_PARAM_AC_AGGRSIZE_SCALING, | ||
404 | WMI_TLV_PDEV_PARAM_LTR_ENABLE, | ||
405 | WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BE, | ||
406 | WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_BK, | ||
407 | WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VI, | ||
408 | WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_VO, | ||
409 | WMI_TLV_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, | ||
410 | WMI_TLV_PDEV_PARAM_LTR_SLEEP_OVERRIDE, | ||
411 | WMI_TLV_PDEV_PARAM_LTR_RX_OVERRIDE, | ||
412 | WMI_TLV_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, | ||
413 | WMI_TLV_PDEV_PARAM_L1SS_ENABLE, | ||
414 | WMI_TLV_PDEV_PARAM_DSLEEP_ENABLE, | ||
415 | WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_FLUSH, | ||
416 | WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_WATERMARK, | ||
417 | WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, | ||
418 | WMI_TLV_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE, | ||
419 | WMI_TLV_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, | ||
420 | WMI_TLV_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, | ||
421 | WMI_TLV_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, | ||
422 | WMI_TLV_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, | ||
423 | WMI_TLV_PDEV_PARAM_PMF_QOS, | ||
424 | WMI_TLV_PDEV_PARAM_ARP_AC_OVERRIDE, | ||
425 | WMI_TLV_PDEV_PARAM_DCS, | ||
426 | WMI_TLV_PDEV_PARAM_ANI_ENABLE, | ||
427 | WMI_TLV_PDEV_PARAM_ANI_POLL_PERIOD, | ||
428 | WMI_TLV_PDEV_PARAM_ANI_LISTEN_PERIOD, | ||
429 | WMI_TLV_PDEV_PARAM_ANI_OFDM_LEVEL, | ||
430 | WMI_TLV_PDEV_PARAM_ANI_CCK_LEVEL, | ||
431 | WMI_TLV_PDEV_PARAM_DYNTXCHAIN, | ||
432 | WMI_TLV_PDEV_PARAM_PROXY_STA, | ||
433 | WMI_TLV_PDEV_PARAM_IDLE_PS_CONFIG, | ||
434 | WMI_TLV_PDEV_PARAM_POWER_GATING_SLEEP, | ||
435 | WMI_TLV_PDEV_PARAM_RFKILL_ENABLE, | ||
436 | WMI_TLV_PDEV_PARAM_BURST_DUR, | ||
437 | WMI_TLV_PDEV_PARAM_BURST_ENABLE, | ||
438 | WMI_TLV_PDEV_PARAM_HW_RFKILL_CONFIG, | ||
439 | WMI_TLV_PDEV_PARAM_LOW_POWER_RF_ENABLE, | ||
440 | WMI_TLV_PDEV_PARAM_L1SS_TRACK, | ||
441 | WMI_TLV_PDEV_PARAM_HYST_EN, | ||
442 | WMI_TLV_PDEV_PARAM_POWER_COLLAPSE_ENABLE, | ||
443 | WMI_TLV_PDEV_PARAM_LED_SYS_STATE, | ||
444 | WMI_TLV_PDEV_PARAM_LED_ENABLE, | ||
445 | WMI_TLV_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY, | ||
446 | WMI_TLV_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE, | ||
447 | WMI_TLV_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE, | ||
448 | WMI_TLV_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD, | ||
449 | WMI_TLV_PDEV_PARAM_TXPOWER_REASON_NONE, | ||
450 | WMI_TLV_PDEV_PARAM_TXPOWER_REASON_SAR, | ||
451 | WMI_TLV_PDEV_PARAM_TXPOWER_REASON_MAX, | ||
452 | }; | ||
453 | |||
454 | enum wmi_tlv_vdev_param { | ||
455 | WMI_TLV_VDEV_PARAM_RTS_THRESHOLD = 0x1, | ||
456 | WMI_TLV_VDEV_PARAM_FRAGMENTATION_THRESHOLD, | ||
457 | WMI_TLV_VDEV_PARAM_BEACON_INTERVAL, | ||
458 | WMI_TLV_VDEV_PARAM_LISTEN_INTERVAL, | ||
459 | WMI_TLV_VDEV_PARAM_MULTICAST_RATE, | ||
460 | WMI_TLV_VDEV_PARAM_MGMT_TX_RATE, | ||
461 | WMI_TLV_VDEV_PARAM_SLOT_TIME, | ||
462 | WMI_TLV_VDEV_PARAM_PREAMBLE, | ||
463 | WMI_TLV_VDEV_PARAM_SWBA_TIME, | ||
464 | WMI_TLV_VDEV_STATS_UPDATE_PERIOD, | ||
465 | WMI_TLV_VDEV_PWRSAVE_AGEOUT_TIME, | ||
466 | WMI_TLV_VDEV_HOST_SWBA_INTERVAL, | ||
467 | WMI_TLV_VDEV_PARAM_DTIM_PERIOD, | ||
468 | WMI_TLV_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, | ||
469 | WMI_TLV_VDEV_PARAM_WDS, | ||
470 | WMI_TLV_VDEV_PARAM_ATIM_WINDOW, | ||
471 | WMI_TLV_VDEV_PARAM_BMISS_COUNT_MAX, | ||
472 | WMI_TLV_VDEV_PARAM_BMISS_FIRST_BCNT, | ||
473 | WMI_TLV_VDEV_PARAM_BMISS_FINAL_BCNT, | ||
474 | WMI_TLV_VDEV_PARAM_FEATURE_WMM, | ||
475 | WMI_TLV_VDEV_PARAM_CHWIDTH, | ||
476 | WMI_TLV_VDEV_PARAM_CHEXTOFFSET, | ||
477 | WMI_TLV_VDEV_PARAM_DISABLE_HTPROTECTION, | ||
478 | WMI_TLV_VDEV_PARAM_STA_QUICKKICKOUT, | ||
479 | WMI_TLV_VDEV_PARAM_MGMT_RATE, | ||
480 | WMI_TLV_VDEV_PARAM_PROTECTION_MODE, | ||
481 | WMI_TLV_VDEV_PARAM_FIXED_RATE, | ||
482 | WMI_TLV_VDEV_PARAM_SGI, | ||
483 | WMI_TLV_VDEV_PARAM_LDPC, | ||
484 | WMI_TLV_VDEV_PARAM_TX_STBC, | ||
485 | WMI_TLV_VDEV_PARAM_RX_STBC, | ||
486 | WMI_TLV_VDEV_PARAM_INTRA_BSS_FWD, | ||
487 | WMI_TLV_VDEV_PARAM_DEF_KEYID, | ||
488 | WMI_TLV_VDEV_PARAM_NSS, | ||
489 | WMI_TLV_VDEV_PARAM_BCAST_DATA_RATE, | ||
490 | WMI_TLV_VDEV_PARAM_MCAST_DATA_RATE, | ||
491 | WMI_TLV_VDEV_PARAM_MCAST_INDICATE, | ||
492 | WMI_TLV_VDEV_PARAM_DHCP_INDICATE, | ||
493 | WMI_TLV_VDEV_PARAM_UNKNOWN_DEST_INDICATE, | ||
494 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, | ||
495 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, | ||
496 | WMI_TLV_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, | ||
497 | WMI_TLV_VDEV_PARAM_AP_ENABLE_NAWDS, | ||
498 | WMI_TLV_VDEV_PARAM_ENABLE_RTSCTS, | ||
499 | WMI_TLV_VDEV_PARAM_TXBF, | ||
500 | WMI_TLV_VDEV_PARAM_PACKET_POWERSAVE, | ||
501 | WMI_TLV_VDEV_PARAM_DROP_UNENCRY, | ||
502 | WMI_TLV_VDEV_PARAM_TX_ENCAP_TYPE, | ||
503 | WMI_TLV_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, | ||
504 | WMI_TLV_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, | ||
505 | WMI_TLV_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, | ||
506 | WMI_TLV_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, | ||
507 | WMI_TLV_VDEV_PARAM_EARLY_RX_SLOP_STEP, | ||
508 | WMI_TLV_VDEV_PARAM_EARLY_RX_INIT_SLOP, | ||
509 | WMI_TLV_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, | ||
510 | WMI_TLV_VDEV_PARAM_TX_PWRLIMIT, | ||
511 | WMI_TLV_VDEV_PARAM_SNR_NUM_FOR_CAL, | ||
512 | WMI_TLV_VDEV_PARAM_ROAM_FW_OFFLOAD, | ||
513 | WMI_TLV_VDEV_PARAM_ENABLE_RMC, | ||
514 | WMI_TLV_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS, | ||
515 | WMI_TLV_VDEV_PARAM_MAX_RATE, | ||
516 | WMI_TLV_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE, | ||
517 | WMI_TLV_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR, | ||
518 | WMI_TLV_VDEV_PARAM_EBT_RESYNC_TIMEOUT, | ||
519 | WMI_TLV_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE, | ||
520 | WMI_TLV_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED, | ||
521 | WMI_TLV_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED, | ||
522 | WMI_TLV_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED, | ||
523 | WMI_TLV_VDEV_PARAM_INACTIVITY_CNT, | ||
524 | WMI_TLV_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS, | ||
525 | WMI_TLV_VDEV_PARAM_DTIM_POLICY, | ||
526 | WMI_TLV_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS, | ||
527 | WMI_TLV_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE, | ||
528 | }; | ||
529 | |||
530 | enum wmi_tlv_tag { | ||
531 | WMI_TLV_TAG_LAST_RESERVED = 15, | ||
532 | |||
533 | WMI_TLV_TAG_FIRST_ARRAY_ENUM, | ||
534 | WMI_TLV_TAG_ARRAY_UINT32 = WMI_TLV_TAG_FIRST_ARRAY_ENUM, | ||
535 | WMI_TLV_TAG_ARRAY_BYTE, | ||
536 | WMI_TLV_TAG_ARRAY_STRUCT, | ||
537 | WMI_TLV_TAG_ARRAY_FIXED_STRUCT, | ||
538 | WMI_TLV_TAG_LAST_ARRAY_ENUM = 31, | ||
539 | |||
540 | WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT, | ||
541 | WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES, | ||
542 | WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ, | ||
543 | WMI_TLV_TAG_STRUCT_READY_EVENT, | ||
544 | WMI_TLV_TAG_STRUCT_SCAN_EVENT, | ||
545 | WMI_TLV_TAG_STRUCT_PDEV_TPC_CONFIG_EVENT, | ||
546 | WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT, | ||
547 | WMI_TLV_TAG_STRUCT_COMB_PHYERR_RX_HDR, | ||
548 | WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT, | ||
549 | WMI_TLV_TAG_STRUCT_VDEV_STOPPED_EVENT, | ||
550 | WMI_TLV_TAG_STRUCT_VDEV_INSTALL_KEY_COMPLETE_EVENT, | ||
551 | WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT, | ||
552 | WMI_TLV_TAG_STRUCT_MGMT_RX_HDR, | ||
553 | WMI_TLV_TAG_STRUCT_TBTT_OFFSET_EVENT, | ||
554 | WMI_TLV_TAG_STRUCT_TX_DELBA_COMPLETE_EVENT, | ||
555 | WMI_TLV_TAG_STRUCT_TX_ADDBA_COMPLETE_EVENT, | ||
556 | WMI_TLV_TAG_STRUCT_ROAM_EVENT, | ||
557 | WMI_TLV_TAG_STRUCT_WOW_EVENT_INFO, | ||
558 | WMI_TLV_TAG_STRUCT_WOW_EVENT_INFO_SECTION_BITMAP, | ||
559 | WMI_TLV_TAG_STRUCT_RTT_EVENT_HEADER, | ||
560 | WMI_TLV_TAG_STRUCT_RTT_ERROR_REPORT_EVENT, | ||
561 | WMI_TLV_TAG_STRUCT_RTT_MEAS_EVENT, | ||
562 | WMI_TLV_TAG_STRUCT_ECHO_EVENT, | ||
563 | WMI_TLV_TAG_STRUCT_FTM_INTG_EVENT, | ||
564 | WMI_TLV_TAG_STRUCT_VDEV_GET_KEEPALIVE_EVENT, | ||
565 | WMI_TLV_TAG_STRUCT_GPIO_INPUT_EVENT, | ||
566 | WMI_TLV_TAG_STRUCT_CSA_EVENT, | ||
567 | WMI_TLV_TAG_STRUCT_GTK_OFFLOAD_STATUS_EVENT, | ||
568 | WMI_TLV_TAG_STRUCT_IGTK_INFO, | ||
569 | WMI_TLV_TAG_STRUCT_DCS_INTERFERENCE_EVENT, | ||
570 | WMI_TLV_TAG_STRUCT_ATH_DCS_CW_INT, | ||
571 | WMI_TLV_TAG_STRUCT_ATH_DCS_WLAN_INT_STAT, | ||
572 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_CTX_T, | ||
573 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_T, | ||
574 | WMI_TLV_TAG_STRUCT_PDEV_QVIT_EVENT, | ||
575 | WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT, | ||
576 | WMI_TLV_TAG_STRUCT_TIM_INFO, | ||
577 | WMI_TLV_TAG_STRUCT_P2P_NOA_INFO, | ||
578 | WMI_TLV_TAG_STRUCT_STATS_EVENT, | ||
579 | WMI_TLV_TAG_STRUCT_AVOID_FREQ_RANGES_EVENT, | ||
580 | WMI_TLV_TAG_STRUCT_AVOID_FREQ_RANGE_DESC, | ||
581 | WMI_TLV_TAG_STRUCT_GTK_REKEY_FAIL_EVENT, | ||
582 | WMI_TLV_TAG_STRUCT_INIT_CMD, | ||
583 | WMI_TLV_TAG_STRUCT_RESOURCE_CONFIG, | ||
584 | WMI_TLV_TAG_STRUCT_WLAN_HOST_MEMORY_CHUNK, | ||
585 | WMI_TLV_TAG_STRUCT_START_SCAN_CMD, | ||
586 | WMI_TLV_TAG_STRUCT_STOP_SCAN_CMD, | ||
587 | WMI_TLV_TAG_STRUCT_SCAN_CHAN_LIST_CMD, | ||
588 | WMI_TLV_TAG_STRUCT_CHANNEL, | ||
589 | WMI_TLV_TAG_STRUCT_PDEV_SET_REGDOMAIN_CMD, | ||
590 | WMI_TLV_TAG_STRUCT_PDEV_SET_PARAM_CMD, | ||
591 | WMI_TLV_TAG_STRUCT_PDEV_SET_WMM_PARAMS_CMD, | ||
592 | WMI_TLV_TAG_STRUCT_WMM_PARAMS, | ||
593 | WMI_TLV_TAG_STRUCT_PDEV_SET_QUIET_CMD, | ||
594 | WMI_TLV_TAG_STRUCT_VDEV_CREATE_CMD, | ||
595 | WMI_TLV_TAG_STRUCT_VDEV_DELETE_CMD, | ||
596 | WMI_TLV_TAG_STRUCT_VDEV_START_REQUEST_CMD, | ||
597 | WMI_TLV_TAG_STRUCT_P2P_NOA_DESCRIPTOR, | ||
598 | WMI_TLV_TAG_STRUCT_P2P_GO_SET_BEACON_IE, | ||
599 | WMI_TLV_TAG_STRUCT_GTK_OFFLOAD_CMD, | ||
600 | WMI_TLV_TAG_STRUCT_VDEV_UP_CMD, | ||
601 | WMI_TLV_TAG_STRUCT_VDEV_STOP_CMD, | ||
602 | WMI_TLV_TAG_STRUCT_VDEV_DOWN_CMD, | ||
603 | WMI_TLV_TAG_STRUCT_VDEV_SET_PARAM_CMD, | ||
604 | WMI_TLV_TAG_STRUCT_VDEV_INSTALL_KEY_CMD, | ||
605 | WMI_TLV_TAG_STRUCT_PEER_CREATE_CMD, | ||
606 | WMI_TLV_TAG_STRUCT_PEER_DELETE_CMD, | ||
607 | WMI_TLV_TAG_STRUCT_PEER_FLUSH_TIDS_CMD, | ||
608 | WMI_TLV_TAG_STRUCT_PEER_SET_PARAM_CMD, | ||
609 | WMI_TLV_TAG_STRUCT_PEER_ASSOC_COMPLETE_CMD, | ||
610 | WMI_TLV_TAG_STRUCT_VHT_RATE_SET, | ||
611 | WMI_TLV_TAG_STRUCT_BCN_TMPL_CMD, | ||
612 | WMI_TLV_TAG_STRUCT_PRB_TMPL_CMD, | ||
613 | WMI_TLV_TAG_STRUCT_BCN_PRB_INFO, | ||
614 | WMI_TLV_TAG_STRUCT_PEER_TID_ADDBA_CMD, | ||
615 | WMI_TLV_TAG_STRUCT_PEER_TID_DELBA_CMD, | ||
616 | WMI_TLV_TAG_STRUCT_STA_POWERSAVE_MODE_CMD, | ||
617 | WMI_TLV_TAG_STRUCT_STA_POWERSAVE_PARAM_CMD, | ||
618 | WMI_TLV_TAG_STRUCT_STA_DTIM_PS_METHOD_CMD, | ||
619 | WMI_TLV_TAG_STRUCT_ROAM_SCAN_MODE, | ||
620 | WMI_TLV_TAG_STRUCT_ROAM_SCAN_RSSI_THRESHOLD, | ||
621 | WMI_TLV_TAG_STRUCT_ROAM_SCAN_PERIOD, | ||
622 | WMI_TLV_TAG_STRUCT_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, | ||
623 | WMI_TLV_TAG_STRUCT_PDEV_SUSPEND_CMD, | ||
624 | WMI_TLV_TAG_STRUCT_PDEV_RESUME_CMD, | ||
625 | WMI_TLV_TAG_STRUCT_ADD_BCN_FILTER_CMD, | ||
626 | WMI_TLV_TAG_STRUCT_RMV_BCN_FILTER_CMD, | ||
627 | WMI_TLV_TAG_STRUCT_WOW_ENABLE_CMD, | ||
628 | WMI_TLV_TAG_STRUCT_WOW_HOSTWAKEUP_FROM_SLEEP_CMD, | ||
629 | WMI_TLV_TAG_STRUCT_STA_UAPSD_AUTO_TRIG_CMD, | ||
630 | WMI_TLV_TAG_STRUCT_STA_UAPSD_AUTO_TRIG_PARAM, | ||
631 | WMI_TLV_TAG_STRUCT_SET_ARP_NS_OFFLOAD_CMD, | ||
632 | WMI_TLV_TAG_STRUCT_ARP_OFFLOAD_TUPLE, | ||
633 | WMI_TLV_TAG_STRUCT_NS_OFFLOAD_TUPLE, | ||
634 | WMI_TLV_TAG_STRUCT_FTM_INTG_CMD, | ||
635 | WMI_TLV_TAG_STRUCT_STA_KEEPALIVE_CMD, | ||
636 | WMI_TLV_TAG_STRUCT_STA_KEEPALVE_ARP_RESPONSE, | ||
637 | WMI_TLV_TAG_STRUCT_P2P_SET_VENDOR_IE_DATA_CMD, | ||
638 | WMI_TLV_TAG_STRUCT_AP_PS_PEER_CMD, | ||
639 | WMI_TLV_TAG_STRUCT_PEER_RATE_RETRY_SCHED_CMD, | ||
640 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_TRIGGER_CMD, | ||
641 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_SET_HIST_INTVL_CMD, | ||
642 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_GET_PROF_DATA_CMD, | ||
643 | WMI_TLV_TAG_STRUCT_WLAN_PROFILE_ENABLE_PROFILE_ID_CMD, | ||
644 | WMI_TLV_TAG_STRUCT_WOW_DEL_PATTERN_CMD, | ||
645 | WMI_TLV_TAG_STRUCT_WOW_ADD_DEL_EVT_CMD, | ||
646 | WMI_TLV_TAG_STRUCT_RTT_MEASREQ_HEAD, | ||
647 | WMI_TLV_TAG_STRUCT_RTT_MEASREQ_BODY, | ||
648 | WMI_TLV_TAG_STRUCT_RTT_TSF_CMD, | ||
649 | WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_CONFIGURE_CMD, | ||
650 | WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_ENABLE_CMD, | ||
651 | WMI_TLV_TAG_STRUCT_REQUEST_STATS_CMD, | ||
652 | WMI_TLV_TAG_STRUCT_NLO_CONFIG_CMD, | ||
653 | WMI_TLV_TAG_STRUCT_NLO_CONFIGURED_PARAMETERS, | ||
654 | WMI_TLV_TAG_STRUCT_CSA_OFFLOAD_ENABLE_CMD, | ||
655 | WMI_TLV_TAG_STRUCT_CSA_OFFLOAD_CHANSWITCH_CMD, | ||
656 | WMI_TLV_TAG_STRUCT_CHATTER_SET_MODE_CMD, | ||
657 | WMI_TLV_TAG_STRUCT_ECHO_CMD, | ||
658 | WMI_TLV_TAG_STRUCT_VDEV_SET_KEEPALIVE_CMD, | ||
659 | WMI_TLV_TAG_STRUCT_VDEV_GET_KEEPALIVE_CMD, | ||
660 | WMI_TLV_TAG_STRUCT_FORCE_FW_HANG_CMD, | ||
661 | WMI_TLV_TAG_STRUCT_GPIO_CONFIG_CMD, | ||
662 | WMI_TLV_TAG_STRUCT_GPIO_OUTPUT_CMD, | ||
663 | WMI_TLV_TAG_STRUCT_PEER_ADD_WDS_ENTRY_CMD, | ||
664 | WMI_TLV_TAG_STRUCT_PEER_REMOVE_WDS_ENTRY_CMD, | ||
665 | WMI_TLV_TAG_STRUCT_BCN_TX_HDR, | ||
666 | WMI_TLV_TAG_STRUCT_BCN_SEND_FROM_HOST_CMD, | ||
667 | WMI_TLV_TAG_STRUCT_MGMT_TX_HDR, | ||
668 | WMI_TLV_TAG_STRUCT_ADDBA_CLEAR_RESP_CMD, | ||
669 | WMI_TLV_TAG_STRUCT_ADDBA_SEND_CMD, | ||
670 | WMI_TLV_TAG_STRUCT_DELBA_SEND_CMD, | ||
671 | WMI_TLV_TAG_STRUCT_ADDBA_SETRESPONSE_CMD, | ||
672 | WMI_TLV_TAG_STRUCT_SEND_SINGLEAMSDU_CMD, | ||
673 | WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_ENABLE_CMD, | ||
674 | WMI_TLV_TAG_STRUCT_PDEV_PKTLOG_DISABLE_CMD, | ||
675 | WMI_TLV_TAG_STRUCT_PDEV_SET_HT_IE_CMD, | ||
676 | WMI_TLV_TAG_STRUCT_PDEV_SET_VHT_IE_CMD, | ||
677 | WMI_TLV_TAG_STRUCT_PDEV_SET_DSCP_TID_MAP_CMD, | ||
678 | WMI_TLV_TAG_STRUCT_PDEV_GREEN_AP_PS_ENABLE_CMD, | ||
679 | WMI_TLV_TAG_STRUCT_PDEV_GET_TPC_CONFIG_CMD, | ||
680 | WMI_TLV_TAG_STRUCT_PDEV_SET_BASE_MACADDR_CMD, | ||
681 | WMI_TLV_TAG_STRUCT_PEER_MCAST_GROUP_CMD, | ||
682 | WMI_TLV_TAG_STRUCT_ROAM_AP_PROFILE, | ||
683 | WMI_TLV_TAG_STRUCT_AP_PROFILE, | ||
684 | WMI_TLV_TAG_STRUCT_SCAN_SCH_PRIORITY_TABLE_CMD, | ||
685 | WMI_TLV_TAG_STRUCT_PDEV_DFS_ENABLE_CMD, | ||
686 | WMI_TLV_TAG_STRUCT_PDEV_DFS_DISABLE_CMD, | ||
687 | WMI_TLV_TAG_STRUCT_WOW_ADD_PATTERN_CMD, | ||
688 | WMI_TLV_TAG_STRUCT_WOW_BITMAP_PATTERN_T, | ||
689 | WMI_TLV_TAG_STRUCT_WOW_IPV4_SYNC_PATTERN_T, | ||
690 | WMI_TLV_TAG_STRUCT_WOW_IPV6_SYNC_PATTERN_T, | ||
691 | WMI_TLV_TAG_STRUCT_WOW_MAGIC_PATTERN_CMD, | ||
692 | WMI_TLV_TAG_STRUCT_SCAN_UPDATE_REQUEST_CMD, | ||
693 | WMI_TLV_TAG_STRUCT_CHATTER_PKT_COALESCING_FILTER, | ||
694 | WMI_TLV_TAG_STRUCT_CHATTER_COALESCING_ADD_FILTER_CMD, | ||
695 | WMI_TLV_TAG_STRUCT_CHATTER_COALESCING_DELETE_FILTER_CMD, | ||
696 | WMI_TLV_TAG_STRUCT_CHATTER_COALESCING_QUERY_CMD, | ||
697 | WMI_TLV_TAG_STRUCT_TXBF_CMD, | ||
698 | WMI_TLV_TAG_STRUCT_DEBUG_LOG_CONFIG_CMD, | ||
699 | WMI_TLV_TAG_STRUCT_NLO_EVENT, | ||
700 | WMI_TLV_TAG_STRUCT_CHATTER_QUERY_REPLY_EVENT, | ||
701 | WMI_TLV_TAG_STRUCT_UPLOAD_H_HDR, | ||
702 | WMI_TLV_TAG_STRUCT_CAPTURE_H_EVENT_HDR, | ||
703 | WMI_TLV_TAG_STRUCT_VDEV_WNM_SLEEPMODE_CMD, | ||
704 | WMI_TLV_TAG_STRUCT_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD, | ||
705 | WMI_TLV_TAG_STRUCT_VDEV_WMM_ADDTS_CMD, | ||
706 | WMI_TLV_TAG_STRUCT_VDEV_WMM_DELTS_CMD, | ||
707 | WMI_TLV_TAG_STRUCT_VDEV_SET_WMM_PARAMS_CMD, | ||
708 | WMI_TLV_TAG_STRUCT_TDLS_SET_STATE_CMD, | ||
709 | WMI_TLV_TAG_STRUCT_TDLS_PEER_UPDATE_CMD, | ||
710 | WMI_TLV_TAG_STRUCT_TDLS_PEER_EVENT, | ||
711 | WMI_TLV_TAG_STRUCT_TDLS_PEER_CAPABILITIES, | ||
712 | WMI_TLV_TAG_STRUCT_VDEV_MCC_SET_TBTT_MODE_CMD, | ||
713 | WMI_TLV_TAG_STRUCT_ROAM_CHAN_LIST, | ||
714 | WMI_TLV_TAG_STRUCT_VDEV_MCC_BCN_INTVL_CHANGE_EVENT, | ||
715 | WMI_TLV_TAG_STRUCT_RESMGR_ADAPTIVE_OCS_CMD, | ||
716 | WMI_TLV_TAG_STRUCT_RESMGR_SET_CHAN_TIME_QUOTA_CMD, | ||
717 | WMI_TLV_TAG_STRUCT_RESMGR_SET_CHAN_LATENCY_CMD, | ||
718 | WMI_TLV_TAG_STRUCT_BA_REQ_SSN_CMD, | ||
719 | WMI_TLV_TAG_STRUCT_BA_RSP_SSN_EVENT, | ||
720 | WMI_TLV_TAG_STRUCT_STA_SMPS_FORCE_MODE_CMD, | ||
721 | WMI_TLV_TAG_STRUCT_SET_MCASTBCAST_FILTER_CMD, | ||
722 | WMI_TLV_TAG_STRUCT_P2P_SET_OPPPS_CMD, | ||
723 | WMI_TLV_TAG_STRUCT_P2P_SET_NOA_CMD, | ||
724 | WMI_TLV_TAG_STRUCT_BA_REQ_SSN_CMD_SUB_STRUCT_PARAM, | ||
725 | WMI_TLV_TAG_STRUCT_BA_REQ_SSN_EVENT_SUB_STRUCT_PARAM, | ||
726 | WMI_TLV_TAG_STRUCT_STA_SMPS_PARAM_CMD, | ||
727 | WMI_TLV_TAG_STRUCT_VDEV_SET_GTX_PARAMS_CMD, | ||
728 | WMI_TLV_TAG_STRUCT_MCC_SCHED_TRAFFIC_STATS_CMD, | ||
729 | WMI_TLV_TAG_STRUCT_MCC_SCHED_STA_TRAFFIC_STATS, | ||
730 | WMI_TLV_TAG_STRUCT_OFFLOAD_BCN_TX_STATUS_EVENT, | ||
731 | WMI_TLV_TAG_STRUCT_P2P_NOA_EVENT, | ||
732 | WMI_TLV_TAG_STRUCT_HB_SET_ENABLE_CMD, | ||
733 | WMI_TLV_TAG_STRUCT_HB_SET_TCP_PARAMS_CMD, | ||
734 | WMI_TLV_TAG_STRUCT_HB_SET_TCP_PKT_FILTER_CMD, | ||
735 | WMI_TLV_TAG_STRUCT_HB_SET_UDP_PARAMS_CMD, | ||
736 | WMI_TLV_TAG_STRUCT_HB_SET_UDP_PKT_FILTER_CMD, | ||
737 | WMI_TLV_TAG_STRUCT_HB_IND_EVENT, | ||
738 | WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT, | ||
739 | WMI_TLV_TAG_STRUCT_RFKILL_EVENT, | ||
740 | WMI_TLV_TAG_STRUCT_DFS_RADAR_EVENT, | ||
741 | WMI_TLV_TAG_STRUCT_DFS_PHYERR_FILTER_ENA_CMD, | ||
742 | WMI_TLV_TAG_STRUCT_DFS_PHYERR_FILTER_DIS_CMD, | ||
743 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_RESULT_SCAN_LIST, | ||
744 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_RESULT_NETWORK_INFO, | ||
745 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_ENABLE_CMD, | ||
746 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_DISABLE_CMD, | ||
747 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_TRIGGER_RESULT_CMD, | ||
748 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_ENABLED_EVENT, | ||
749 | WMI_TLV_TAG_STRUCT_BATCH_SCAN_RESULT_EVENT, | ||
750 | WMI_TLV_TAG_STRUCT_VDEV_PLMREQ_START_CMD, | ||
751 | WMI_TLV_TAG_STRUCT_VDEV_PLMREQ_STOP_CMD, | ||
752 | WMI_TLV_TAG_STRUCT_THERMAL_MGMT_CMD, | ||
753 | WMI_TLV_TAG_STRUCT_THERMAL_MGMT_EVENT, | ||
754 | WMI_TLV_TAG_STRUCT_PEER_INFO_REQ_CMD, | ||
755 | WMI_TLV_TAG_STRUCT_PEER_INFO_EVENT, | ||
756 | WMI_TLV_TAG_STRUCT_PEER_INFO, | ||
757 | WMI_TLV_TAG_STRUCT_PEER_TX_FAIL_CNT_THR_EVENT, | ||
758 | WMI_TLV_TAG_STRUCT_RMC_SET_MODE_CMD, | ||
759 | WMI_TLV_TAG_STRUCT_RMC_SET_ACTION_PERIOD_CMD, | ||
760 | WMI_TLV_TAG_STRUCT_RMC_CONFIG_CMD, | ||
761 | WMI_TLV_TAG_STRUCT_MHF_OFFLOAD_SET_MODE_CMD, | ||
762 | WMI_TLV_TAG_STRUCT_MHF_OFFLOAD_PLUMB_ROUTING_TABLE_CMD, | ||
763 | WMI_TLV_TAG_STRUCT_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD, | ||
764 | WMI_TLV_TAG_STRUCT_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD, | ||
765 | WMI_TLV_TAG_STRUCT_NAN_CMD_PARAM, | ||
766 | WMI_TLV_TAG_STRUCT_NAN_EVENT_HDR, | ||
767 | WMI_TLV_TAG_STRUCT_PDEV_L1SS_TRACK_EVENT, | ||
768 | WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT, | ||
769 | WMI_TLV_TAG_STRUCT_MODEM_POWER_STATE_CMD_PARAM, | ||
770 | WMI_TLV_TAG_STRUCT_PEER_GET_ESTIMATED_LINKSPEED_CMD, | ||
771 | WMI_TLV_TAG_STRUCT_PEER_ESTIMATED_LINKSPEED_EVENT, | ||
772 | WMI_TLV_TAG_STRUCT_AGGR_STATE_TRIG_EVENT, | ||
773 | WMI_TLV_TAG_STRUCT_MHF_OFFLOAD_ROUTING_TABLE_ENTRY, | ||
774 | WMI_TLV_TAG_STRUCT_ROAM_SCAN_CMD, | ||
775 | WMI_TLV_TAG_STRUCT_REQ_STATS_EXT_CMD, | ||
776 | WMI_TLV_TAG_STRUCT_STATS_EXT_EVENT, | ||
777 | WMI_TLV_TAG_STRUCT_OBSS_SCAN_ENABLE_CMD, | ||
778 | WMI_TLV_TAG_STRUCT_OBSS_SCAN_DISABLE_CMD, | ||
779 | WMI_TLV_TAG_STRUCT_OFFLOAD_PRB_RSP_TX_STATUS_EVENT, | ||
780 | WMI_TLV_TAG_STRUCT_PDEV_SET_LED_CONFIG_CMD, | ||
781 | WMI_TLV_TAG_STRUCT_HOST_AUTO_SHUTDOWN_CFG_CMD, | ||
782 | WMI_TLV_TAG_STRUCT_HOST_AUTO_SHUTDOWN_EVENT, | ||
783 | WMI_TLV_TAG_STRUCT_UPDATE_WHAL_MIB_STATS_EVENT, | ||
784 | WMI_TLV_TAG_STRUCT_CHAN_AVOID_UPDATE_CMD_PARAM, | ||
785 | WMI_TLV_TAG_STRUCT_WOW_ACER_IOAC_PKT_PATTERN_T, | ||
786 | WMI_TLV_TAG_STRUCT_WOW_ACER_IOAC_TMR_PATTERN_T, | ||
787 | WMI_TLV_TAG_STRUCT_WOW_IOAC_ADD_KEEPALIVE_CMD, | ||
788 | WMI_TLV_TAG_STRUCT_WOW_IOAC_DEL_KEEPALIVE_CMD, | ||
789 | WMI_TLV_TAG_STRUCT_WOW_IOAC_KEEPALIVE_T, | ||
790 | WMI_TLV_TAG_STRUCT_WOW_ACER_IOAC_ADD_PATTERN_CMD, | ||
791 | WMI_TLV_TAG_STRUCT_WOW_ACER_IOAC_DEL_PATTERN_CMD, | ||
792 | WMI_TLV_TAG_STRUCT_START_LINK_STATS_CMD, | ||
793 | WMI_TLV_TAG_STRUCT_CLEAR_LINK_STATS_CMD, | ||
794 | WMI_TLV_TAG_STRUCT_REQUEST_LINK_STATS_CMD, | ||
795 | WMI_TLV_TAG_STRUCT_IFACE_LINK_STATS_EVENT, | ||
796 | WMI_TLV_TAG_STRUCT_RADIO_LINK_STATS_EVENT, | ||
797 | WMI_TLV_TAG_STRUCT_PEER_STATS_EVENT, | ||
798 | WMI_TLV_TAG_STRUCT_CHANNEL_STATS, | ||
799 | WMI_TLV_TAG_STRUCT_RADIO_LINK_STATS, | ||
800 | WMI_TLV_TAG_STRUCT_RATE_STATS, | ||
801 | WMI_TLV_TAG_STRUCT_PEER_LINK_STATS, | ||
802 | WMI_TLV_TAG_STRUCT_WMM_AC_STATS, | ||
803 | WMI_TLV_TAG_STRUCT_IFACE_LINK_STATS, | ||
804 | WMI_TLV_TAG_STRUCT_LPI_MGMT_SNOOPING_CONFIG_CMD, | ||
805 | WMI_TLV_TAG_STRUCT_LPI_START_SCAN_CMD, | ||
806 | WMI_TLV_TAG_STRUCT_LPI_STOP_SCAN_CMD, | ||
807 | WMI_TLV_TAG_STRUCT_LPI_RESULT_EVENT, | ||
808 | WMI_TLV_TAG_STRUCT_PEER_STATE_EVENT, | ||
809 | WMI_TLV_TAG_STRUCT_EXTSCAN_BUCKET_CMD, | ||
810 | WMI_TLV_TAG_STRUCT_EXTSCAN_BUCKET_CHANNEL_EVENT, | ||
811 | WMI_TLV_TAG_STRUCT_EXTSCAN_START_CMD, | ||
812 | WMI_TLV_TAG_STRUCT_EXTSCAN_STOP_CMD, | ||
813 | WMI_TLV_TAG_STRUCT_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMD, | ||
814 | WMI_TLV_TAG_STRUCT_EXTSCAN_WLAN_CHANGE_BSSID_PARAM_CMD, | ||
815 | WMI_TLV_TAG_STRUCT_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMD, | ||
816 | WMI_TLV_TAG_STRUCT_EXTSCAN_GET_CACHED_RESULTS_CMD, | ||
817 | WMI_TLV_TAG_STRUCT_EXTSCAN_GET_WLAN_CHANGE_RESULTS_CMD, | ||
818 | WMI_TLV_TAG_STRUCT_EXTSCAN_SET_CAPABILITIES_CMD, | ||
819 | WMI_TLV_TAG_STRUCT_EXTSCAN_GET_CAPABILITIES_CMD, | ||
820 | WMI_TLV_TAG_STRUCT_EXTSCAN_OPERATION_EVENT, | ||
821 | WMI_TLV_TAG_STRUCT_EXTSCAN_START_STOP_EVENT, | ||
822 | WMI_TLV_TAG_STRUCT_EXTSCAN_TABLE_USAGE_EVENT, | ||
823 | WMI_TLV_TAG_STRUCT_EXTSCAN_WLAN_DESCRIPTOR_EVENT, | ||
824 | WMI_TLV_TAG_STRUCT_EXTSCAN_RSSI_INFO_EVENT, | ||
825 | WMI_TLV_TAG_STRUCT_EXTSCAN_CACHED_RESULTS_EVENT, | ||
826 | WMI_TLV_TAG_STRUCT_EXTSCAN_WLAN_CHANGE_RESULTS_EVENT, | ||
827 | WMI_TLV_TAG_STRUCT_EXTSCAN_WLAN_CHANGE_RESULT_BSSID_EVENT, | ||
828 | WMI_TLV_TAG_STRUCT_EXTSCAN_HOTLIST_MATCH_EVENT, | ||
829 | WMI_TLV_TAG_STRUCT_EXTSCAN_CAPABILITIES_EVENT, | ||
830 | WMI_TLV_TAG_STRUCT_EXTSCAN_CACHE_CAPABILITIES_EVENT, | ||
831 | WMI_TLV_TAG_STRUCT_EXTSCAN_WLAN_CHANGE_MONITOR_CAPABILITIES_EVENT, | ||
832 | WMI_TLV_TAG_STRUCT_EXTSCAN_HOTLIST_MONITOR_CAPABILITIES_EVENT, | ||
833 | WMI_TLV_TAG_STRUCT_D0_WOW_ENABLE_DISABLE_CMD, | ||
834 | WMI_TLV_TAG_STRUCT_D0_WOW_DISABLE_ACK_EVENT, | ||
835 | WMI_TLV_TAG_STRUCT_UNIT_TEST_CMD, | ||
836 | WMI_TLV_TAG_STRUCT_ROAM_OFFLOAD_TLV_PARAM, | ||
837 | WMI_TLV_TAG_STRUCT_ROAM_11I_OFFLOAD_TLV_PARAM, | ||
838 | WMI_TLV_TAG_STRUCT_ROAM_11R_OFFLOAD_TLV_PARAM, | ||
839 | WMI_TLV_TAG_STRUCT_ROAM_ESE_OFFLOAD_TLV_PARAM, | ||
840 | WMI_TLV_TAG_STRUCT_ROAM_SYNCH_EVENT, | ||
841 | WMI_TLV_TAG_STRUCT_ROAM_SYNCH_COMPLETE, | ||
842 | WMI_TLV_TAG_STRUCT_EXTWOW_ENABLE_CMD, | ||
843 | WMI_TLV_TAG_STRUCT_EXTWOW_SET_APP_TYPE1_PARAMS_CMD, | ||
844 | WMI_TLV_TAG_STRUCT_EXTWOW_SET_APP_TYPE2_PARAMS_CMD, | ||
845 | WMI_TLV_TAG_STRUCT_LPI_STATUS_EVENT, | ||
846 | WMI_TLV_TAG_STRUCT_LPI_HANDOFF_EVENT, | ||
847 | WMI_TLV_TAG_STRUCT_VDEV_RATE_STATS_EVENT, | ||
848 | WMI_TLV_TAG_STRUCT_VDEV_RATE_HT_INFO, | ||
849 | WMI_TLV_TAG_STRUCT_RIC_REQUEST, | ||
850 | WMI_TLV_TAG_STRUCT_PDEV_GET_TEMPERATURE_CMD, | ||
851 | WMI_TLV_TAG_STRUCT_PDEV_TEMPERATURE_EVENT, | ||
852 | WMI_TLV_TAG_STRUCT_SET_DHCP_SERVER_OFFLOAD_CMD, | ||
853 | WMI_TLV_TAG_STRUCT_TPC_CHAINMASK_CONFIG_CMD, | ||
854 | WMI_TLV_TAG_STRUCT_RIC_TSPEC, | ||
855 | WMI_TLV_TAG_STRUCT_TPC_CHAINMASK_CONFIG, | ||
856 | WMI_TLV_TAG_STRUCT_IPA_OFFLOAD_CMD, | ||
857 | WMI_TLV_TAG_STRUCT_SCAN_PROB_REQ_OUI_CMD, | ||
858 | WMI_TLV_TAG_STRUCT_KEY_MATERIAL, | ||
859 | WMI_TLV_TAG_STRUCT_TDLS_SET_OFFCHAN_MODE_CMD, | ||
860 | WMI_TLV_TAG_STRUCT_SET_LED_FLASHING_CMD, | ||
861 | WMI_TLV_TAG_STRUCT_MDNS_OFFLOAD_CMD, | ||
862 | WMI_TLV_TAG_STRUCT_MDNS_SET_FQDN_CMD, | ||
863 | WMI_TLV_TAG_STRUCT_MDNS_SET_RESP_CMD, | ||
864 | WMI_TLV_TAG_STRUCT_MDNS_GET_STATS_CMD, | ||
865 | WMI_TLV_TAG_STRUCT_MDNS_STATS_EVENT, | ||
866 | WMI_TLV_TAG_STRUCT_ROAM_INVOKE_CMD, | ||
867 | WMI_TLV_TAG_STRUCT_PDEV_RESUME_EVENT, | ||
868 | WMI_TLV_TAG_STRUCT_PDEV_SET_ANTENNA_DIVERSITY_CMD, | ||
869 | WMI_TLV_TAG_STRUCT_SAP_OFL_ENABLE_CMD, | ||
870 | WMI_TLV_TAG_STRUCT_SAP_OFL_ADD_STA_EVENT, | ||
871 | WMI_TLV_TAG_STRUCT_SAP_OFL_DEL_STA_EVENT, | ||
872 | WMI_TLV_TAG_STRUCT_APFIND_CMD_PARAM, | ||
873 | WMI_TLV_TAG_STRUCT_APFIND_EVENT_HDR, | ||
874 | |||
875 | WMI_TLV_TAG_MAX | ||
876 | }; | ||
877 | |||
878 | enum wmi_tlv_service { | ||
879 | WMI_TLV_SERVICE_BEACON_OFFLOAD = 0, | ||
880 | WMI_TLV_SERVICE_SCAN_OFFLOAD, | ||
881 | WMI_TLV_SERVICE_ROAM_SCAN_OFFLOAD, | ||
882 | WMI_TLV_SERVICE_BCN_MISS_OFFLOAD, | ||
883 | WMI_TLV_SERVICE_STA_PWRSAVE, | ||
884 | WMI_TLV_SERVICE_STA_ADVANCED_PWRSAVE, | ||
885 | WMI_TLV_SERVICE_AP_UAPSD, | ||
886 | WMI_TLV_SERVICE_AP_DFS, | ||
887 | WMI_TLV_SERVICE_11AC, | ||
888 | WMI_TLV_SERVICE_BLOCKACK, | ||
889 | WMI_TLV_SERVICE_PHYERR, | ||
890 | WMI_TLV_SERVICE_BCN_FILTER, | ||
891 | WMI_TLV_SERVICE_RTT, | ||
892 | WMI_TLV_SERVICE_WOW, | ||
893 | WMI_TLV_SERVICE_RATECTRL_CACHE, | ||
894 | WMI_TLV_SERVICE_IRAM_TIDS, | ||
895 | WMI_TLV_SERVICE_ARPNS_OFFLOAD, | ||
896 | WMI_TLV_SERVICE_NLO, | ||
897 | WMI_TLV_SERVICE_GTK_OFFLOAD, | ||
898 | WMI_TLV_SERVICE_SCAN_SCH, | ||
899 | WMI_TLV_SERVICE_CSA_OFFLOAD, | ||
900 | WMI_TLV_SERVICE_CHATTER, | ||
901 | WMI_TLV_SERVICE_COEX_FREQAVOID, | ||
902 | WMI_TLV_SERVICE_PACKET_POWER_SAVE, | ||
903 | WMI_TLV_SERVICE_FORCE_FW_HANG, | ||
904 | WMI_TLV_SERVICE_GPIO, | ||
905 | WMI_TLV_SERVICE_STA_DTIM_PS_MODULATED_DTIM, | ||
906 | WMI_TLV_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, | ||
907 | WMI_TLV_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, | ||
908 | WMI_TLV_SERVICE_STA_KEEP_ALIVE, | ||
909 | WMI_TLV_SERVICE_TX_ENCAP, | ||
910 | WMI_TLV_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, | ||
911 | WMI_TLV_SERVICE_EARLY_RX, | ||
912 | WMI_TLV_SERVICE_STA_SMPS, | ||
913 | WMI_TLV_SERVICE_FWTEST, | ||
914 | WMI_TLV_SERVICE_STA_WMMAC, | ||
915 | WMI_TLV_SERVICE_TDLS, | ||
916 | WMI_TLV_SERVICE_BURST, | ||
917 | WMI_TLV_SERVICE_MCC_BCN_INTERVAL_CHANGE, | ||
918 | WMI_TLV_SERVICE_ADAPTIVE_OCS, | ||
919 | WMI_TLV_SERVICE_BA_SSN_SUPPORT, | ||
920 | WMI_TLV_SERVICE_FILTER_IPSEC_NATKEEPALIVE, | ||
921 | WMI_TLV_SERVICE_WLAN_HB, | ||
922 | WMI_TLV_SERVICE_LTE_ANT_SHARE_SUPPORT, | ||
923 | WMI_TLV_SERVICE_BATCH_SCAN, | ||
924 | WMI_TLV_SERVICE_QPOWER, | ||
925 | WMI_TLV_SERVICE_PLMREQ, | ||
926 | WMI_TLV_SERVICE_THERMAL_MGMT, | ||
927 | WMI_TLV_SERVICE_RMC, | ||
928 | WMI_TLV_SERVICE_MHF_OFFLOAD, | ||
929 | WMI_TLV_SERVICE_COEX_SAR, | ||
930 | WMI_TLV_SERVICE_BCN_TXRATE_OVERRIDE, | ||
931 | WMI_TLV_SERVICE_NAN, | ||
932 | WMI_TLV_SERVICE_L1SS_STAT, | ||
933 | WMI_TLV_SERVICE_ESTIMATE_LINKSPEED, | ||
934 | WMI_TLV_SERVICE_OBSS_SCAN, | ||
935 | WMI_TLV_SERVICE_TDLS_OFFCHAN, | ||
936 | WMI_TLV_SERVICE_TDLS_UAPSD_BUFFER_STA, | ||
937 | WMI_TLV_SERVICE_TDLS_UAPSD_SLEEP_STA, | ||
938 | WMI_TLV_SERVICE_IBSS_PWRSAVE, | ||
939 | WMI_TLV_SERVICE_LPASS, | ||
940 | WMI_TLV_SERVICE_EXTSCAN, | ||
941 | WMI_TLV_SERVICE_D0WOW, | ||
942 | WMI_TLV_SERVICE_HSOFFLOAD, | ||
943 | WMI_TLV_SERVICE_ROAM_HO_OFFLOAD, | ||
944 | WMI_TLV_SERVICE_RX_FULL_REORDER, | ||
945 | WMI_TLV_SERVICE_DHCP_OFFLOAD, | ||
946 | WMI_TLV_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, | ||
947 | WMI_TLV_SERVICE_MDNS_OFFLOAD, | ||
948 | WMI_TLV_SERVICE_SAP_AUTH_OFFLOAD, | ||
949 | }; | ||
950 | |||
951 | #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \ | ||
952 | ((svc_id) < (len) && \ | ||
953 | __le32_to_cpu((wmi_svc_bmap)[(svc_id)/(sizeof(u32))]) & \ | ||
954 | BIT((svc_id)%(sizeof(u32)))) | ||
955 | |||
956 | #define SVCMAP(x, y, len) \ | ||
957 | do { \ | ||
958 | if (WMI_SERVICE_IS_ENABLED((in), (x), (len))) \ | ||
959 | __set_bit(y, out); \ | ||
960 | } while (0) | ||
961 | |||
962 | static inline void | ||
963 | wmi_tlv_svc_map(const __le32 *in, unsigned long *out, size_t len) | ||
964 | { | ||
965 | SVCMAP(WMI_TLV_SERVICE_BEACON_OFFLOAD, | ||
966 | WMI_SERVICE_BEACON_OFFLOAD, len); | ||
967 | SVCMAP(WMI_TLV_SERVICE_SCAN_OFFLOAD, | ||
968 | WMI_SERVICE_SCAN_OFFLOAD, len); | ||
969 | SVCMAP(WMI_TLV_SERVICE_ROAM_SCAN_OFFLOAD, | ||
970 | WMI_SERVICE_ROAM_SCAN_OFFLOAD, len); | ||
971 | SVCMAP(WMI_TLV_SERVICE_BCN_MISS_OFFLOAD, | ||
972 | WMI_SERVICE_BCN_MISS_OFFLOAD, len); | ||
973 | SVCMAP(WMI_TLV_SERVICE_STA_PWRSAVE, | ||
974 | WMI_SERVICE_STA_PWRSAVE, len); | ||
975 | SVCMAP(WMI_TLV_SERVICE_STA_ADVANCED_PWRSAVE, | ||
976 | WMI_SERVICE_STA_ADVANCED_PWRSAVE, len); | ||
977 | SVCMAP(WMI_TLV_SERVICE_AP_UAPSD, | ||
978 | WMI_SERVICE_AP_UAPSD, len); | ||
979 | SVCMAP(WMI_TLV_SERVICE_AP_DFS, | ||
980 | WMI_SERVICE_AP_DFS, len); | ||
981 | SVCMAP(WMI_TLV_SERVICE_11AC, | ||
982 | WMI_SERVICE_11AC, len); | ||
983 | SVCMAP(WMI_TLV_SERVICE_BLOCKACK, | ||
984 | WMI_SERVICE_BLOCKACK, len); | ||
985 | SVCMAP(WMI_TLV_SERVICE_PHYERR, | ||
986 | WMI_SERVICE_PHYERR, len); | ||
987 | SVCMAP(WMI_TLV_SERVICE_BCN_FILTER, | ||
988 | WMI_SERVICE_BCN_FILTER, len); | ||
989 | SVCMAP(WMI_TLV_SERVICE_RTT, | ||
990 | WMI_SERVICE_RTT, len); | ||
991 | SVCMAP(WMI_TLV_SERVICE_WOW, | ||
992 | WMI_SERVICE_WOW, len); | ||
993 | SVCMAP(WMI_TLV_SERVICE_RATECTRL_CACHE, | ||
994 | WMI_SERVICE_RATECTRL_CACHE, len); | ||
995 | SVCMAP(WMI_TLV_SERVICE_IRAM_TIDS, | ||
996 | WMI_SERVICE_IRAM_TIDS, len); | ||
997 | SVCMAP(WMI_TLV_SERVICE_ARPNS_OFFLOAD, | ||
998 | WMI_SERVICE_ARPNS_OFFLOAD, len); | ||
999 | SVCMAP(WMI_TLV_SERVICE_NLO, | ||
1000 | WMI_SERVICE_NLO, len); | ||
1001 | SVCMAP(WMI_TLV_SERVICE_GTK_OFFLOAD, | ||
1002 | WMI_SERVICE_GTK_OFFLOAD, len); | ||
1003 | SVCMAP(WMI_TLV_SERVICE_SCAN_SCH, | ||
1004 | WMI_SERVICE_SCAN_SCH, len); | ||
1005 | SVCMAP(WMI_TLV_SERVICE_CSA_OFFLOAD, | ||
1006 | WMI_SERVICE_CSA_OFFLOAD, len); | ||
1007 | SVCMAP(WMI_TLV_SERVICE_CHATTER, | ||
1008 | WMI_SERVICE_CHATTER, len); | ||
1009 | SVCMAP(WMI_TLV_SERVICE_COEX_FREQAVOID, | ||
1010 | WMI_SERVICE_COEX_FREQAVOID, len); | ||
1011 | SVCMAP(WMI_TLV_SERVICE_PACKET_POWER_SAVE, | ||
1012 | WMI_SERVICE_PACKET_POWER_SAVE, len); | ||
1013 | SVCMAP(WMI_TLV_SERVICE_FORCE_FW_HANG, | ||
1014 | WMI_SERVICE_FORCE_FW_HANG, len); | ||
1015 | SVCMAP(WMI_TLV_SERVICE_GPIO, | ||
1016 | WMI_SERVICE_GPIO, len); | ||
1017 | SVCMAP(WMI_TLV_SERVICE_STA_DTIM_PS_MODULATED_DTIM, | ||
1018 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM, len); | ||
1019 | SVCMAP(WMI_TLV_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, | ||
1020 | WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, len); | ||
1021 | SVCMAP(WMI_TLV_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, | ||
1022 | WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, len); | ||
1023 | SVCMAP(WMI_TLV_SERVICE_STA_KEEP_ALIVE, | ||
1024 | WMI_SERVICE_STA_KEEP_ALIVE, len); | ||
1025 | SVCMAP(WMI_TLV_SERVICE_TX_ENCAP, | ||
1026 | WMI_SERVICE_TX_ENCAP, len); | ||
1027 | SVCMAP(WMI_TLV_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, | ||
1028 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, len); | ||
1029 | SVCMAP(WMI_TLV_SERVICE_EARLY_RX, | ||
1030 | WMI_SERVICE_EARLY_RX, len); | ||
1031 | SVCMAP(WMI_TLV_SERVICE_STA_SMPS, | ||
1032 | WMI_SERVICE_STA_SMPS, len); | ||
1033 | SVCMAP(WMI_TLV_SERVICE_FWTEST, | ||
1034 | WMI_SERVICE_FWTEST, len); | ||
1035 | SVCMAP(WMI_TLV_SERVICE_STA_WMMAC, | ||
1036 | WMI_SERVICE_STA_WMMAC, len); | ||
1037 | SVCMAP(WMI_TLV_SERVICE_TDLS, | ||
1038 | WMI_SERVICE_TDLS, len); | ||
1039 | SVCMAP(WMI_TLV_SERVICE_BURST, | ||
1040 | WMI_SERVICE_BURST, len); | ||
1041 | SVCMAP(WMI_TLV_SERVICE_MCC_BCN_INTERVAL_CHANGE, | ||
1042 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE, len); | ||
1043 | SVCMAP(WMI_TLV_SERVICE_ADAPTIVE_OCS, | ||
1044 | WMI_SERVICE_ADAPTIVE_OCS, len); | ||
1045 | SVCMAP(WMI_TLV_SERVICE_BA_SSN_SUPPORT, | ||
1046 | WMI_SERVICE_BA_SSN_SUPPORT, len); | ||
1047 | SVCMAP(WMI_TLV_SERVICE_FILTER_IPSEC_NATKEEPALIVE, | ||
1048 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE, len); | ||
1049 | SVCMAP(WMI_TLV_SERVICE_WLAN_HB, | ||
1050 | WMI_SERVICE_WLAN_HB, len); | ||
1051 | SVCMAP(WMI_TLV_SERVICE_LTE_ANT_SHARE_SUPPORT, | ||
1052 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT, len); | ||
1053 | SVCMAP(WMI_TLV_SERVICE_BATCH_SCAN, | ||
1054 | WMI_SERVICE_BATCH_SCAN, len); | ||
1055 | SVCMAP(WMI_TLV_SERVICE_QPOWER, | ||
1056 | WMI_SERVICE_QPOWER, len); | ||
1057 | SVCMAP(WMI_TLV_SERVICE_PLMREQ, | ||
1058 | WMI_SERVICE_PLMREQ, len); | ||
1059 | SVCMAP(WMI_TLV_SERVICE_THERMAL_MGMT, | ||
1060 | WMI_SERVICE_THERMAL_MGMT, len); | ||
1061 | SVCMAP(WMI_TLV_SERVICE_RMC, | ||
1062 | WMI_SERVICE_RMC, len); | ||
1063 | SVCMAP(WMI_TLV_SERVICE_MHF_OFFLOAD, | ||
1064 | WMI_SERVICE_MHF_OFFLOAD, len); | ||
1065 | SVCMAP(WMI_TLV_SERVICE_COEX_SAR, | ||
1066 | WMI_SERVICE_COEX_SAR, len); | ||
1067 | SVCMAP(WMI_TLV_SERVICE_BCN_TXRATE_OVERRIDE, | ||
1068 | WMI_SERVICE_BCN_TXRATE_OVERRIDE, len); | ||
1069 | SVCMAP(WMI_TLV_SERVICE_NAN, | ||
1070 | WMI_SERVICE_NAN, len); | ||
1071 | SVCMAP(WMI_TLV_SERVICE_L1SS_STAT, | ||
1072 | WMI_SERVICE_L1SS_STAT, len); | ||
1073 | SVCMAP(WMI_TLV_SERVICE_ESTIMATE_LINKSPEED, | ||
1074 | WMI_SERVICE_ESTIMATE_LINKSPEED, len); | ||
1075 | SVCMAP(WMI_TLV_SERVICE_OBSS_SCAN, | ||
1076 | WMI_SERVICE_OBSS_SCAN, len); | ||
1077 | SVCMAP(WMI_TLV_SERVICE_TDLS_OFFCHAN, | ||
1078 | WMI_SERVICE_TDLS_OFFCHAN, len); | ||
1079 | SVCMAP(WMI_TLV_SERVICE_TDLS_UAPSD_BUFFER_STA, | ||
1080 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, len); | ||
1081 | SVCMAP(WMI_TLV_SERVICE_TDLS_UAPSD_SLEEP_STA, | ||
1082 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA, len); | ||
1083 | SVCMAP(WMI_TLV_SERVICE_IBSS_PWRSAVE, | ||
1084 | WMI_SERVICE_IBSS_PWRSAVE, len); | ||
1085 | SVCMAP(WMI_TLV_SERVICE_LPASS, | ||
1086 | WMI_SERVICE_LPASS, len); | ||
1087 | SVCMAP(WMI_TLV_SERVICE_EXTSCAN, | ||
1088 | WMI_SERVICE_EXTSCAN, len); | ||
1089 | SVCMAP(WMI_TLV_SERVICE_D0WOW, | ||
1090 | WMI_SERVICE_D0WOW, len); | ||
1091 | SVCMAP(WMI_TLV_SERVICE_HSOFFLOAD, | ||
1092 | WMI_SERVICE_HSOFFLOAD, len); | ||
1093 | SVCMAP(WMI_TLV_SERVICE_ROAM_HO_OFFLOAD, | ||
1094 | WMI_SERVICE_ROAM_HO_OFFLOAD, len); | ||
1095 | SVCMAP(WMI_TLV_SERVICE_RX_FULL_REORDER, | ||
1096 | WMI_SERVICE_RX_FULL_REORDER, len); | ||
1097 | SVCMAP(WMI_TLV_SERVICE_DHCP_OFFLOAD, | ||
1098 | WMI_SERVICE_DHCP_OFFLOAD, len); | ||
1099 | SVCMAP(WMI_TLV_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, | ||
1100 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, len); | ||
1101 | SVCMAP(WMI_TLV_SERVICE_MDNS_OFFLOAD, | ||
1102 | WMI_SERVICE_MDNS_OFFLOAD, len); | ||
1103 | SVCMAP(WMI_TLV_SERVICE_SAP_AUTH_OFFLOAD, | ||
1104 | WMI_SERVICE_SAP_AUTH_OFFLOAD, len); | ||
1105 | } | ||
1106 | |||
1107 | #undef SVCMAP | ||
1108 | |||
1109 | struct wmi_tlv { | ||
1110 | __le16 len; | ||
1111 | __le16 tag; | ||
1112 | u8 value[0]; | ||
1113 | } __packed; | ||
1114 | |||
1115 | #define WMI_TLV_MGMT_RX_NUM_RSSI 4 | ||
1116 | |||
1117 | struct wmi_tlv_mgmt_rx_ev { | ||
1118 | __le32 channel; | ||
1119 | __le32 snr; | ||
1120 | __le32 rate; | ||
1121 | __le32 phy_mode; | ||
1122 | __le32 buf_len; | ||
1123 | __le32 status; | ||
1124 | __le32 rssi[WMI_TLV_MGMT_RX_NUM_RSSI]; | ||
1125 | } __packed; | ||
1126 | |||
1127 | struct wmi_tlv_abi_version { | ||
1128 | __le32 abi_ver0; | ||
1129 | __le32 abi_ver1; | ||
1130 | __le32 abi_ver_ns0; | ||
1131 | __le32 abi_ver_ns1; | ||
1132 | __le32 abi_ver_ns2; | ||
1133 | __le32 abi_ver_ns3; | ||
1134 | } __packed; | ||
1135 | |||
1136 | enum wmi_tlv_hw_bd_id { | ||
1137 | WMI_TLV_HW_BD_LEGACY = 0, | ||
1138 | WMI_TLV_HW_BD_QCA6174 = 1, | ||
1139 | WMI_TLV_HW_BD_QCA2582 = 2, | ||
1140 | }; | ||
1141 | |||
1142 | struct wmi_tlv_hw_bd_info { | ||
1143 | u8 rev; | ||
1144 | u8 project_id; | ||
1145 | u8 custom_id; | ||
1146 | u8 reference_design_id; | ||
1147 | } __packed; | ||
1148 | |||
1149 | struct wmi_tlv_svc_rdy_ev { | ||
1150 | __le32 fw_build_vers; | ||
1151 | struct wmi_tlv_abi_version abi; | ||
1152 | __le32 phy_capability; | ||
1153 | __le32 max_frag_entry; | ||
1154 | __le32 num_rf_chains; | ||
1155 | __le32 ht_cap_info; | ||
1156 | __le32 vht_cap_info; | ||
1157 | __le32 vht_supp_mcs; | ||
1158 | __le32 hw_min_tx_power; | ||
1159 | __le32 hw_max_tx_power; | ||
1160 | __le32 sys_cap_info; | ||
1161 | __le32 min_pkt_size_enable; | ||
1162 | __le32 max_bcn_ie_size; | ||
1163 | __le32 num_mem_reqs; | ||
1164 | __le32 max_num_scan_chans; | ||
1165 | __le32 hw_bd_id; /* 0 means hw_bd_info is invalid */ | ||
1166 | struct wmi_tlv_hw_bd_info hw_bd_info[5]; | ||
1167 | } __packed; | ||
1168 | |||
1169 | struct wmi_tlv_rdy_ev { | ||
1170 | struct wmi_tlv_abi_version abi; | ||
1171 | struct wmi_mac_addr mac_addr; | ||
1172 | __le32 status; | ||
1173 | } __packed; | ||
1174 | |||
1175 | struct wmi_tlv_resource_config { | ||
1176 | __le32 num_vdevs; | ||
1177 | __le32 num_peers; | ||
1178 | __le32 num_offload_peers; | ||
1179 | __le32 num_offload_reorder_bufs; | ||
1180 | __le32 num_peer_keys; | ||
1181 | __le32 num_tids; | ||
1182 | __le32 ast_skid_limit; | ||
1183 | __le32 tx_chain_mask; | ||
1184 | __le32 rx_chain_mask; | ||
1185 | __le32 rx_timeout_pri[4]; | ||
1186 | __le32 rx_decap_mode; | ||
1187 | __le32 scan_max_pending_reqs; | ||
1188 | __le32 bmiss_offload_max_vdev; | ||
1189 | __le32 roam_offload_max_vdev; | ||
1190 | __le32 roam_offload_max_ap_profiles; | ||
1191 | __le32 num_mcast_groups; | ||
1192 | __le32 num_mcast_table_elems; | ||
1193 | __le32 mcast2ucast_mode; | ||
1194 | __le32 tx_dbg_log_size; | ||
1195 | __le32 num_wds_entries; | ||
1196 | __le32 dma_burst_size; | ||
1197 | __le32 mac_aggr_delim; | ||
1198 | __le32 rx_skip_defrag_timeout_dup_detection_check; | ||
1199 | __le32 vow_config; | ||
1200 | __le32 gtk_offload_max_vdev; | ||
1201 | __le32 num_msdu_desc; | ||
1202 | __le32 max_frag_entries; | ||
1203 | __le32 num_tdls_vdevs; | ||
1204 | __le32 num_tdls_conn_table_entries; | ||
1205 | __le32 beacon_tx_offload_max_vdev; | ||
1206 | __le32 num_multicast_filter_entries; | ||
1207 | __le32 num_wow_filters; | ||
1208 | __le32 num_keep_alive_pattern; | ||
1209 | __le32 keep_alive_pattern_size; | ||
1210 | __le32 max_tdls_concurrent_sleep_sta; | ||
1211 | __le32 max_tdls_concurrent_buffer_sta; | ||
1212 | } __packed; | ||
1213 | |||
1214 | struct wmi_tlv_init_cmd { | ||
1215 | struct wmi_tlv_abi_version abi; | ||
1216 | __le32 num_host_mem_chunks; | ||
1217 | } __packed; | ||
1218 | |||
1219 | struct wmi_tlv_pdev_set_param_cmd { | ||
1220 | __le32 pdev_id; /* not used yet */ | ||
1221 | __le32 param_id; | ||
1222 | __le32 param_value; | ||
1223 | } __packed; | ||
1224 | |||
1225 | struct wmi_tlv_pdev_set_rd_cmd { | ||
1226 | __le32 pdev_id; /* not used yet */ | ||
1227 | __le32 regd; | ||
1228 | __le32 regd_2ghz; | ||
1229 | __le32 regd_5ghz; | ||
1230 | __le32 conform_limit_2ghz; | ||
1231 | __le32 conform_limit_5ghz; | ||
1232 | } __packed; | ||
1233 | |||
1234 | struct wmi_tlv_scan_chan_list_cmd { | ||
1235 | __le32 num_scan_chans; | ||
1236 | } __packed; | ||
1237 | |||
1238 | struct wmi_tlv_start_scan_cmd { | ||
1239 | struct wmi_start_scan_common common; | ||
1240 | __le32 burst_duration_ms; | ||
1241 | __le32 num_channels; | ||
1242 | __le32 num_bssids; | ||
1243 | __le32 num_ssids; | ||
1244 | __le32 ie_len; | ||
1245 | __le32 num_probes; | ||
1246 | } __packed; | ||
1247 | |||
1248 | struct wmi_tlv_vdev_start_cmd { | ||
1249 | __le32 vdev_id; | ||
1250 | __le32 requestor_id; | ||
1251 | __le32 bcn_intval; | ||
1252 | __le32 dtim_period; | ||
1253 | __le32 flags; | ||
1254 | struct wmi_ssid ssid; | ||
1255 | __le32 bcn_tx_rate; | ||
1256 | __le32 bcn_tx_power; | ||
1257 | __le32 num_noa_descr; | ||
1258 | __le32 disable_hw_ack; | ||
1259 | } __packed; | ||
1260 | |||
1261 | enum { | ||
1262 | WMI_TLV_PEER_TYPE_DEFAULT = 0, /* generic / non-BSS / self-peer */ | ||
1263 | WMI_TLV_PEER_TYPE_BSS = 1, | ||
1264 | WMI_TLV_PEER_TYPE_TDLS = 2, | ||
1265 | WMI_TLV_PEER_TYPE_HOST_MAX = 127, | ||
1266 | WMI_TLV_PEER_TYPE_ROAMOFFLOAD_TMP = 128, | ||
1267 | }; | ||
1268 | |||
1269 | struct wmi_tlv_peer_create_cmd { | ||
1270 | __le32 vdev_id; | ||
1271 | struct wmi_mac_addr peer_addr; | ||
1272 | __le32 peer_type; | ||
1273 | } __packed; | ||
1274 | |||
1275 | struct wmi_tlv_peer_assoc_cmd { | ||
1276 | struct wmi_mac_addr mac_addr; | ||
1277 | __le32 vdev_id; | ||
1278 | __le32 new_assoc; | ||
1279 | __le32 assoc_id; | ||
1280 | __le32 flags; | ||
1281 | __le32 caps; | ||
1282 | __le32 listen_intval; | ||
1283 | __le32 ht_caps; | ||
1284 | __le32 max_mpdu; | ||
1285 | __le32 mpdu_density; | ||
1286 | __le32 rate_caps; | ||
1287 | __le32 nss; | ||
1288 | __le32 vht_caps; | ||
1289 | __le32 phy_mode; | ||
1290 | __le32 ht_info[2]; | ||
1291 | __le32 num_legacy_rates; | ||
1292 | __le32 num_ht_rates; | ||
1293 | } __packed; | ||
1294 | |||
1295 | struct wmi_tlv_pdev_suspend { | ||
1296 | __le32 pdev_id; /* not used yet */ | ||
1297 | __le32 opt; | ||
1298 | } __packed; | ||
1299 | |||
1300 | struct wmi_tlv_pdev_set_wmm_cmd { | ||
1301 | __le32 pdev_id; /* not used yet */ | ||
1302 | __le32 dg_type; /* no idea.. */ | ||
1303 | } __packed; | ||
1304 | |||
1305 | struct wmi_tlv_phyerr_ev { | ||
1306 | __le32 num_phyerrs; | ||
1307 | __le32 tsf_l32; | ||
1308 | __le32 tsf_u32; | ||
1309 | __le32 buf_len; | ||
1310 | } __packed; | ||
1311 | |||
1312 | enum wmi_tlv_dbglog_param { | ||
1313 | WMI_TLV_DBGLOG_PARAM_LOG_LEVEL = 1, | ||
1314 | WMI_TLV_DBGLOG_PARAM_VDEV_ENABLE, | ||
1315 | WMI_TLV_DBGLOG_PARAM_VDEV_DISABLE, | ||
1316 | WMI_TLV_DBGLOG_PARAM_VDEV_ENABLE_BITMAP, | ||
1317 | WMI_TLV_DBGLOG_PARAM_VDEV_DISABLE_BITMAP, | ||
1318 | }; | ||
1319 | |||
1320 | enum wmi_tlv_dbglog_log_level { | ||
1321 | WMI_TLV_DBGLOG_LOG_LEVEL_VERBOSE = 0, | ||
1322 | WMI_TLV_DBGLOG_LOG_LEVEL_INFO, | ||
1323 | WMI_TLV_DBGLOG_LOG_LEVEL_INFO_LVL_1, | ||
1324 | WMI_TLV_DBGLOG_LOG_LEVEL_INFO_LVL_2, | ||
1325 | WMI_TLV_DBGLOG_LOG_LEVEL_WARN, | ||
1326 | WMI_TLV_DBGLOG_LOG_LEVEL_ERR, | ||
1327 | }; | ||
1328 | |||
1329 | #define WMI_TLV_DBGLOG_BITMAP_MAX_IDS 512 | ||
1330 | #define WMI_TLV_DBGLOG_BITMAP_MAX_WORDS (WMI_TLV_DBGLOG_BITMAP_MAX_IDS / \ | ||
1331 | sizeof(__le32)) | ||
1332 | #define WMI_TLV_DBGLOG_ALL_MODULES 0xffff | ||
1333 | #define WMI_TLV_DBGLOG_LOG_LEVEL_VALUE(module_id, log_level) \ | ||
1334 | (((module_id << 16) & 0xffff0000) | \ | ||
1335 | ((log_level << 0) & 0x000000ff)) | ||
1336 | |||
1337 | struct wmi_tlv_dbglog_cmd { | ||
1338 | __le32 param; | ||
1339 | __le32 value; | ||
1340 | } __packed; | ||
1341 | |||
1342 | struct wmi_tlv_resume_cmd { | ||
1343 | __le32 reserved; | ||
1344 | } __packed; | ||
1345 | |||
1346 | struct wmi_tlv_req_stats_cmd { | ||
1347 | __le32 stats_id; /* wmi_stats_id */ | ||
1348 | __le32 vdev_id; | ||
1349 | struct wmi_mac_addr peer_macaddr; | ||
1350 | } __packed; | ||
1351 | |||
1352 | struct wmi_tlv_vdev_stats { | ||
1353 | __le32 vdev_id; | ||
1354 | __le32 beacon_snr; | ||
1355 | __le32 data_snr; | ||
1356 | __le32 num_tx_frames[4]; /* per-AC */ | ||
1357 | __le32 num_rx_frames; | ||
1358 | __le32 num_tx_frames_retries[4]; | ||
1359 | __le32 num_tx_frames_failures[4]; | ||
1360 | __le32 num_rts_fail; | ||
1361 | __le32 num_rts_success; | ||
1362 | __le32 num_rx_err; | ||
1363 | __le32 num_rx_discard; | ||
1364 | __le32 num_tx_not_acked; | ||
1365 | __le32 tx_rate_history[10]; | ||
1366 | __le32 beacon_rssi_history[10]; | ||
1367 | } __packed; | ||
1368 | |||
1369 | struct wmi_tlv_pktlog_enable { | ||
1370 | __le32 reserved; | ||
1371 | __le32 filter; | ||
1372 | } __packed; | ||
1373 | |||
1374 | struct wmi_tlv_pktlog_disable { | ||
1375 | __le32 reserved; | ||
1376 | } __packed; | ||
1377 | |||
1378 | void ath10k_wmi_tlv_attach(struct ath10k *ar); | ||
1379 | |||
1380 | #endif | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index c0f3e4d09263..ac742905331b 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c | |||
@@ -22,8 +22,10 @@ | |||
22 | #include "htc.h" | 22 | #include "htc.h" |
23 | #include "debug.h" | 23 | #include "debug.h" |
24 | #include "wmi.h" | 24 | #include "wmi.h" |
25 | #include "wmi-tlv.h" | ||
25 | #include "mac.h" | 26 | #include "mac.h" |
26 | #include "testmode.h" | 27 | #include "testmode.h" |
28 | #include "wmi-ops.h" | ||
27 | 29 | ||
28 | /* MAIN WMI cmd track */ | 30 | /* MAIN WMI cmd track */ |
29 | static struct wmi_cmd_map wmi_cmd_map = { | 31 | static struct wmi_cmd_map wmi_cmd_map = { |
@@ -143,6 +145,7 @@ static struct wmi_cmd_map wmi_cmd_map = { | |||
143 | .force_fw_hang_cmdid = WMI_FORCE_FW_HANG_CMDID, | 145 | .force_fw_hang_cmdid = WMI_FORCE_FW_HANG_CMDID, |
144 | .gpio_config_cmdid = WMI_GPIO_CONFIG_CMDID, | 146 | .gpio_config_cmdid = WMI_GPIO_CONFIG_CMDID, |
145 | .gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID, | 147 | .gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID, |
148 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, | ||
146 | }; | 149 | }; |
147 | 150 | ||
148 | /* 10.X WMI cmd track */ | 151 | /* 10.X WMI cmd track */ |
@@ -265,6 +268,129 @@ static struct wmi_cmd_map wmi_10x_cmd_map = { | |||
265 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, | 268 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, |
266 | .gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID, | 269 | .gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID, |
267 | .gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID, | 270 | .gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID, |
271 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, | ||
272 | }; | ||
273 | |||
274 | /* 10.2.4 WMI cmd track */ | ||
275 | static struct wmi_cmd_map wmi_10_2_4_cmd_map = { | ||
276 | .init_cmdid = WMI_10_2_INIT_CMDID, | ||
277 | .start_scan_cmdid = WMI_10_2_START_SCAN_CMDID, | ||
278 | .stop_scan_cmdid = WMI_10_2_STOP_SCAN_CMDID, | ||
279 | .scan_chan_list_cmdid = WMI_10_2_SCAN_CHAN_LIST_CMDID, | ||
280 | .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED, | ||
281 | .pdev_set_regdomain_cmdid = WMI_10_2_PDEV_SET_REGDOMAIN_CMDID, | ||
282 | .pdev_set_channel_cmdid = WMI_10_2_PDEV_SET_CHANNEL_CMDID, | ||
283 | .pdev_set_param_cmdid = WMI_10_2_PDEV_SET_PARAM_CMDID, | ||
284 | .pdev_pktlog_enable_cmdid = WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID, | ||
285 | .pdev_pktlog_disable_cmdid = WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID, | ||
286 | .pdev_set_wmm_params_cmdid = WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID, | ||
287 | .pdev_set_ht_cap_ie_cmdid = WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID, | ||
288 | .pdev_set_vht_cap_ie_cmdid = WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID, | ||
289 | .pdev_set_quiet_mode_cmdid = WMI_10_2_PDEV_SET_QUIET_MODE_CMDID, | ||
290 | .pdev_green_ap_ps_enable_cmdid = WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID, | ||
291 | .pdev_get_tpc_config_cmdid = WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID, | ||
292 | .pdev_set_base_macaddr_cmdid = WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID, | ||
293 | .vdev_create_cmdid = WMI_10_2_VDEV_CREATE_CMDID, | ||
294 | .vdev_delete_cmdid = WMI_10_2_VDEV_DELETE_CMDID, | ||
295 | .vdev_start_request_cmdid = WMI_10_2_VDEV_START_REQUEST_CMDID, | ||
296 | .vdev_restart_request_cmdid = WMI_10_2_VDEV_RESTART_REQUEST_CMDID, | ||
297 | .vdev_up_cmdid = WMI_10_2_VDEV_UP_CMDID, | ||
298 | .vdev_stop_cmdid = WMI_10_2_VDEV_STOP_CMDID, | ||
299 | .vdev_down_cmdid = WMI_10_2_VDEV_DOWN_CMDID, | ||
300 | .vdev_set_param_cmdid = WMI_10_2_VDEV_SET_PARAM_CMDID, | ||
301 | .vdev_install_key_cmdid = WMI_10_2_VDEV_INSTALL_KEY_CMDID, | ||
302 | .peer_create_cmdid = WMI_10_2_PEER_CREATE_CMDID, | ||
303 | .peer_delete_cmdid = WMI_10_2_PEER_DELETE_CMDID, | ||
304 | .peer_flush_tids_cmdid = WMI_10_2_PEER_FLUSH_TIDS_CMDID, | ||
305 | .peer_set_param_cmdid = WMI_10_2_PEER_SET_PARAM_CMDID, | ||
306 | .peer_assoc_cmdid = WMI_10_2_PEER_ASSOC_CMDID, | ||
307 | .peer_add_wds_entry_cmdid = WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID, | ||
308 | .peer_remove_wds_entry_cmdid = WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID, | ||
309 | .peer_mcast_group_cmdid = WMI_10_2_PEER_MCAST_GROUP_CMDID, | ||
310 | .bcn_tx_cmdid = WMI_10_2_BCN_TX_CMDID, | ||
311 | .pdev_send_bcn_cmdid = WMI_10_2_PDEV_SEND_BCN_CMDID, | ||
312 | .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED, | ||
313 | .bcn_filter_rx_cmdid = WMI_10_2_BCN_FILTER_RX_CMDID, | ||
314 | .prb_req_filter_rx_cmdid = WMI_10_2_PRB_REQ_FILTER_RX_CMDID, | ||
315 | .mgmt_tx_cmdid = WMI_10_2_MGMT_TX_CMDID, | ||
316 | .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED, | ||
317 | .addba_clear_resp_cmdid = WMI_10_2_ADDBA_CLEAR_RESP_CMDID, | ||
318 | .addba_send_cmdid = WMI_10_2_ADDBA_SEND_CMDID, | ||
319 | .addba_status_cmdid = WMI_10_2_ADDBA_STATUS_CMDID, | ||
320 | .delba_send_cmdid = WMI_10_2_DELBA_SEND_CMDID, | ||
321 | .addba_set_resp_cmdid = WMI_10_2_ADDBA_SET_RESP_CMDID, | ||
322 | .send_singleamsdu_cmdid = WMI_10_2_SEND_SINGLEAMSDU_CMDID, | ||
323 | .sta_powersave_mode_cmdid = WMI_10_2_STA_POWERSAVE_MODE_CMDID, | ||
324 | .sta_powersave_param_cmdid = WMI_10_2_STA_POWERSAVE_PARAM_CMDID, | ||
325 | .sta_mimo_ps_mode_cmdid = WMI_10_2_STA_MIMO_PS_MODE_CMDID, | ||
326 | .pdev_dfs_enable_cmdid = WMI_10_2_PDEV_DFS_ENABLE_CMDID, | ||
327 | .pdev_dfs_disable_cmdid = WMI_10_2_PDEV_DFS_DISABLE_CMDID, | ||
328 | .roam_scan_mode = WMI_10_2_ROAM_SCAN_MODE, | ||
329 | .roam_scan_rssi_threshold = WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD, | ||
330 | .roam_scan_period = WMI_10_2_ROAM_SCAN_PERIOD, | ||
331 | .roam_scan_rssi_change_threshold = | ||
332 | WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, | ||
333 | .roam_ap_profile = WMI_10_2_ROAM_AP_PROFILE, | ||
334 | .ofl_scan_add_ap_profile = WMI_10_2_OFL_SCAN_ADD_AP_PROFILE, | ||
335 | .ofl_scan_remove_ap_profile = WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE, | ||
336 | .ofl_scan_period = WMI_10_2_OFL_SCAN_PERIOD, | ||
337 | .p2p_dev_set_device_info = WMI_10_2_P2P_DEV_SET_DEVICE_INFO, | ||
338 | .p2p_dev_set_discoverability = WMI_10_2_P2P_DEV_SET_DISCOVERABILITY, | ||
339 | .p2p_go_set_beacon_ie = WMI_10_2_P2P_GO_SET_BEACON_IE, | ||
340 | .p2p_go_set_probe_resp_ie = WMI_10_2_P2P_GO_SET_PROBE_RESP_IE, | ||
341 | .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED, | ||
342 | .ap_ps_peer_param_cmdid = WMI_10_2_AP_PS_PEER_PARAM_CMDID, | ||
343 | .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED, | ||
344 | .peer_rate_retry_sched_cmdid = WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID, | ||
345 | .wlan_profile_trigger_cmdid = WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID, | ||
346 | .wlan_profile_set_hist_intvl_cmdid = | ||
347 | WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID, | ||
348 | .wlan_profile_get_profile_data_cmdid = | ||
349 | WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, | ||
350 | .wlan_profile_enable_profile_id_cmdid = | ||
351 | WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, | ||
352 | .wlan_profile_list_profile_id_cmdid = | ||
353 | WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, | ||
354 | .pdev_suspend_cmdid = WMI_10_2_PDEV_SUSPEND_CMDID, | ||
355 | .pdev_resume_cmdid = WMI_10_2_PDEV_RESUME_CMDID, | ||
356 | .add_bcn_filter_cmdid = WMI_10_2_ADD_BCN_FILTER_CMDID, | ||
357 | .rmv_bcn_filter_cmdid = WMI_10_2_RMV_BCN_FILTER_CMDID, | ||
358 | .wow_add_wake_pattern_cmdid = WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID, | ||
359 | .wow_del_wake_pattern_cmdid = WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID, | ||
360 | .wow_enable_disable_wake_event_cmdid = | ||
361 | WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, | ||
362 | .wow_enable_cmdid = WMI_10_2_WOW_ENABLE_CMDID, | ||
363 | .wow_hostwakeup_from_sleep_cmdid = | ||
364 | WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, | ||
365 | .rtt_measreq_cmdid = WMI_10_2_RTT_MEASREQ_CMDID, | ||
366 | .rtt_tsf_cmdid = WMI_10_2_RTT_TSF_CMDID, | ||
367 | .vdev_spectral_scan_configure_cmdid = | ||
368 | WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, | ||
369 | .vdev_spectral_scan_enable_cmdid = | ||
370 | WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, | ||
371 | .request_stats_cmdid = WMI_10_2_REQUEST_STATS_CMDID, | ||
372 | .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED, | ||
373 | .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED, | ||
374 | .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED, | ||
375 | .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED, | ||
376 | .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED, | ||
377 | .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED, | ||
378 | .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED, | ||
379 | .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED, | ||
380 | .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED, | ||
381 | .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED, | ||
382 | .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED, | ||
383 | .echo_cmdid = WMI_10_2_ECHO_CMDID, | ||
384 | .pdev_utf_cmdid = WMI_10_2_PDEV_UTF_CMDID, | ||
385 | .dbglog_cfg_cmdid = WMI_10_2_DBGLOG_CFG_CMDID, | ||
386 | .pdev_qvit_cmdid = WMI_10_2_PDEV_QVIT_CMDID, | ||
387 | .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED, | ||
388 | .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED, | ||
389 | .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED, | ||
390 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, | ||
391 | .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID, | ||
392 | .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID, | ||
393 | .pdev_get_temperature_cmdid = WMI_10_2_PDEV_GET_TEMPERATURE_CMDID, | ||
268 | }; | 394 | }; |
269 | 395 | ||
270 | /* MAIN WMI VDEV param map */ | 396 | /* MAIN WMI VDEV param map */ |
@@ -385,6 +511,64 @@ static struct wmi_vdev_param_map wmi_10x_vdev_param_map = { | |||
385 | WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, | 511 | WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, |
386 | }; | 512 | }; |
387 | 513 | ||
514 | static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = { | ||
515 | .rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD, | ||
516 | .fragmentation_threshold = WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD, | ||
517 | .beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL, | ||
518 | .listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL, | ||
519 | .multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE, | ||
520 | .mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE, | ||
521 | .slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME, | ||
522 | .preamble = WMI_10X_VDEV_PARAM_PREAMBLE, | ||
523 | .swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME, | ||
524 | .wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD, | ||
525 | .wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME, | ||
526 | .wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL, | ||
527 | .dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD, | ||
528 | .wmi_vdev_oc_scheduler_air_time_limit = | ||
529 | WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, | ||
530 | .wds = WMI_10X_VDEV_PARAM_WDS, | ||
531 | .atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW, | ||
532 | .bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX, | ||
533 | .bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, | ||
534 | .bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, | ||
535 | .feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM, | ||
536 | .chwidth = WMI_10X_VDEV_PARAM_CHWIDTH, | ||
537 | .chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET, | ||
538 | .disable_htprotection = WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION, | ||
539 | .sta_quickkickout = WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT, | ||
540 | .mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE, | ||
541 | .protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE, | ||
542 | .fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE, | ||
543 | .sgi = WMI_10X_VDEV_PARAM_SGI, | ||
544 | .ldpc = WMI_10X_VDEV_PARAM_LDPC, | ||
545 | .tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC, | ||
546 | .rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC, | ||
547 | .intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD, | ||
548 | .def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID, | ||
549 | .nss = WMI_10X_VDEV_PARAM_NSS, | ||
550 | .bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE, | ||
551 | .mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE, | ||
552 | .mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE, | ||
553 | .dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE, | ||
554 | .unknown_dest_indicate = WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE, | ||
555 | .ap_keepalive_min_idle_inactive_time_secs = | ||
556 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, | ||
557 | .ap_keepalive_max_idle_inactive_time_secs = | ||
558 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, | ||
559 | .ap_keepalive_max_unresponsive_time_secs = | ||
560 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, | ||
561 | .ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS, | ||
562 | .mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET, | ||
563 | .enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS, | ||
564 | .txbf = WMI_VDEV_PARAM_UNSUPPORTED, | ||
565 | .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED, | ||
566 | .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED, | ||
567 | .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED, | ||
568 | .ap_detect_out_of_sync_sleeping_sta_time_secs = | ||
569 | WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, | ||
570 | }; | ||
571 | |||
388 | static struct wmi_pdev_param_map wmi_pdev_param_map = { | 572 | static struct wmi_pdev_param_map wmi_pdev_param_map = { |
389 | .tx_chain_mask = WMI_PDEV_PARAM_TX_CHAIN_MASK, | 573 | .tx_chain_mask = WMI_PDEV_PARAM_TX_CHAIN_MASK, |
390 | .rx_chain_mask = WMI_PDEV_PARAM_RX_CHAIN_MASK, | 574 | .rx_chain_mask = WMI_PDEV_PARAM_RX_CHAIN_MASK, |
@@ -434,6 +618,7 @@ static struct wmi_pdev_param_map wmi_pdev_param_map = { | |||
434 | .fast_channel_reset = WMI_PDEV_PARAM_UNSUPPORTED, | 618 | .fast_channel_reset = WMI_PDEV_PARAM_UNSUPPORTED, |
435 | .burst_dur = WMI_PDEV_PARAM_UNSUPPORTED, | 619 | .burst_dur = WMI_PDEV_PARAM_UNSUPPORTED, |
436 | .burst_enable = WMI_PDEV_PARAM_UNSUPPORTED, | 620 | .burst_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
621 | .cal_period = WMI_PDEV_PARAM_UNSUPPORTED, | ||
437 | }; | 622 | }; |
438 | 623 | ||
439 | static struct wmi_pdev_param_map wmi_10x_pdev_param_map = { | 624 | static struct wmi_pdev_param_map wmi_10x_pdev_param_map = { |
@@ -486,6 +671,60 @@ static struct wmi_pdev_param_map wmi_10x_pdev_param_map = { | |||
486 | .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET, | 671 | .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET, |
487 | .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR, | 672 | .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR, |
488 | .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE, | 673 | .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE, |
674 | .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD, | ||
675 | }; | ||
676 | |||
677 | static struct wmi_pdev_param_map wmi_10_2_4_pdev_param_map = { | ||
678 | .tx_chain_mask = WMI_10X_PDEV_PARAM_TX_CHAIN_MASK, | ||
679 | .rx_chain_mask = WMI_10X_PDEV_PARAM_RX_CHAIN_MASK, | ||
680 | .txpower_limit2g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G, | ||
681 | .txpower_limit5g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G, | ||
682 | .txpower_scale = WMI_10X_PDEV_PARAM_TXPOWER_SCALE, | ||
683 | .beacon_gen_mode = WMI_10X_PDEV_PARAM_BEACON_GEN_MODE, | ||
684 | .beacon_tx_mode = WMI_10X_PDEV_PARAM_BEACON_TX_MODE, | ||
685 | .resmgr_offchan_mode = WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE, | ||
686 | .protection_mode = WMI_10X_PDEV_PARAM_PROTECTION_MODE, | ||
687 | .dynamic_bw = WMI_10X_PDEV_PARAM_DYNAMIC_BW, | ||
688 | .non_agg_sw_retry_th = WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH, | ||
689 | .agg_sw_retry_th = WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH, | ||
690 | .sta_kickout_th = WMI_10X_PDEV_PARAM_STA_KICKOUT_TH, | ||
691 | .ac_aggrsize_scaling = WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING, | ||
692 | .ltr_enable = WMI_10X_PDEV_PARAM_LTR_ENABLE, | ||
693 | .ltr_ac_latency_be = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE, | ||
694 | .ltr_ac_latency_bk = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK, | ||
695 | .ltr_ac_latency_vi = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI, | ||
696 | .ltr_ac_latency_vo = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO, | ||
697 | .ltr_ac_latency_timeout = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, | ||
698 | .ltr_sleep_override = WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE, | ||
699 | .ltr_rx_override = WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE, | ||
700 | .ltr_tx_activity_timeout = WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, | ||
701 | .l1ss_enable = WMI_10X_PDEV_PARAM_L1SS_ENABLE, | ||
702 | .dsleep_enable = WMI_10X_PDEV_PARAM_DSLEEP_ENABLE, | ||
703 | .pcielp_txbuf_flush = WMI_PDEV_PARAM_UNSUPPORTED, | ||
704 | .pcielp_txbuf_watermark = WMI_PDEV_PARAM_UNSUPPORTED, | ||
705 | .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_UNSUPPORTED, | ||
706 | .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_UNSUPPORTED, | ||
707 | .pdev_stats_update_period = WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, | ||
708 | .vdev_stats_update_period = WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, | ||
709 | .peer_stats_update_period = WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, | ||
710 | .bcnflt_stats_update_period = | ||
711 | WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, | ||
712 | .pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS, | ||
713 | .arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE, | ||
714 | .dcs = WMI_10X_PDEV_PARAM_DCS, | ||
715 | .ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE, | ||
716 | .ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD, | ||
717 | .ani_listen_period = WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD, | ||
718 | .ani_ofdm_level = WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL, | ||
719 | .ani_cck_level = WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL, | ||
720 | .dyntxchain = WMI_10X_PDEV_PARAM_DYNTXCHAIN, | ||
721 | .proxy_sta = WMI_PDEV_PARAM_UNSUPPORTED, | ||
722 | .idle_ps_config = WMI_PDEV_PARAM_UNSUPPORTED, | ||
723 | .power_gating_sleep = WMI_PDEV_PARAM_UNSUPPORTED, | ||
724 | .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET, | ||
725 | .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR, | ||
726 | .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE, | ||
727 | .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD, | ||
489 | }; | 728 | }; |
490 | 729 | ||
491 | /* firmware 10.2 specific mappings */ | 730 | /* firmware 10.2 specific mappings */ |
@@ -607,11 +846,11 @@ static struct wmi_cmd_map wmi_10_2_cmd_map = { | |||
607 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, | 846 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, |
608 | .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID, | 847 | .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID, |
609 | .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID, | 848 | .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID, |
849 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, | ||
610 | }; | 850 | }; |
611 | 851 | ||
612 | static void | 852 | void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, |
613 | ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, | 853 | const struct wmi_channel_arg *arg) |
614 | const struct wmi_channel_arg *arg) | ||
615 | { | 854 | { |
616 | u32 flags = 0; | 855 | u32 flags = 0; |
617 | 856 | ||
@@ -685,8 +924,8 @@ static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) | |||
685 | dev_kfree_skb(skb); | 924 | dev_kfree_skb(skb); |
686 | } | 925 | } |
687 | 926 | ||
688 | static int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb, | 927 | int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb, |
689 | u32 cmd_id) | 928 | u32 cmd_id) |
690 | { | 929 | { |
691 | struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); | 930 | struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); |
692 | struct wmi_cmd_hdr *cmd_hdr; | 931 | struct wmi_cmd_hdr *cmd_hdr; |
@@ -792,24 +1031,23 @@ int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id) | |||
792 | return ret; | 1031 | return ret; |
793 | } | 1032 | } |
794 | 1033 | ||
795 | int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb) | 1034 | static struct sk_buff * |
1035 | ath10k_wmi_op_gen_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) | ||
796 | { | 1036 | { |
797 | int ret = 0; | ||
798 | struct wmi_mgmt_tx_cmd *cmd; | 1037 | struct wmi_mgmt_tx_cmd *cmd; |
799 | struct ieee80211_hdr *hdr; | 1038 | struct ieee80211_hdr *hdr; |
800 | struct sk_buff *wmi_skb; | 1039 | struct sk_buff *skb; |
801 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
802 | int len; | 1040 | int len; |
803 | u32 buf_len = skb->len; | 1041 | u32 buf_len = msdu->len; |
804 | u16 fc; | 1042 | u16 fc; |
805 | 1043 | ||
806 | hdr = (struct ieee80211_hdr *)skb->data; | 1044 | hdr = (struct ieee80211_hdr *)msdu->data; |
807 | fc = le16_to_cpu(hdr->frame_control); | 1045 | fc = le16_to_cpu(hdr->frame_control); |
808 | 1046 | ||
809 | if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control))) | 1047 | if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control))) |
810 | return -EINVAL; | 1048 | return ERR_PTR(-EINVAL); |
811 | 1049 | ||
812 | len = sizeof(cmd->hdr) + skb->len; | 1050 | len = sizeof(cmd->hdr) + msdu->len; |
813 | 1051 | ||
814 | if ((ieee80211_is_action(hdr->frame_control) || | 1052 | if ((ieee80211_is_action(hdr->frame_control) || |
815 | ieee80211_is_deauth(hdr->frame_control) || | 1053 | ieee80211_is_deauth(hdr->frame_control) || |
@@ -821,36 +1059,27 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb) | |||
821 | 1059 | ||
822 | len = round_up(len, 4); | 1060 | len = round_up(len, 4); |
823 | 1061 | ||
824 | wmi_skb = ath10k_wmi_alloc_skb(ar, len); | 1062 | skb = ath10k_wmi_alloc_skb(ar, len); |
825 | if (!wmi_skb) | 1063 | if (!skb) |
826 | return -ENOMEM; | 1064 | return ERR_PTR(-ENOMEM); |
827 | 1065 | ||
828 | cmd = (struct wmi_mgmt_tx_cmd *)wmi_skb->data; | 1066 | cmd = (struct wmi_mgmt_tx_cmd *)skb->data; |
829 | 1067 | ||
830 | cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(skb)->vdev_id); | 1068 | cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(msdu)->vdev_id); |
831 | cmd->hdr.tx_rate = 0; | 1069 | cmd->hdr.tx_rate = 0; |
832 | cmd->hdr.tx_power = 0; | 1070 | cmd->hdr.tx_power = 0; |
833 | cmd->hdr.buf_len = __cpu_to_le32(buf_len); | 1071 | cmd->hdr.buf_len = __cpu_to_le32(buf_len); |
834 | 1072 | ||
835 | ether_addr_copy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr)); | 1073 | ether_addr_copy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr)); |
836 | memcpy(cmd->buf, skb->data, skb->len); | 1074 | memcpy(cmd->buf, msdu->data, msdu->len); |
837 | 1075 | ||
838 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %p len %d ftype %02x stype %02x\n", | 1076 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %p len %d ftype %02x stype %02x\n", |
839 | wmi_skb, wmi_skb->len, fc & IEEE80211_FCTL_FTYPE, | 1077 | msdu, skb->len, fc & IEEE80211_FCTL_FTYPE, |
840 | fc & IEEE80211_FCTL_STYPE); | 1078 | fc & IEEE80211_FCTL_STYPE); |
841 | trace_ath10k_tx_hdr(ar, skb->data, skb->len); | 1079 | trace_ath10k_tx_hdr(ar, skb->data, skb->len); |
842 | trace_ath10k_tx_payload(ar, skb->data, skb->len); | 1080 | trace_ath10k_tx_payload(ar, skb->data, skb->len); |
843 | 1081 | ||
844 | /* Send the management frame buffer to the target */ | 1082 | return skb; |
845 | ret = ath10k_wmi_cmd_send(ar, wmi_skb, ar->wmi.cmd->mgmt_tx_cmdid); | ||
846 | if (ret) | ||
847 | return ret; | ||
848 | |||
849 | /* TODO: report tx status to mac80211 - temporary just ACK */ | ||
850 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
851 | ieee80211_tx_status_irqsafe(ar->hw, skb); | ||
852 | |||
853 | return ret; | ||
854 | } | 1083 | } |
855 | 1084 | ||
856 | static void ath10k_wmi_event_scan_started(struct ath10k *ar) | 1085 | static void ath10k_wmi_event_scan_started(struct ath10k *ar) |
@@ -977,22 +1206,48 @@ ath10k_wmi_event_scan_type_str(enum wmi_scan_event_type type, | |||
977 | } | 1206 | } |
978 | } | 1207 | } |
979 | 1208 | ||
980 | static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb) | 1209 | static int ath10k_wmi_op_pull_scan_ev(struct ath10k *ar, struct sk_buff *skb, |
1210 | struct wmi_scan_ev_arg *arg) | ||
981 | { | 1211 | { |
982 | struct wmi_scan_event *event = (struct wmi_scan_event *)skb->data; | 1212 | struct wmi_scan_event *ev = (void *)skb->data; |
1213 | |||
1214 | if (skb->len < sizeof(*ev)) | ||
1215 | return -EPROTO; | ||
1216 | |||
1217 | skb_pull(skb, sizeof(*ev)); | ||
1218 | arg->event_type = ev->event_type; | ||
1219 | arg->reason = ev->reason; | ||
1220 | arg->channel_freq = ev->channel_freq; | ||
1221 | arg->scan_req_id = ev->scan_req_id; | ||
1222 | arg->scan_id = ev->scan_id; | ||
1223 | arg->vdev_id = ev->vdev_id; | ||
1224 | |||
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1228 | int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb) | ||
1229 | { | ||
1230 | struct wmi_scan_ev_arg arg = {}; | ||
983 | enum wmi_scan_event_type event_type; | 1231 | enum wmi_scan_event_type event_type; |
984 | enum wmi_scan_completion_reason reason; | 1232 | enum wmi_scan_completion_reason reason; |
985 | u32 freq; | 1233 | u32 freq; |
986 | u32 req_id; | 1234 | u32 req_id; |
987 | u32 scan_id; | 1235 | u32 scan_id; |
988 | u32 vdev_id; | 1236 | u32 vdev_id; |
1237 | int ret; | ||
989 | 1238 | ||
990 | event_type = __le32_to_cpu(event->event_type); | 1239 | ret = ath10k_wmi_pull_scan(ar, skb, &arg); |
991 | reason = __le32_to_cpu(event->reason); | 1240 | if (ret) { |
992 | freq = __le32_to_cpu(event->channel_freq); | 1241 | ath10k_warn(ar, "failed to parse scan event: %d\n", ret); |
993 | req_id = __le32_to_cpu(event->scan_req_id); | 1242 | return ret; |
994 | scan_id = __le32_to_cpu(event->scan_id); | 1243 | } |
995 | vdev_id = __le32_to_cpu(event->vdev_id); | 1244 | |
1245 | event_type = __le32_to_cpu(arg.event_type); | ||
1246 | reason = __le32_to_cpu(arg.reason); | ||
1247 | freq = __le32_to_cpu(arg.channel_freq); | ||
1248 | req_id = __le32_to_cpu(arg.scan_req_id); | ||
1249 | scan_id = __le32_to_cpu(arg.scan_id); | ||
1250 | vdev_id = __le32_to_cpu(arg.vdev_id); | ||
996 | 1251 | ||
997 | spin_lock_bh(&ar->data_lock); | 1252 | spin_lock_bh(&ar->data_lock); |
998 | 1253 | ||
@@ -1147,11 +1402,51 @@ static void ath10k_wmi_handle_wep_reauth(struct ath10k *ar, | |||
1147 | } | 1402 | } |
1148 | } | 1403 | } |
1149 | 1404 | ||
1150 | static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | 1405 | static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb, |
1406 | struct wmi_mgmt_rx_ev_arg *arg) | ||
1151 | { | 1407 | { |
1152 | struct wmi_mgmt_rx_event_v1 *ev_v1; | 1408 | struct wmi_mgmt_rx_event_v1 *ev_v1; |
1153 | struct wmi_mgmt_rx_event_v2 *ev_v2; | 1409 | struct wmi_mgmt_rx_event_v2 *ev_v2; |
1154 | struct wmi_mgmt_rx_hdr_v1 *ev_hdr; | 1410 | struct wmi_mgmt_rx_hdr_v1 *ev_hdr; |
1411 | size_t pull_len; | ||
1412 | u32 msdu_len; | ||
1413 | |||
1414 | if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar->fw_features)) { | ||
1415 | ev_v2 = (struct wmi_mgmt_rx_event_v2 *)skb->data; | ||
1416 | ev_hdr = &ev_v2->hdr.v1; | ||
1417 | pull_len = sizeof(*ev_v2); | ||
1418 | } else { | ||
1419 | ev_v1 = (struct wmi_mgmt_rx_event_v1 *)skb->data; | ||
1420 | ev_hdr = &ev_v1->hdr; | ||
1421 | pull_len = sizeof(*ev_v1); | ||
1422 | } | ||
1423 | |||
1424 | if (skb->len < pull_len) | ||
1425 | return -EPROTO; | ||
1426 | |||
1427 | skb_pull(skb, pull_len); | ||
1428 | arg->channel = ev_hdr->channel; | ||
1429 | arg->buf_len = ev_hdr->buf_len; | ||
1430 | arg->status = ev_hdr->status; | ||
1431 | arg->snr = ev_hdr->snr; | ||
1432 | arg->phy_mode = ev_hdr->phy_mode; | ||
1433 | arg->rate = ev_hdr->rate; | ||
1434 | |||
1435 | msdu_len = __le32_to_cpu(arg->buf_len); | ||
1436 | if (skb->len < msdu_len) | ||
1437 | return -EPROTO; | ||
1438 | |||
1439 | /* the WMI buffer might've ended up being padded to 4 bytes due to HTC | ||
1440 | * trailer with credit update. Trim the excess garbage. | ||
1441 | */ | ||
1442 | skb_trim(skb, msdu_len); | ||
1443 | |||
1444 | return 0; | ||
1445 | } | ||
1446 | |||
1447 | int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | ||
1448 | { | ||
1449 | struct wmi_mgmt_rx_ev_arg arg = {}; | ||
1155 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 1450 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
1156 | struct ieee80211_hdr *hdr; | 1451 | struct ieee80211_hdr *hdr; |
1157 | u32 rx_status; | 1452 | u32 rx_status; |
@@ -1161,24 +1456,20 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | |||
1161 | u32 rate; | 1456 | u32 rate; |
1162 | u32 buf_len; | 1457 | u32 buf_len; |
1163 | u16 fc; | 1458 | u16 fc; |
1164 | int pull_len; | 1459 | int ret; |
1165 | 1460 | ||
1166 | if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar->fw_features)) { | 1461 | ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg); |
1167 | ev_v2 = (struct wmi_mgmt_rx_event_v2 *)skb->data; | 1462 | if (ret) { |
1168 | ev_hdr = &ev_v2->hdr.v1; | 1463 | ath10k_warn(ar, "failed to parse mgmt rx event: %d\n", ret); |
1169 | pull_len = sizeof(*ev_v2); | 1464 | return ret; |
1170 | } else { | ||
1171 | ev_v1 = (struct wmi_mgmt_rx_event_v1 *)skb->data; | ||
1172 | ev_hdr = &ev_v1->hdr; | ||
1173 | pull_len = sizeof(*ev_v1); | ||
1174 | } | 1465 | } |
1175 | 1466 | ||
1176 | channel = __le32_to_cpu(ev_hdr->channel); | 1467 | channel = __le32_to_cpu(arg.channel); |
1177 | buf_len = __le32_to_cpu(ev_hdr->buf_len); | 1468 | buf_len = __le32_to_cpu(arg.buf_len); |
1178 | rx_status = __le32_to_cpu(ev_hdr->status); | 1469 | rx_status = __le32_to_cpu(arg.status); |
1179 | snr = __le32_to_cpu(ev_hdr->snr); | 1470 | snr = __le32_to_cpu(arg.snr); |
1180 | phy_mode = __le32_to_cpu(ev_hdr->phy_mode); | 1471 | phy_mode = __le32_to_cpu(arg.phy_mode); |
1181 | rate = __le32_to_cpu(ev_hdr->rate); | 1472 | rate = __le32_to_cpu(arg.rate); |
1182 | 1473 | ||
1183 | memset(status, 0, sizeof(*status)); | 1474 | memset(status, 0, sizeof(*status)); |
1184 | 1475 | ||
@@ -1232,8 +1523,6 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | |||
1232 | status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR; | 1523 | status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR; |
1233 | status->rate_idx = get_rate_idx(rate, status->band); | 1524 | status->rate_idx = get_rate_idx(rate, status->band); |
1234 | 1525 | ||
1235 | skb_pull(skb, pull_len); | ||
1236 | |||
1237 | hdr = (struct ieee80211_hdr *)skb->data; | 1526 | hdr = (struct ieee80211_hdr *)skb->data; |
1238 | fc = le16_to_cpu(hdr->frame_control); | 1527 | fc = le16_to_cpu(hdr->frame_control); |
1239 | 1528 | ||
@@ -1266,12 +1555,6 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | |||
1266 | status->freq, status->band, status->signal, | 1555 | status->freq, status->band, status->signal, |
1267 | status->rate_idx); | 1556 | status->rate_idx); |
1268 | 1557 | ||
1269 | /* | ||
1270 | * packets from HTC come aligned to 4byte boundaries | ||
1271 | * because they can originally come in along with a trailer | ||
1272 | */ | ||
1273 | skb_trim(skb, buf_len); | ||
1274 | |||
1275 | ieee80211_rx(ar->hw, skb); | 1558 | ieee80211_rx(ar->hw, skb); |
1276 | return 0; | 1559 | return 0; |
1277 | } | 1560 | } |
@@ -1295,21 +1578,44 @@ exit: | |||
1295 | return idx; | 1578 | return idx; |
1296 | } | 1579 | } |
1297 | 1580 | ||
1298 | static void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) | 1581 | static int ath10k_wmi_op_pull_ch_info_ev(struct ath10k *ar, struct sk_buff *skb, |
1582 | struct wmi_ch_info_ev_arg *arg) | ||
1299 | { | 1583 | { |
1300 | struct wmi_chan_info_event *ev; | 1584 | struct wmi_chan_info_event *ev = (void *)skb->data; |
1585 | |||
1586 | if (skb->len < sizeof(*ev)) | ||
1587 | return -EPROTO; | ||
1588 | |||
1589 | skb_pull(skb, sizeof(*ev)); | ||
1590 | arg->err_code = ev->err_code; | ||
1591 | arg->freq = ev->freq; | ||
1592 | arg->cmd_flags = ev->cmd_flags; | ||
1593 | arg->noise_floor = ev->noise_floor; | ||
1594 | arg->rx_clear_count = ev->rx_clear_count; | ||
1595 | arg->cycle_count = ev->cycle_count; | ||
1596 | |||
1597 | return 0; | ||
1598 | } | ||
1599 | |||
1600 | void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) | ||
1601 | { | ||
1602 | struct wmi_ch_info_ev_arg arg = {}; | ||
1301 | struct survey_info *survey; | 1603 | struct survey_info *survey; |
1302 | u32 err_code, freq, cmd_flags, noise_floor, rx_clear_count, cycle_count; | 1604 | u32 err_code, freq, cmd_flags, noise_floor, rx_clear_count, cycle_count; |
1303 | int idx; | 1605 | int idx, ret; |
1304 | 1606 | ||
1305 | ev = (struct wmi_chan_info_event *)skb->data; | 1607 | ret = ath10k_wmi_pull_ch_info(ar, skb, &arg); |
1608 | if (ret) { | ||
1609 | ath10k_warn(ar, "failed to parse chan info event: %d\n", ret); | ||
1610 | return; | ||
1611 | } | ||
1306 | 1612 | ||
1307 | err_code = __le32_to_cpu(ev->err_code); | 1613 | err_code = __le32_to_cpu(arg.err_code); |
1308 | freq = __le32_to_cpu(ev->freq); | 1614 | freq = __le32_to_cpu(arg.freq); |
1309 | cmd_flags = __le32_to_cpu(ev->cmd_flags); | 1615 | cmd_flags = __le32_to_cpu(arg.cmd_flags); |
1310 | noise_floor = __le32_to_cpu(ev->noise_floor); | 1616 | noise_floor = __le32_to_cpu(arg.noise_floor); |
1311 | rx_clear_count = __le32_to_cpu(ev->rx_clear_count); | 1617 | rx_clear_count = __le32_to_cpu(arg.rx_clear_count); |
1312 | cycle_count = __le32_to_cpu(ev->cycle_count); | 1618 | cycle_count = __le32_to_cpu(arg.cycle_count); |
1313 | 1619 | ||
1314 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 1620 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
1315 | "chan info err_code %d freq %d cmd_flags %d noise_floor %d rx_clear_count %d cycle_count %d\n", | 1621 | "chan info err_code %d freq %d cmd_flags %d noise_floor %d rx_clear_count %d cycle_count %d\n", |
@@ -1359,12 +1665,12 @@ exit: | |||
1359 | spin_unlock_bh(&ar->data_lock); | 1665 | spin_unlock_bh(&ar->data_lock); |
1360 | } | 1666 | } |
1361 | 1667 | ||
1362 | static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb) | 1668 | void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb) |
1363 | { | 1669 | { |
1364 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ECHO_EVENTID\n"); | 1670 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ECHO_EVENTID\n"); |
1365 | } | 1671 | } |
1366 | 1672 | ||
1367 | static int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb) | 1673 | int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb) |
1368 | { | 1674 | { |
1369 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event debug mesg len %d\n", | 1675 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event debug mesg len %d\n", |
1370 | skb->len); | 1676 | skb->len); |
@@ -1374,8 +1680,8 @@ static int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb) | |||
1374 | return 0; | 1680 | return 0; |
1375 | } | 1681 | } |
1376 | 1682 | ||
1377 | static void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src, | 1683 | void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src, |
1378 | struct ath10k_fw_stats_pdev *dst) | 1684 | struct ath10k_fw_stats_pdev *dst) |
1379 | { | 1685 | { |
1380 | const struct wal_dbg_tx_stats *tx = &src->wal.tx; | 1686 | const struct wal_dbg_tx_stats *tx = &src->wal.tx; |
1381 | const struct wal_dbg_rx_stats *rx = &src->wal.rx; | 1687 | const struct wal_dbg_rx_stats *rx = &src->wal.rx; |
@@ -1427,17 +1733,17 @@ static void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src, | |||
1427 | dst->mpdu_errs = __le32_to_cpu(rx->mpdu_errs); | 1733 | dst->mpdu_errs = __le32_to_cpu(rx->mpdu_errs); |
1428 | } | 1734 | } |
1429 | 1735 | ||
1430 | static void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src, | 1736 | void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src, |
1431 | struct ath10k_fw_stats_peer *dst) | 1737 | struct ath10k_fw_stats_peer *dst) |
1432 | { | 1738 | { |
1433 | ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr); | 1739 | ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr); |
1434 | dst->peer_rssi = __le32_to_cpu(src->peer_rssi); | 1740 | dst->peer_rssi = __le32_to_cpu(src->peer_rssi); |
1435 | dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate); | 1741 | dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate); |
1436 | } | 1742 | } |
1437 | 1743 | ||
1438 | static int ath10k_wmi_main_pull_fw_stats(struct ath10k *ar, | 1744 | static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar, |
1439 | struct sk_buff *skb, | 1745 | struct sk_buff *skb, |
1440 | struct ath10k_fw_stats *stats) | 1746 | struct ath10k_fw_stats *stats) |
1441 | { | 1747 | { |
1442 | const struct wmi_stats_event *ev = (void *)skb->data; | 1748 | const struct wmi_stats_event *ev = (void *)skb->data; |
1443 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; | 1749 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; |
@@ -1487,9 +1793,9 @@ static int ath10k_wmi_main_pull_fw_stats(struct ath10k *ar, | |||
1487 | return 0; | 1793 | return 0; |
1488 | } | 1794 | } |
1489 | 1795 | ||
1490 | static int ath10k_wmi_10x_pull_fw_stats(struct ath10k *ar, | 1796 | static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar, |
1491 | struct sk_buff *skb, | 1797 | struct sk_buff *skb, |
1492 | struct ath10k_fw_stats *stats) | 1798 | struct ath10k_fw_stats *stats) |
1493 | { | 1799 | { |
1494 | const struct wmi_stats_event *ev = (void *)skb->data; | 1800 | const struct wmi_stats_event *ev = (void *)skb->data; |
1495 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; | 1801 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; |
@@ -1550,61 +1856,92 @@ static int ath10k_wmi_10x_pull_fw_stats(struct ath10k *ar, | |||
1550 | return 0; | 1856 | return 0; |
1551 | } | 1857 | } |
1552 | 1858 | ||
1553 | int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, | 1859 | void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb) |
1554 | struct ath10k_fw_stats *stats) | ||
1555 | { | 1860 | { |
1556 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) | 1861 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_UPDATE_STATS_EVENTID\n"); |
1557 | return ath10k_wmi_10x_pull_fw_stats(ar, skb, stats); | 1862 | ath10k_debug_fw_stats_process(ar, skb); |
1558 | else | ||
1559 | return ath10k_wmi_main_pull_fw_stats(ar, skb, stats); | ||
1560 | } | 1863 | } |
1561 | 1864 | ||
1562 | static void ath10k_wmi_event_update_stats(struct ath10k *ar, | 1865 | static int |
1563 | struct sk_buff *skb) | 1866 | ath10k_wmi_op_pull_vdev_start_ev(struct ath10k *ar, struct sk_buff *skb, |
1867 | struct wmi_vdev_start_ev_arg *arg) | ||
1564 | { | 1868 | { |
1565 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_UPDATE_STATS_EVENTID\n"); | 1869 | struct wmi_vdev_start_response_event *ev = (void *)skb->data; |
1566 | ath10k_debug_fw_stats_process(ar, skb); | 1870 | |
1871 | if (skb->len < sizeof(*ev)) | ||
1872 | return -EPROTO; | ||
1873 | |||
1874 | skb_pull(skb, sizeof(*ev)); | ||
1875 | arg->vdev_id = ev->vdev_id; | ||
1876 | arg->req_id = ev->req_id; | ||
1877 | arg->resp_type = ev->resp_type; | ||
1878 | arg->status = ev->status; | ||
1879 | |||
1880 | return 0; | ||
1567 | } | 1881 | } |
1568 | 1882 | ||
1569 | static void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, | 1883 | void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) |
1570 | struct sk_buff *skb) | ||
1571 | { | 1884 | { |
1572 | struct wmi_vdev_start_response_event *ev; | 1885 | struct wmi_vdev_start_ev_arg arg = {}; |
1886 | int ret; | ||
1573 | 1887 | ||
1574 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); | 1888 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); |
1575 | 1889 | ||
1576 | ev = (struct wmi_vdev_start_response_event *)skb->data; | 1890 | ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg); |
1891 | if (ret) { | ||
1892 | ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret); | ||
1893 | return; | ||
1894 | } | ||
1577 | 1895 | ||
1578 | if (WARN_ON(__le32_to_cpu(ev->status))) | 1896 | if (WARN_ON(__le32_to_cpu(arg.status))) |
1579 | return; | 1897 | return; |
1580 | 1898 | ||
1581 | complete(&ar->vdev_setup_done); | 1899 | complete(&ar->vdev_setup_done); |
1582 | } | 1900 | } |
1583 | 1901 | ||
1584 | static void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, | 1902 | void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb) |
1585 | struct sk_buff *skb) | ||
1586 | { | 1903 | { |
1587 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STOPPED_EVENTID\n"); | 1904 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STOPPED_EVENTID\n"); |
1588 | complete(&ar->vdev_setup_done); | 1905 | complete(&ar->vdev_setup_done); |
1589 | } | 1906 | } |
1590 | 1907 | ||
1591 | static void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, | 1908 | static int |
1592 | struct sk_buff *skb) | 1909 | ath10k_wmi_op_pull_peer_kick_ev(struct ath10k *ar, struct sk_buff *skb, |
1910 | struct wmi_peer_kick_ev_arg *arg) | ||
1593 | { | 1911 | { |
1594 | struct wmi_peer_sta_kickout_event *ev; | 1912 | struct wmi_peer_sta_kickout_event *ev = (void *)skb->data; |
1913 | |||
1914 | if (skb->len < sizeof(*ev)) | ||
1915 | return -EPROTO; | ||
1916 | |||
1917 | skb_pull(skb, sizeof(*ev)); | ||
1918 | arg->mac_addr = ev->peer_macaddr.addr; | ||
1919 | |||
1920 | return 0; | ||
1921 | } | ||
1922 | |||
1923 | void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb) | ||
1924 | { | ||
1925 | struct wmi_peer_kick_ev_arg arg = {}; | ||
1595 | struct ieee80211_sta *sta; | 1926 | struct ieee80211_sta *sta; |
1927 | int ret; | ||
1596 | 1928 | ||
1597 | ev = (struct wmi_peer_sta_kickout_event *)skb->data; | 1929 | ret = ath10k_wmi_pull_peer_kick(ar, skb, &arg); |
1930 | if (ret) { | ||
1931 | ath10k_warn(ar, "failed to parse peer kickout event: %d\n", | ||
1932 | ret); | ||
1933 | return; | ||
1934 | } | ||
1598 | 1935 | ||
1599 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n", | 1936 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n", |
1600 | ev->peer_macaddr.addr); | 1937 | arg.mac_addr); |
1601 | 1938 | ||
1602 | rcu_read_lock(); | 1939 | rcu_read_lock(); |
1603 | 1940 | ||
1604 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, ev->peer_macaddr.addr, NULL); | 1941 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, arg.mac_addr, NULL); |
1605 | if (!sta) { | 1942 | if (!sta) { |
1606 | ath10k_warn(ar, "Spurious quick kickout for STA %pM\n", | 1943 | ath10k_warn(ar, "Spurious quick kickout for STA %pM\n", |
1607 | ev->peer_macaddr.addr); | 1944 | arg.mac_addr); |
1608 | goto exit; | 1945 | goto exit; |
1609 | } | 1946 | } |
1610 | 1947 | ||
@@ -1641,7 +1978,7 @@ exit: | |||
1641 | static void ath10k_wmi_update_tim(struct ath10k *ar, | 1978 | static void ath10k_wmi_update_tim(struct ath10k *ar, |
1642 | struct ath10k_vif *arvif, | 1979 | struct ath10k_vif *arvif, |
1643 | struct sk_buff *bcn, | 1980 | struct sk_buff *bcn, |
1644 | struct wmi_bcn_info *bcn_info) | 1981 | const struct wmi_tim_info *tim_info) |
1645 | { | 1982 | { |
1646 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)bcn->data; | 1983 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)bcn->data; |
1647 | struct ieee80211_tim_ie *tim; | 1984 | struct ieee80211_tim_ie *tim; |
@@ -1652,14 +1989,14 @@ static void ath10k_wmi_update_tim(struct ath10k *ar, | |||
1652 | 1989 | ||
1653 | /* if next SWBA has no tim_changed the tim_bitmap is garbage. | 1990 | /* if next SWBA has no tim_changed the tim_bitmap is garbage. |
1654 | * we must copy the bitmap upon change and reuse it later */ | 1991 | * we must copy the bitmap upon change and reuse it later */ |
1655 | if (__le32_to_cpu(bcn_info->tim_info.tim_changed)) { | 1992 | if (__le32_to_cpu(tim_info->tim_changed)) { |
1656 | int i; | 1993 | int i; |
1657 | 1994 | ||
1658 | BUILD_BUG_ON(sizeof(arvif->u.ap.tim_bitmap) != | 1995 | BUILD_BUG_ON(sizeof(arvif->u.ap.tim_bitmap) != |
1659 | sizeof(bcn_info->tim_info.tim_bitmap)); | 1996 | sizeof(tim_info->tim_bitmap)); |
1660 | 1997 | ||
1661 | for (i = 0; i < sizeof(arvif->u.ap.tim_bitmap); i++) { | 1998 | for (i = 0; i < sizeof(arvif->u.ap.tim_bitmap); i++) { |
1662 | t = bcn_info->tim_info.tim_bitmap[i / 4]; | 1999 | t = tim_info->tim_bitmap[i / 4]; |
1663 | v = __le32_to_cpu(t); | 2000 | v = __le32_to_cpu(t); |
1664 | arvif->u.ap.tim_bitmap[i] = (v >> ((i % 4) * 8)) & 0xFF; | 2001 | arvif->u.ap.tim_bitmap[i] = (v >> ((i % 4) * 8)) & 0xFF; |
1665 | } | 2002 | } |
@@ -1711,13 +2048,13 @@ static void ath10k_wmi_update_tim(struct ath10k *ar, | |||
1711 | return; | 2048 | return; |
1712 | } | 2049 | } |
1713 | 2050 | ||
1714 | tim->bitmap_ctrl = !!__le32_to_cpu(bcn_info->tim_info.tim_mcast); | 2051 | tim->bitmap_ctrl = !!__le32_to_cpu(tim_info->tim_mcast); |
1715 | memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len); | 2052 | memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len); |
1716 | 2053 | ||
1717 | if (tim->dtim_count == 0) { | 2054 | if (tim->dtim_count == 0) { |
1718 | ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true; | 2055 | ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true; |
1719 | 2056 | ||
1720 | if (__le32_to_cpu(bcn_info->tim_info.tim_mcast) == 1) | 2057 | if (__le32_to_cpu(tim_info->tim_mcast) == 1) |
1721 | ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true; | 2058 | ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true; |
1722 | } | 2059 | } |
1723 | 2060 | ||
@@ -1727,7 +2064,7 @@ static void ath10k_wmi_update_tim(struct ath10k *ar, | |||
1727 | } | 2064 | } |
1728 | 2065 | ||
1729 | static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, | 2066 | static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, |
1730 | struct wmi_p2p_noa_info *noa) | 2067 | const struct wmi_p2p_noa_info *noa) |
1731 | { | 2068 | { |
1732 | struct ieee80211_p2p_noa_attr *noa_attr; | 2069 | struct ieee80211_p2p_noa_attr *noa_attr; |
1733 | u8 ctwindow_oppps = noa->ctwindow_oppps; | 2070 | u8 ctwindow_oppps = noa->ctwindow_oppps; |
@@ -1769,7 +2106,7 @@ static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, | |||
1769 | *noa_attr_len = __cpu_to_le16(attr_len); | 2106 | *noa_attr_len = __cpu_to_le16(attr_len); |
1770 | } | 2107 | } |
1771 | 2108 | ||
1772 | static u32 ath10k_p2p_calc_noa_ie_len(struct wmi_p2p_noa_info *noa) | 2109 | static u32 ath10k_p2p_calc_noa_ie_len(const struct wmi_p2p_noa_info *noa) |
1773 | { | 2110 | { |
1774 | u32 len = 0; | 2111 | u32 len = 0; |
1775 | u8 noa_descriptors = noa->num_descriptors; | 2112 | u8 noa_descriptors = noa->num_descriptors; |
@@ -1789,9 +2126,8 @@ static u32 ath10k_p2p_calc_noa_ie_len(struct wmi_p2p_noa_info *noa) | |||
1789 | 2126 | ||
1790 | static void ath10k_wmi_update_noa(struct ath10k *ar, struct ath10k_vif *arvif, | 2127 | static void ath10k_wmi_update_noa(struct ath10k *ar, struct ath10k_vif *arvif, |
1791 | struct sk_buff *bcn, | 2128 | struct sk_buff *bcn, |
1792 | struct wmi_bcn_info *bcn_info) | 2129 | const struct wmi_p2p_noa_info *noa) |
1793 | { | 2130 | { |
1794 | struct wmi_p2p_noa_info *noa = &bcn_info->p2p_noa_info; | ||
1795 | u8 *new_data, *old_data = arvif->u.ap.noa_data; | 2131 | u8 *new_data, *old_data = arvif->u.ap.noa_data; |
1796 | u32 new_len; | 2132 | u32 new_len; |
1797 | 2133 | ||
@@ -1832,22 +2168,59 @@ cleanup: | |||
1832 | kfree(old_data); | 2168 | kfree(old_data); |
1833 | } | 2169 | } |
1834 | 2170 | ||
1835 | static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | 2171 | static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, struct sk_buff *skb, |
2172 | struct wmi_swba_ev_arg *arg) | ||
2173 | { | ||
2174 | struct wmi_host_swba_event *ev = (void *)skb->data; | ||
2175 | u32 map; | ||
2176 | size_t i; | ||
2177 | |||
2178 | if (skb->len < sizeof(*ev)) | ||
2179 | return -EPROTO; | ||
2180 | |||
2181 | skb_pull(skb, sizeof(*ev)); | ||
2182 | arg->vdev_map = ev->vdev_map; | ||
2183 | |||
2184 | for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) { | ||
2185 | if (!(map & BIT(0))) | ||
2186 | continue; | ||
2187 | |||
2188 | /* If this happens there were some changes in firmware and | ||
2189 | * ath10k should update the max size of tim_info array. | ||
2190 | */ | ||
2191 | if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info))) | ||
2192 | break; | ||
2193 | |||
2194 | arg->tim_info[i] = &ev->bcn_info[i].tim_info; | ||
2195 | arg->noa_info[i] = &ev->bcn_info[i].p2p_noa_info; | ||
2196 | i++; | ||
2197 | } | ||
2198 | |||
2199 | return 0; | ||
2200 | } | ||
2201 | |||
2202 | void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | ||
1836 | { | 2203 | { |
1837 | struct wmi_host_swba_event *ev; | 2204 | struct wmi_swba_ev_arg arg = {}; |
1838 | u32 map; | 2205 | u32 map; |
1839 | int i = -1; | 2206 | int i = -1; |
1840 | struct wmi_bcn_info *bcn_info; | 2207 | const struct wmi_tim_info *tim_info; |
2208 | const struct wmi_p2p_noa_info *noa_info; | ||
1841 | struct ath10k_vif *arvif; | 2209 | struct ath10k_vif *arvif; |
1842 | struct sk_buff *bcn; | 2210 | struct sk_buff *bcn; |
1843 | dma_addr_t paddr; | 2211 | dma_addr_t paddr; |
1844 | int ret, vdev_id = 0; | 2212 | int ret, vdev_id = 0; |
1845 | 2213 | ||
1846 | ev = (struct wmi_host_swba_event *)skb->data; | 2214 | ret = ath10k_wmi_pull_swba(ar, skb, &arg); |
1847 | map = __le32_to_cpu(ev->vdev_map); | 2215 | if (ret) { |
2216 | ath10k_warn(ar, "failed to parse swba event: %d\n", ret); | ||
2217 | return; | ||
2218 | } | ||
2219 | |||
2220 | map = __le32_to_cpu(arg.vdev_map); | ||
1848 | 2221 | ||
1849 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "mgmt swba vdev_map 0x%x\n", | 2222 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "mgmt swba vdev_map 0x%x\n", |
1850 | ev->vdev_map); | 2223 | map); |
1851 | 2224 | ||
1852 | for (; map; map >>= 1, vdev_id++) { | 2225 | for (; map; map >>= 1, vdev_id++) { |
1853 | if (!(map & 0x1)) | 2226 | if (!(map & 0x1)) |
@@ -1860,19 +2233,20 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1860 | break; | 2233 | break; |
1861 | } | 2234 | } |
1862 | 2235 | ||
1863 | bcn_info = &ev->bcn_info[i]; | 2236 | tim_info = arg.tim_info[i]; |
2237 | noa_info = arg.noa_info[i]; | ||
1864 | 2238 | ||
1865 | ath10k_dbg(ar, ATH10K_DBG_MGMT, | 2239 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
1866 | "mgmt event bcn_info %d tim_len %d mcast %d changed %d num_ps_pending %d bitmap 0x%08x%08x%08x%08x\n", | 2240 | "mgmt event bcn_info %d tim_len %d mcast %d changed %d num_ps_pending %d bitmap 0x%08x%08x%08x%08x\n", |
1867 | i, | 2241 | i, |
1868 | __le32_to_cpu(bcn_info->tim_info.tim_len), | 2242 | __le32_to_cpu(tim_info->tim_len), |
1869 | __le32_to_cpu(bcn_info->tim_info.tim_mcast), | 2243 | __le32_to_cpu(tim_info->tim_mcast), |
1870 | __le32_to_cpu(bcn_info->tim_info.tim_changed), | 2244 | __le32_to_cpu(tim_info->tim_changed), |
1871 | __le32_to_cpu(bcn_info->tim_info.tim_num_ps_pending), | 2245 | __le32_to_cpu(tim_info->tim_num_ps_pending), |
1872 | __le32_to_cpu(bcn_info->tim_info.tim_bitmap[3]), | 2246 | __le32_to_cpu(tim_info->tim_bitmap[3]), |
1873 | __le32_to_cpu(bcn_info->tim_info.tim_bitmap[2]), | 2247 | __le32_to_cpu(tim_info->tim_bitmap[2]), |
1874 | __le32_to_cpu(bcn_info->tim_info.tim_bitmap[1]), | 2248 | __le32_to_cpu(tim_info->tim_bitmap[1]), |
1875 | __le32_to_cpu(bcn_info->tim_info.tim_bitmap[0])); | 2249 | __le32_to_cpu(tim_info->tim_bitmap[0])); |
1876 | 2250 | ||
1877 | arvif = ath10k_get_arvif(ar, vdev_id); | 2251 | arvif = ath10k_get_arvif(ar, vdev_id); |
1878 | if (arvif == NULL) { | 2252 | if (arvif == NULL) { |
@@ -1899,8 +2273,8 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1899 | } | 2273 | } |
1900 | 2274 | ||
1901 | ath10k_tx_h_seq_no(arvif->vif, bcn); | 2275 | ath10k_tx_h_seq_no(arvif->vif, bcn); |
1902 | ath10k_wmi_update_tim(ar, arvif, bcn, bcn_info); | 2276 | ath10k_wmi_update_tim(ar, arvif, bcn, tim_info); |
1903 | ath10k_wmi_update_noa(ar, arvif, bcn, bcn_info); | 2277 | ath10k_wmi_update_noa(ar, arvif, bcn, noa_info); |
1904 | 2278 | ||
1905 | spin_lock_bh(&ar->data_lock); | 2279 | spin_lock_bh(&ar->data_lock); |
1906 | 2280 | ||
@@ -1946,8 +2320,7 @@ skip: | |||
1946 | } | 2320 | } |
1947 | } | 2321 | } |
1948 | 2322 | ||
1949 | static void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, | 2323 | void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, struct sk_buff *skb) |
1950 | struct sk_buff *skb) | ||
1951 | { | 2324 | { |
1952 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n"); | 2325 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n"); |
1953 | } | 2326 | } |
@@ -2068,9 +2441,9 @@ static int ath10k_dfs_fft_report(struct ath10k *ar, | |||
2068 | return 0; | 2441 | return 0; |
2069 | } | 2442 | } |
2070 | 2443 | ||
2071 | static void ath10k_wmi_event_dfs(struct ath10k *ar, | 2444 | void ath10k_wmi_event_dfs(struct ath10k *ar, |
2072 | const struct wmi_phyerr *phyerr, | 2445 | const struct wmi_phyerr *phyerr, |
2073 | u64 tsf) | 2446 | u64 tsf) |
2074 | { | 2447 | { |
2075 | int buf_len, tlv_len, res, i = 0; | 2448 | int buf_len, tlv_len, res, i = 0; |
2076 | const struct phyerr_tlv *tlv; | 2449 | const struct phyerr_tlv *tlv; |
@@ -2133,10 +2506,9 @@ static void ath10k_wmi_event_dfs(struct ath10k *ar, | |||
2133 | } | 2506 | } |
2134 | } | 2507 | } |
2135 | 2508 | ||
2136 | static void | 2509 | void ath10k_wmi_event_spectral_scan(struct ath10k *ar, |
2137 | ath10k_wmi_event_spectral_scan(struct ath10k *ar, | 2510 | const struct wmi_phyerr *phyerr, |
2138 | const struct wmi_phyerr *phyerr, | 2511 | u64 tsf) |
2139 | u64 tsf) | ||
2140 | { | 2512 | { |
2141 | int buf_len, tlv_len, res, i = 0; | 2513 | int buf_len, tlv_len, res, i = 0; |
2142 | struct phyerr_tlv *tlv; | 2514 | struct phyerr_tlv *tlv; |
@@ -2188,37 +2560,53 @@ ath10k_wmi_event_spectral_scan(struct ath10k *ar, | |||
2188 | } | 2560 | } |
2189 | } | 2561 | } |
2190 | 2562 | ||
2191 | static void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb) | 2563 | static int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar, struct sk_buff *skb, |
2564 | struct wmi_phyerr_ev_arg *arg) | ||
2565 | { | ||
2566 | struct wmi_phyerr_event *ev = (void *)skb->data; | ||
2567 | |||
2568 | if (skb->len < sizeof(*ev)) | ||
2569 | return -EPROTO; | ||
2570 | |||
2571 | arg->num_phyerrs = ev->num_phyerrs; | ||
2572 | arg->tsf_l32 = ev->tsf_l32; | ||
2573 | arg->tsf_u32 = ev->tsf_u32; | ||
2574 | arg->buf_len = __cpu_to_le32(skb->len - sizeof(*ev)); | ||
2575 | arg->phyerrs = ev->phyerrs; | ||
2576 | |||
2577 | return 0; | ||
2578 | } | ||
2579 | |||
2580 | void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb) | ||
2192 | { | 2581 | { |
2193 | const struct wmi_phyerr_event *ev; | 2582 | struct wmi_phyerr_ev_arg arg = {}; |
2194 | const struct wmi_phyerr *phyerr; | 2583 | const struct wmi_phyerr *phyerr; |
2195 | u32 count, i, buf_len, phy_err_code; | 2584 | u32 count, i, buf_len, phy_err_code; |
2196 | u64 tsf; | 2585 | u64 tsf; |
2197 | int left_len = skb->len; | 2586 | int left_len, ret; |
2198 | 2587 | ||
2199 | ATH10K_DFS_STAT_INC(ar, phy_errors); | 2588 | ATH10K_DFS_STAT_INC(ar, phy_errors); |
2200 | 2589 | ||
2201 | /* Check if combined event available */ | 2590 | ret = ath10k_wmi_pull_phyerr(ar, skb, &arg); |
2202 | if (left_len < sizeof(*ev)) { | 2591 | if (ret) { |
2203 | ath10k_warn(ar, "wmi phyerr combined event wrong len\n"); | 2592 | ath10k_warn(ar, "failed to parse phyerr event: %d\n", ret); |
2204 | return; | 2593 | return; |
2205 | } | 2594 | } |
2206 | 2595 | ||
2207 | left_len -= sizeof(*ev); | 2596 | left_len = __le32_to_cpu(arg.buf_len); |
2208 | 2597 | ||
2209 | /* Check number of included events */ | 2598 | /* Check number of included events */ |
2210 | ev = (const struct wmi_phyerr_event *)skb->data; | 2599 | count = __le32_to_cpu(arg.num_phyerrs); |
2211 | count = __le32_to_cpu(ev->num_phyerrs); | ||
2212 | 2600 | ||
2213 | tsf = __le32_to_cpu(ev->tsf_u32); | 2601 | tsf = __le32_to_cpu(arg.tsf_u32); |
2214 | tsf <<= 32; | 2602 | tsf <<= 32; |
2215 | tsf |= __le32_to_cpu(ev->tsf_l32); | 2603 | tsf |= __le32_to_cpu(arg.tsf_l32); |
2216 | 2604 | ||
2217 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 2605 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
2218 | "wmi event phyerr count %d tsf64 0x%llX\n", | 2606 | "wmi event phyerr count %d tsf64 0x%llX\n", |
2219 | count, tsf); | 2607 | count, tsf); |
2220 | 2608 | ||
2221 | phyerr = ev->phyerrs; | 2609 | phyerr = arg.phyerrs; |
2222 | for (i = 0; i < count; i++) { | 2610 | for (i = 0; i < count; i++) { |
2223 | /* Check if we can read event header */ | 2611 | /* Check if we can read event header */ |
2224 | if (left_len < sizeof(*phyerr)) { | 2612 | if (left_len < sizeof(*phyerr)) { |
@@ -2258,19 +2646,17 @@ static void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb) | |||
2258 | } | 2646 | } |
2259 | } | 2647 | } |
2260 | 2648 | ||
2261 | static void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb) | 2649 | void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb) |
2262 | { | 2650 | { |
2263 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ROAM_EVENTID\n"); | 2651 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ROAM_EVENTID\n"); |
2264 | } | 2652 | } |
2265 | 2653 | ||
2266 | static void ath10k_wmi_event_profile_match(struct ath10k *ar, | 2654 | void ath10k_wmi_event_profile_match(struct ath10k *ar, struct sk_buff *skb) |
2267 | struct sk_buff *skb) | ||
2268 | { | 2655 | { |
2269 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PROFILE_MATCH\n"); | 2656 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PROFILE_MATCH\n"); |
2270 | } | 2657 | } |
2271 | 2658 | ||
2272 | static void ath10k_wmi_event_debug_print(struct ath10k *ar, | 2659 | void ath10k_wmi_event_debug_print(struct ath10k *ar, struct sk_buff *skb) |
2273 | struct sk_buff *skb) | ||
2274 | { | 2660 | { |
2275 | char buf[101], c; | 2661 | char buf[101], c; |
2276 | int i; | 2662 | int i; |
@@ -2303,103 +2689,90 @@ static void ath10k_wmi_event_debug_print(struct ath10k *ar, | |||
2303 | ath10k_dbg(ar, ATH10K_DBG_WMI_PRINT, "wmi print '%s'\n", buf); | 2689 | ath10k_dbg(ar, ATH10K_DBG_WMI_PRINT, "wmi print '%s'\n", buf); |
2304 | } | 2690 | } |
2305 | 2691 | ||
2306 | static void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb) | 2692 | void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb) |
2307 | { | 2693 | { |
2308 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_QVIT_EVENTID\n"); | 2694 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_QVIT_EVENTID\n"); |
2309 | } | 2695 | } |
2310 | 2696 | ||
2311 | static void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, | 2697 | void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, struct sk_buff *skb) |
2312 | struct sk_buff *skb) | ||
2313 | { | 2698 | { |
2314 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WLAN_PROFILE_DATA_EVENTID\n"); | 2699 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WLAN_PROFILE_DATA_EVENTID\n"); |
2315 | } | 2700 | } |
2316 | 2701 | ||
2317 | static void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar, | 2702 | void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar, |
2318 | struct sk_buff *skb) | 2703 | struct sk_buff *skb) |
2319 | { | 2704 | { |
2320 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_MEASUREMENT_REPORT_EVENTID\n"); | 2705 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_MEASUREMENT_REPORT_EVENTID\n"); |
2321 | } | 2706 | } |
2322 | 2707 | ||
2323 | static void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar, | 2708 | void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar, |
2324 | struct sk_buff *skb) | 2709 | struct sk_buff *skb) |
2325 | { | 2710 | { |
2326 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TSF_MEASUREMENT_REPORT_EVENTID\n"); | 2711 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TSF_MEASUREMENT_REPORT_EVENTID\n"); |
2327 | } | 2712 | } |
2328 | 2713 | ||
2329 | static void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, | 2714 | void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, struct sk_buff *skb) |
2330 | struct sk_buff *skb) | ||
2331 | { | 2715 | { |
2332 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_ERROR_REPORT_EVENTID\n"); | 2716 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_ERROR_REPORT_EVENTID\n"); |
2333 | } | 2717 | } |
2334 | 2718 | ||
2335 | static void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, | 2719 | void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb) |
2336 | struct sk_buff *skb) | ||
2337 | { | 2720 | { |
2338 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WOW_WAKEUP_HOST_EVENTID\n"); | 2721 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WOW_WAKEUP_HOST_EVENTID\n"); |
2339 | } | 2722 | } |
2340 | 2723 | ||
2341 | static void ath10k_wmi_event_dcs_interference(struct ath10k *ar, | 2724 | void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb) |
2342 | struct sk_buff *skb) | ||
2343 | { | 2725 | { |
2344 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_DCS_INTERFERENCE_EVENTID\n"); | 2726 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_DCS_INTERFERENCE_EVENTID\n"); |
2345 | } | 2727 | } |
2346 | 2728 | ||
2347 | static void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, | 2729 | void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) |
2348 | struct sk_buff *skb) | ||
2349 | { | 2730 | { |
2350 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_TPC_CONFIG_EVENTID\n"); | 2731 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_TPC_CONFIG_EVENTID\n"); |
2351 | } | 2732 | } |
2352 | 2733 | ||
2353 | static void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, | 2734 | void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb) |
2354 | struct sk_buff *skb) | ||
2355 | { | 2735 | { |
2356 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_FTM_INTG_EVENTID\n"); | 2736 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_FTM_INTG_EVENTID\n"); |
2357 | } | 2737 | } |
2358 | 2738 | ||
2359 | static void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar, | 2739 | void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar, struct sk_buff *skb) |
2360 | struct sk_buff *skb) | ||
2361 | { | 2740 | { |
2362 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_OFFLOAD_STATUS_EVENTID\n"); | 2741 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_OFFLOAD_STATUS_EVENTID\n"); |
2363 | } | 2742 | } |
2364 | 2743 | ||
2365 | static void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, | 2744 | void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, struct sk_buff *skb) |
2366 | struct sk_buff *skb) | ||
2367 | { | 2745 | { |
2368 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_REKEY_FAIL_EVENTID\n"); | 2746 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_REKEY_FAIL_EVENTID\n"); |
2369 | } | 2747 | } |
2370 | 2748 | ||
2371 | static void ath10k_wmi_event_delba_complete(struct ath10k *ar, | 2749 | void ath10k_wmi_event_delba_complete(struct ath10k *ar, struct sk_buff *skb) |
2372 | struct sk_buff *skb) | ||
2373 | { | 2750 | { |
2374 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_DELBA_COMPLETE_EVENTID\n"); | 2751 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_DELBA_COMPLETE_EVENTID\n"); |
2375 | } | 2752 | } |
2376 | 2753 | ||
2377 | static void ath10k_wmi_event_addba_complete(struct ath10k *ar, | 2754 | void ath10k_wmi_event_addba_complete(struct ath10k *ar, struct sk_buff *skb) |
2378 | struct sk_buff *skb) | ||
2379 | { | 2755 | { |
2380 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_ADDBA_COMPLETE_EVENTID\n"); | 2756 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_ADDBA_COMPLETE_EVENTID\n"); |
2381 | } | 2757 | } |
2382 | 2758 | ||
2383 | static void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar, | 2759 | void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar, |
2384 | struct sk_buff *skb) | 2760 | struct sk_buff *skb) |
2385 | { | 2761 | { |
2386 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID\n"); | 2762 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID\n"); |
2387 | } | 2763 | } |
2388 | 2764 | ||
2389 | static void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, | 2765 | void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, struct sk_buff *skb) |
2390 | struct sk_buff *skb) | ||
2391 | { | 2766 | { |
2392 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_INST_RSSI_STATS_EVENTID\n"); | 2767 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_INST_RSSI_STATS_EVENTID\n"); |
2393 | } | 2768 | } |
2394 | 2769 | ||
2395 | static void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, | 2770 | void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, struct sk_buff *skb) |
2396 | struct sk_buff *skb) | ||
2397 | { | 2771 | { |
2398 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STANDBY_REQ_EVENTID\n"); | 2772 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STANDBY_REQ_EVENTID\n"); |
2399 | } | 2773 | } |
2400 | 2774 | ||
2401 | static void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, | 2775 | void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb) |
2402 | struct sk_buff *skb) | ||
2403 | { | 2776 | { |
2404 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n"); | 2777 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n"); |
2405 | } | 2778 | } |
@@ -2435,8 +2808,9 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id, | |||
2435 | return 0; | 2808 | return 0; |
2436 | } | 2809 | } |
2437 | 2810 | ||
2438 | static int ath10k_wmi_main_pull_svc_rdy_ev(struct sk_buff *skb, | 2811 | static int |
2439 | struct wmi_svc_rdy_ev_arg *arg) | 2812 | ath10k_wmi_main_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
2813 | struct wmi_svc_rdy_ev_arg *arg) | ||
2440 | { | 2814 | { |
2441 | struct wmi_service_ready_event *ev; | 2815 | struct wmi_service_ready_event *ev; |
2442 | size_t i, n; | 2816 | size_t i, n; |
@@ -2471,8 +2845,9 @@ static int ath10k_wmi_main_pull_svc_rdy_ev(struct sk_buff *skb, | |||
2471 | return 0; | 2845 | return 0; |
2472 | } | 2846 | } |
2473 | 2847 | ||
2474 | static int ath10k_wmi_10x_pull_svc_rdy_ev(struct sk_buff *skb, | 2848 | static int |
2475 | struct wmi_svc_rdy_ev_arg *arg) | 2849 | ath10k_wmi_10x_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
2850 | struct wmi_svc_rdy_ev_arg *arg) | ||
2476 | { | 2851 | { |
2477 | struct wmi_10x_service_ready_event *ev; | 2852 | struct wmi_10x_service_ready_event *ev; |
2478 | int i, n; | 2853 | int i, n; |
@@ -2506,30 +2881,22 @@ static int ath10k_wmi_10x_pull_svc_rdy_ev(struct sk_buff *skb, | |||
2506 | return 0; | 2881 | return 0; |
2507 | } | 2882 | } |
2508 | 2883 | ||
2509 | static void ath10k_wmi_event_service_ready(struct ath10k *ar, | 2884 | void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb) |
2510 | struct sk_buff *skb) | ||
2511 | { | 2885 | { |
2512 | struct wmi_svc_rdy_ev_arg arg = {}; | 2886 | struct wmi_svc_rdy_ev_arg arg = {}; |
2513 | u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i; | 2887 | u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i; |
2514 | int ret; | 2888 | int ret; |
2515 | 2889 | ||
2516 | memset(&ar->wmi.svc_map, 0, sizeof(ar->wmi.svc_map)); | 2890 | ret = ath10k_wmi_pull_svc_rdy(ar, skb, &arg); |
2517 | |||
2518 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
2519 | ret = ath10k_wmi_10x_pull_svc_rdy_ev(skb, &arg); | ||
2520 | wmi_10x_svc_map(arg.service_map, ar->wmi.svc_map, | ||
2521 | arg.service_map_len); | ||
2522 | } else { | ||
2523 | ret = ath10k_wmi_main_pull_svc_rdy_ev(skb, &arg); | ||
2524 | wmi_main_svc_map(arg.service_map, ar->wmi.svc_map, | ||
2525 | arg.service_map_len); | ||
2526 | } | ||
2527 | |||
2528 | if (ret) { | 2891 | if (ret) { |
2529 | ath10k_warn(ar, "failed to parse service ready: %d\n", ret); | 2892 | ath10k_warn(ar, "failed to parse service ready: %d\n", ret); |
2530 | return; | 2893 | return; |
2531 | } | 2894 | } |
2532 | 2895 | ||
2896 | memset(&ar->wmi.svc_map, 0, sizeof(ar->wmi.svc_map)); | ||
2897 | ath10k_wmi_map_svc(ar, arg.service_map, ar->wmi.svc_map, | ||
2898 | arg.service_map_len); | ||
2899 | |||
2533 | ar->hw_min_tx_power = __le32_to_cpu(arg.min_tx_power); | 2900 | ar->hw_min_tx_power = __le32_to_cpu(arg.min_tx_power); |
2534 | ar->hw_max_tx_power = __le32_to_cpu(arg.max_tx_power); | 2901 | ar->hw_max_tx_power = __le32_to_cpu(arg.max_tx_power); |
2535 | ar->ht_cap_info = __le32_to_cpu(arg.ht_cap); | 2902 | ar->ht_cap_info = __le32_to_cpu(arg.ht_cap); |
@@ -2607,13 +2974,14 @@ static void ath10k_wmi_event_service_ready(struct ath10k *ar, | |||
2607 | } | 2974 | } |
2608 | 2975 | ||
2609 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 2976 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
2610 | "wmi event service ready min_tx_power 0x%08x max_tx_power 0x%08x ht_cap 0x%08x vht_cap 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x num_mem_reqs 0x%08x\n", | 2977 | "wmi event service ready min_tx_power 0x%08x max_tx_power 0x%08x ht_cap 0x%08x vht_cap 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x fw_build 0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x num_mem_reqs 0x%08x\n", |
2611 | __le32_to_cpu(arg.min_tx_power), | 2978 | __le32_to_cpu(arg.min_tx_power), |
2612 | __le32_to_cpu(arg.max_tx_power), | 2979 | __le32_to_cpu(arg.max_tx_power), |
2613 | __le32_to_cpu(arg.ht_cap), | 2980 | __le32_to_cpu(arg.ht_cap), |
2614 | __le32_to_cpu(arg.vht_cap), | 2981 | __le32_to_cpu(arg.vht_cap), |
2615 | __le32_to_cpu(arg.sw_ver0), | 2982 | __le32_to_cpu(arg.sw_ver0), |
2616 | __le32_to_cpu(arg.sw_ver1), | 2983 | __le32_to_cpu(arg.sw_ver1), |
2984 | __le32_to_cpu(arg.fw_build), | ||
2617 | __le32_to_cpu(arg.phy_capab), | 2985 | __le32_to_cpu(arg.phy_capab), |
2618 | __le32_to_cpu(arg.num_rf_chains), | 2986 | __le32_to_cpu(arg.num_rf_chains), |
2619 | __le32_to_cpu(arg.eeprom_rd), | 2987 | __le32_to_cpu(arg.eeprom_rd), |
@@ -2622,27 +2990,59 @@ static void ath10k_wmi_event_service_ready(struct ath10k *ar, | |||
2622 | complete(&ar->wmi.service_ready); | 2990 | complete(&ar->wmi.service_ready); |
2623 | } | 2991 | } |
2624 | 2992 | ||
2625 | static int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb) | 2993 | static int ath10k_wmi_op_pull_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
2994 | struct wmi_rdy_ev_arg *arg) | ||
2626 | { | 2995 | { |
2627 | struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data; | 2996 | struct wmi_ready_event *ev = (void *)skb->data; |
2628 | 2997 | ||
2629 | if (WARN_ON(skb->len < sizeof(*ev))) | 2998 | if (skb->len < sizeof(*ev)) |
2630 | return -EINVAL; | 2999 | return -EPROTO; |
3000 | |||
3001 | skb_pull(skb, sizeof(*ev)); | ||
3002 | arg->sw_version = ev->sw_version; | ||
3003 | arg->abi_version = ev->abi_version; | ||
3004 | arg->status = ev->status; | ||
3005 | arg->mac_addr = ev->mac_addr.addr; | ||
2631 | 3006 | ||
2632 | ether_addr_copy(ar->mac_addr, ev->mac_addr.addr); | 3007 | return 0; |
3008 | } | ||
3009 | |||
3010 | int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb) | ||
3011 | { | ||
3012 | struct wmi_rdy_ev_arg arg = {}; | ||
3013 | int ret; | ||
3014 | |||
3015 | ret = ath10k_wmi_pull_rdy(ar, skb, &arg); | ||
3016 | if (ret) { | ||
3017 | ath10k_warn(ar, "failed to parse ready event: %d\n", ret); | ||
3018 | return ret; | ||
3019 | } | ||
2633 | 3020 | ||
2634 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 3021 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
2635 | "wmi event ready sw_version %u abi_version %u mac_addr %pM status %d skb->len %i ev-sz %zu\n", | 3022 | "wmi event ready sw_version %u abi_version %u mac_addr %pM status %d\n", |
2636 | __le32_to_cpu(ev->sw_version), | 3023 | __le32_to_cpu(arg.sw_version), |
2637 | __le32_to_cpu(ev->abi_version), | 3024 | __le32_to_cpu(arg.abi_version), |
2638 | ev->mac_addr.addr, | 3025 | arg.mac_addr, |
2639 | __le32_to_cpu(ev->status), skb->len, sizeof(*ev)); | 3026 | __le32_to_cpu(arg.status)); |
2640 | 3027 | ||
3028 | ether_addr_copy(ar->mac_addr, arg.mac_addr); | ||
2641 | complete(&ar->wmi.unified_ready); | 3029 | complete(&ar->wmi.unified_ready); |
2642 | return 0; | 3030 | return 0; |
2643 | } | 3031 | } |
2644 | 3032 | ||
2645 | static void ath10k_wmi_main_process_rx(struct ath10k *ar, struct sk_buff *skb) | 3033 | static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb) |
3034 | { | ||
3035 | const struct wmi_pdev_temperature_event *ev; | ||
3036 | |||
3037 | ev = (struct wmi_pdev_temperature_event *)skb->data; | ||
3038 | if (WARN_ON(skb->len < sizeof(*ev))) | ||
3039 | return -EPROTO; | ||
3040 | |||
3041 | ath10k_thermal_event_temperature(ar, __le32_to_cpu(ev->temperature)); | ||
3042 | return 0; | ||
3043 | } | ||
3044 | |||
3045 | static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb) | ||
2646 | { | 3046 | { |
2647 | struct wmi_cmd_hdr *cmd_hdr; | 3047 | struct wmi_cmd_hdr *cmd_hdr; |
2648 | enum wmi_event_id id; | 3048 | enum wmi_event_id id; |
@@ -2758,7 +3158,7 @@ static void ath10k_wmi_main_process_rx(struct ath10k *ar, struct sk_buff *skb) | |||
2758 | dev_kfree_skb(skb); | 3158 | dev_kfree_skb(skb); |
2759 | } | 3159 | } |
2760 | 3160 | ||
2761 | static void ath10k_wmi_10x_process_rx(struct ath10k *ar, struct sk_buff *skb) | 3161 | static void ath10k_wmi_10_1_op_rx(struct ath10k *ar, struct sk_buff *skb) |
2762 | { | 3162 | { |
2763 | struct wmi_cmd_hdr *cmd_hdr; | 3163 | struct wmi_cmd_hdr *cmd_hdr; |
2764 | enum wmi_10x_event_id id; | 3164 | enum wmi_10x_event_id id; |
@@ -2882,7 +3282,7 @@ out: | |||
2882 | dev_kfree_skb(skb); | 3282 | dev_kfree_skb(skb); |
2883 | } | 3283 | } |
2884 | 3284 | ||
2885 | static void ath10k_wmi_10_2_process_rx(struct ath10k *ar, struct sk_buff *skb) | 3285 | static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb) |
2886 | { | 3286 | { |
2887 | struct wmi_cmd_hdr *cmd_hdr; | 3287 | struct wmi_cmd_hdr *cmd_hdr; |
2888 | enum wmi_10_2_event_id id; | 3288 | enum wmi_10_2_event_id id; |
@@ -2981,6 +3381,9 @@ static void ath10k_wmi_10_2_process_rx(struct ath10k *ar, struct sk_buff *skb) | |||
2981 | case WMI_10_2_READY_EVENTID: | 3381 | case WMI_10_2_READY_EVENTID: |
2982 | ath10k_wmi_event_ready(ar, skb); | 3382 | ath10k_wmi_event_ready(ar, skb); |
2983 | break; | 3383 | break; |
3384 | case WMI_10_2_PDEV_TEMPERATURE_EVENTID: | ||
3385 | ath10k_wmi_event_temperature(ar, skb); | ||
3386 | break; | ||
2984 | case WMI_10_2_RTT_KEEPALIVE_EVENTID: | 3387 | case WMI_10_2_RTT_KEEPALIVE_EVENTID: |
2985 | case WMI_10_2_GPIO_INPUT_EVENTID: | 3388 | case WMI_10_2_GPIO_INPUT_EVENTID: |
2986 | case WMI_10_2_PEER_RATECODE_LIST_EVENTID: | 3389 | case WMI_10_2_PEER_RATECODE_LIST_EVENTID: |
@@ -3001,14 +3404,11 @@ static void ath10k_wmi_10_2_process_rx(struct ath10k *ar, struct sk_buff *skb) | |||
3001 | 3404 | ||
3002 | static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb) | 3405 | static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb) |
3003 | { | 3406 | { |
3004 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 3407 | int ret; |
3005 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) | 3408 | |
3006 | ath10k_wmi_10_2_process_rx(ar, skb); | 3409 | ret = ath10k_wmi_rx(ar, skb); |
3007 | else | 3410 | if (ret) |
3008 | ath10k_wmi_10x_process_rx(ar, skb); | 3411 | ath10k_warn(ar, "failed to process wmi rx: %d\n", ret); |
3009 | } else { | ||
3010 | ath10k_wmi_main_process_rx(ar, skb); | ||
3011 | } | ||
3012 | } | 3412 | } |
3013 | 3413 | ||
3014 | int ath10k_wmi_connect(struct ath10k *ar) | 3414 | int ath10k_wmi_connect(struct ath10k *ar) |
@@ -3039,16 +3439,17 @@ int ath10k_wmi_connect(struct ath10k *ar) | |||
3039 | return 0; | 3439 | return 0; |
3040 | } | 3440 | } |
3041 | 3441 | ||
3042 | static int ath10k_wmi_main_pdev_set_regdomain(struct ath10k *ar, u16 rd, | 3442 | static struct sk_buff * |
3043 | u16 rd2g, u16 rd5g, u16 ctl2g, | 3443 | ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, |
3044 | u16 ctl5g) | 3444 | u16 ctl2g, u16 ctl5g, |
3445 | enum wmi_dfs_region dfs_reg) | ||
3045 | { | 3446 | { |
3046 | struct wmi_pdev_set_regdomain_cmd *cmd; | 3447 | struct wmi_pdev_set_regdomain_cmd *cmd; |
3047 | struct sk_buff *skb; | 3448 | struct sk_buff *skb; |
3048 | 3449 | ||
3049 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 3450 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3050 | if (!skb) | 3451 | if (!skb) |
3051 | return -ENOMEM; | 3452 | return ERR_PTR(-ENOMEM); |
3052 | 3453 | ||
3053 | cmd = (struct wmi_pdev_set_regdomain_cmd *)skb->data; | 3454 | cmd = (struct wmi_pdev_set_regdomain_cmd *)skb->data; |
3054 | cmd->reg_domain = __cpu_to_le32(rd); | 3455 | cmd->reg_domain = __cpu_to_le32(rd); |
@@ -3060,22 +3461,20 @@ static int ath10k_wmi_main_pdev_set_regdomain(struct ath10k *ar, u16 rd, | |||
3060 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 3461 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3061 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n", | 3462 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n", |
3062 | rd, rd2g, rd5g, ctl2g, ctl5g); | 3463 | rd, rd2g, rd5g, ctl2g, ctl5g); |
3063 | 3464 | return skb; | |
3064 | return ath10k_wmi_cmd_send(ar, skb, | ||
3065 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | ||
3066 | } | 3465 | } |
3067 | 3466 | ||
3068 | static int ath10k_wmi_10x_pdev_set_regdomain(struct ath10k *ar, u16 rd, | 3467 | static struct sk_buff * |
3069 | u16 rd2g, u16 rd5g, | 3468 | ath10k_wmi_10x_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 |
3070 | u16 ctl2g, u16 ctl5g, | 3469 | rd5g, u16 ctl2g, u16 ctl5g, |
3071 | enum wmi_dfs_region dfs_reg) | 3470 | enum wmi_dfs_region dfs_reg) |
3072 | { | 3471 | { |
3073 | struct wmi_pdev_set_regdomain_cmd_10x *cmd; | 3472 | struct wmi_pdev_set_regdomain_cmd_10x *cmd; |
3074 | struct sk_buff *skb; | 3473 | struct sk_buff *skb; |
3075 | 3474 | ||
3076 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 3475 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3077 | if (!skb) | 3476 | if (!skb) |
3078 | return -ENOMEM; | 3477 | return ERR_PTR(-ENOMEM); |
3079 | 3478 | ||
3080 | cmd = (struct wmi_pdev_set_regdomain_cmd_10x *)skb->data; | 3479 | cmd = (struct wmi_pdev_set_regdomain_cmd_10x *)skb->data; |
3081 | cmd->reg_domain = __cpu_to_le32(rd); | 3480 | cmd->reg_domain = __cpu_to_le32(rd); |
@@ -3088,50 +3487,39 @@ static int ath10k_wmi_10x_pdev_set_regdomain(struct ath10k *ar, u16 rd, | |||
3088 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 3487 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3089 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x dfs_region %x\n", | 3488 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x dfs_region %x\n", |
3090 | rd, rd2g, rd5g, ctl2g, ctl5g, dfs_reg); | 3489 | rd, rd2g, rd5g, ctl2g, ctl5g, dfs_reg); |
3091 | 3490 | return skb; | |
3092 | return ath10k_wmi_cmd_send(ar, skb, | ||
3093 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | ||
3094 | } | ||
3095 | |||
3096 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | ||
3097 | u16 rd5g, u16 ctl2g, u16 ctl5g, | ||
3098 | enum wmi_dfs_region dfs_reg) | ||
3099 | { | ||
3100 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) | ||
3101 | return ath10k_wmi_10x_pdev_set_regdomain(ar, rd, rd2g, rd5g, | ||
3102 | ctl2g, ctl5g, dfs_reg); | ||
3103 | else | ||
3104 | return ath10k_wmi_main_pdev_set_regdomain(ar, rd, rd2g, rd5g, | ||
3105 | ctl2g, ctl5g); | ||
3106 | } | 3491 | } |
3107 | 3492 | ||
3108 | int ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) | 3493 | static struct sk_buff * |
3494 | ath10k_wmi_op_gen_pdev_suspend(struct ath10k *ar, u32 suspend_opt) | ||
3109 | { | 3495 | { |
3110 | struct wmi_pdev_suspend_cmd *cmd; | 3496 | struct wmi_pdev_suspend_cmd *cmd; |
3111 | struct sk_buff *skb; | 3497 | struct sk_buff *skb; |
3112 | 3498 | ||
3113 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 3499 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3114 | if (!skb) | 3500 | if (!skb) |
3115 | return -ENOMEM; | 3501 | return ERR_PTR(-ENOMEM); |
3116 | 3502 | ||
3117 | cmd = (struct wmi_pdev_suspend_cmd *)skb->data; | 3503 | cmd = (struct wmi_pdev_suspend_cmd *)skb->data; |
3118 | cmd->suspend_opt = __cpu_to_le32(suspend_opt); | 3504 | cmd->suspend_opt = __cpu_to_le32(suspend_opt); |
3119 | 3505 | ||
3120 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_suspend_cmdid); | 3506 | return skb; |
3121 | } | 3507 | } |
3122 | 3508 | ||
3123 | int ath10k_wmi_pdev_resume_target(struct ath10k *ar) | 3509 | static struct sk_buff * |
3510 | ath10k_wmi_op_gen_pdev_resume(struct ath10k *ar) | ||
3124 | { | 3511 | { |
3125 | struct sk_buff *skb; | 3512 | struct sk_buff *skb; |
3126 | 3513 | ||
3127 | skb = ath10k_wmi_alloc_skb(ar, 0); | 3514 | skb = ath10k_wmi_alloc_skb(ar, 0); |
3128 | if (skb == NULL) | 3515 | if (!skb) |
3129 | return -ENOMEM; | 3516 | return ERR_PTR(-ENOMEM); |
3130 | 3517 | ||
3131 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_resume_cmdid); | 3518 | return skb; |
3132 | } | 3519 | } |
3133 | 3520 | ||
3134 | int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | 3521 | static struct sk_buff * |
3522 | ath10k_wmi_op_gen_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | ||
3135 | { | 3523 | { |
3136 | struct wmi_pdev_set_param_cmd *cmd; | 3524 | struct wmi_pdev_set_param_cmd *cmd; |
3137 | struct sk_buff *skb; | 3525 | struct sk_buff *skb; |
@@ -3139,12 +3527,12 @@ int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | |||
3139 | if (id == WMI_PDEV_PARAM_UNSUPPORTED) { | 3527 | if (id == WMI_PDEV_PARAM_UNSUPPORTED) { |
3140 | ath10k_warn(ar, "pdev param %d not supported by firmware\n", | 3528 | ath10k_warn(ar, "pdev param %d not supported by firmware\n", |
3141 | id); | 3529 | id); |
3142 | return -EOPNOTSUPP; | 3530 | return ERR_PTR(-EOPNOTSUPP); |
3143 | } | 3531 | } |
3144 | 3532 | ||
3145 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 3533 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3146 | if (!skb) | 3534 | if (!skb) |
3147 | return -ENOMEM; | 3535 | return ERR_PTR(-ENOMEM); |
3148 | 3536 | ||
3149 | cmd = (struct wmi_pdev_set_param_cmd *)skb->data; | 3537 | cmd = (struct wmi_pdev_set_param_cmd *)skb->data; |
3150 | cmd->param_id = __cpu_to_le32(id); | 3538 | cmd->param_id = __cpu_to_le32(id); |
@@ -3152,11 +3540,11 @@ int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | |||
3152 | 3540 | ||
3153 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set param %d value %d\n", | 3541 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set param %d value %d\n", |
3154 | id, value); | 3542 | id, value); |
3155 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_set_param_cmdid); | 3543 | return skb; |
3156 | } | 3544 | } |
3157 | 3545 | ||
3158 | static void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar, | 3546 | void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar, |
3159 | struct wmi_host_mem_chunks *chunks) | 3547 | struct wmi_host_mem_chunks *chunks) |
3160 | { | 3548 | { |
3161 | struct host_memory_chunk *chunk; | 3549 | struct host_memory_chunk *chunk; |
3162 | int i; | 3550 | int i; |
@@ -3177,7 +3565,7 @@ static void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar, | |||
3177 | } | 3565 | } |
3178 | } | 3566 | } |
3179 | 3567 | ||
3180 | static int ath10k_wmi_main_cmd_init(struct ath10k *ar) | 3568 | static struct sk_buff *ath10k_wmi_op_gen_init(struct ath10k *ar) |
3181 | { | 3569 | { |
3182 | struct wmi_init_cmd *cmd; | 3570 | struct wmi_init_cmd *cmd; |
3183 | struct sk_buff *buf; | 3571 | struct sk_buff *buf; |
@@ -3240,7 +3628,7 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar) | |||
3240 | 3628 | ||
3241 | buf = ath10k_wmi_alloc_skb(ar, len); | 3629 | buf = ath10k_wmi_alloc_skb(ar, len); |
3242 | if (!buf) | 3630 | if (!buf) |
3243 | return -ENOMEM; | 3631 | return ERR_PTR(-ENOMEM); |
3244 | 3632 | ||
3245 | cmd = (struct wmi_init_cmd *)buf->data; | 3633 | cmd = (struct wmi_init_cmd *)buf->data; |
3246 | 3634 | ||
@@ -3248,10 +3636,10 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar) | |||
3248 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); | 3636 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
3249 | 3637 | ||
3250 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init\n"); | 3638 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init\n"); |
3251 | return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->init_cmdid); | 3639 | return buf; |
3252 | } | 3640 | } |
3253 | 3641 | ||
3254 | static int ath10k_wmi_10x_cmd_init(struct ath10k *ar) | 3642 | static struct sk_buff *ath10k_wmi_10_1_op_gen_init(struct ath10k *ar) |
3255 | { | 3643 | { |
3256 | struct wmi_init_cmd_10x *cmd; | 3644 | struct wmi_init_cmd_10x *cmd; |
3257 | struct sk_buff *buf; | 3645 | struct sk_buff *buf; |
@@ -3306,7 +3694,7 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar) | |||
3306 | 3694 | ||
3307 | buf = ath10k_wmi_alloc_skb(ar, len); | 3695 | buf = ath10k_wmi_alloc_skb(ar, len); |
3308 | if (!buf) | 3696 | if (!buf) |
3309 | return -ENOMEM; | 3697 | return ERR_PTR(-ENOMEM); |
3310 | 3698 | ||
3311 | cmd = (struct wmi_init_cmd_10x *)buf->data; | 3699 | cmd = (struct wmi_init_cmd_10x *)buf->data; |
3312 | 3700 | ||
@@ -3314,10 +3702,10 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar) | |||
3314 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); | 3702 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
3315 | 3703 | ||
3316 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10x\n"); | 3704 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10x\n"); |
3317 | return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->init_cmdid); | 3705 | return buf; |
3318 | } | 3706 | } |
3319 | 3707 | ||
3320 | static int ath10k_wmi_10_2_cmd_init(struct ath10k *ar) | 3708 | static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar) |
3321 | { | 3709 | { |
3322 | struct wmi_init_cmd_10_2 *cmd; | 3710 | struct wmi_init_cmd_10_2 *cmd; |
3323 | struct sk_buff *buf; | 3711 | struct sk_buff *buf; |
@@ -3372,7 +3760,7 @@ static int ath10k_wmi_10_2_cmd_init(struct ath10k *ar) | |||
3372 | 3760 | ||
3373 | buf = ath10k_wmi_alloc_skb(ar, len); | 3761 | buf = ath10k_wmi_alloc_skb(ar, len); |
3374 | if (!buf) | 3762 | if (!buf) |
3375 | return -ENOMEM; | 3763 | return ERR_PTR(-ENOMEM); |
3376 | 3764 | ||
3377 | cmd = (struct wmi_init_cmd_10_2 *)buf->data; | 3765 | cmd = (struct wmi_init_cmd_10_2 *)buf->data; |
3378 | 3766 | ||
@@ -3380,26 +3768,10 @@ static int ath10k_wmi_10_2_cmd_init(struct ath10k *ar) | |||
3380 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); | 3768 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
3381 | 3769 | ||
3382 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.2\n"); | 3770 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.2\n"); |
3383 | return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->init_cmdid); | 3771 | return buf; |
3384 | } | 3772 | } |
3385 | 3773 | ||
3386 | int ath10k_wmi_cmd_init(struct ath10k *ar) | 3774 | int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg) |
3387 | { | ||
3388 | int ret; | ||
3389 | |||
3390 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
3391 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) | ||
3392 | ret = ath10k_wmi_10_2_cmd_init(ar); | ||
3393 | else | ||
3394 | ret = ath10k_wmi_10x_cmd_init(ar); | ||
3395 | } else { | ||
3396 | ret = ath10k_wmi_main_cmd_init(ar); | ||
3397 | } | ||
3398 | |||
3399 | return ret; | ||
3400 | } | ||
3401 | |||
3402 | static int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg) | ||
3403 | { | 3775 | { |
3404 | if (arg->ie_len && !arg->ie) | 3776 | if (arg->ie_len && !arg->ie) |
3405 | return -EINVAL; | 3777 | return -EINVAL; |
@@ -3450,9 +3822,8 @@ ath10k_wmi_start_scan_tlvs_len(const struct wmi_start_scan_arg *arg) | |||
3450 | return len; | 3822 | return len; |
3451 | } | 3823 | } |
3452 | 3824 | ||
3453 | static void | 3825 | void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn, |
3454 | ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn, | 3826 | const struct wmi_start_scan_arg *arg) |
3455 | const struct wmi_start_scan_arg *arg) | ||
3456 | { | 3827 | { |
3457 | u32 scan_id; | 3828 | u32 scan_id; |
3458 | u32 scan_req_id; | 3829 | u32 scan_req_id; |
@@ -3546,46 +3917,60 @@ ath10k_wmi_put_start_scan_tlvs(struct wmi_start_scan_tlvs *tlvs, | |||
3546 | } | 3917 | } |
3547 | } | 3918 | } |
3548 | 3919 | ||
3549 | int ath10k_wmi_start_scan(struct ath10k *ar, | 3920 | static struct sk_buff * |
3550 | const struct wmi_start_scan_arg *arg) | 3921 | ath10k_wmi_op_gen_start_scan(struct ath10k *ar, |
3922 | const struct wmi_start_scan_arg *arg) | ||
3551 | { | 3923 | { |
3924 | struct wmi_start_scan_cmd *cmd; | ||
3552 | struct sk_buff *skb; | 3925 | struct sk_buff *skb; |
3553 | size_t len; | 3926 | size_t len; |
3554 | int ret; | 3927 | int ret; |
3555 | 3928 | ||
3556 | ret = ath10k_wmi_start_scan_verify(arg); | 3929 | ret = ath10k_wmi_start_scan_verify(arg); |
3557 | if (ret) | 3930 | if (ret) |
3558 | return ret; | 3931 | return ERR_PTR(ret); |
3559 | |||
3560 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) | ||
3561 | len = sizeof(struct wmi_10x_start_scan_cmd) + | ||
3562 | ath10k_wmi_start_scan_tlvs_len(arg); | ||
3563 | else | ||
3564 | len = sizeof(struct wmi_start_scan_cmd) + | ||
3565 | ath10k_wmi_start_scan_tlvs_len(arg); | ||
3566 | 3932 | ||
3933 | len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg); | ||
3567 | skb = ath10k_wmi_alloc_skb(ar, len); | 3934 | skb = ath10k_wmi_alloc_skb(ar, len); |
3568 | if (!skb) | 3935 | if (!skb) |
3569 | return -ENOMEM; | 3936 | return ERR_PTR(-ENOMEM); |
3570 | |||
3571 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
3572 | struct wmi_10x_start_scan_cmd *cmd; | ||
3573 | 3937 | ||
3574 | cmd = (struct wmi_10x_start_scan_cmd *)skb->data; | 3938 | cmd = (struct wmi_start_scan_cmd *)skb->data; |
3575 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); | ||
3576 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); | ||
3577 | } else { | ||
3578 | struct wmi_start_scan_cmd *cmd; | ||
3579 | 3939 | ||
3580 | cmd = (struct wmi_start_scan_cmd *)skb->data; | 3940 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); |
3581 | cmd->burst_duration_ms = __cpu_to_le32(0); | 3941 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); |
3582 | 3942 | ||
3583 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); | 3943 | cmd->burst_duration_ms = __cpu_to_le32(0); |
3584 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); | ||
3585 | } | ||
3586 | 3944 | ||
3587 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi start scan\n"); | 3945 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi start scan\n"); |
3588 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->start_scan_cmdid); | 3946 | return skb; |
3947 | } | ||
3948 | |||
3949 | static struct sk_buff * | ||
3950 | ath10k_wmi_10x_op_gen_start_scan(struct ath10k *ar, | ||
3951 | const struct wmi_start_scan_arg *arg) | ||
3952 | { | ||
3953 | struct wmi_10x_start_scan_cmd *cmd; | ||
3954 | struct sk_buff *skb; | ||
3955 | size_t len; | ||
3956 | int ret; | ||
3957 | |||
3958 | ret = ath10k_wmi_start_scan_verify(arg); | ||
3959 | if (ret) | ||
3960 | return ERR_PTR(ret); | ||
3961 | |||
3962 | len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg); | ||
3963 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
3964 | if (!skb) | ||
3965 | return ERR_PTR(-ENOMEM); | ||
3966 | |||
3967 | cmd = (struct wmi_10x_start_scan_cmd *)skb->data; | ||
3968 | |||
3969 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); | ||
3970 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); | ||
3971 | |||
3972 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi 10x start scan\n"); | ||
3973 | return skb; | ||
3589 | } | 3974 | } |
3590 | 3975 | ||
3591 | void ath10k_wmi_start_scan_init(struct ath10k *ar, | 3976 | void ath10k_wmi_start_scan_init(struct ath10k *ar, |
@@ -3614,7 +3999,9 @@ void ath10k_wmi_start_scan_init(struct ath10k *ar, | |||
3614 | arg->bssids[0].bssid = "\xFF\xFF\xFF\xFF\xFF\xFF"; | 3999 | arg->bssids[0].bssid = "\xFF\xFF\xFF\xFF\xFF\xFF"; |
3615 | } | 4000 | } |
3616 | 4001 | ||
3617 | int ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) | 4002 | static struct sk_buff * |
4003 | ath10k_wmi_op_gen_stop_scan(struct ath10k *ar, | ||
4004 | const struct wmi_stop_scan_arg *arg) | ||
3618 | { | 4005 | { |
3619 | struct wmi_stop_scan_cmd *cmd; | 4006 | struct wmi_stop_scan_cmd *cmd; |
3620 | struct sk_buff *skb; | 4007 | struct sk_buff *skb; |
@@ -3622,13 +4009,13 @@ int ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) | |||
3622 | u32 req_id; | 4009 | u32 req_id; |
3623 | 4010 | ||
3624 | if (arg->req_id > 0xFFF) | 4011 | if (arg->req_id > 0xFFF) |
3625 | return -EINVAL; | 4012 | return ERR_PTR(-EINVAL); |
3626 | if (arg->req_type == WMI_SCAN_STOP_ONE && arg->u.scan_id > 0xFFF) | 4013 | if (arg->req_type == WMI_SCAN_STOP_ONE && arg->u.scan_id > 0xFFF) |
3627 | return -EINVAL; | 4014 | return ERR_PTR(-EINVAL); |
3628 | 4015 | ||
3629 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4016 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3630 | if (!skb) | 4017 | if (!skb) |
3631 | return -ENOMEM; | 4018 | return ERR_PTR(-ENOMEM); |
3632 | 4019 | ||
3633 | scan_id = arg->u.scan_id; | 4020 | scan_id = arg->u.scan_id; |
3634 | scan_id |= WMI_HOST_SCAN_REQ_ID_PREFIX; | 4021 | scan_id |= WMI_HOST_SCAN_REQ_ID_PREFIX; |
@@ -3645,20 +4032,21 @@ int ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) | |||
3645 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4032 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3646 | "wmi stop scan reqid %d req_type %d vdev/scan_id %d\n", | 4033 | "wmi stop scan reqid %d req_type %d vdev/scan_id %d\n", |
3647 | arg->req_id, arg->req_type, arg->u.scan_id); | 4034 | arg->req_id, arg->req_type, arg->u.scan_id); |
3648 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->stop_scan_cmdid); | 4035 | return skb; |
3649 | } | 4036 | } |
3650 | 4037 | ||
3651 | int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, | 4038 | static struct sk_buff * |
3652 | enum wmi_vdev_type type, | 4039 | ath10k_wmi_op_gen_vdev_create(struct ath10k *ar, u32 vdev_id, |
3653 | enum wmi_vdev_subtype subtype, | 4040 | enum wmi_vdev_type type, |
3654 | const u8 macaddr[ETH_ALEN]) | 4041 | enum wmi_vdev_subtype subtype, |
4042 | const u8 macaddr[ETH_ALEN]) | ||
3655 | { | 4043 | { |
3656 | struct wmi_vdev_create_cmd *cmd; | 4044 | struct wmi_vdev_create_cmd *cmd; |
3657 | struct sk_buff *skb; | 4045 | struct sk_buff *skb; |
3658 | 4046 | ||
3659 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4047 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3660 | if (!skb) | 4048 | if (!skb) |
3661 | return -ENOMEM; | 4049 | return ERR_PTR(-ENOMEM); |
3662 | 4050 | ||
3663 | cmd = (struct wmi_vdev_create_cmd *)skb->data; | 4051 | cmd = (struct wmi_vdev_create_cmd *)skb->data; |
3664 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4052 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -3669,58 +4057,52 @@ int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, | |||
3669 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4057 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3670 | "WMI vdev create: id %d type %d subtype %d macaddr %pM\n", | 4058 | "WMI vdev create: id %d type %d subtype %d macaddr %pM\n", |
3671 | vdev_id, type, subtype, macaddr); | 4059 | vdev_id, type, subtype, macaddr); |
3672 | 4060 | return skb; | |
3673 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_create_cmdid); | ||
3674 | } | 4061 | } |
3675 | 4062 | ||
3676 | int ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id) | 4063 | static struct sk_buff * |
4064 | ath10k_wmi_op_gen_vdev_delete(struct ath10k *ar, u32 vdev_id) | ||
3677 | { | 4065 | { |
3678 | struct wmi_vdev_delete_cmd *cmd; | 4066 | struct wmi_vdev_delete_cmd *cmd; |
3679 | struct sk_buff *skb; | 4067 | struct sk_buff *skb; |
3680 | 4068 | ||
3681 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4069 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3682 | if (!skb) | 4070 | if (!skb) |
3683 | return -ENOMEM; | 4071 | return ERR_PTR(-ENOMEM); |
3684 | 4072 | ||
3685 | cmd = (struct wmi_vdev_delete_cmd *)skb->data; | 4073 | cmd = (struct wmi_vdev_delete_cmd *)skb->data; |
3686 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4074 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
3687 | 4075 | ||
3688 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4076 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3689 | "WMI vdev delete id %d\n", vdev_id); | 4077 | "WMI vdev delete id %d\n", vdev_id); |
3690 | 4078 | return skb; | |
3691 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_delete_cmdid); | ||
3692 | } | 4079 | } |
3693 | 4080 | ||
3694 | static int | 4081 | static struct sk_buff * |
3695 | ath10k_wmi_vdev_start_restart(struct ath10k *ar, | 4082 | ath10k_wmi_op_gen_vdev_start(struct ath10k *ar, |
3696 | const struct wmi_vdev_start_request_arg *arg, | 4083 | const struct wmi_vdev_start_request_arg *arg, |
3697 | u32 cmd_id) | 4084 | bool restart) |
3698 | { | 4085 | { |
3699 | struct wmi_vdev_start_request_cmd *cmd; | 4086 | struct wmi_vdev_start_request_cmd *cmd; |
3700 | struct sk_buff *skb; | 4087 | struct sk_buff *skb; |
3701 | const char *cmdname; | 4088 | const char *cmdname; |
3702 | u32 flags = 0; | 4089 | u32 flags = 0; |
3703 | 4090 | ||
3704 | if (cmd_id != ar->wmi.cmd->vdev_start_request_cmdid && | ||
3705 | cmd_id != ar->wmi.cmd->vdev_restart_request_cmdid) | ||
3706 | return -EINVAL; | ||
3707 | if (WARN_ON(arg->ssid && arg->ssid_len == 0)) | 4091 | if (WARN_ON(arg->ssid && arg->ssid_len == 0)) |
3708 | return -EINVAL; | 4092 | return ERR_PTR(-EINVAL); |
3709 | if (WARN_ON(arg->hidden_ssid && !arg->ssid)) | 4093 | if (WARN_ON(arg->hidden_ssid && !arg->ssid)) |
3710 | return -EINVAL; | 4094 | return ERR_PTR(-EINVAL); |
3711 | if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid))) | 4095 | if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid))) |
3712 | return -EINVAL; | 4096 | return ERR_PTR(-EINVAL); |
3713 | 4097 | ||
3714 | if (cmd_id == ar->wmi.cmd->vdev_start_request_cmdid) | 4098 | if (restart) |
3715 | cmdname = "start"; | ||
3716 | else if (cmd_id == ar->wmi.cmd->vdev_restart_request_cmdid) | ||
3717 | cmdname = "restart"; | 4099 | cmdname = "restart"; |
3718 | else | 4100 | else |
3719 | return -EINVAL; /* should not happen, we already check cmd_id */ | 4101 | cmdname = "start"; |
3720 | 4102 | ||
3721 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4103 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3722 | if (!skb) | 4104 | if (!skb) |
3723 | return -ENOMEM; | 4105 | return ERR_PTR(-ENOMEM); |
3724 | 4106 | ||
3725 | if (arg->hidden_ssid) | 4107 | if (arg->hidden_ssid) |
3726 | flags |= WMI_VDEV_START_HIDDEN_SSID; | 4108 | flags |= WMI_VDEV_START_HIDDEN_SSID; |
@@ -3749,50 +4131,36 @@ ath10k_wmi_vdev_start_restart(struct ath10k *ar, | |||
3749 | flags, arg->channel.freq, arg->channel.mode, | 4131 | flags, arg->channel.freq, arg->channel.mode, |
3750 | cmd->chan.flags, arg->channel.max_power); | 4132 | cmd->chan.flags, arg->channel.max_power); |
3751 | 4133 | ||
3752 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | 4134 | return skb; |
3753 | } | ||
3754 | |||
3755 | int ath10k_wmi_vdev_start(struct ath10k *ar, | ||
3756 | const struct wmi_vdev_start_request_arg *arg) | ||
3757 | { | ||
3758 | u32 cmd_id = ar->wmi.cmd->vdev_start_request_cmdid; | ||
3759 | |||
3760 | return ath10k_wmi_vdev_start_restart(ar, arg, cmd_id); | ||
3761 | } | ||
3762 | |||
3763 | int ath10k_wmi_vdev_restart(struct ath10k *ar, | ||
3764 | const struct wmi_vdev_start_request_arg *arg) | ||
3765 | { | ||
3766 | u32 cmd_id = ar->wmi.cmd->vdev_restart_request_cmdid; | ||
3767 | |||
3768 | return ath10k_wmi_vdev_start_restart(ar, arg, cmd_id); | ||
3769 | } | 4135 | } |
3770 | 4136 | ||
3771 | int ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id) | 4137 | static struct sk_buff * |
4138 | ath10k_wmi_op_gen_vdev_stop(struct ath10k *ar, u32 vdev_id) | ||
3772 | { | 4139 | { |
3773 | struct wmi_vdev_stop_cmd *cmd; | 4140 | struct wmi_vdev_stop_cmd *cmd; |
3774 | struct sk_buff *skb; | 4141 | struct sk_buff *skb; |
3775 | 4142 | ||
3776 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4143 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3777 | if (!skb) | 4144 | if (!skb) |
3778 | return -ENOMEM; | 4145 | return ERR_PTR(-ENOMEM); |
3779 | 4146 | ||
3780 | cmd = (struct wmi_vdev_stop_cmd *)skb->data; | 4147 | cmd = (struct wmi_vdev_stop_cmd *)skb->data; |
3781 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4148 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
3782 | 4149 | ||
3783 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi vdev stop id 0x%x\n", vdev_id); | 4150 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi vdev stop id 0x%x\n", vdev_id); |
3784 | 4151 | return skb; | |
3785 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_stop_cmdid); | ||
3786 | } | 4152 | } |
3787 | 4153 | ||
3788 | int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) | 4154 | static struct sk_buff * |
4155 | ath10k_wmi_op_gen_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, | ||
4156 | const u8 *bssid) | ||
3789 | { | 4157 | { |
3790 | struct wmi_vdev_up_cmd *cmd; | 4158 | struct wmi_vdev_up_cmd *cmd; |
3791 | struct sk_buff *skb; | 4159 | struct sk_buff *skb; |
3792 | 4160 | ||
3793 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4161 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3794 | if (!skb) | 4162 | if (!skb) |
3795 | return -ENOMEM; | 4163 | return ERR_PTR(-ENOMEM); |
3796 | 4164 | ||
3797 | cmd = (struct wmi_vdev_up_cmd *)skb->data; | 4165 | cmd = (struct wmi_vdev_up_cmd *)skb->data; |
3798 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4166 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -3802,30 +4170,30 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) | |||
3802 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4170 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3803 | "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n", | 4171 | "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n", |
3804 | vdev_id, aid, bssid); | 4172 | vdev_id, aid, bssid); |
3805 | 4173 | return skb; | |
3806 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_up_cmdid); | ||
3807 | } | 4174 | } |
3808 | 4175 | ||
3809 | int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id) | 4176 | static struct sk_buff * |
4177 | ath10k_wmi_op_gen_vdev_down(struct ath10k *ar, u32 vdev_id) | ||
3810 | { | 4178 | { |
3811 | struct wmi_vdev_down_cmd *cmd; | 4179 | struct wmi_vdev_down_cmd *cmd; |
3812 | struct sk_buff *skb; | 4180 | struct sk_buff *skb; |
3813 | 4181 | ||
3814 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4182 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3815 | if (!skb) | 4183 | if (!skb) |
3816 | return -ENOMEM; | 4184 | return ERR_PTR(-ENOMEM); |
3817 | 4185 | ||
3818 | cmd = (struct wmi_vdev_down_cmd *)skb->data; | 4186 | cmd = (struct wmi_vdev_down_cmd *)skb->data; |
3819 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4187 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
3820 | 4188 | ||
3821 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4189 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3822 | "wmi mgmt vdev down id 0x%x\n", vdev_id); | 4190 | "wmi mgmt vdev down id 0x%x\n", vdev_id); |
3823 | 4191 | return skb; | |
3824 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_down_cmdid); | ||
3825 | } | 4192 | } |
3826 | 4193 | ||
3827 | int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, | 4194 | static struct sk_buff * |
3828 | u32 param_id, u32 param_value) | 4195 | ath10k_wmi_op_gen_vdev_set_param(struct ath10k *ar, u32 vdev_id, |
4196 | u32 param_id, u32 param_value) | ||
3829 | { | 4197 | { |
3830 | struct wmi_vdev_set_param_cmd *cmd; | 4198 | struct wmi_vdev_set_param_cmd *cmd; |
3831 | struct sk_buff *skb; | 4199 | struct sk_buff *skb; |
@@ -3834,12 +4202,12 @@ int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, | |||
3834 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4202 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3835 | "vdev param %d not supported by firmware\n", | 4203 | "vdev param %d not supported by firmware\n", |
3836 | param_id); | 4204 | param_id); |
3837 | return -EOPNOTSUPP; | 4205 | return ERR_PTR(-EOPNOTSUPP); |
3838 | } | 4206 | } |
3839 | 4207 | ||
3840 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4208 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3841 | if (!skb) | 4209 | if (!skb) |
3842 | return -ENOMEM; | 4210 | return ERR_PTR(-ENOMEM); |
3843 | 4211 | ||
3844 | cmd = (struct wmi_vdev_set_param_cmd *)skb->data; | 4212 | cmd = (struct wmi_vdev_set_param_cmd *)skb->data; |
3845 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4213 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -3849,24 +4217,24 @@ int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, | |||
3849 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4217 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3850 | "wmi vdev id 0x%x set param %d value %d\n", | 4218 | "wmi vdev id 0x%x set param %d value %d\n", |
3851 | vdev_id, param_id, param_value); | 4219 | vdev_id, param_id, param_value); |
3852 | 4220 | return skb; | |
3853 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_set_param_cmdid); | ||
3854 | } | 4221 | } |
3855 | 4222 | ||
3856 | int ath10k_wmi_vdev_install_key(struct ath10k *ar, | 4223 | static struct sk_buff * |
3857 | const struct wmi_vdev_install_key_arg *arg) | 4224 | ath10k_wmi_op_gen_vdev_install_key(struct ath10k *ar, |
4225 | const struct wmi_vdev_install_key_arg *arg) | ||
3858 | { | 4226 | { |
3859 | struct wmi_vdev_install_key_cmd *cmd; | 4227 | struct wmi_vdev_install_key_cmd *cmd; |
3860 | struct sk_buff *skb; | 4228 | struct sk_buff *skb; |
3861 | 4229 | ||
3862 | if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL) | 4230 | if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL) |
3863 | return -EINVAL; | 4231 | return ERR_PTR(-EINVAL); |
3864 | if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL) | 4232 | if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL) |
3865 | return -EINVAL; | 4233 | return ERR_PTR(-EINVAL); |
3866 | 4234 | ||
3867 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + arg->key_len); | 4235 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + arg->key_len); |
3868 | if (!skb) | 4236 | if (!skb) |
3869 | return -ENOMEM; | 4237 | return ERR_PTR(-ENOMEM); |
3870 | 4238 | ||
3871 | cmd = (struct wmi_vdev_install_key_cmd *)skb->data; | 4239 | cmd = (struct wmi_vdev_install_key_cmd *)skb->data; |
3872 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); | 4240 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
@@ -3885,20 +4253,19 @@ int ath10k_wmi_vdev_install_key(struct ath10k *ar, | |||
3885 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4253 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3886 | "wmi vdev install key idx %d cipher %d len %d\n", | 4254 | "wmi vdev install key idx %d cipher %d len %d\n", |
3887 | arg->key_idx, arg->key_cipher, arg->key_len); | 4255 | arg->key_idx, arg->key_cipher, arg->key_len); |
3888 | return ath10k_wmi_cmd_send(ar, skb, | 4256 | return skb; |
3889 | ar->wmi.cmd->vdev_install_key_cmdid); | ||
3890 | } | 4257 | } |
3891 | 4258 | ||
3892 | int ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, | 4259 | static struct sk_buff * |
3893 | const struct wmi_vdev_spectral_conf_arg *arg) | 4260 | ath10k_wmi_op_gen_vdev_spectral_conf(struct ath10k *ar, |
4261 | const struct wmi_vdev_spectral_conf_arg *arg) | ||
3894 | { | 4262 | { |
3895 | struct wmi_vdev_spectral_conf_cmd *cmd; | 4263 | struct wmi_vdev_spectral_conf_cmd *cmd; |
3896 | struct sk_buff *skb; | 4264 | struct sk_buff *skb; |
3897 | u32 cmdid; | ||
3898 | 4265 | ||
3899 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4266 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3900 | if (!skb) | 4267 | if (!skb) |
3901 | return -ENOMEM; | 4268 | return ERR_PTR(-ENOMEM); |
3902 | 4269 | ||
3903 | cmd = (struct wmi_vdev_spectral_conf_cmd *)skb->data; | 4270 | cmd = (struct wmi_vdev_spectral_conf_cmd *)skb->data; |
3904 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); | 4271 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
@@ -3921,39 +4288,38 @@ int ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, | |||
3921 | cmd->scan_dbm_adj = __cpu_to_le32(arg->scan_dbm_adj); | 4288 | cmd->scan_dbm_adj = __cpu_to_le32(arg->scan_dbm_adj); |
3922 | cmd->scan_chn_mask = __cpu_to_le32(arg->scan_chn_mask); | 4289 | cmd->scan_chn_mask = __cpu_to_le32(arg->scan_chn_mask); |
3923 | 4290 | ||
3924 | cmdid = ar->wmi.cmd->vdev_spectral_scan_configure_cmdid; | 4291 | return skb; |
3925 | return ath10k_wmi_cmd_send(ar, skb, cmdid); | ||
3926 | } | 4292 | } |
3927 | 4293 | ||
3928 | int ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, | 4294 | static struct sk_buff * |
3929 | u32 enable) | 4295 | ath10k_wmi_op_gen_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, |
4296 | u32 trigger, u32 enable) | ||
3930 | { | 4297 | { |
3931 | struct wmi_vdev_spectral_enable_cmd *cmd; | 4298 | struct wmi_vdev_spectral_enable_cmd *cmd; |
3932 | struct sk_buff *skb; | 4299 | struct sk_buff *skb; |
3933 | u32 cmdid; | ||
3934 | 4300 | ||
3935 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4301 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3936 | if (!skb) | 4302 | if (!skb) |
3937 | return -ENOMEM; | 4303 | return ERR_PTR(-ENOMEM); |
3938 | 4304 | ||
3939 | cmd = (struct wmi_vdev_spectral_enable_cmd *)skb->data; | 4305 | cmd = (struct wmi_vdev_spectral_enable_cmd *)skb->data; |
3940 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4306 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
3941 | cmd->trigger_cmd = __cpu_to_le32(trigger); | 4307 | cmd->trigger_cmd = __cpu_to_le32(trigger); |
3942 | cmd->enable_cmd = __cpu_to_le32(enable); | 4308 | cmd->enable_cmd = __cpu_to_le32(enable); |
3943 | 4309 | ||
3944 | cmdid = ar->wmi.cmd->vdev_spectral_scan_enable_cmdid; | 4310 | return skb; |
3945 | return ath10k_wmi_cmd_send(ar, skb, cmdid); | ||
3946 | } | 4311 | } |
3947 | 4312 | ||
3948 | int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, | 4313 | static struct sk_buff * |
3949 | const u8 peer_addr[ETH_ALEN]) | 4314 | ath10k_wmi_op_gen_peer_create(struct ath10k *ar, u32 vdev_id, |
4315 | const u8 peer_addr[ETH_ALEN]) | ||
3950 | { | 4316 | { |
3951 | struct wmi_peer_create_cmd *cmd; | 4317 | struct wmi_peer_create_cmd *cmd; |
3952 | struct sk_buff *skb; | 4318 | struct sk_buff *skb; |
3953 | 4319 | ||
3954 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4320 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3955 | if (!skb) | 4321 | if (!skb) |
3956 | return -ENOMEM; | 4322 | return ERR_PTR(-ENOMEM); |
3957 | 4323 | ||
3958 | cmd = (struct wmi_peer_create_cmd *)skb->data; | 4324 | cmd = (struct wmi_peer_create_cmd *)skb->data; |
3959 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4325 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -3962,18 +4328,19 @@ int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, | |||
3962 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4328 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3963 | "wmi peer create vdev_id %d peer_addr %pM\n", | 4329 | "wmi peer create vdev_id %d peer_addr %pM\n", |
3964 | vdev_id, peer_addr); | 4330 | vdev_id, peer_addr); |
3965 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_create_cmdid); | 4331 | return skb; |
3966 | } | 4332 | } |
3967 | 4333 | ||
3968 | int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, | 4334 | static struct sk_buff * |
3969 | const u8 peer_addr[ETH_ALEN]) | 4335 | ath10k_wmi_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id, |
4336 | const u8 peer_addr[ETH_ALEN]) | ||
3970 | { | 4337 | { |
3971 | struct wmi_peer_delete_cmd *cmd; | 4338 | struct wmi_peer_delete_cmd *cmd; |
3972 | struct sk_buff *skb; | 4339 | struct sk_buff *skb; |
3973 | 4340 | ||
3974 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4341 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3975 | if (!skb) | 4342 | if (!skb) |
3976 | return -ENOMEM; | 4343 | return ERR_PTR(-ENOMEM); |
3977 | 4344 | ||
3978 | cmd = (struct wmi_peer_delete_cmd *)skb->data; | 4345 | cmd = (struct wmi_peer_delete_cmd *)skb->data; |
3979 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4346 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -3982,18 +4349,19 @@ int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, | |||
3982 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4349 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
3983 | "wmi peer delete vdev_id %d peer_addr %pM\n", | 4350 | "wmi peer delete vdev_id %d peer_addr %pM\n", |
3984 | vdev_id, peer_addr); | 4351 | vdev_id, peer_addr); |
3985 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_delete_cmdid); | 4352 | return skb; |
3986 | } | 4353 | } |
3987 | 4354 | ||
3988 | int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, | 4355 | static struct sk_buff * |
3989 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) | 4356 | ath10k_wmi_op_gen_peer_flush(struct ath10k *ar, u32 vdev_id, |
4357 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) | ||
3990 | { | 4358 | { |
3991 | struct wmi_peer_flush_tids_cmd *cmd; | 4359 | struct wmi_peer_flush_tids_cmd *cmd; |
3992 | struct sk_buff *skb; | 4360 | struct sk_buff *skb; |
3993 | 4361 | ||
3994 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4362 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
3995 | if (!skb) | 4363 | if (!skb) |
3996 | return -ENOMEM; | 4364 | return ERR_PTR(-ENOMEM); |
3997 | 4365 | ||
3998 | cmd = (struct wmi_peer_flush_tids_cmd *)skb->data; | 4366 | cmd = (struct wmi_peer_flush_tids_cmd *)skb->data; |
3999 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4367 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -4003,19 +4371,21 @@ int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, | |||
4003 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4371 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4004 | "wmi peer flush vdev_id %d peer_addr %pM tids %08x\n", | 4372 | "wmi peer flush vdev_id %d peer_addr %pM tids %08x\n", |
4005 | vdev_id, peer_addr, tid_bitmap); | 4373 | vdev_id, peer_addr, tid_bitmap); |
4006 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_flush_tids_cmdid); | 4374 | return skb; |
4007 | } | 4375 | } |
4008 | 4376 | ||
4009 | int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, | 4377 | static struct sk_buff * |
4010 | const u8 *peer_addr, enum wmi_peer_param param_id, | 4378 | ath10k_wmi_op_gen_peer_set_param(struct ath10k *ar, u32 vdev_id, |
4011 | u32 param_value) | 4379 | const u8 *peer_addr, |
4380 | enum wmi_peer_param param_id, | ||
4381 | u32 param_value) | ||
4012 | { | 4382 | { |
4013 | struct wmi_peer_set_param_cmd *cmd; | 4383 | struct wmi_peer_set_param_cmd *cmd; |
4014 | struct sk_buff *skb; | 4384 | struct sk_buff *skb; |
4015 | 4385 | ||
4016 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4386 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4017 | if (!skb) | 4387 | if (!skb) |
4018 | return -ENOMEM; | 4388 | return ERR_PTR(-ENOMEM); |
4019 | 4389 | ||
4020 | cmd = (struct wmi_peer_set_param_cmd *)skb->data; | 4390 | cmd = (struct wmi_peer_set_param_cmd *)skb->data; |
4021 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4391 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -4026,19 +4396,19 @@ int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, | |||
4026 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4396 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4027 | "wmi vdev %d peer 0x%pM set param %d value %d\n", | 4397 | "wmi vdev %d peer 0x%pM set param %d value %d\n", |
4028 | vdev_id, peer_addr, param_id, param_value); | 4398 | vdev_id, peer_addr, param_id, param_value); |
4029 | 4399 | return skb; | |
4030 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_set_param_cmdid); | ||
4031 | } | 4400 | } |
4032 | 4401 | ||
4033 | int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, | 4402 | static struct sk_buff * |
4034 | enum wmi_sta_ps_mode psmode) | 4403 | ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, |
4404 | enum wmi_sta_ps_mode psmode) | ||
4035 | { | 4405 | { |
4036 | struct wmi_sta_powersave_mode_cmd *cmd; | 4406 | struct wmi_sta_powersave_mode_cmd *cmd; |
4037 | struct sk_buff *skb; | 4407 | struct sk_buff *skb; |
4038 | 4408 | ||
4039 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4409 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4040 | if (!skb) | 4410 | if (!skb) |
4041 | return -ENOMEM; | 4411 | return ERR_PTR(-ENOMEM); |
4042 | 4412 | ||
4043 | cmd = (struct wmi_sta_powersave_mode_cmd *)skb->data; | 4413 | cmd = (struct wmi_sta_powersave_mode_cmd *)skb->data; |
4044 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4414 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -4047,21 +4417,20 @@ int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, | |||
4047 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4417 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4048 | "wmi set powersave id 0x%x mode %d\n", | 4418 | "wmi set powersave id 0x%x mode %d\n", |
4049 | vdev_id, psmode); | 4419 | vdev_id, psmode); |
4050 | 4420 | return skb; | |
4051 | return ath10k_wmi_cmd_send(ar, skb, | ||
4052 | ar->wmi.cmd->sta_powersave_mode_cmdid); | ||
4053 | } | 4421 | } |
4054 | 4422 | ||
4055 | int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, | 4423 | static struct sk_buff * |
4056 | enum wmi_sta_powersave_param param_id, | 4424 | ath10k_wmi_op_gen_set_sta_ps(struct ath10k *ar, u32 vdev_id, |
4057 | u32 value) | 4425 | enum wmi_sta_powersave_param param_id, |
4426 | u32 value) | ||
4058 | { | 4427 | { |
4059 | struct wmi_sta_powersave_param_cmd *cmd; | 4428 | struct wmi_sta_powersave_param_cmd *cmd; |
4060 | struct sk_buff *skb; | 4429 | struct sk_buff *skb; |
4061 | 4430 | ||
4062 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4431 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4063 | if (!skb) | 4432 | if (!skb) |
4064 | return -ENOMEM; | 4433 | return ERR_PTR(-ENOMEM); |
4065 | 4434 | ||
4066 | cmd = (struct wmi_sta_powersave_param_cmd *)skb->data; | 4435 | cmd = (struct wmi_sta_powersave_param_cmd *)skb->data; |
4067 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4436 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -4071,22 +4440,22 @@ int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, | |||
4071 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4440 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4072 | "wmi sta ps param vdev_id 0x%x param %d value %d\n", | 4441 | "wmi sta ps param vdev_id 0x%x param %d value %d\n", |
4073 | vdev_id, param_id, value); | 4442 | vdev_id, param_id, value); |
4074 | return ath10k_wmi_cmd_send(ar, skb, | 4443 | return skb; |
4075 | ar->wmi.cmd->sta_powersave_param_cmdid); | ||
4076 | } | 4444 | } |
4077 | 4445 | ||
4078 | int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, | 4446 | static struct sk_buff * |
4079 | enum wmi_ap_ps_peer_param param_id, u32 value) | 4447 | ath10k_wmi_op_gen_set_ap_ps(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
4448 | enum wmi_ap_ps_peer_param param_id, u32 value) | ||
4080 | { | 4449 | { |
4081 | struct wmi_ap_ps_peer_cmd *cmd; | 4450 | struct wmi_ap_ps_peer_cmd *cmd; |
4082 | struct sk_buff *skb; | 4451 | struct sk_buff *skb; |
4083 | 4452 | ||
4084 | if (!mac) | 4453 | if (!mac) |
4085 | return -EINVAL; | 4454 | return ERR_PTR(-EINVAL); |
4086 | 4455 | ||
4087 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4456 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4088 | if (!skb) | 4457 | if (!skb) |
4089 | return -ENOMEM; | 4458 | return ERR_PTR(-ENOMEM); |
4090 | 4459 | ||
4091 | cmd = (struct wmi_ap_ps_peer_cmd *)skb->data; | 4460 | cmd = (struct wmi_ap_ps_peer_cmd *)skb->data; |
4092 | cmd->vdev_id = __cpu_to_le32(vdev_id); | 4461 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
@@ -4097,13 +4466,12 @@ int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, | |||
4097 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4466 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4098 | "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n", | 4467 | "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n", |
4099 | vdev_id, param_id, value, mac); | 4468 | vdev_id, param_id, value, mac); |
4100 | 4469 | return skb; | |
4101 | return ath10k_wmi_cmd_send(ar, skb, | ||
4102 | ar->wmi.cmd->ap_ps_peer_param_cmdid); | ||
4103 | } | 4470 | } |
4104 | 4471 | ||
4105 | int ath10k_wmi_scan_chan_list(struct ath10k *ar, | 4472 | static struct sk_buff * |
4106 | const struct wmi_scan_chan_list_arg *arg) | 4473 | ath10k_wmi_op_gen_scan_chan_list(struct ath10k *ar, |
4474 | const struct wmi_scan_chan_list_arg *arg) | ||
4107 | { | 4475 | { |
4108 | struct wmi_scan_chan_list_cmd *cmd; | 4476 | struct wmi_scan_chan_list_cmd *cmd; |
4109 | struct sk_buff *skb; | 4477 | struct sk_buff *skb; |
@@ -4116,7 +4484,7 @@ int ath10k_wmi_scan_chan_list(struct ath10k *ar, | |||
4116 | 4484 | ||
4117 | skb = ath10k_wmi_alloc_skb(ar, len); | 4485 | skb = ath10k_wmi_alloc_skb(ar, len); |
4118 | if (!skb) | 4486 | if (!skb) |
4119 | return -EINVAL; | 4487 | return ERR_PTR(-EINVAL); |
4120 | 4488 | ||
4121 | cmd = (struct wmi_scan_chan_list_cmd *)skb->data; | 4489 | cmd = (struct wmi_scan_chan_list_cmd *)skb->data; |
4122 | cmd->num_scan_chans = __cpu_to_le32(arg->n_channels); | 4490 | cmd->num_scan_chans = __cpu_to_le32(arg->n_channels); |
@@ -4128,7 +4496,7 @@ int ath10k_wmi_scan_chan_list(struct ath10k *ar, | |||
4128 | ath10k_wmi_put_wmi_channel(ci, ch); | 4496 | ath10k_wmi_put_wmi_channel(ci, ch); |
4129 | } | 4497 | } |
4130 | 4498 | ||
4131 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->scan_chan_list_cmdid); | 4499 | return skb; |
4132 | } | 4500 | } |
4133 | 4501 | ||
4134 | static void | 4502 | static void |
@@ -4209,12 +4577,9 @@ ath10k_wmi_peer_assoc_fill_10_2(struct ath10k *ar, void *buf, | |||
4209 | cmd->info0 = __cpu_to_le32(info0); | 4577 | cmd->info0 = __cpu_to_le32(info0); |
4210 | } | 4578 | } |
4211 | 4579 | ||
4212 | int ath10k_wmi_peer_assoc(struct ath10k *ar, | 4580 | static int |
4213 | const struct wmi_peer_assoc_complete_arg *arg) | 4581 | ath10k_wmi_peer_assoc_check_arg(const struct wmi_peer_assoc_complete_arg *arg) |
4214 | { | 4582 | { |
4215 | struct sk_buff *skb; | ||
4216 | int len; | ||
4217 | |||
4218 | if (arg->peer_mpdu_density > 16) | 4583 | if (arg->peer_mpdu_density > 16) |
4219 | return -EINVAL; | 4584 | return -EINVAL; |
4220 | if (arg->peer_legacy_rates.num_rates > MAX_SUPPORTED_RATES) | 4585 | if (arg->peer_legacy_rates.num_rates > MAX_SUPPORTED_RATES) |
@@ -4222,49 +4587,111 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar, | |||
4222 | if (arg->peer_ht_rates.num_rates > MAX_SUPPORTED_RATES) | 4587 | if (arg->peer_ht_rates.num_rates > MAX_SUPPORTED_RATES) |
4223 | return -EINVAL; | 4588 | return -EINVAL; |
4224 | 4589 | ||
4225 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 4590 | return 0; |
4226 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) | 4591 | } |
4227 | len = sizeof(struct wmi_10_2_peer_assoc_complete_cmd); | 4592 | |
4228 | else | 4593 | static struct sk_buff * |
4229 | len = sizeof(struct wmi_10_1_peer_assoc_complete_cmd); | 4594 | ath10k_wmi_op_gen_peer_assoc(struct ath10k *ar, |
4230 | } else { | 4595 | const struct wmi_peer_assoc_complete_arg *arg) |
4231 | len = sizeof(struct wmi_main_peer_assoc_complete_cmd); | 4596 | { |
4232 | } | 4597 | size_t len = sizeof(struct wmi_main_peer_assoc_complete_cmd); |
4598 | struct sk_buff *skb; | ||
4599 | int ret; | ||
4600 | |||
4601 | ret = ath10k_wmi_peer_assoc_check_arg(arg); | ||
4602 | if (ret) | ||
4603 | return ERR_PTR(ret); | ||
4233 | 4604 | ||
4234 | skb = ath10k_wmi_alloc_skb(ar, len); | 4605 | skb = ath10k_wmi_alloc_skb(ar, len); |
4235 | if (!skb) | 4606 | if (!skb) |
4236 | return -ENOMEM; | 4607 | return ERR_PTR(-ENOMEM); |
4237 | 4608 | ||
4238 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 4609 | ath10k_wmi_peer_assoc_fill_main(ar, skb->data, arg); |
4239 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) | 4610 | |
4240 | ath10k_wmi_peer_assoc_fill_10_2(ar, skb->data, arg); | 4611 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4241 | else | 4612 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
4242 | ath10k_wmi_peer_assoc_fill_10_1(ar, skb->data, arg); | 4613 | arg->vdev_id, arg->addr, |
4243 | } else { | 4614 | arg->peer_reassoc ? "reassociate" : "new"); |
4244 | ath10k_wmi_peer_assoc_fill_main(ar, skb->data, arg); | 4615 | return skb; |
4245 | } | 4616 | } |
4617 | |||
4618 | static struct sk_buff * | ||
4619 | ath10k_wmi_10_1_op_gen_peer_assoc(struct ath10k *ar, | ||
4620 | const struct wmi_peer_assoc_complete_arg *arg) | ||
4621 | { | ||
4622 | size_t len = sizeof(struct wmi_10_1_peer_assoc_complete_cmd); | ||
4623 | struct sk_buff *skb; | ||
4624 | int ret; | ||
4625 | |||
4626 | ret = ath10k_wmi_peer_assoc_check_arg(arg); | ||
4627 | if (ret) | ||
4628 | return ERR_PTR(ret); | ||
4629 | |||
4630 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
4631 | if (!skb) | ||
4632 | return ERR_PTR(-ENOMEM); | ||
4633 | |||
4634 | ath10k_wmi_peer_assoc_fill_10_1(ar, skb->data, arg); | ||
4246 | 4635 | ||
4247 | ath10k_dbg(ar, ATH10K_DBG_WMI, | 4636 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
4248 | "wmi peer assoc vdev %d addr %pM (%s)\n", | 4637 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
4249 | arg->vdev_id, arg->addr, | 4638 | arg->vdev_id, arg->addr, |
4250 | arg->peer_reassoc ? "reassociate" : "new"); | 4639 | arg->peer_reassoc ? "reassociate" : "new"); |
4251 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); | 4640 | return skb; |
4641 | } | ||
4642 | |||
4643 | static struct sk_buff * | ||
4644 | ath10k_wmi_10_2_op_gen_peer_assoc(struct ath10k *ar, | ||
4645 | const struct wmi_peer_assoc_complete_arg *arg) | ||
4646 | { | ||
4647 | size_t len = sizeof(struct wmi_10_2_peer_assoc_complete_cmd); | ||
4648 | struct sk_buff *skb; | ||
4649 | int ret; | ||
4650 | |||
4651 | ret = ath10k_wmi_peer_assoc_check_arg(arg); | ||
4652 | if (ret) | ||
4653 | return ERR_PTR(ret); | ||
4654 | |||
4655 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
4656 | if (!skb) | ||
4657 | return ERR_PTR(-ENOMEM); | ||
4658 | |||
4659 | ath10k_wmi_peer_assoc_fill_10_2(ar, skb->data, arg); | ||
4660 | |||
4661 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
4662 | "wmi peer assoc vdev %d addr %pM (%s)\n", | ||
4663 | arg->vdev_id, arg->addr, | ||
4664 | arg->peer_reassoc ? "reassociate" : "new"); | ||
4665 | return skb; | ||
4666 | } | ||
4667 | |||
4668 | static struct sk_buff * | ||
4669 | ath10k_wmi_10_2_op_gen_pdev_get_temperature(struct ath10k *ar) | ||
4670 | { | ||
4671 | struct sk_buff *skb; | ||
4672 | |||
4673 | skb = ath10k_wmi_alloc_skb(ar, 0); | ||
4674 | if (!skb) | ||
4675 | return ERR_PTR(-ENOMEM); | ||
4676 | |||
4677 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev get temperature\n"); | ||
4678 | return skb; | ||
4252 | } | 4679 | } |
4253 | 4680 | ||
4254 | /* This function assumes the beacon is already DMA mapped */ | 4681 | /* This function assumes the beacon is already DMA mapped */ |
4255 | int ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif) | 4682 | static struct sk_buff * |
4683 | ath10k_wmi_op_gen_beacon_dma(struct ath10k_vif *arvif) | ||
4256 | { | 4684 | { |
4685 | struct ath10k *ar = arvif->ar; | ||
4257 | struct wmi_bcn_tx_ref_cmd *cmd; | 4686 | struct wmi_bcn_tx_ref_cmd *cmd; |
4258 | struct sk_buff *skb; | 4687 | struct sk_buff *skb; |
4259 | struct sk_buff *beacon = arvif->beacon; | 4688 | struct sk_buff *beacon = arvif->beacon; |
4260 | struct ath10k *ar = arvif->ar; | ||
4261 | struct ieee80211_hdr *hdr; | 4689 | struct ieee80211_hdr *hdr; |
4262 | int ret; | ||
4263 | u16 fc; | 4690 | u16 fc; |
4264 | 4691 | ||
4265 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4692 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4266 | if (!skb) | 4693 | if (!skb) |
4267 | return -ENOMEM; | 4694 | return ERR_PTR(-ENOMEM); |
4268 | 4695 | ||
4269 | hdr = (struct ieee80211_hdr *)beacon->data; | 4696 | hdr = (struct ieee80211_hdr *)beacon->data; |
4270 | fc = le16_to_cpu(hdr->frame_control); | 4697 | fc = le16_to_cpu(hdr->frame_control); |
@@ -4284,17 +4711,11 @@ int ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif) | |||
4284 | if (ATH10K_SKB_CB(beacon)->bcn.deliver_cab) | 4711 | if (ATH10K_SKB_CB(beacon)->bcn.deliver_cab) |
4285 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB); | 4712 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB); |
4286 | 4713 | ||
4287 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, | 4714 | return skb; |
4288 | ar->wmi.cmd->pdev_send_bcn_cmdid); | ||
4289 | |||
4290 | if (ret) | ||
4291 | dev_kfree_skb(skb); | ||
4292 | |||
4293 | return ret; | ||
4294 | } | 4715 | } |
4295 | 4716 | ||
4296 | static void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params, | 4717 | void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params, |
4297 | const struct wmi_wmm_params_arg *arg) | 4718 | const struct wmi_wmm_params_arg *arg) |
4298 | { | 4719 | { |
4299 | params->cwmin = __cpu_to_le32(arg->cwmin); | 4720 | params->cwmin = __cpu_to_le32(arg->cwmin); |
4300 | params->cwmax = __cpu_to_le32(arg->cwmax); | 4721 | params->cwmax = __cpu_to_le32(arg->cwmax); |
@@ -4304,15 +4725,16 @@ static void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params, | |||
4304 | params->no_ack = __cpu_to_le32(arg->no_ack); | 4725 | params->no_ack = __cpu_to_le32(arg->no_ack); |
4305 | } | 4726 | } |
4306 | 4727 | ||
4307 | int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, | 4728 | static struct sk_buff * |
4308 | const struct wmi_pdev_set_wmm_params_arg *arg) | 4729 | ath10k_wmi_op_gen_pdev_set_wmm(struct ath10k *ar, |
4730 | const struct wmi_pdev_set_wmm_params_arg *arg) | ||
4309 | { | 4731 | { |
4310 | struct wmi_pdev_set_wmm_params *cmd; | 4732 | struct wmi_pdev_set_wmm_params *cmd; |
4311 | struct sk_buff *skb; | 4733 | struct sk_buff *skb; |
4312 | 4734 | ||
4313 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4735 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4314 | if (!skb) | 4736 | if (!skb) |
4315 | return -ENOMEM; | 4737 | return ERR_PTR(-ENOMEM); |
4316 | 4738 | ||
4317 | cmd = (struct wmi_pdev_set_wmm_params *)skb->data; | 4739 | cmd = (struct wmi_pdev_set_wmm_params *)skb->data; |
4318 | ath10k_wmi_pdev_set_wmm_param(&cmd->ac_be, &arg->ac_be); | 4740 | ath10k_wmi_pdev_set_wmm_param(&cmd->ac_be, &arg->ac_be); |
@@ -4321,35 +4743,36 @@ int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, | |||
4321 | ath10k_wmi_pdev_set_wmm_param(&cmd->ac_vo, &arg->ac_vo); | 4743 | ath10k_wmi_pdev_set_wmm_param(&cmd->ac_vo, &arg->ac_vo); |
4322 | 4744 | ||
4323 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set wmm params\n"); | 4745 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set wmm params\n"); |
4324 | return ath10k_wmi_cmd_send(ar, skb, | 4746 | return skb; |
4325 | ar->wmi.cmd->pdev_set_wmm_params_cmdid); | ||
4326 | } | 4747 | } |
4327 | 4748 | ||
4328 | int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id) | 4749 | static struct sk_buff * |
4750 | ath10k_wmi_op_gen_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id) | ||
4329 | { | 4751 | { |
4330 | struct wmi_request_stats_cmd *cmd; | 4752 | struct wmi_request_stats_cmd *cmd; |
4331 | struct sk_buff *skb; | 4753 | struct sk_buff *skb; |
4332 | 4754 | ||
4333 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4755 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4334 | if (!skb) | 4756 | if (!skb) |
4335 | return -ENOMEM; | 4757 | return ERR_PTR(-ENOMEM); |
4336 | 4758 | ||
4337 | cmd = (struct wmi_request_stats_cmd *)skb->data; | 4759 | cmd = (struct wmi_request_stats_cmd *)skb->data; |
4338 | cmd->stats_id = __cpu_to_le32(stats_id); | 4760 | cmd->stats_id = __cpu_to_le32(stats_id); |
4339 | 4761 | ||
4340 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request stats %d\n", (int)stats_id); | 4762 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request stats %d\n", (int)stats_id); |
4341 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); | 4763 | return skb; |
4342 | } | 4764 | } |
4343 | 4765 | ||
4344 | int ath10k_wmi_force_fw_hang(struct ath10k *ar, | 4766 | static struct sk_buff * |
4345 | enum wmi_force_fw_hang_type type, u32 delay_ms) | 4767 | ath10k_wmi_op_gen_force_fw_hang(struct ath10k *ar, |
4768 | enum wmi_force_fw_hang_type type, u32 delay_ms) | ||
4346 | { | 4769 | { |
4347 | struct wmi_force_fw_hang_cmd *cmd; | 4770 | struct wmi_force_fw_hang_cmd *cmd; |
4348 | struct sk_buff *skb; | 4771 | struct sk_buff *skb; |
4349 | 4772 | ||
4350 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4773 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4351 | if (!skb) | 4774 | if (!skb) |
4352 | return -ENOMEM; | 4775 | return ERR_PTR(-ENOMEM); |
4353 | 4776 | ||
4354 | cmd = (struct wmi_force_fw_hang_cmd *)skb->data; | 4777 | cmd = (struct wmi_force_fw_hang_cmd *)skb->data; |
4355 | cmd->type = __cpu_to_le32(type); | 4778 | cmd->type = __cpu_to_le32(type); |
@@ -4357,10 +4780,11 @@ int ath10k_wmi_force_fw_hang(struct ath10k *ar, | |||
4357 | 4780 | ||
4358 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi force fw hang %d delay %d\n", | 4781 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi force fw hang %d delay %d\n", |
4359 | type, delay_ms); | 4782 | type, delay_ms); |
4360 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); | 4783 | return skb; |
4361 | } | 4784 | } |
4362 | 4785 | ||
4363 | int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) | 4786 | static struct sk_buff * |
4787 | ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable) | ||
4364 | { | 4788 | { |
4365 | struct wmi_dbglog_cfg_cmd *cmd; | 4789 | struct wmi_dbglog_cfg_cmd *cmd; |
4366 | struct sk_buff *skb; | 4790 | struct sk_buff *skb; |
@@ -4368,7 +4792,7 @@ int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) | |||
4368 | 4792 | ||
4369 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4793 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4370 | if (!skb) | 4794 | if (!skb) |
4371 | return -ENOMEM; | 4795 | return ERR_PTR(-ENOMEM); |
4372 | 4796 | ||
4373 | cmd = (struct wmi_dbglog_cfg_cmd *)skb->data; | 4797 | cmd = (struct wmi_dbglog_cfg_cmd *)skb->data; |
4374 | 4798 | ||
@@ -4393,57 +4817,318 @@ int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) | |||
4393 | __le32_to_cpu(cmd->module_valid), | 4817 | __le32_to_cpu(cmd->module_valid), |
4394 | __le32_to_cpu(cmd->config_enable), | 4818 | __le32_to_cpu(cmd->config_enable), |
4395 | __le32_to_cpu(cmd->config_valid)); | 4819 | __le32_to_cpu(cmd->config_valid)); |
4396 | 4820 | return skb; | |
4397 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid); | ||
4398 | } | 4821 | } |
4399 | 4822 | ||
4400 | int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_bitmap) | 4823 | static struct sk_buff * |
4824 | ath10k_wmi_op_gen_pktlog_enable(struct ath10k *ar, u32 ev_bitmap) | ||
4401 | { | 4825 | { |
4402 | struct wmi_pdev_pktlog_enable_cmd *cmd; | 4826 | struct wmi_pdev_pktlog_enable_cmd *cmd; |
4403 | struct sk_buff *skb; | 4827 | struct sk_buff *skb; |
4404 | 4828 | ||
4405 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | 4829 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4406 | if (!skb) | 4830 | if (!skb) |
4407 | return -ENOMEM; | 4831 | return ERR_PTR(-ENOMEM); |
4408 | 4832 | ||
4409 | ev_bitmap &= ATH10K_PKTLOG_ANY; | 4833 | ev_bitmap &= ATH10K_PKTLOG_ANY; |
4410 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
4411 | "wmi enable pktlog filter:%x\n", ev_bitmap); | ||
4412 | 4834 | ||
4413 | cmd = (struct wmi_pdev_pktlog_enable_cmd *)skb->data; | 4835 | cmd = (struct wmi_pdev_pktlog_enable_cmd *)skb->data; |
4414 | cmd->ev_bitmap = __cpu_to_le32(ev_bitmap); | 4836 | cmd->ev_bitmap = __cpu_to_le32(ev_bitmap); |
4415 | return ath10k_wmi_cmd_send(ar, skb, | 4837 | |
4416 | ar->wmi.cmd->pdev_pktlog_enable_cmdid); | 4838 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi enable pktlog filter 0x%08x\n", |
4839 | ev_bitmap); | ||
4840 | return skb; | ||
4417 | } | 4841 | } |
4418 | 4842 | ||
4419 | int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar) | 4843 | static struct sk_buff * |
4844 | ath10k_wmi_op_gen_pktlog_disable(struct ath10k *ar) | ||
4420 | { | 4845 | { |
4421 | struct sk_buff *skb; | 4846 | struct sk_buff *skb; |
4422 | 4847 | ||
4423 | skb = ath10k_wmi_alloc_skb(ar, 0); | 4848 | skb = ath10k_wmi_alloc_skb(ar, 0); |
4424 | if (!skb) | 4849 | if (!skb) |
4425 | return -ENOMEM; | 4850 | return ERR_PTR(-ENOMEM); |
4426 | 4851 | ||
4427 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi disable pktlog\n"); | 4852 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi disable pktlog\n"); |
4853 | return skb; | ||
4854 | } | ||
4855 | |||
4856 | static struct sk_buff * | ||
4857 | ath10k_wmi_op_gen_pdev_set_quiet_mode(struct ath10k *ar, u32 period, | ||
4858 | u32 duration, u32 next_offset, | ||
4859 | u32 enabled) | ||
4860 | { | ||
4861 | struct wmi_pdev_set_quiet_cmd *cmd; | ||
4862 | struct sk_buff *skb; | ||
4428 | 4863 | ||
4429 | return ath10k_wmi_cmd_send(ar, skb, | 4864 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
4430 | ar->wmi.cmd->pdev_pktlog_disable_cmdid); | 4865 | if (!skb) |
4866 | return ERR_PTR(-ENOMEM); | ||
4867 | |||
4868 | cmd = (struct wmi_pdev_set_quiet_cmd *)skb->data; | ||
4869 | cmd->period = __cpu_to_le32(period); | ||
4870 | cmd->duration = __cpu_to_le32(duration); | ||
4871 | cmd->next_start = __cpu_to_le32(next_offset); | ||
4872 | cmd->enabled = __cpu_to_le32(enabled); | ||
4873 | |||
4874 | ath10k_dbg(ar, ATH10K_DBG_WMI, | ||
4875 | "wmi quiet param: period %u duration %u enabled %d\n", | ||
4876 | period, duration, enabled); | ||
4877 | return skb; | ||
4431 | } | 4878 | } |
4432 | 4879 | ||
4880 | static const struct wmi_ops wmi_ops = { | ||
4881 | .rx = ath10k_wmi_op_rx, | ||
4882 | .map_svc = wmi_main_svc_map, | ||
4883 | |||
4884 | .pull_scan = ath10k_wmi_op_pull_scan_ev, | ||
4885 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, | ||
4886 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, | ||
4887 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, | ||
4888 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, | ||
4889 | .pull_swba = ath10k_wmi_op_pull_swba_ev, | ||
4890 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, | ||
4891 | .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev, | ||
4892 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, | ||
4893 | .pull_fw_stats = ath10k_wmi_main_op_pull_fw_stats, | ||
4894 | |||
4895 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, | ||
4896 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, | ||
4897 | .gen_pdev_set_rd = ath10k_wmi_op_gen_pdev_set_rd, | ||
4898 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, | ||
4899 | .gen_init = ath10k_wmi_op_gen_init, | ||
4900 | .gen_start_scan = ath10k_wmi_op_gen_start_scan, | ||
4901 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, | ||
4902 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, | ||
4903 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, | ||
4904 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, | ||
4905 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, | ||
4906 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, | ||
4907 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, | ||
4908 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, | ||
4909 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, | ||
4910 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, | ||
4911 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, | ||
4912 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, | ||
4913 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, | ||
4914 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, | ||
4915 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, | ||
4916 | .gen_peer_assoc = ath10k_wmi_op_gen_peer_assoc, | ||
4917 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, | ||
4918 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, | ||
4919 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, | ||
4920 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, | ||
4921 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, | ||
4922 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, | ||
4923 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, | ||
4924 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, | ||
4925 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, | ||
4926 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, | ||
4927 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, | ||
4928 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, | ||
4929 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, | ||
4930 | /* .gen_pdev_get_temperature not implemented */ | ||
4931 | }; | ||
4932 | |||
4933 | static const struct wmi_ops wmi_10_1_ops = { | ||
4934 | .rx = ath10k_wmi_10_1_op_rx, | ||
4935 | .map_svc = wmi_10x_svc_map, | ||
4936 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, | ||
4937 | .pull_fw_stats = ath10k_wmi_10x_op_pull_fw_stats, | ||
4938 | .gen_init = ath10k_wmi_10_1_op_gen_init, | ||
4939 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, | ||
4940 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, | ||
4941 | .gen_peer_assoc = ath10k_wmi_10_1_op_gen_peer_assoc, | ||
4942 | /* .gen_pdev_get_temperature not implemented */ | ||
4943 | |||
4944 | /* shared with main branch */ | ||
4945 | .pull_scan = ath10k_wmi_op_pull_scan_ev, | ||
4946 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, | ||
4947 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, | ||
4948 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, | ||
4949 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, | ||
4950 | .pull_swba = ath10k_wmi_op_pull_swba_ev, | ||
4951 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, | ||
4952 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, | ||
4953 | |||
4954 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, | ||
4955 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, | ||
4956 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, | ||
4957 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, | ||
4958 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, | ||
4959 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, | ||
4960 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, | ||
4961 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, | ||
4962 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, | ||
4963 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, | ||
4964 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, | ||
4965 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, | ||
4966 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, | ||
4967 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, | ||
4968 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, | ||
4969 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, | ||
4970 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, | ||
4971 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, | ||
4972 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, | ||
4973 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, | ||
4974 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, | ||
4975 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, | ||
4976 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, | ||
4977 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, | ||
4978 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, | ||
4979 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, | ||
4980 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, | ||
4981 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, | ||
4982 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, | ||
4983 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, | ||
4984 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, | ||
4985 | }; | ||
4986 | |||
4987 | static const struct wmi_ops wmi_10_2_ops = { | ||
4988 | .rx = ath10k_wmi_10_2_op_rx, | ||
4989 | .gen_init = ath10k_wmi_10_2_op_gen_init, | ||
4990 | .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc, | ||
4991 | /* .gen_pdev_get_temperature not implemented */ | ||
4992 | |||
4993 | /* shared with 10.1 */ | ||
4994 | .map_svc = wmi_10x_svc_map, | ||
4995 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, | ||
4996 | .pull_fw_stats = ath10k_wmi_10x_op_pull_fw_stats, | ||
4997 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, | ||
4998 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, | ||
4999 | |||
5000 | .pull_scan = ath10k_wmi_op_pull_scan_ev, | ||
5001 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, | ||
5002 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, | ||
5003 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, | ||
5004 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, | ||
5005 | .pull_swba = ath10k_wmi_op_pull_swba_ev, | ||
5006 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, | ||
5007 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, | ||
5008 | |||
5009 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, | ||
5010 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, | ||
5011 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, | ||
5012 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, | ||
5013 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, | ||
5014 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, | ||
5015 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, | ||
5016 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, | ||
5017 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, | ||
5018 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, | ||
5019 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, | ||
5020 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, | ||
5021 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, | ||
5022 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, | ||
5023 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, | ||
5024 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, | ||
5025 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, | ||
5026 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, | ||
5027 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, | ||
5028 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, | ||
5029 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, | ||
5030 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, | ||
5031 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, | ||
5032 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, | ||
5033 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, | ||
5034 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, | ||
5035 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, | ||
5036 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, | ||
5037 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, | ||
5038 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, | ||
5039 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, | ||
5040 | }; | ||
5041 | |||
5042 | static const struct wmi_ops wmi_10_2_4_ops = { | ||
5043 | .rx = ath10k_wmi_10_2_op_rx, | ||
5044 | .gen_init = ath10k_wmi_10_2_op_gen_init, | ||
5045 | .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc, | ||
5046 | .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature, | ||
5047 | |||
5048 | /* shared with 10.1 */ | ||
5049 | .map_svc = wmi_10x_svc_map, | ||
5050 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, | ||
5051 | .pull_fw_stats = ath10k_wmi_10x_op_pull_fw_stats, | ||
5052 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, | ||
5053 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, | ||
5054 | |||
5055 | .pull_scan = ath10k_wmi_op_pull_scan_ev, | ||
5056 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, | ||
5057 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, | ||
5058 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, | ||
5059 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, | ||
5060 | .pull_swba = ath10k_wmi_op_pull_swba_ev, | ||
5061 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, | ||
5062 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, | ||
5063 | |||
5064 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, | ||
5065 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, | ||
5066 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, | ||
5067 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, | ||
5068 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, | ||
5069 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, | ||
5070 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, | ||
5071 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, | ||
5072 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, | ||
5073 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, | ||
5074 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, | ||
5075 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, | ||
5076 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, | ||
5077 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, | ||
5078 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, | ||
5079 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, | ||
5080 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, | ||
5081 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, | ||
5082 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, | ||
5083 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, | ||
5084 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, | ||
5085 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, | ||
5086 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, | ||
5087 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, | ||
5088 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, | ||
5089 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, | ||
5090 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, | ||
5091 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, | ||
5092 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, | ||
5093 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, | ||
5094 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, | ||
5095 | }; | ||
5096 | |||
4433 | int ath10k_wmi_attach(struct ath10k *ar) | 5097 | int ath10k_wmi_attach(struct ath10k *ar) |
4434 | { | 5098 | { |
4435 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | 5099 | switch (ar->wmi.op_version) { |
4436 | if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) | 5100 | case ATH10K_FW_WMI_OP_VERSION_10_2_4: |
4437 | ar->wmi.cmd = &wmi_10_2_cmd_map; | 5101 | ar->wmi.cmd = &wmi_10_2_4_cmd_map; |
4438 | else | 5102 | ar->wmi.ops = &wmi_10_2_4_ops; |
4439 | ar->wmi.cmd = &wmi_10x_cmd_map; | 5103 | ar->wmi.vdev_param = &wmi_10_2_4_vdev_param_map; |
4440 | 5104 | ar->wmi.pdev_param = &wmi_10_2_4_pdev_param_map; | |
5105 | break; | ||
5106 | case ATH10K_FW_WMI_OP_VERSION_10_2: | ||
5107 | ar->wmi.cmd = &wmi_10_2_cmd_map; | ||
5108 | ar->wmi.ops = &wmi_10_2_ops; | ||
4441 | ar->wmi.vdev_param = &wmi_10x_vdev_param_map; | 5109 | ar->wmi.vdev_param = &wmi_10x_vdev_param_map; |
4442 | ar->wmi.pdev_param = &wmi_10x_pdev_param_map; | 5110 | ar->wmi.pdev_param = &wmi_10x_pdev_param_map; |
4443 | } else { | 5111 | break; |
5112 | case ATH10K_FW_WMI_OP_VERSION_10_1: | ||
5113 | ar->wmi.cmd = &wmi_10x_cmd_map; | ||
5114 | ar->wmi.ops = &wmi_10_1_ops; | ||
5115 | ar->wmi.vdev_param = &wmi_10x_vdev_param_map; | ||
5116 | ar->wmi.pdev_param = &wmi_10x_pdev_param_map; | ||
5117 | break; | ||
5118 | case ATH10K_FW_WMI_OP_VERSION_MAIN: | ||
4444 | ar->wmi.cmd = &wmi_cmd_map; | 5119 | ar->wmi.cmd = &wmi_cmd_map; |
5120 | ar->wmi.ops = &wmi_ops; | ||
4445 | ar->wmi.vdev_param = &wmi_vdev_param_map; | 5121 | ar->wmi.vdev_param = &wmi_vdev_param_map; |
4446 | ar->wmi.pdev_param = &wmi_pdev_param_map; | 5122 | ar->wmi.pdev_param = &wmi_pdev_param_map; |
5123 | break; | ||
5124 | case ATH10K_FW_WMI_OP_VERSION_TLV: | ||
5125 | ath10k_wmi_tlv_attach(ar); | ||
5126 | break; | ||
5127 | case ATH10K_FW_WMI_OP_VERSION_UNSET: | ||
5128 | case ATH10K_FW_WMI_OP_VERSION_MAX: | ||
5129 | ath10k_err(ar, "unsupported WMI op version: %d\n", | ||
5130 | ar->wmi.op_version); | ||
5131 | return -EINVAL; | ||
4447 | } | 5132 | } |
4448 | 5133 | ||
4449 | init_completion(&ar->wmi.service_ready); | 5134 | init_completion(&ar->wmi.service_ready); |
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 21391929d318..bd7f29a3a122 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h | |||
@@ -109,6 +109,45 @@ enum wmi_service { | |||
109 | WMI_SERVICE_BURST, | 109 | WMI_SERVICE_BURST, |
110 | WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, | 110 | WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, |
111 | WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, | 111 | WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, |
112 | WMI_SERVICE_ROAM_SCAN_OFFLOAD, | ||
113 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, | ||
114 | WMI_SERVICE_EARLY_RX, | ||
115 | WMI_SERVICE_STA_SMPS, | ||
116 | WMI_SERVICE_FWTEST, | ||
117 | WMI_SERVICE_STA_WMMAC, | ||
118 | WMI_SERVICE_TDLS, | ||
119 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE, | ||
120 | WMI_SERVICE_ADAPTIVE_OCS, | ||
121 | WMI_SERVICE_BA_SSN_SUPPORT, | ||
122 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE, | ||
123 | WMI_SERVICE_WLAN_HB, | ||
124 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT, | ||
125 | WMI_SERVICE_BATCH_SCAN, | ||
126 | WMI_SERVICE_QPOWER, | ||
127 | WMI_SERVICE_PLMREQ, | ||
128 | WMI_SERVICE_THERMAL_MGMT, | ||
129 | WMI_SERVICE_RMC, | ||
130 | WMI_SERVICE_MHF_OFFLOAD, | ||
131 | WMI_SERVICE_COEX_SAR, | ||
132 | WMI_SERVICE_BCN_TXRATE_OVERRIDE, | ||
133 | WMI_SERVICE_NAN, | ||
134 | WMI_SERVICE_L1SS_STAT, | ||
135 | WMI_SERVICE_ESTIMATE_LINKSPEED, | ||
136 | WMI_SERVICE_OBSS_SCAN, | ||
137 | WMI_SERVICE_TDLS_OFFCHAN, | ||
138 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, | ||
139 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA, | ||
140 | WMI_SERVICE_IBSS_PWRSAVE, | ||
141 | WMI_SERVICE_LPASS, | ||
142 | WMI_SERVICE_EXTSCAN, | ||
143 | WMI_SERVICE_D0WOW, | ||
144 | WMI_SERVICE_HSOFFLOAD, | ||
145 | WMI_SERVICE_ROAM_HO_OFFLOAD, | ||
146 | WMI_SERVICE_RX_FULL_REORDER, | ||
147 | WMI_SERVICE_DHCP_OFFLOAD, | ||
148 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, | ||
149 | WMI_SERVICE_MDNS_OFFLOAD, | ||
150 | WMI_SERVICE_SAP_AUTH_OFFLOAD, | ||
112 | 151 | ||
113 | /* keep last */ | 152 | /* keep last */ |
114 | WMI_SERVICE_MAX, | 153 | WMI_SERVICE_MAX, |
@@ -215,6 +254,45 @@ static inline char *wmi_service_name(int service_id) | |||
215 | SVCSTR(WMI_SERVICE_BURST); | 254 | SVCSTR(WMI_SERVICE_BURST); |
216 | SVCSTR(WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT); | 255 | SVCSTR(WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT); |
217 | SVCSTR(WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT); | 256 | SVCSTR(WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT); |
257 | SVCSTR(WMI_SERVICE_ROAM_SCAN_OFFLOAD); | ||
258 | SVCSTR(WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC); | ||
259 | SVCSTR(WMI_SERVICE_EARLY_RX); | ||
260 | SVCSTR(WMI_SERVICE_STA_SMPS); | ||
261 | SVCSTR(WMI_SERVICE_FWTEST); | ||
262 | SVCSTR(WMI_SERVICE_STA_WMMAC); | ||
263 | SVCSTR(WMI_SERVICE_TDLS); | ||
264 | SVCSTR(WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE); | ||
265 | SVCSTR(WMI_SERVICE_ADAPTIVE_OCS); | ||
266 | SVCSTR(WMI_SERVICE_BA_SSN_SUPPORT); | ||
267 | SVCSTR(WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE); | ||
268 | SVCSTR(WMI_SERVICE_WLAN_HB); | ||
269 | SVCSTR(WMI_SERVICE_LTE_ANT_SHARE_SUPPORT); | ||
270 | SVCSTR(WMI_SERVICE_BATCH_SCAN); | ||
271 | SVCSTR(WMI_SERVICE_QPOWER); | ||
272 | SVCSTR(WMI_SERVICE_PLMREQ); | ||
273 | SVCSTR(WMI_SERVICE_THERMAL_MGMT); | ||
274 | SVCSTR(WMI_SERVICE_RMC); | ||
275 | SVCSTR(WMI_SERVICE_MHF_OFFLOAD); | ||
276 | SVCSTR(WMI_SERVICE_COEX_SAR); | ||
277 | SVCSTR(WMI_SERVICE_BCN_TXRATE_OVERRIDE); | ||
278 | SVCSTR(WMI_SERVICE_NAN); | ||
279 | SVCSTR(WMI_SERVICE_L1SS_STAT); | ||
280 | SVCSTR(WMI_SERVICE_ESTIMATE_LINKSPEED); | ||
281 | SVCSTR(WMI_SERVICE_OBSS_SCAN); | ||
282 | SVCSTR(WMI_SERVICE_TDLS_OFFCHAN); | ||
283 | SVCSTR(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA); | ||
284 | SVCSTR(WMI_SERVICE_TDLS_UAPSD_SLEEP_STA); | ||
285 | SVCSTR(WMI_SERVICE_IBSS_PWRSAVE); | ||
286 | SVCSTR(WMI_SERVICE_LPASS); | ||
287 | SVCSTR(WMI_SERVICE_EXTSCAN); | ||
288 | SVCSTR(WMI_SERVICE_D0WOW); | ||
289 | SVCSTR(WMI_SERVICE_HSOFFLOAD); | ||
290 | SVCSTR(WMI_SERVICE_ROAM_HO_OFFLOAD); | ||
291 | SVCSTR(WMI_SERVICE_RX_FULL_REORDER); | ||
292 | SVCSTR(WMI_SERVICE_DHCP_OFFLOAD); | ||
293 | SVCSTR(WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT); | ||
294 | SVCSTR(WMI_SERVICE_MDNS_OFFLOAD); | ||
295 | SVCSTR(WMI_SERVICE_SAP_AUTH_OFFLOAD); | ||
218 | default: | 296 | default: |
219 | return NULL; | 297 | return NULL; |
220 | } | 298 | } |
@@ -472,6 +550,7 @@ struct wmi_cmd_map { | |||
472 | u32 force_fw_hang_cmdid; | 550 | u32 force_fw_hang_cmdid; |
473 | u32 gpio_config_cmdid; | 551 | u32 gpio_config_cmdid; |
474 | u32 gpio_output_cmdid; | 552 | u32 gpio_output_cmdid; |
553 | u32 pdev_get_temperature_cmdid; | ||
475 | }; | 554 | }; |
476 | 555 | ||
477 | /* | 556 | /* |
@@ -1076,6 +1155,11 @@ enum wmi_10_2_cmd_id { | |||
1076 | WMI_10_2_PDEV_SET_MIMOGAIN_TABLE_CMDID, | 1155 | WMI_10_2_PDEV_SET_MIMOGAIN_TABLE_CMDID, |
1077 | WMI_10_2_PDEV_RATEPWR_TABLE_CMDID, | 1156 | WMI_10_2_PDEV_RATEPWR_TABLE_CMDID, |
1078 | WMI_10_2_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID, | 1157 | WMI_10_2_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID, |
1158 | WMI_10_2_PDEV_GET_INFO, | ||
1159 | WMI_10_2_VDEV_GET_INFO, | ||
1160 | WMI_10_2_VDEV_ATF_REQUEST_CMDID, | ||
1161 | WMI_10_2_PEER_ATF_REQUEST_CMDID, | ||
1162 | WMI_10_2_PDEV_GET_TEMPERATURE_CMDID, | ||
1079 | WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1, | 1163 | WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1, |
1080 | }; | 1164 | }; |
1081 | 1165 | ||
@@ -1117,6 +1201,8 @@ enum wmi_10_2_event_id { | |||
1117 | WMI_10_2_MCAST_BUF_RELEASE_EVENTID, | 1201 | WMI_10_2_MCAST_BUF_RELEASE_EVENTID, |
1118 | WMI_10_2_MCAST_LIST_AGEOUT_EVENTID, | 1202 | WMI_10_2_MCAST_LIST_AGEOUT_EVENTID, |
1119 | WMI_10_2_WDS_PEER_EVENTID, | 1203 | WMI_10_2_WDS_PEER_EVENTID, |
1204 | WMI_10_2_PEER_STA_PS_STATECHG_EVENTID, | ||
1205 | WMI_10_2_PDEV_TEMPERATURE_EVENTID, | ||
1120 | WMI_10_2_PDEV_UTF_EVENTID = WMI_10_2_END_EVENTID - 1, | 1206 | WMI_10_2_PDEV_UTF_EVENTID = WMI_10_2_END_EVENTID - 1, |
1121 | }; | 1207 | }; |
1122 | 1208 | ||
@@ -1862,6 +1948,11 @@ struct wmi_resource_config_10x { | |||
1862 | __le32 max_frag_entries; | 1948 | __le32 max_frag_entries; |
1863 | } __packed; | 1949 | } __packed; |
1864 | 1950 | ||
1951 | enum wmi_10_2_feature_mask { | ||
1952 | WMI_10_2_RX_BATCH_MODE = BIT(0), | ||
1953 | WMI_10_2_ATF_CONFIG = BIT(1), | ||
1954 | }; | ||
1955 | |||
1865 | struct wmi_resource_config_10_2 { | 1956 | struct wmi_resource_config_10_2 { |
1866 | struct wmi_resource_config_10x common; | 1957 | struct wmi_resource_config_10x common; |
1867 | __le32 max_peer_ext_stats; | 1958 | __le32 max_peer_ext_stats; |
@@ -1870,7 +1961,7 @@ struct wmi_resource_config_10_2 { | |||
1870 | __le32 be_min_free; | 1961 | __le32 be_min_free; |
1871 | __le32 vi_min_free; | 1962 | __le32 vi_min_free; |
1872 | __le32 vo_min_free; | 1963 | __le32 vo_min_free; |
1873 | __le32 rx_batchmode; /* 0-disable, 1-enable */ | 1964 | __le32 feature_mask; |
1874 | } __packed; | 1965 | } __packed; |
1875 | 1966 | ||
1876 | #define NUM_UNITS_IS_NUM_VDEVS 0x1 | 1967 | #define NUM_UNITS_IS_NUM_VDEVS 0x1 |
@@ -2505,6 +2596,7 @@ struct wmi_pdev_param_map { | |||
2505 | u32 fast_channel_reset; | 2596 | u32 fast_channel_reset; |
2506 | u32 burst_dur; | 2597 | u32 burst_dur; |
2507 | u32 burst_enable; | 2598 | u32 burst_enable; |
2599 | u32 cal_period; | ||
2508 | }; | 2600 | }; |
2509 | 2601 | ||
2510 | #define WMI_PDEV_PARAM_UNSUPPORTED 0 | 2602 | #define WMI_PDEV_PARAM_UNSUPPORTED 0 |
@@ -2715,6 +2807,9 @@ enum wmi_10x_pdev_param { | |||
2715 | WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_MODE, | 2807 | WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_MODE, |
2716 | WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_BUFFER, | 2808 | WMI_10X_PDEV_PARAM_SET_MCAST2UCAST_BUFFER, |
2717 | WMI_10X_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER, | 2809 | WMI_10X_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER, |
2810 | WMI_10X_PDEV_PARAM_PEER_STA_PS_STATECHG_ENABLE, | ||
2811 | WMI_10X_PDEV_PARAM_RTS_FIXED_RATE, | ||
2812 | WMI_10X_PDEV_PARAM_CAL_PERIOD | ||
2718 | }; | 2813 | }; |
2719 | 2814 | ||
2720 | struct wmi_pdev_set_param_cmd { | 2815 | struct wmi_pdev_set_param_cmd { |
@@ -2722,6 +2817,9 @@ struct wmi_pdev_set_param_cmd { | |||
2722 | __le32 param_value; | 2817 | __le32 param_value; |
2723 | } __packed; | 2818 | } __packed; |
2724 | 2819 | ||
2820 | /* valid period is 1 ~ 60000ms, unit in millisecond */ | ||
2821 | #define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000 | ||
2822 | |||
2725 | struct wmi_pdev_get_tpc_config_cmd { | 2823 | struct wmi_pdev_get_tpc_config_cmd { |
2726 | /* parameter */ | 2824 | /* parameter */ |
2727 | __le32 param; | 2825 | __le32 param; |
@@ -3930,6 +4028,13 @@ enum wmi_sta_ps_param_pspoll_count { | |||
3930 | * Values greater than 0 indicate the maximum numer of PS-Poll frames | 4028 | * Values greater than 0 indicate the maximum numer of PS-Poll frames |
3931 | * FW will send before waking up. | 4029 | * FW will send before waking up. |
3932 | */ | 4030 | */ |
4031 | |||
4032 | /* When u-APSD is enabled the firmware will be very reluctant to exit | ||
4033 | * STA PS. This could result in very poor Rx performance with STA doing | ||
4034 | * PS-Poll for each and every buffered frame. This value is a bit | ||
4035 | * arbitrary. | ||
4036 | */ | ||
4037 | WMI_STA_PS_PSPOLL_COUNT_UAPSD = 3, | ||
3933 | }; | 4038 | }; |
3934 | 4039 | ||
3935 | /* | 4040 | /* |
@@ -4120,7 +4225,7 @@ struct wmi_bcn_info { | |||
4120 | 4225 | ||
4121 | struct wmi_host_swba_event { | 4226 | struct wmi_host_swba_event { |
4122 | __le32 vdev_map; | 4227 | __le32 vdev_map; |
4123 | struct wmi_bcn_info bcn_info[1]; | 4228 | struct wmi_bcn_info bcn_info[0]; |
4124 | } __packed; | 4229 | } __packed; |
4125 | 4230 | ||
4126 | #define WMI_MAX_AP_VDEV 16 | 4231 | #define WMI_MAX_AP_VDEV 16 |
@@ -4567,6 +4672,58 @@ struct wmi_dbglog_cfg_cmd { | |||
4567 | 4672 | ||
4568 | #define WMI_MAX_MEM_REQS 16 | 4673 | #define WMI_MAX_MEM_REQS 16 |
4569 | 4674 | ||
4675 | struct wmi_scan_ev_arg { | ||
4676 | __le32 event_type; /* %WMI_SCAN_EVENT_ */ | ||
4677 | __le32 reason; /* %WMI_SCAN_REASON_ */ | ||
4678 | __le32 channel_freq; /* only valid for WMI_SCAN_EVENT_FOREIGN_CHANNEL */ | ||
4679 | __le32 scan_req_id; | ||
4680 | __le32 scan_id; | ||
4681 | __le32 vdev_id; | ||
4682 | }; | ||
4683 | |||
4684 | struct wmi_mgmt_rx_ev_arg { | ||
4685 | __le32 channel; | ||
4686 | __le32 snr; | ||
4687 | __le32 rate; | ||
4688 | __le32 phy_mode; | ||
4689 | __le32 buf_len; | ||
4690 | __le32 status; /* %WMI_RX_STATUS_ */ | ||
4691 | }; | ||
4692 | |||
4693 | struct wmi_ch_info_ev_arg { | ||
4694 | __le32 err_code; | ||
4695 | __le32 freq; | ||
4696 | __le32 cmd_flags; | ||
4697 | __le32 noise_floor; | ||
4698 | __le32 rx_clear_count; | ||
4699 | __le32 cycle_count; | ||
4700 | }; | ||
4701 | |||
4702 | struct wmi_vdev_start_ev_arg { | ||
4703 | __le32 vdev_id; | ||
4704 | __le32 req_id; | ||
4705 | __le32 resp_type; /* %WMI_VDEV_RESP_ */ | ||
4706 | __le32 status; | ||
4707 | }; | ||
4708 | |||
4709 | struct wmi_peer_kick_ev_arg { | ||
4710 | const u8 *mac_addr; | ||
4711 | }; | ||
4712 | |||
4713 | struct wmi_swba_ev_arg { | ||
4714 | __le32 vdev_map; | ||
4715 | const struct wmi_tim_info *tim_info[WMI_MAX_AP_VDEV]; | ||
4716 | const struct wmi_p2p_noa_info *noa_info[WMI_MAX_AP_VDEV]; | ||
4717 | }; | ||
4718 | |||
4719 | struct wmi_phyerr_ev_arg { | ||
4720 | __le32 num_phyerrs; | ||
4721 | __le32 tsf_l32; | ||
4722 | __le32 tsf_u32; | ||
4723 | __le32 buf_len; | ||
4724 | const struct wmi_phyerr *phyerrs; | ||
4725 | }; | ||
4726 | |||
4570 | struct wmi_svc_rdy_ev_arg { | 4727 | struct wmi_svc_rdy_ev_arg { |
4571 | __le32 min_tx_power; | 4728 | __le32 min_tx_power; |
4572 | __le32 max_tx_power; | 4729 | __le32 max_tx_power; |
@@ -4574,6 +4731,7 @@ struct wmi_svc_rdy_ev_arg { | |||
4574 | __le32 vht_cap; | 4731 | __le32 vht_cap; |
4575 | __le32 sw_ver0; | 4732 | __le32 sw_ver0; |
4576 | __le32 sw_ver1; | 4733 | __le32 sw_ver1; |
4734 | __le32 fw_build; | ||
4577 | __le32 phy_capab; | 4735 | __le32 phy_capab; |
4578 | __le32 num_rf_chains; | 4736 | __le32 num_rf_chains; |
4579 | __le32 eeprom_rd; | 4737 | __le32 eeprom_rd; |
@@ -4583,83 +4741,93 @@ struct wmi_svc_rdy_ev_arg { | |||
4583 | const struct wlan_host_mem_req *mem_reqs[WMI_MAX_MEM_REQS]; | 4741 | const struct wlan_host_mem_req *mem_reqs[WMI_MAX_MEM_REQS]; |
4584 | }; | 4742 | }; |
4585 | 4743 | ||
4744 | struct wmi_rdy_ev_arg { | ||
4745 | __le32 sw_version; | ||
4746 | __le32 abi_version; | ||
4747 | __le32 status; | ||
4748 | const u8 *mac_addr; | ||
4749 | }; | ||
4750 | |||
4751 | struct wmi_pdev_temperature_event { | ||
4752 | /* temperature value in Celcius degree */ | ||
4753 | __le32 temperature; | ||
4754 | } __packed; | ||
4755 | |||
4586 | struct ath10k; | 4756 | struct ath10k; |
4587 | struct ath10k_vif; | 4757 | struct ath10k_vif; |
4588 | struct ath10k_fw_stats; | 4758 | struct ath10k_fw_stats_pdev; |
4759 | struct ath10k_fw_stats_peer; | ||
4589 | 4760 | ||
4590 | int ath10k_wmi_attach(struct ath10k *ar); | 4761 | int ath10k_wmi_attach(struct ath10k *ar); |
4591 | void ath10k_wmi_detach(struct ath10k *ar); | 4762 | void ath10k_wmi_detach(struct ath10k *ar); |
4592 | int ath10k_wmi_wait_for_service_ready(struct ath10k *ar); | 4763 | int ath10k_wmi_wait_for_service_ready(struct ath10k *ar); |
4593 | int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar); | 4764 | int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar); |
4594 | 4765 | ||
4766 | struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len); | ||
4595 | int ath10k_wmi_connect(struct ath10k *ar); | 4767 | int ath10k_wmi_connect(struct ath10k *ar); |
4596 | 4768 | ||
4597 | struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len); | 4769 | struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len); |
4598 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); | 4770 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); |
4599 | 4771 | int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb, | |
4600 | int ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt); | 4772 | u32 cmd_id); |
4601 | int ath10k_wmi_pdev_resume_target(struct ath10k *ar); | ||
4602 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | ||
4603 | u16 rd5g, u16 ctl2g, u16 ctl5g, | ||
4604 | enum wmi_dfs_region dfs_reg); | ||
4605 | int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value); | ||
4606 | int ath10k_wmi_cmd_init(struct ath10k *ar); | ||
4607 | int ath10k_wmi_start_scan(struct ath10k *ar, const struct wmi_start_scan_arg *); | ||
4608 | void ath10k_wmi_start_scan_init(struct ath10k *ar, struct wmi_start_scan_arg *); | 4773 | void ath10k_wmi_start_scan_init(struct ath10k *ar, struct wmi_start_scan_arg *); |
4609 | int ath10k_wmi_stop_scan(struct ath10k *ar, | 4774 | |
4610 | const struct wmi_stop_scan_arg *arg); | 4775 | void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src, |
4611 | int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, | 4776 | struct ath10k_fw_stats_pdev *dst); |
4612 | enum wmi_vdev_type type, | 4777 | void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src, |
4613 | enum wmi_vdev_subtype subtype, | 4778 | struct ath10k_fw_stats_peer *dst); |
4614 | const u8 macaddr[ETH_ALEN]); | 4779 | void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar, |
4615 | int ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id); | 4780 | struct wmi_host_mem_chunks *chunks); |
4616 | int ath10k_wmi_vdev_start(struct ath10k *ar, | 4781 | void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn, |
4617 | const struct wmi_vdev_start_request_arg *); | 4782 | const struct wmi_start_scan_arg *arg); |
4618 | int ath10k_wmi_vdev_restart(struct ath10k *ar, | 4783 | void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params, |
4619 | const struct wmi_vdev_start_request_arg *); | 4784 | const struct wmi_wmm_params_arg *arg); |
4620 | int ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id); | 4785 | void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, |
4621 | int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, | 4786 | const struct wmi_channel_arg *arg); |
4622 | const u8 *bssid); | 4787 | int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg); |
4623 | int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id); | 4788 | |
4624 | int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, | 4789 | int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb); |
4625 | u32 param_id, u32 param_value); | 4790 | int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb); |
4626 | int ath10k_wmi_vdev_install_key(struct ath10k *ar, | 4791 | void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb); |
4627 | const struct wmi_vdev_install_key_arg *arg); | 4792 | void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb); |
4628 | int ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, | 4793 | int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb); |
4629 | const struct wmi_vdev_spectral_conf_arg *arg); | 4794 | void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb); |
4630 | int ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, | 4795 | void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb); |
4631 | u32 enable); | 4796 | void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb); |
4632 | int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, | 4797 | void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb); |
4633 | const u8 peer_addr[ETH_ALEN]); | 4798 | void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb); |
4634 | int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, | 4799 | void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, struct sk_buff *skb); |
4635 | const u8 peer_addr[ETH_ALEN]); | 4800 | void ath10k_wmi_event_dfs(struct ath10k *ar, |
4636 | int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, | 4801 | const struct wmi_phyerr *phyerr, u64 tsf); |
4637 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap); | 4802 | void ath10k_wmi_event_spectral_scan(struct ath10k *ar, |
4638 | int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, | 4803 | const struct wmi_phyerr *phyerr, |
4639 | const u8 *peer_addr, | 4804 | u64 tsf); |
4640 | enum wmi_peer_param param_id, u32 param_value); | 4805 | void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb); |
4641 | int ath10k_wmi_peer_assoc(struct ath10k *ar, | 4806 | void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb); |
4642 | const struct wmi_peer_assoc_complete_arg *arg); | 4807 | void ath10k_wmi_event_profile_match(struct ath10k *ar, struct sk_buff *skb); |
4643 | int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, | 4808 | void ath10k_wmi_event_debug_print(struct ath10k *ar, struct sk_buff *skb); |
4644 | enum wmi_sta_ps_mode psmode); | 4809 | void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb); |
4645 | int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, | 4810 | void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, struct sk_buff *skb); |
4646 | enum wmi_sta_powersave_param param_id, | 4811 | void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar, |
4647 | u32 value); | 4812 | struct sk_buff *skb); |
4648 | int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, | 4813 | void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar, |
4649 | enum wmi_ap_ps_peer_param param_id, u32 value); | 4814 | struct sk_buff *skb); |
4650 | int ath10k_wmi_scan_chan_list(struct ath10k *ar, | 4815 | void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, struct sk_buff *skb); |
4651 | const struct wmi_scan_chan_list_arg *arg); | 4816 | void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb); |
4652 | int ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif); | 4817 | void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb); |
4653 | int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, | 4818 | void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb); |
4654 | const struct wmi_pdev_set_wmm_params_arg *arg); | 4819 | void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb); |
4655 | int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id); | 4820 | void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar, |
4656 | int ath10k_wmi_force_fw_hang(struct ath10k *ar, | 4821 | struct sk_buff *skb); |
4657 | enum wmi_force_fw_hang_type type, u32 delay_ms); | 4822 | void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, struct sk_buff *skb); |
4658 | int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb); | 4823 | void ath10k_wmi_event_delba_complete(struct ath10k *ar, struct sk_buff *skb); |
4659 | int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable); | 4824 | void ath10k_wmi_event_addba_complete(struct ath10k *ar, struct sk_buff *skb); |
4660 | int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, | 4825 | void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar, |
4661 | struct ath10k_fw_stats *stats); | 4826 | struct sk_buff *skb); |
4662 | int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_list); | 4827 | void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, struct sk_buff *skb); |
4663 | int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar); | 4828 | void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, struct sk_buff *skb); |
4829 | void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb); | ||
4830 | void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb); | ||
4831 | int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb); | ||
4664 | 4832 | ||
4665 | #endif /* _WMI_H_ */ | 4833 | #endif /* _WMI_H_ */ |