From d18ba9f1351c4675948c87e33a571d28c97d53a7 Mon Sep 17 00:00:00 2001 From: Zekun Shen Date: Mon, 11 Jan 2021 19:49:29 +0200 Subject: ath10k: sanitity check for ep connectivity Function ep_rx_complete is being called without NULL checking in ath10k_htc_rx_completion_handler. Without such check, mal- formed packet is able to cause jump to NULL. ep->service_id seems a good candidate for sanity check as it is used in usb.c. Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200622022055.16028-1-bruceshenzk@gmail.com --- drivers/net/wireless/ath/ath10k/htc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 31df6dd04bf6..0a37be6a7d33 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -449,6 +449,10 @@ void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb) } ep = &htc->endpoint[eid]; + if (ep->service_id == ATH10K_HTC_SVC_ID_UNUSED) { + ath10k_warn(ar, "htc rx endpoint %d is not connected\n", eid); + goto out; + } payload_len = __le16_to_cpu(hdr->len); -- cgit v1.2.3 From 3e6b9cf534caa355f569c7cdde7cddd981331433 Mon Sep 17 00:00:00 2001 From: Linus Lüssing Date: Mon, 11 Jan 2021 19:49:29 +0200 Subject: ath10k: increase rx buffer size to 2048 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before, only frames with a maximum size of 1528 bytes could be transmitted between two 802.11s nodes. For batman-adv for instance, which adds its own header to each frame, we typically need an MTU of at least 1532 bytes to be able to transmit without fragmentation. This patch now increases the maxmimum frame size from 1528 to 1656 bytes. Tested with two ath10k devices in 802.11s mode, as well as with batman-adv on top of 802.11s with forwarding disabled. Fix originally found and developed by Ben Greear. Link: https://github.com/greearb/ath10k-ct/issues/89 Link: https://github.com/greearb/ath10k-ct/commit/9e5ab25027e0971fa24ccf93373324c08c4e992d Cc: Ben Greear Signed-off-by: Linus Lüssing Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200205191043.21913-1-linus.luessing@c0d3.blue --- drivers/net/wireless/ath/ath10k/htt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index cad59494f175..956157946106 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -2241,7 +2241,7 @@ struct htt_rx_chan_info { * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, * rounded up to a cache line size. */ -#define HTT_RX_BUF_SIZE 1920 +#define HTT_RX_BUF_SIZE 2048 #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle -- cgit v1.2.3 From cf8480d338a1b9156121e5e035e6b9721db4332a Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Mon, 11 Jan 2021 19:49:30 +0200 Subject: ath11k: remove duplicate function declaration Removed the duplicated peer related function declaration from core.h since those functions are already declared in peer.h Founded in code review. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01492-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Periyasamy Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1608304793-20612-1-git-send-email-periyasa@codeaurora.org --- drivers/net/wireless/ath/ath11k/core.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 799bf3de1117..9db375b193de 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -875,14 +875,6 @@ extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[]; extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[]; -void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id); -void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id, - u8 *mac_addr, u16 ast_hash); -struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id, - const u8 *addr); -struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab, - const u8 *addr); -struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab, int peer_id); int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab); int ath11k_core_pre_init(struct ath11k_base *ab); int ath11k_core_init(struct ath11k_base *ath11k); -- cgit v1.2.3 From 4c239f012f7b38012767100453ac8c2cc45cbc92 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Mon, 11 Jan 2021 19:49:31 +0200 Subject: ath10k: remove unused struct ath10k::dev_type It's unused so let's get rid of it. Compile tested only, no functional changes. Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1608574994-30706-1-git-send-email-kvalo@codeaurora.org --- drivers/net/wireless/ath/ath10k/core.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index f4be6bfb2539..cd206b16d68f 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1019,7 +1019,6 @@ struct ath10k { enum ath10k_hw_rev hw_rev; u16 dev_id; u32 chip_id; - enum ath10k_dev_type dev_type; u32 target_version; u8 fw_version_major; u32 fw_version_minor; -- cgit v1.2.3 From 0d96968315d7ffbd70d608b29e9bea084210b96d Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 18 Jan 2021 18:26:00 +0200 Subject: ath11k: add ieee80211_unregister_hw to avoid kernel crash caused by NULL pointer When function return fail to __ath11k_mac_register after success called ieee80211_register_hw, then it set wiphy->dev.parent to NULL by SET_IEEE80211_DEV(ar->hw, NULL) in end of __ath11k_mac_register, then cfg80211_get_drvinfo will be called by below call stack, but the wiphy->dev.parent is NULL, so kernel crash. Call stack to cfg80211_get_drvinfo: NetworkManager 826 [001] 6696.731371: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) ffffffffc107d8f1 cfg80211_get_drvinfo+0x1 (/lib/modules/5.10.0-rc1-wt-ath+/kernel/net/wireless-back/cfg80211.ko) ffffffff9d8fc529 ethtool_get_drvinfo+0x99 (vmlinux) ffffffff9d90080e dev_ethtool+0x1dbe (vmlinux) ffffffff9d8b88f7 dev_ioctl+0xb7 (vmlinux) ffffffff9d8668de sock_do_ioctl+0xae (vmlinux) ffffffff9d866d60 sock_ioctl+0x350 (vmlinux) ffffffff9d2ca30e __x64_sys_ioctl+0x8e (vmlinux) ffffffff9da0dda3 do_syscall_64+0x33 (vmlinux) ffffffff9dc0008c entry_SYSCALL_64_after_hwframe+0x44 (vmlinux) 7feb5f673007 __GI___ioctl+0x7 (/lib/x86_64-linux-gnu/libc-2.23.so) 0 [unknown] ([unknown]) Code of cfg80211_get_drvinfo, the pdev which is wiphy->dev.parent is NULL when kernel crash: void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { struct wireless_dev *wdev = dev->ieee80211_ptr; struct device *pdev = wiphy_dev(wdev->wiphy); if (pdev->driver) .... kernel crash log: [ 973.619550] ath11k_pci 0000:05:00.0: failed to perform regd update : -16 [ 973.619555] ath11k_pci 0000:05:00.0: ath11k regd update failed: -16 [ 973.619566] ath11k_pci 0000:05:00.0: failed register the radio with mac80211: -16 [ 973.619618] ath11k_pci 0000:05:00.0: failed to create pdev core: -16 [ 973.636035] BUG: kernel NULL pointer dereference, address: 0000000000000068 [ 973.636046] #PF: supervisor read access in kernel mode [ 973.636050] #PF: error_code(0x0000) - not-present page [ 973.636054] PGD 800000012452e067 P4D 800000012452e067 PUD 12452d067 PMD 0 [ 973.636064] Oops: 0000 [#1] SMP PTI [ 973.636072] CPU: 3 PID: 848 Comm: NetworkManager Kdump: loaded Tainted: G W OE 5.10.0-rc1-wt-ath+ #24 [ 973.636076] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW (1.33 ) 07/29/2011 [ 973.636161] RIP: 0010:cfg80211_get_drvinfo+0x25/0xd0 [cfg80211] [ 973.636169] Code: e9 c9 fe ff ff 66 66 66 66 90 55 53 ba 20 00 00 00 48 8b af 08 03 00 00 48 89 f3 48 8d 7e 04 48 8b 45 00 48 8b 80 90 01 00 00 <48> 8b 40 68 48 85 c0 0f 84 8d 00 00 00 48 8b 30 e8 a6 cc 72 c7 48 [ 973.636174] RSP: 0018:ffffaafb4040bbe0 EFLAGS: 00010286 [ 973.636180] RAX: 0000000000000000 RBX: ffffaafb4040bbfc RCX: 0000000000000000 [ 973.636184] RDX: 0000000000000020 RSI: ffffaafb4040bbfc RDI: ffffaafb4040bc00 [ 973.636188] RBP: ffff8a84c9568950 R08: 722d302e30312e35 R09: 74612d74772d3163 [ 973.636192] R10: 3163722d302e3031 R11: 2b6874612d74772d R12: ffffaafb4040bbfc [ 973.636196] R13: 00007ffe453707c0 R14: ffff8a84c9568000 R15: 0000000000000000 [ 973.636202] FS: 00007fd3d179b940(0000) GS:ffff8a84fa2c0000(0000) knlGS:0000000000000000 [ 973.636206] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 973.636211] CR2: 0000000000000068 CR3: 00000001153b6002 CR4: 00000000000606e0 [ 973.636215] Call Trace: [ 973.636234] ethtool_get_drvinfo+0x99/0x1f0 [ 973.636246] dev_ethtool+0x1dbe/0x2be0 [ 973.636256] ? mntput_no_expire+0x35/0x220 [ 973.636264] ? inet_ioctl+0x1ce/0x200 [ 973.636274] ? tomoyo_path_number_perm+0x68/0x1d0 [ 973.636282] ? kmem_cache_alloc+0x3cb/0x430 [ 973.636290] ? dev_ioctl+0xb7/0x570 [ 973.636295] dev_ioctl+0xb7/0x570 [ 973.636307] sock_do_ioctl+0xae/0x150 [ 973.636315] ? sock_ioctl+0x350/0x3c0 [ 973.636319] sock_ioctl+0x350/0x3c0 [ 973.636332] ? __x64_sys_ioctl+0x8e/0xd0 [ 973.636339] ? dlci_ioctl_set+0x30/0x30 [ 973.636346] __x64_sys_ioctl+0x8e/0xd0 [ 973.636359] do_syscall_64+0x33/0x80 [ 973.636368] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Sequence of function call when wlan load for success case when function __ath11k_mac_register return 0: kworker/u16:3-e 2922 [001] 6696.729734: probe:ieee80211_register_hw: (ffffffffc116ae60) kworker/u16:3-e 2922 [001] 6696.730210: probe:ieee80211_if_add: (ffffffffc1185cc0) NetworkManager 826 [001] 6696.731345: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) NetworkManager 826 [001] 6696.731371: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) NetworkManager 826 [001] 6696.731639: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) NetworkManager 826 [001] 6696.731653: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) NetworkManager 826 [001] 6696.732866: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) NetworkManager 826 [001] 6696.732893: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) systemd-udevd 3850 [003] 6696.737199: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) systemd-udevd 3850 [003] 6696.737226: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) NetworkManager 826 [000] 6696.759950: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) NetworkManager 826 [000] 6696.759967: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) NetworkManager 826 [000] 6696.760057: probe:ethtool_get_drvinfo: (ffffffff9d8fc490) NetworkManager 826 [000] 6696.760062: probe:cfg80211_get_drvinfo: (ffffffffc107d8f0) After apply this patch, kernel crash gone, and below is the test case's sequence of function call and log when wlan load with fail by function ath11k_regd_update, and __ath11k_mac_register return fail: kworker/u16:5-e 192 [001] 215.174388: probe:ieee80211_register_hw: (ffffffffc1131e60) kworker/u16:5-e 192 [000] 215.174973: probe:ieee80211_if_add: (ffffffffc114ccc0) NetworkManager 846 [001] 215.175857: probe:ethtool_get_drvinfo: (ffffffff928fc490) kworker/u16:5-e 192 [000] 215.175867: probe:ieee80211_unregister_hw: (ffffffffc1131970) NetworkManager 846 [001] 215.175880: probe:cfg80211_get_drvinfo: (ffffffffc107f8f0) NetworkManager 846 [001] 215.176105: probe:ethtool_get_drvinfo: (ffffffff928fc490) NetworkManager 846 [001] 215.176118: probe:cfg80211_get_drvinfo: (ffffffffc107f8f0) [ 215.175859] ath11k_pci 0000:05:00.0: ath11k regd update failed: -16 NetworkManager 846 [001] 215.196420: probe:ethtool_get_drvinfo: (ffffffff928fc490) NetworkManager 846 [001] 215.196430: probe:cfg80211_get_drvinfo: (ffffffffc107f8f0) [ 215.258598] ath11k_pci 0000:05:00.0: failed register the radio with mac80211: -16 [ 215.258613] ath11k_pci 0000:05:00.0: failed to create pdev core: -16 When ath11k_regd_update or ath11k_debugfs_register return fail, function ieee80211_unregister_hw of mac80211 will be called, then it will wait untill cfg80211_get_drvinfo finished, the wiphy->dev.parent is not NULL at this moment, after that, it set wiphy->dev.parent to NULL by SET_IEEE80211_DEV(ar->hw, NULL) in end of __ath11k_mac_register, so not happen kernel crash. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1608607824-16067-1-git-send-email-wgong@codeaurora.org --- drivers/net/wireless/ath/ath11k/mac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index c1608f64ea95..8f2c4b2afc25 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6360,17 +6360,20 @@ static int __ath11k_mac_register(struct ath11k *ar) ret = ath11k_regd_update(ar, true); if (ret) { ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); - goto err_free_if_combs; + goto err_unregister_hw; } ret = ath11k_debugfs_register(ar); if (ret) { ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); - goto err_free_if_combs; + goto err_unregister_hw; } return 0; +err_unregister_hw: + ieee80211_unregister_hw(ar->hw); + err_free_if_combs: kfree(ar->hw->wiphy->iface_combinations[0].limits); kfree(ar->hw->wiphy->iface_combinations); -- cgit v1.2.3 From 337cd0d3ce0c2e005b650d8ab8f2b05a91ca132e Mon Sep 17 00:00:00 2001 From: Zheng Yongjun Date: Mon, 18 Jan 2021 18:26:00 +0200 Subject: wcn36xx: Remove unnecessary memset memcpy operation is next to memset code, and the size to copy is equals to the size to memset, so the memset operation is unnecessary, remove it. Signed-off-by: Zheng Yongjun Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20201223012516.24286-1-zhengyongjun3@huawei.com --- drivers/net/wireless/ath/wcn36xx/smd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 5445277dd8de..28d3ee3ad4b9 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -485,7 +485,6 @@ static void init_hal_msg(struct wcn36xx_hal_msg_header *hdr, #define PREPARE_HAL_PTT_MSG_BUF(send_buf, p_msg_body) \ do { \ - memset(send_buf, 0, p_msg_body->header.len); \ memcpy(send_buf, p_msg_body, p_msg_body->header.len); \ } while (0) -- cgit v1.2.3 From 442545ba5452b50c471fd5cd04b7688945c8a7da Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Tue, 26 Jan 2021 18:56:22 +0200 Subject: ath10k: allow dynamic SAR power limits via common API ath10k assigns ath10k_mac_set_sar_specs to ath10k_ops, and this function is called when user space application calls NL80211_CMD_SET_SAR_SPECS. ath10k also registers SAR type, and supported frequency ranges to wiphy so user space can query SAR capabilities. This SAR power limitation is compared to regulatory txpower and selects the minimal one to set when station is connected. Otherwise, it delays until the station is connected. If the station is disconnected, it returns to regulatory txpower. This feature is controlled by hw parameter: dynamic_sar_support. Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 Signed-off-by: Carl Huang Reviewed-by: Brian Norris Reviewed-by: Abhishek Kumar Reported-by: kernel test robot Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20201203103728.3034-4-cjhuang@codeaurora.org --- drivers/net/wireless/ath/ath10k/core.c | 16 +++ drivers/net/wireless/ath/ath10k/core.h | 3 + drivers/net/wireless/ath/ath10k/hw.h | 2 + drivers/net/wireless/ath/ath10k/mac.c | 230 ++++++++++++++++++++++++--------- 4 files changed, 192 insertions(+), 59 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index a419ec7130f9..2f9be182fbfb 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -90,6 +90,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = true, + .dynamic_sar_support = false, }, { .id = QCA988X_HW_2_0_VERSION, @@ -124,6 +125,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = true, + .dynamic_sar_support = false, }, { .id = QCA9887_HW_1_0_VERSION, @@ -159,6 +161,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA6174_HW_3_2_VERSION, @@ -189,6 +192,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .bmi_large_size_download = true, .supports_peer_stats_info = true, + .dynamic_sar_support = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -223,6 +227,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA6174_HW_2_1_VERSION, @@ -257,6 +262,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA6174_HW_3_0_VERSION, @@ -291,6 +297,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA6174_HW_3_2_VERSION, @@ -329,6 +336,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .fw_diag_ce_download = true, .tx_stats_over_pktlog = false, .supports_peer_stats_info = true, + .dynamic_sar_support = true, }, { .id = QCA99X0_HW_2_0_DEV_VERSION, @@ -369,6 +377,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA9984_HW_1_0_DEV_VERSION, @@ -416,6 +425,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA9888_HW_2_0_DEV_VERSION, @@ -460,6 +470,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA9377_HW_1_0_DEV_VERSION, @@ -494,6 +505,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -530,6 +542,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = true, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -557,6 +570,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .ast_skid_limit = 0x10, .num_wds_entries = 0x20, .uart_pin_workaround = true, + .dynamic_sar_support = false, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -598,6 +612,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = true, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = false, }, { .id = WCN3990_HW_1_0_DEV_VERSION, @@ -625,6 +640,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .hw_filter_reset_required = false, .fw_diag_ce_download = false, .tx_stats_over_pktlog = false, + .dynamic_sar_support = true, }, }; diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index cd206b16d68f..648ed36f845f 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1295,6 +1295,9 @@ struct ath10k { bool coex_support; int coex_gpio_pin; + s32 tx_power_2g_limit; + s32 tx_power_5g_limit; + /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index c6ded21f5ed6..6b03c7787e36 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -623,6 +623,8 @@ struct ath10k_hw_params { /* provides bitrates for sta_statistics using WMI_TLV_PEER_STATS_INFO_EVENTID */ bool supports_peer_stats_info; + + bool dynamic_sar_support; }; struct htt_rx_desc; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7d98250380ec..8c2bc54e9253 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -81,6 +81,17 @@ static struct ieee80211_rate ath10k_rates_rev2[] = { { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, }; +static const struct cfg80211_sar_freq_ranges ath10k_sar_freq_ranges[] = { + {.start_freq = 2402, .end_freq = 2494 }, + {.start_freq = 5170, .end_freq = 5875 }, +}; + +static const struct cfg80211_sar_capa ath10k_sar_capa = { + .type = NL80211_SAR_TYPE_POWER, + .num_freq_ranges = (ARRAY_SIZE(ath10k_sar_freq_ranges)), + .freq_ranges = &ath10k_sar_freq_ranges[0], +}; + #define ATH10K_MAC_FIRST_OFDM_RATE_IDX 4 #define ath10k_a_rates (ath10k_rates + ATH10K_MAC_FIRST_OFDM_RATE_IDX) @@ -2880,6 +2891,158 @@ static int ath10k_mac_vif_recalc_txbf(struct ath10k *ar, return 0; } +static bool ath10k_mac_is_connected(struct ath10k *ar) +{ + struct ath10k_vif *arvif; + + list_for_each_entry(arvif, &ar->arvifs, list) { + if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) + return true; + } + + return false; +} + +static int ath10k_mac_txpower_setup(struct ath10k *ar, int txpower) +{ + int ret; + u32 param; + int tx_power_2g, tx_power_5g; + bool connected; + + lockdep_assert_held(&ar->conf_mutex); + + /* ath10k internally uses unit of 0.5 dBm so multiply by 2 */ + tx_power_2g = txpower * 2; + tx_power_5g = txpower * 2; + + connected = ath10k_mac_is_connected(ar); + + if (connected && ar->tx_power_2g_limit) + if (tx_power_2g > ar->tx_power_2g_limit) + tx_power_2g = ar->tx_power_2g_limit; + + if (connected && ar->tx_power_5g_limit) + if (tx_power_5g > ar->tx_power_5g_limit) + tx_power_5g = ar->tx_power_5g_limit; + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac txpower 2g: %d, 5g: %d\n", + tx_power_2g, tx_power_5g); + + param = ar->wmi.pdev_param->txpower_limit2g; + ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_2g); + if (ret) { + ath10k_warn(ar, "failed to set 2g txpower %d: %d\n", + tx_power_2g, ret); + return ret; + } + + param = ar->wmi.pdev_param->txpower_limit5g; + ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_5g); + if (ret) { + ath10k_warn(ar, "failed to set 5g txpower %d: %d\n", + tx_power_5g, ret); + return ret; + } + + return 0; +} + +static int ath10k_mac_txpower_recalc(struct ath10k *ar) +{ + struct ath10k_vif *arvif; + int ret, txpower = -1; + + lockdep_assert_held(&ar->conf_mutex); + + list_for_each_entry(arvif, &ar->arvifs, list) { + /* txpower not initialized yet? */ + if (arvif->txpower == INT_MIN) + continue; + + if (txpower == -1) + txpower = arvif->txpower; + else + txpower = min(txpower, arvif->txpower); + } + + if (txpower == -1) + return 0; + + ret = ath10k_mac_txpower_setup(ar, txpower); + if (ret) { + ath10k_warn(ar, "failed to setup tx power %d: %d\n", + txpower, ret); + return ret; + } + + return 0; +} + +static int ath10k_mac_set_sar_power(struct ath10k *ar) +{ + if (!ar->hw_params.dynamic_sar_support) + return -EOPNOTSUPP; + + if (!ath10k_mac_is_connected(ar)) + return 0; + + /* if connected, then arvif->txpower must be valid */ + return ath10k_mac_txpower_recalc(ar); +} + +static int ath10k_mac_set_sar_specs(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar) +{ + const struct cfg80211_sar_sub_specs *sub_specs; + struct ath10k *ar = hw->priv; + u32 i; + int ret; + + mutex_lock(&ar->conf_mutex); + + if (!ar->hw_params.dynamic_sar_support) { + ret = -EOPNOTSUPP; + goto err; + } + + if (!sar || sar->type != NL80211_SAR_TYPE_POWER || + sar->num_sub_specs == 0) { + ret = -EINVAL; + goto err; + } + + sub_specs = sar->sub_specs; + + /* 0dbm is not a practical value for ath10k, so use 0 + * as no SAR limitation on it. + */ + ar->tx_power_2g_limit = 0; + ar->tx_power_5g_limit = 0; + + /* note the power is in 0.25dbm unit, while ath10k uses + * 0.5dbm unit. + */ + for (i = 0; i < sar->num_sub_specs; i++) { + if (sub_specs->freq_range_index == 0) + ar->tx_power_2g_limit = sub_specs->power / 2; + else if (sub_specs->freq_range_index == 1) + ar->tx_power_5g_limit = sub_specs->power / 2; + + sub_specs++; + } + + ret = ath10k_mac_set_sar_power(ar); + if (ret) { + ath10k_warn(ar, "failed to set sar power: %d", ret); + goto err; + } + +err: + mutex_unlock(&ar->conf_mutex); + return ret; +} + /* can be called only in mac80211 callbacks due to `key_count` usage */ static void ath10k_bss_assoc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -2968,6 +3131,8 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw, arvif->is_up = true; + ath10k_mac_set_sar_power(ar); + /* Workaround: Some firmware revisions (tested with qca6174 * WLAN.RM.2.0-00073) have buggy powersave state machine and must be * poked with peer param command. @@ -3010,6 +3175,8 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw, arvif->is_up = false; + ath10k_mac_txpower_recalc(ar); + cancel_delayed_work_sync(&arvif->connection_loss_work); } @@ -5207,65 +5374,6 @@ static int ath10k_config_ps(struct ath10k *ar) return ret; } -static int ath10k_mac_txpower_setup(struct ath10k *ar, int txpower) -{ - int ret; - u32 param; - - lockdep_assert_held(&ar->conf_mutex); - - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac txpower %d\n", txpower); - - param = ar->wmi.pdev_param->txpower_limit2g; - ret = ath10k_wmi_pdev_set_param(ar, param, txpower * 2); - if (ret) { - ath10k_warn(ar, "failed to set 2g txpower %d: %d\n", - txpower, ret); - return ret; - } - - param = ar->wmi.pdev_param->txpower_limit5g; - ret = ath10k_wmi_pdev_set_param(ar, param, txpower * 2); - if (ret) { - ath10k_warn(ar, "failed to set 5g txpower %d: %d\n", - txpower, ret); - return ret; - } - - return 0; -} - -static int ath10k_mac_txpower_recalc(struct ath10k *ar) -{ - struct ath10k_vif *arvif; - int ret, txpower = -1; - - lockdep_assert_held(&ar->conf_mutex); - - list_for_each_entry(arvif, &ar->arvifs, list) { - /* txpower not initialized yet? */ - if (arvif->txpower == INT_MIN) - continue; - - if (txpower == -1) - txpower = arvif->txpower; - else - txpower = min(txpower, arvif->txpower); - } - - if (txpower == -1) - return 0; - - ret = ath10k_mac_txpower_setup(ar, txpower); - if (ret) { - ath10k_warn(ar, "failed to setup tx power %d: %d\n", - txpower, ret); - return ret; - } - - return 0; -} - static int ath10k_config(struct ieee80211_hw *hw, u32 changed) { struct ath10k *ar = hw->priv; @@ -9272,6 +9380,7 @@ static const struct ieee80211_ops ath10k_ops = { #ifdef CONFIG_MAC80211_DEBUGFS .sta_add_debugfs = ath10k_sta_add_debugfs, #endif + .set_sar_specs = ath10k_mac_set_sar_specs, }; #define CHAN2G(_channel, _freq, _flags) { \ @@ -10009,6 +10118,9 @@ int ath10k_mac_register(struct ath10k *ar) goto err_free; } + if (ar->hw_params.dynamic_sar_support) + ar->hw->wiphy->sar_capa = &ath10k_sar_capa; + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) ar->hw->netdev_features = NETIF_F_HW_CSUM; -- cgit v1.2.3 From 22df5e1bec25e8b321165b4707192fefbe9e0ba1 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 26 Jan 2021 18:56:23 +0200 Subject: ath10k: pass the ssid info to get the correct bss entity When connect to an AP with WPA mode, ath10k need to set need_ptk_4_way to firmware in WMI_PEER_ASSOC_CMD, then the data path is disallow in firmware, it will be allowed untill firmware finish the 4 way handshake. It failed with a test case with below steps: 1. configure AP with WPA mode with ssid1 SimpleConnect_a_orbvt_ch1, bssid1 and channel 1. 2. connect to ssid1 and ping success. 3. wait 10 seconds which is less than IEEE80211_SCAN_RESULT_EXPIRE(30 seconds). 4. configure AP with OPEN mode with ssid2 SimpleConnect_b_z3a00_ch1, but use same bssid1 and channel 1 of step 1. 5. disconnect ssid1. 6. connect to ssid2 and ping fail. Fail reason: When run step 6, ath10k_peer_assoc_h_crypto() called cfg80211_get_bss() with bssid and chan info, but ssid1 and ssid2 have the same bssid and channel, then there have 2 entry for ssid1 and ssid2 in cfg80211. The ssid1's order is before ssid2 in bss_list, and ssid1's age is less than the expire time which is IEEE80211_SCAN_RESULT_EXPIRE(30 seconds). Then ssid1's entry is selected and ath10k_peer_assoc_h_crypto() parsed it and get the rsnie and then need_ptk_4_way is set to firmware, so data path is disallowed and it will not receive 4 way handshake for OPEN mode, so ping fail in step 6. This patch is to pass the ssid info to cfg80211_get_bss() as same as cfg80211_mlme_assoc() and cfg80211_mlme_auth(), then it will find the correct bss entry in above test case, then case success. For AP mode, the ssid info is filled in ieee80211_start_ap(), for STATION mode, it is filled in ieee80211_mgd_assoc(). Tested for both AP/STATION mode with QCA6174 hw3.2 PCI, it is success start/connect/ping for WPA/OPEN mode. Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1607312195-3583-3-git-send-email-wgong@codeaurora.org --- drivers/net/wireless/ath/ath10k/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 8c2bc54e9253..8809950afb69 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2188,7 +2188,8 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k *ar, if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; - bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, + bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, + info->ssid_len ? info->ssid : NULL, info->ssid_len, IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); if (bss) { const struct cfg80211_bss_ies *ies; -- cgit v1.2.3 From b55379e343a3472c35f4a1245906db5158cab453 Mon Sep 17 00:00:00 2001 From: Miaoqing Pan Date: Tue, 22 Dec 2020 14:34:47 +0800 Subject: ath10k: fix wmi mgmt tx queue full due to race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Failed to transmit wmi management frames: [84977.840894] ath10k_snoc a000000.wifi: wmi mgmt tx queue is full [84977.840913] ath10k_snoc a000000.wifi: failed to transmit packet, dropping: -28 [84977.840924] ath10k_snoc a000000.wifi: failed to submit frame: -28 [84977.840932] ath10k_snoc a000000.wifi: failed to transmit frame: -28 This issue is caused by race condition between skb_dequeue and __skb_queue_tail. The queue of ‘wmi_mgmt_tx_queue’ is protected by a different lock: ar->data_lock vs list->lock, the result is no protection. So when ath10k_mgmt_over_wmi_tx_work() and ath10k_mac_tx_wmi_mgmt() running concurrently on different CPUs, there appear to be a rare corner cases when the queue length is 1, CPUx (skb_deuque) CPUy (__skb_queue_tail) next=list prev=list struct sk_buff *skb = skb_peek(list); WRITE_ONCE(newsk->next, next); WRITE_ONCE(list->qlen, list->qlen - 1);WRITE_ONCE(newsk->prev, prev); next = skb->next; WRITE_ONCE(next->prev, newsk); prev = skb->prev; WRITE_ONCE(prev->next, newsk); skb->next = skb->prev = NULL; list->qlen++; WRITE_ONCE(next->prev, prev); WRITE_ONCE(prev->next, next); If the instruction ‘next = skb->next’ is executed before ‘WRITE_ONCE(prev->next, newsk)’, newsk will be lost, as CPUx get the old ‘next’ pointer, but the length is still added by one. The final result is the length of the queue will reach the maximum value but the queue is empty. So remove ar->data_lock, and use 'skb_queue_tail' instead of '__skb_queue_tail' to prevent the potential race condition. Also switch to use skb_queue_len_lockless, in case we queue a few SKBs simultaneously. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1.c2-00033-QCAHLSWMTPLZ-1 Signed-off-by: Miaoqing Pan Reviewed-by: Brian Norris Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1608618887-8857-1-git-send-email-miaoqing@codeaurora.org --- drivers/net/wireless/ath/ath10k/mac.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 8809950afb69..84db56729cba 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3931,23 +3931,16 @@ bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar) static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb) { struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; - int ret = 0; - - spin_lock_bh(&ar->data_lock); - if (skb_queue_len(q) == ATH10K_MAX_NUM_MGMT_PENDING) { + if (skb_queue_len_lockless(q) >= ATH10K_MAX_NUM_MGMT_PENDING) { ath10k_warn(ar, "wmi mgmt tx queue is full\n"); - ret = -ENOSPC; - goto unlock; + return -ENOSPC; } - __skb_queue_tail(q, skb); + skb_queue_tail(q, skb); ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); -unlock: - spin_unlock_bh(&ar->data_lock); - - return ret; + return 0; } static enum ath10k_mac_tx_path -- cgit v1.2.3 From 779750bb153da37fb99388a7aad888c7798dc58a Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Wed, 27 Jan 2021 14:23:44 -0800 Subject: ath10k: remove h from printk format specifier This change fixes the checkpatch warning described in this commit commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi]. Signed-off-by: Tom Rix Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210127222344.2445641-1-trix@redhat.com --- drivers/net/wireless/ath/ath10k/htt_rx.c | 32 +++++++++++++++---------------- drivers/net/wireless/ath/ath10k/htt_tx.c | 12 ++++++------ drivers/net/wireless/ath/ath10k/mac.c | 12 ++++++------ drivers/net/wireless/ath/ath10k/trace.h | 4 ++-- drivers/net/wireless/ath/ath10k/txrx.c | 4 ++-- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 6 +++--- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- 7 files changed, 36 insertions(+), 36 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 9c4e6cf2137a..1a08156d5011 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2781,13 +2781,13 @@ static void ath10k_htt_rx_addba(struct ath10k *ar, struct htt_resp *resp) peer_id = MS(info0, HTT_RX_BA_INFO0_PEER_ID); ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt rx addba tid %hu peer_id %hu size %hhu\n", + "htt rx addba tid %u peer_id %u size %u\n", tid, peer_id, ev->window_size); spin_lock_bh(&ar->data_lock); peer = ath10k_peer_find_by_id(ar, peer_id); if (!peer) { - ath10k_warn(ar, "received addba event for invalid peer_id: %hu\n", + ath10k_warn(ar, "received addba event for invalid peer_id: %u\n", peer_id); spin_unlock_bh(&ar->data_lock); return; @@ -2802,7 +2802,7 @@ static void ath10k_htt_rx_addba(struct ath10k *ar, struct htt_resp *resp) } ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt rx start rx ba session sta %pM tid %hu size %hhu\n", + "htt rx start rx ba session sta %pM tid %u size %u\n", peer->addr, tid, ev->window_size); ieee80211_start_rx_ba_session_offl(arvif->vif, peer->addr, tid); @@ -2821,13 +2821,13 @@ static void ath10k_htt_rx_delba(struct ath10k *ar, struct htt_resp *resp) peer_id = MS(info0, HTT_RX_BA_INFO0_PEER_ID); ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt rx delba tid %hu peer_id %hu\n", + "htt rx delba tid %u peer_id %u\n", tid, peer_id); spin_lock_bh(&ar->data_lock); peer = ath10k_peer_find_by_id(ar, peer_id); if (!peer) { - ath10k_warn(ar, "received addba event for invalid peer_id: %hu\n", + ath10k_warn(ar, "received addba event for invalid peer_id: %u\n", peer_id); spin_unlock_bh(&ar->data_lock); return; @@ -2842,7 +2842,7 @@ static void ath10k_htt_rx_delba(struct ath10k *ar, struct htt_resp *resp) } ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt rx stop rx ba session sta %pM tid %hu\n", + "htt rx stop rx ba session sta %pM tid %u\n", peer->addr, tid); ieee80211_stop_rx_ba_session_offl(arvif->vif, peer->addr, tid); @@ -3102,7 +3102,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) return; } - ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch ind num records %hu num resps %hu seq %hu\n", + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch ind num records %u num resps %u seq %u\n", num_records, num_resp_ids, le16_to_cpu(resp->tx_fetch_ind.fetch_seq_num)); @@ -3127,12 +3127,12 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) max_num_msdus = le16_to_cpu(record->num_msdus); max_num_bytes = le32_to_cpu(record->num_bytes); - ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch record %i peer_id %hu tid %hhu msdus %zu bytes %zu\n", + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch record %i peer_id %u tid %u msdus %zu bytes %zu\n", i, peer_id, tid, max_num_msdus, max_num_bytes); if (unlikely(peer_id >= ar->htt.tx_q_state.num_peers) || unlikely(tid >= ar->htt.tx_q_state.num_tids)) { - ath10k_warn(ar, "received out of range peer_id %hu tid %hhu\n", + ath10k_warn(ar, "received out of range peer_id %u tid %u\n", peer_id, tid); continue; } @@ -3146,7 +3146,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) */ if (unlikely(!txq)) { - ath10k_warn(ar, "failed to lookup txq for peer_id %hu tid %hhu\n", + ath10k_warn(ar, "failed to lookup txq for peer_id %u tid %u\n", peer_id, tid); continue; } @@ -3259,7 +3259,7 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar, threshold = MS(info1, HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD); ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt rx tx mode switch ind info0 0x%04hx info1 0x%04hx enable %d num records %zd mode %d threshold %hu\n", + "htt rx tx mode switch ind info0 0x%04hx info1 0x%04x enable %d num records %zd mode %d threshold %u\n", info0, info1, enable, num_records, mode, threshold); len += sizeof(resp->tx_mode_switch_ind.records[0]) * num_records; @@ -3296,7 +3296,7 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar, if (unlikely(peer_id >= ar->htt.tx_q_state.num_peers) || unlikely(tid >= ar->htt.tx_q_state.num_tids)) { - ath10k_warn(ar, "received out of range peer_id %hu tid %hhu\n", + ath10k_warn(ar, "received out of range peer_id %u tid %u\n", peer_id, tid); continue; } @@ -3310,7 +3310,7 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar, */ if (unlikely(!txq)) { - ath10k_warn(ar, "failed to lookup txq for peer_id %hu tid %hhu\n", + ath10k_warn(ar, "failed to lookup txq for peer_id %u tid %u\n", peer_id, tid); continue; } @@ -3348,7 +3348,7 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) return i; } - ath10k_warn(ar, "Invalid legacy rate %hhd peer stats", rate); + ath10k_warn(ar, "Invalid legacy rate %d peer stats", rate); return -EINVAL; } @@ -3502,13 +3502,13 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar, return; if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) { - ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); + ath10k_warn(ar, "Invalid VHT mcs %d peer stats", txrate.mcs); return; } if (txrate.flags == WMI_RATE_PREAMBLE_HT && (txrate.mcs > 7 || txrate.nss < 1)) { - ath10k_warn(ar, "Invalid HT mcs %hhd nss %hhd peer stats", + ath10k_warn(ar, "Invalid HT mcs %d nss %d peer stats", txrate.mcs, txrate.nss); return; } diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 1fc0a312ab58..77f4d27e9d07 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -72,7 +72,7 @@ static void __ath10k_htt_tx_txq_recalc(struct ieee80211_hw *hw, if (unlikely(peer_id >= ar->htt.tx_q_state.num_peers) || unlikely(tid >= ar->htt.tx_q_state.num_tids)) { - ath10k_warn(ar, "refusing to update txq for peer_id %hu tid %hhu due to out of bounds\n", + ath10k_warn(ar, "refusing to update txq for peer_id %u tid %u due to out of bounds\n", peer_id, tid); return; } @@ -81,7 +81,7 @@ static void __ath10k_htt_tx_txq_recalc(struct ieee80211_hw *hw, ar->htt.tx_q_state.vaddr->map[tid][idx] &= ~bit; ar->htt.tx_q_state.vaddr->map[tid][idx] |= count ? bit : 0; - ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx txq state update peer_id %hu tid %hhu count %hhu\n", + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx txq state update peer_id %u tid %u count %u\n", peer_id, tid, count); } @@ -213,7 +213,7 @@ void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id) lockdep_assert_held(&htt->tx_lock); - ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx free msdu_id %hu\n", msdu_id); + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx free msdu_id %u\n", msdu_id); idr_remove(&htt->pending_tx, msdu_id); } @@ -507,7 +507,7 @@ static int ath10k_htt_tx_clean_up_pending(int msdu_id, void *skb, void *ctx) struct ath10k_htt *htt = &ar->htt; struct htt_tx_done tx_done = {0}; - ath10k_dbg(ar, ATH10K_DBG_HTT, "force cleanup msdu_id %hu\n", msdu_id); + ath10k_dbg(ar, ATH10K_DBG_HTT, "force cleanup msdu_id %u\n", msdu_id); tx_done.msdu_id = msdu_id; tx_done.status = HTT_TX_COMPL_STATE_DISCARD; @@ -1557,7 +1557,7 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt, trace_ath10k_htt_tx(ar, msdu_id, msdu->len, vdev_id, tid); ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt tx flags0 %hhu flags1 %hu len %d id %hu frags_paddr %pad, msdu_paddr %pad vdev %hhu tid %hhu freq %hu\n", + "htt tx flags0 %u flags1 %u len %d id %u frags_paddr %pad, msdu_paddr %pad vdev %u tid %u freq %u\n", flags0, flags1, msdu->len, msdu_id, &frags_paddr, &skb_cb->paddr, vdev_id, tid, freq); ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt tx msdu: ", @@ -1766,7 +1766,7 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt, trace_ath10k_htt_tx(ar, msdu_id, msdu->len, vdev_id, tid); ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt tx flags0 %hhu flags1 %hu len %d id %hu frags_paddr %pad, msdu_paddr %pad vdev %hhu tid %hhu freq %hu\n", + "htt tx flags0 %u flags1 %u len %d id %u frags_paddr %pad, msdu_paddr %pad vdev %u tid %u freq %u\n", flags0, flags1, msdu->len, msdu_id, &frags_paddr, &skb_cb->paddr, vdev_id, tid, freq); ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt tx msdu: ", diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 84db56729cba..d403c9fd4980 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8171,7 +8171,7 @@ static int ath10k_mac_set_fixed_rate_params(struct ath10k_vif *arvif, lockdep_assert_held(&ar->conf_mutex); - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02hhx nss %hhu sgi %hhu\n", + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02x nss %u sgi %u\n", arvif->vdev_id, rate, nss, sgi); vdev_param = ar->wmi.vdev_param->fixed_rate; @@ -8528,7 +8528,7 @@ static int ath10k_ampdu_action(struct ieee80211_hw *hw, enum ieee80211_ampdu_mlme_action action = params->action; u16 tid = params->tid; - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ampdu vdev_id %i sta %pM tid %hu action %d\n", + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ampdu vdev_id %i sta %pM tid %u action %d\n", arvif->vdev_id, sta->addr, tid, action); switch (action) { @@ -8624,7 +8624,7 @@ ath10k_mac_update_vif_chan(struct ath10k *ar, arvif = (void *)vifs[i].vif->drv_priv; ath10k_dbg(ar, ATH10K_DBG_MAC, - "mac chanctx switch vdev_id %i freq %hu->%hu width %d->%d\n", + "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", arvif->vdev_id, vifs[i].old_ctx->def.chan->center_freq, vifs[i].new_ctx->def.chan->center_freq, @@ -8698,7 +8698,7 @@ ath10k_mac_op_add_chanctx(struct ieee80211_hw *hw, struct ath10k *ar = hw->priv; ath10k_dbg(ar, ATH10K_DBG_MAC, - "mac chanctx add freq %hu width %d ptr %pK\n", + "mac chanctx add freq %u width %d ptr %pK\n", ctx->def.chan->center_freq, ctx->def.width, ctx); mutex_lock(&ar->conf_mutex); @@ -8722,7 +8722,7 @@ ath10k_mac_op_remove_chanctx(struct ieee80211_hw *hw, struct ath10k *ar = hw->priv; ath10k_dbg(ar, ATH10K_DBG_MAC, - "mac chanctx remove freq %hu width %d ptr %pK\n", + "mac chanctx remove freq %u width %d ptr %pK\n", ctx->def.chan->center_freq, ctx->def.width, ctx); mutex_lock(&ar->conf_mutex); @@ -8787,7 +8787,7 @@ ath10k_mac_op_change_chanctx(struct ieee80211_hw *hw, mutex_lock(&ar->conf_mutex); ath10k_dbg(ar, ATH10K_DBG_MAC, - "mac chanctx change freq %hu width %d ptr %pK changed %x\n", + "mac chanctx change freq %u width %d ptr %pK changed %x\n", ctx->def.chan->center_freq, ctx->def.width, ctx, changed); /* This shouldn't really happen because channel switching should use diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h index 842e42ec814f..4714c86bb501 100644 --- a/drivers/net/wireless/ath/ath10k/trace.h +++ b/drivers/net/wireless/ath/ath10k/trace.h @@ -283,7 +283,7 @@ TRACE_EVENT(ath10k_htt_pktlog, ), TP_printk( - "%s %s %d size %hu", + "%s %s %d size %u", __get_str(driver), __get_str(device), __entry->hw_type, @@ -488,7 +488,7 @@ TRACE_EVENT(ath10k_wmi_diag_container, ), TP_printk( - "%s %s diag container type %hhu timestamp %u code %u len %d", + "%s %s diag container type %u timestamp %u code %u len %d", __get_str(driver), __get_str(device), __entry->type, diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index aefe1f7f906c..7c9ea0c073d8 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -211,7 +211,7 @@ void ath10k_peer_map_event(struct ath10k_htt *htt, if (ev->peer_id >= ATH10K_MAX_NUM_PEER_IDS) { ath10k_warn(ar, - "received htt peer map event with idx out of bounds: %hu\n", + "received htt peer map event with idx out of bounds: %u\n", ev->peer_id); return; } @@ -247,7 +247,7 @@ void ath10k_peer_unmap_event(struct ath10k_htt *htt, if (ev->peer_id >= ATH10K_MAX_NUM_PEER_IDS) { ath10k_warn(ar, - "received htt peer unmap event with idx out of bounds: %hu\n", + "received htt peer unmap event with idx out of bounds: %u\n", ev->peer_id); return; } diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 7b5834157fe5..72d64af8e229 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -93,7 +93,7 @@ ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len, if (tlv_len > len) { ath10k_dbg(ar, ATH10K_DBG_WMI, - "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n", + "wmi tlv parse failure of tag %u at byte %zd (%zu bytes left, %u expected)\n", tlv_tag, ptr - begin, len, tlv_len); return -EINVAL; } @@ -102,7 +102,7 @@ ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len, wmi_tlv_policies[tlv_tag].min_len && wmi_tlv_policies[tlv_tag].min_len > tlv_len) { ath10k_dbg(ar, ATH10K_DBG_WMI, - "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n", + "wmi tlv parse failure of tag %u at byte %zd (%u bytes is less than min length %zu)\n", tlv_tag, ptr - begin, tlv_len, wmi_tlv_policies[tlv_tag].min_len); return -EINVAL; @@ -421,7 +421,7 @@ static int ath10k_wmi_tlv_event_p2p_noa(struct ath10k *ar, vdev_id = __le32_to_cpu(ev->vdev_id); ath10k_dbg(ar, ATH10K_DBG_WMI, - "wmi tlv p2p noa vdev_id %i descriptors %hhu\n", + "wmi tlv p2p noa vdev_id %i descriptors %u\n", vdev_id, noa->num_descriptors); ath10k_p2p_noa_update_by_vdev_id(ar, vdev_id, noa); diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 1f33947e2088..29f64315a3b5 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -9551,7 +9551,7 @@ static int ath10k_wmi_mgmt_tx_clean_up_pending(int msdu_id, void *ptr, struct sk_buff *msdu; ath10k_dbg(ar, ATH10K_DBG_WMI, - "force cleanup mgmt msdu_id %hu\n", msdu_id); + "force cleanup mgmt msdu_id %u\n", msdu_id); msdu = pkt_addr->vaddr; dma_unmap_single(ar->dev, pkt_addr->paddr, -- cgit v1.2.3 From bb2d2dfd3c93cd5b26535694a46450c0c3d21bb1 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 28 Jan 2021 06:49:28 -0800 Subject: ath11k: remove h from printk format specifier This change fixes the checkpatch warning described in this commit commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi]. Signed-off-by: Tom Rix Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210128144928.2557605-1-trix@redhat.com --- drivers/net/wireless/ath/ath11k/dp_rx.c | 10 +++++----- drivers/net/wireless/ath/ath11k/mac.c | 10 +++++----- drivers/net/wireless/ath/ath11k/trace.h | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/net/wireless/ath') diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 42328a06107b..859cfcabceb5 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1292,7 +1292,7 @@ int ath11k_dp_htt_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len, len -= sizeof(*tlv); if (tlv_len > len) { - ath11k_err(ab, "htt tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n", + ath11k_err(ab, "htt tlv parse failure of tag %u at byte %zd (%zu bytes left, %u expected)\n", tlv_tag, ptr - begin, len, tlv_len); return -EINVAL; } @@ -1381,22 +1381,22 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, */ if (flags == WMI_RATE_PREAMBLE_HE && mcs > 11) { - ath11k_warn(ab, "Invalid HE mcs %hhd peer stats", mcs); + ath11k_warn(ab, "Invalid HE mcs %d peer stats", mcs); return; } if (flags == WMI_RATE_PREAMBLE_HE && mcs > ATH11K_HE_MCS_MAX) { - ath11k_warn(ab, "Invalid HE mcs %hhd peer stats", mcs); + ath11k_warn(ab, "Invalid HE mcs %d peer stats", mcs); return; } if (flags == WMI_RATE_PREAMBLE_VHT && mcs > ATH11K_VHT_MCS_MAX) { - ath11k_warn(ab, "Invalid VHT mcs %hhd peer stats", mcs); + ath11k_warn(ab, "Invalid VHT mcs %d peer stats", mcs); return; } if (flags == WMI_RATE_PREAMBLE_HT && (mcs > ATH11K_HT_MCS_MAX || nss < 1)) { - ath11k_warn(ab, "Invalid HT mcs %hhd nss %hhd peer stats", + ath11k_warn(ab, "Invalid HT mcs %d nss %d peer stats", mcs, nss); return; } diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 8f2c4b2afc25..288720c5ab01 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4849,7 +4849,7 @@ static int ath11k_mac_op_add_chanctx(struct ieee80211_hw *hw, struct ath11k_base *ab = ar->ab; ath11k_dbg(ab, ATH11K_DBG_MAC, - "mac chanctx add freq %hu width %d ptr %pK\n", + "mac chanctx add freq %u width %d ptr %pK\n", ctx->def.chan->center_freq, ctx->def.width, ctx); mutex_lock(&ar->conf_mutex); @@ -4873,7 +4873,7 @@ static void ath11k_mac_op_remove_chanctx(struct ieee80211_hw *hw, struct ath11k_base *ab = ar->ab; ath11k_dbg(ab, ATH11K_DBG_MAC, - "mac chanctx remove freq %hu width %d ptr %pK\n", + "mac chanctx remove freq %u width %d ptr %pK\n", ctx->def.chan->center_freq, ctx->def.width, ctx); mutex_lock(&ar->conf_mutex); @@ -5117,7 +5117,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, arvif = (void *)vifs[i].vif->drv_priv; ath11k_dbg(ab, ATH11K_DBG_MAC, - "mac chanctx switch vdev_id %i freq %hu->%hu width %d->%d\n", + "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", arvif->vdev_id, vifs[i].old_ctx->def.chan->center_freq, vifs[i].new_ctx->def.chan->center_freq, @@ -5214,7 +5214,7 @@ static void ath11k_mac_op_change_chanctx(struct ieee80211_hw *hw, mutex_lock(&ar->conf_mutex); ath11k_dbg(ab, ATH11K_DBG_MAC, - "mac chanctx change freq %hu width %d ptr %pK changed %x\n", + "mac chanctx change freq %u width %d ptr %pK changed %x\n", ctx->def.chan->center_freq, ctx->def.width, ctx, changed); /* This shouldn't really happen because channel switching should use @@ -5583,7 +5583,7 @@ static int ath11k_mac_set_fixed_rate_params(struct ath11k_vif *arvif, lockdep_assert_held(&ar->conf_mutex); - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02hhx nss %hhu sgi %hhu\n", + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02x nss %u sgi %u\n", arvif->vdev_id, rate, nss, sgi); vdev_param = WMI_VDEV_PARAM_FIXED_RATE; diff --git a/drivers/net/wireless/ath/ath11k/trace.h b/drivers/net/wireless/ath/ath11k/trace.h index 66d0aae7816c..d2d2a3cb0826 100644 --- a/drivers/net/wireless/ath/ath11k/trace.h +++ b/drivers/net/wireless/ath/ath11k/trace.h @@ -43,7 +43,7 @@ TRACE_EVENT(ath11k_htt_pktlog, ), TP_printk( - "%s %s size %hu pktlog_checksum %d", + "%s %s size %u pktlog_checksum %d", __get_str(driver), __get_str(device), __entry->buf_len, diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 73869d445c5b..2e6ce28ecc8d 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -169,7 +169,7 @@ ath11k_wmi_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len, len -= sizeof(*tlv); if (tlv_len > len) { - ath11k_err(ab, "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n", + ath11k_err(ab, "wmi tlv parse failure of tag %u at byte %zd (%zu bytes left, %u expected)\n", tlv_tag, ptr - begin, len, tlv_len); return -EINVAL; } @@ -177,7 +177,7 @@ ath11k_wmi_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len, if (tlv_tag < ARRAY_SIZE(wmi_tlv_policies) && wmi_tlv_policies[tlv_tag].min_len && wmi_tlv_policies[tlv_tag].min_len > tlv_len) { - ath11k_err(ab, "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n", + ath11k_err(ab, "wmi tlv parse failure of tag %u at byte %zd (%u bytes is less than min length %zu)\n", tlv_tag, ptr - begin, tlv_len, wmi_tlv_policies[tlv_tag].min_len); return -EINVAL; -- cgit v1.2.3