Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ath-next-20250922' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath

Jeff Johnson says:
==================
ath.git patches for v6.18

Highlights for some specific drivers include:

ath10k:
Fix connection after GTK rekeying

ath12k:
Fix Issues in REO RX Queue Updates
Handle inactivity STA kickout event

And of course there is the usual set of cleanups and bug fixes across
the entire family of "ath" drivers.
==================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+669 -283
+1 -2
drivers/net/wireless/ath/ath10k/leds.c
··· 27 27 goto out; 28 28 29 29 ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; 30 - ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); 30 + ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, ar->leds.gpio_state_pin); 31 31 32 32 out: 33 33 mutex_unlock(&ar->conf_mutex); ··· 64 64 snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", 65 65 wiphy_name(ar->hw->wiphy)); 66 66 ar->leds.wifi_led.active_low = 1; 67 - ar->leds.wifi_led.gpio = ar->hw_params.led_pin; 68 67 ar->leds.wifi_led.name = ar->leds.label; 69 68 ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; 70 69
+10 -2
drivers/net/wireless/ath/ath10k/mac.c
··· 16 16 #include <linux/acpi.h> 17 17 #include <linux/of.h> 18 18 #include <linux/bitfield.h> 19 + #include <linux/random.h> 19 20 20 21 #include "hif.h" 21 22 #include "core.h" ··· 291 290 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 292 291 293 292 if (cmd == DISABLE_KEY) { 294 - arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; 295 - arg.key_data = NULL; 293 + if (flags & WMI_KEY_GROUP) { 294 + /* Not all hardware handles group-key deletion operation 295 + * correctly. Replace the key with a junk value to invalidate it. 296 + */ 297 + get_random_bytes(key->key, key->keylen); 298 + } else { 299 + arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; 300 + arg.key_data = NULL; 301 + } 296 302 } 297 303 298 304 return ath10k_wmi_vdev_install_key(arvif->ar, &arg);
+3 -11
drivers/net/wireless/ath/ath10k/snoc.c
··· 13 13 #include <linux/property.h> 14 14 #include <linux/regulator/consumer.h> 15 15 #include <linux/remoteproc/qcom_rproc.h> 16 - #include <linux/of_address.h> 16 + #include <linux/of_reserved_mem.h> 17 17 #include <linux/iommu.h> 18 18 19 19 #include "ce.h" ··· 1559 1559 static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) 1560 1560 { 1561 1561 struct device *dev = ar->dev; 1562 - struct device_node *node; 1563 1562 struct resource r; 1564 1563 int ret; 1565 1564 1566 - node = of_parse_phandle(dev->of_node, "memory-region", 0); 1567 - if (node) { 1568 - ret = of_address_to_resource(node, 0, &r); 1569 - of_node_put(node); 1570 - if (ret) { 1571 - dev_err(dev, "failed to resolve msa fixed region\n"); 1572 - return ret; 1573 - } 1574 - 1565 + ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &r); 1566 + if (!ret) { 1575 1567 ar->msa.paddr = r.start; 1576 1568 ar->msa.mem_size = resource_size(&r); 1577 1569 ar->msa.vaddr = devm_memremap(dev, ar->msa.paddr,
+19 -20
drivers/net/wireless/ath/ath10k/wmi.c
··· 1764 1764 1765 1765 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar) 1766 1766 { 1767 + unsigned long timeout = jiffies + WMI_SERVICE_READY_TIMEOUT_HZ; 1767 1768 unsigned long time_left, i; 1768 1769 1769 - time_left = wait_for_completion_timeout(&ar->wmi.service_ready, 1770 - WMI_SERVICE_READY_TIMEOUT_HZ); 1771 - if (!time_left) { 1772 - /* Sometimes the PCI HIF doesn't receive interrupt 1773 - * for the service ready message even if the buffer 1774 - * was completed. PCIe sniffer shows that it's 1775 - * because the corresponding CE ring doesn't fires 1776 - * it. Workaround here by polling CE rings once. 1777 - */ 1778 - ath10k_warn(ar, "failed to receive service ready completion, polling..\n"); 1779 - 1770 + /* Sometimes the PCI HIF doesn't receive interrupt 1771 + * for the service ready message even if the buffer 1772 + * was completed. PCIe sniffer shows that it's 1773 + * because the corresponding CE ring doesn't fires 1774 + * it. Workaround here by polling CE rings. Since 1775 + * the message could arrive at any time, continue 1776 + * polling until timeout. 1777 + */ 1778 + do { 1780 1779 for (i = 0; i < CE_COUNT; i++) 1781 1780 ath10k_hif_send_complete_check(ar, i, 1); 1782 1781 1782 + /* The 100 ms granularity is a tradeoff considering scheduler 1783 + * overhead and response latency 1784 + */ 1783 1785 time_left = wait_for_completion_timeout(&ar->wmi.service_ready, 1784 - WMI_SERVICE_READY_TIMEOUT_HZ); 1785 - if (!time_left) { 1786 - ath10k_warn(ar, "polling timed out\n"); 1787 - return -ETIMEDOUT; 1788 - } 1786 + msecs_to_jiffies(100)); 1787 + if (time_left) 1788 + return 0; 1789 + } while (time_before(jiffies, timeout)); 1789 1790 1790 - ath10k_warn(ar, "service ready completion received, continuing normally\n"); 1791 - } 1792 - 1793 - return 0; 1791 + ath10k_warn(ar, "failed to receive service ready completion\n"); 1792 + return -ETIMEDOUT; 1794 1793 } 1795 1794 1796 1795 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
+3 -14
drivers/net/wireless/ath/ath11k/ahb.c
··· 9 9 #include <linux/property.h> 10 10 #include <linux/of_device.h> 11 11 #include <linux/of.h> 12 + #include <linux/of_reserved_mem.h> 12 13 #include <linux/dma-mapping.h> 13 - #include <linux/of_address.h> 14 14 #include <linux/iommu.h> 15 15 #include "ahb.h" 16 16 #include "debug.h" ··· 919 919 { 920 920 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); 921 921 struct device *dev = ab->dev; 922 - struct device_node *node; 923 922 struct resource r; 924 923 int ret; 925 924 926 - node = of_parse_phandle(dev->of_node, "memory-region", 0); 927 - if (!node) 928 - return -ENOENT; 929 - 930 - ret = of_address_to_resource(node, 0, &r); 931 - of_node_put(node); 925 + ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &r); 932 926 if (ret) { 933 927 dev_err(dev, "failed to resolve msa fixed region\n"); 934 928 return ret; ··· 931 937 ab_ahb->fw.msa_paddr = r.start; 932 938 ab_ahb->fw.msa_size = resource_size(&r); 933 939 934 - node = of_parse_phandle(dev->of_node, "memory-region", 1); 935 - if (!node) 936 - return -ENOENT; 937 - 938 - ret = of_address_to_resource(node, 0, &r); 939 - of_node_put(node); 940 + ret = of_reserved_mem_region_to_resource(dev->of_node, 1, &r); 940 941 if (ret) { 941 942 dev_err(dev, "failed to resolve ce fixed region\n"); 942 943 return ret;
+2 -1
drivers/net/wireless/ath/ath11k/ce.c
··· 354 354 ret = ath11k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr); 355 355 356 356 if (ret) { 357 - ath11k_warn(ab, "failed to enqueue rx buf: %d\n", ret); 357 + ath11k_dbg(ab, ATH11K_DBG_CE, "failed to enqueue rx buf: %d\n", 358 + ret); 358 359 dma_unmap_single(ab->dev, paddr, 359 360 skb->len + skb_tailroom(skb), 360 361 DMA_FROM_DEVICE);
+1 -5
drivers/net/wireless/ath/ath11k/core.c
··· 2215 2215 mutex_unlock(&ab->core_lock); 2216 2216 2217 2217 ath11k_dp_free(ab); 2218 - ath11k_hal_srng_deinit(ab); 2218 + ath11k_hal_srng_clear(ab); 2219 2219 2220 2220 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; 2221 - 2222 - ret = ath11k_hal_srng_init(ab); 2223 - if (ret) 2224 - return ret; 2225 2221 2226 2222 clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); 2227 2223
-1
drivers/net/wireless/ath/ath11k/dp_rx.c
··· 4615 4615 msdu_details[i].buf_addr_info.info0) == 0) { 4616 4616 msdu_desc_info = &msdu_details[i - 1].rx_msdu_info; 4617 4617 msdu_desc_info->info0 |= last; 4618 - ; 4619 4618 break; 4620 4619 } 4621 4620 msdu_desc_info = &msdu_details[i].rx_msdu_info;
+16
drivers/net/wireless/ath/ath11k/hal.c
··· 1386 1386 } 1387 1387 EXPORT_SYMBOL(ath11k_hal_srng_deinit); 1388 1388 1389 + void ath11k_hal_srng_clear(struct ath11k_base *ab) 1390 + { 1391 + /* No need to memset rdp and wrp memory since each individual 1392 + * segment would get cleared in ath11k_hal_srng_src_hw_init() 1393 + * and ath11k_hal_srng_dst_hw_init(). 1394 + */ 1395 + memset(ab->hal.srng_list, 0, 1396 + sizeof(ab->hal.srng_list)); 1397 + memset(ab->hal.shadow_reg_addr, 0, 1398 + sizeof(ab->hal.shadow_reg_addr)); 1399 + ab->hal.avail_blk_resource = 0; 1400 + ab->hal.current_blk_index = 0; 1401 + ab->hal.num_shadow_reg_configured = 0; 1402 + } 1403 + EXPORT_SYMBOL(ath11k_hal_srng_clear); 1404 + 1389 1405 void ath11k_hal_dump_srng_stats(struct ath11k_base *ab) 1390 1406 { 1391 1407 struct hal_srng *srng;
+1
drivers/net/wireless/ath/ath11k/hal.h
··· 965 965 struct hal_srng_params *params); 966 966 int ath11k_hal_srng_init(struct ath11k_base *ath11k); 967 967 void ath11k_hal_srng_deinit(struct ath11k_base *ath11k); 968 + void ath11k_hal_srng_clear(struct ath11k_base *ab); 968 969 void ath11k_hal_dump_srng_stats(struct ath11k_base *ab); 969 970 void ath11k_hal_srng_get_shadow_config(struct ath11k_base *ab, 970 971 u32 **cfg, u32 *len);
+5 -14
drivers/net/wireless/ath/ath11k/qmi.c
··· 13 13 #include "debug.h" 14 14 #include "hif.h" 15 15 #include <linux/of.h> 16 - #include <linux/of_address.h> 16 + #include <linux/of_reserved_mem.h> 17 17 #include <linux/ioport.h> 18 18 #include <linux/firmware.h> 19 19 #include <linux/of_irq.h> ··· 2040 2040 static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab) 2041 2041 { 2042 2042 struct device *dev = ab->dev; 2043 - struct device_node *hremote_node = NULL; 2044 - struct resource res; 2043 + struct resource res = {}; 2045 2044 u32 host_ddr_sz; 2046 2045 int i, idx, ret; 2047 2046 2048 2047 for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) { 2049 2048 switch (ab->qmi.target_mem[i].type) { 2050 2049 case HOST_DDR_REGION_TYPE: 2051 - hremote_node = of_parse_phandle(dev->of_node, "memory-region", 0); 2052 - if (!hremote_node) { 2053 - ath11k_dbg(ab, ATH11K_DBG_QMI, 2054 - "fail to get hremote_node\n"); 2055 - return -ENODEV; 2056 - } 2057 - 2058 - ret = of_address_to_resource(hremote_node, 0, &res); 2059 - of_node_put(hremote_node); 2050 + ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &res); 2060 2051 if (ret) { 2061 2052 ath11k_dbg(ab, ATH11K_DBG_QMI, 2062 2053 "fail to get reg from hremote\n"); ··· 2086 2095 } 2087 2096 2088 2097 if (ath11k_core_coldboot_cal_support(ab)) { 2089 - if (hremote_node) { 2098 + if (resource_size(&res)) { 2090 2099 ab->qmi.target_mem[idx].paddr = 2091 2100 res.start + host_ddr_sz; 2092 2101 ab->qmi.target_mem[idx].iaddr = ··· 2548 2557 GFP_KERNEL); 2549 2558 if (!m3_mem->vaddr) { 2550 2559 ath11k_err(ab, "failed to allocate memory for M3 with size %zu\n", 2551 - fw->size); 2560 + m3_len); 2552 2561 ret = -ENOMEM; 2553 2562 goto out; 2554 2563 }
+3 -2
drivers/net/wireless/ath/ath12k/ce.c
··· 392 392 393 393 ret = ath12k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr); 394 394 if (ret) { 395 - ath12k_warn(ab, "failed to enqueue rx buf: %d\n", ret); 395 + ath12k_dbg(ab, ATH12K_DBG_CE, "failed to enqueue rx buf: %d\n", 396 + ret); 396 397 dma_unmap_single(ab->dev, paddr, 397 398 skb->len + skb_tailroom(skb), 398 399 DMA_FROM_DEVICE); ··· 479 478 } 480 479 481 480 while ((skb = __skb_dequeue(&list))) { 482 - ath12k_dbg(ab, ATH12K_DBG_AHB, "rx ce pipe %d len %d\n", 481 + ath12k_dbg(ab, ATH12K_DBG_CE, "rx ce pipe %d len %d\n", 483 482 pipe->pipe_num, skb->len); 484 483 pipe->recv_cb(ab, skb); 485 484 }
+6 -1
drivers/net/wireless/ath/ath12k/core.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. 5 5 */ 6 6 7 7 #ifndef ATH12K_CORE_H ··· 71 71 72 72 #define ATH12K_MAX_MLO_PEERS 256 73 73 #define ATH12K_MLO_PEER_ID_INVALID 0xFFFF 74 + 75 + #define ATH12K_INVALID_RSSI_FULL -1 76 + #define ATH12K_INVALID_RSSI_EMPTY -128 74 77 75 78 enum ath12k_bdf_search { 76 79 ATH12K_BDF_SEARCH_DEFAULT, ··· 563 560 u32 bw_prev; 564 561 u32 peer_nss; 565 562 s8 rssi_beacon; 563 + s8 chain_signal[IEEE80211_MAX_CHAINS]; 566 564 567 565 /* For now the assoc link will be considered primary */ 568 566 bool is_assoc_link; ··· 734 730 u32 txpower_scale; 735 731 u32 power_scale; 736 732 u32 chan_tx_pwr; 733 + u32 rts_threshold; 737 734 u32 num_stations; 738 735 u32 max_num_stations; 739 736
+1
drivers/net/wireless/ath/ath12k/debug.h
··· 26 26 ATH12K_DBG_DP_TX = 0x00002000, 27 27 ATH12K_DBG_DP_RX = 0x00004000, 28 28 ATH12K_DBG_WOW = 0x00008000, 29 + ATH12K_DBG_CE = 0x00010000, 29 30 ATH12K_DBG_ANY = 0xffffffff, 30 31 }; 31 32
+2
drivers/net/wireless/ath/ath12k/dp.c
··· 1745 1745 1746 1746 INIT_LIST_HEAD(&dp->reo_cmd_list); 1747 1747 INIT_LIST_HEAD(&dp->reo_cmd_cache_flush_list); 1748 + INIT_LIST_HEAD(&dp->reo_cmd_update_rx_queue_list); 1748 1749 spin_lock_init(&dp->reo_cmd_lock); 1750 + spin_lock_init(&dp->reo_rxq_flush_lock); 1749 1751 1750 1752 dp->reo_cmd_cache_flush_count = 0; 1751 1753 dp->idle_link_rbm = ath12k_dp_get_idle_link_rbm(ab);
+8 -4
drivers/net/wireless/ath/ath12k/dp.h
··· 184 184 #define DP_REO_REINJECT_RING_SIZE 32 185 185 #define DP_RX_RELEASE_RING_SIZE 1024 186 186 #define DP_REO_EXCEPTION_RING_SIZE 128 187 - #define DP_REO_CMD_RING_SIZE 128 187 + #define DP_REO_CMD_RING_SIZE 256 188 188 #define DP_REO_STATUS_RING_SIZE 2048 189 189 #define DP_RXDMA_BUF_RING_SIZE 4096 190 190 #define DP_RX_MAC_BUF_RING_SIZE 2048 ··· 389 389 struct dp_srng reo_dst_ring[DP_REO_DST_RING_MAX]; 390 390 struct dp_tx_ring tx_ring[DP_TCL_NUM_RING_MAX]; 391 391 struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX]; 392 - struct list_head reo_cmd_list; 392 + struct list_head reo_cmd_update_rx_queue_list; 393 393 struct list_head reo_cmd_cache_flush_list; 394 394 u32 reo_cmd_cache_flush_count; 395 - 396 395 /* protects access to below fields, 397 - * - reo_cmd_list 396 + * - reo_cmd_update_rx_queue_list 398 397 * - reo_cmd_cache_flush_list 399 398 * - reo_cmd_cache_flush_count 399 + */ 400 + spinlock_t reo_rxq_flush_lock; 401 + struct list_head reo_cmd_list; 402 + /* protects access to below fields, 403 + * - reo_cmd_list 400 404 */ 401 405 spinlock_t reo_cmd_lock; 402 406 struct ath12k_hp_update_timer reo_cmd_timer;
+42 -14
drivers/net/wireless/ath/ath12k/dp_mon.c
··· 1441 1441 } 1442 1442 1443 1443 static void 1444 + ath12k_parse_cmn_usr_info(const struct hal_phyrx_common_user_info *cmn_usr_info, 1445 + struct hal_rx_mon_ppdu_info *ppdu_info) 1446 + { 1447 + struct hal_rx_radiotap_eht *eht = &ppdu_info->eht_info.eht; 1448 + u32 known, data, cp_setting, ltf_size; 1449 + 1450 + known = __le32_to_cpu(eht->known); 1451 + known |= IEEE80211_RADIOTAP_EHT_KNOWN_GI | 1452 + IEEE80211_RADIOTAP_EHT_KNOWN_EHT_LTF; 1453 + eht->known = cpu_to_le32(known); 1454 + 1455 + cp_setting = le32_get_bits(cmn_usr_info->info0, 1456 + HAL_RX_CMN_USR_INFO0_CP_SETTING); 1457 + ltf_size = le32_get_bits(cmn_usr_info->info0, 1458 + HAL_RX_CMN_USR_INFO0_LTF_SIZE); 1459 + 1460 + data = __le32_to_cpu(eht->data[0]); 1461 + data |= u32_encode_bits(cp_setting, IEEE80211_RADIOTAP_EHT_DATA0_GI); 1462 + data |= u32_encode_bits(ltf_size, IEEE80211_RADIOTAP_EHT_DATA0_LTF); 1463 + eht->data[0] = cpu_to_le32(data); 1464 + 1465 + if (!ppdu_info->ltf_size) 1466 + ppdu_info->ltf_size = ltf_size; 1467 + if (!ppdu_info->gi) 1468 + ppdu_info->gi = cp_setting; 1469 + } 1470 + 1471 + static void 1444 1472 ath12k_dp_mon_parse_status_msdu_end(struct ath12k_mon_data *pmon, 1445 1473 const struct hal_rx_msdu_end *msdu_end) 1446 1474 { ··· 1655 1627 const struct hal_rx_phyrx_rssi_legacy_info *rssi = tlv_data; 1656 1628 1657 1629 info[0] = __le32_to_cpu(rssi->info0); 1658 - info[1] = __le32_to_cpu(rssi->info1); 1630 + info[2] = __le32_to_cpu(rssi->info2); 1659 1631 1660 1632 /* TODO: Please note that the combined rssi will not be accurate 1661 1633 * in MU case. Rssi in MU needs to be retrieved from 1662 1634 * PHYRX_OTHER_RECEIVE_INFO TLV. 1663 1635 */ 1664 1636 ppdu_info->rssi_comb = 1665 - u32_get_bits(info[1], 1666 - HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB); 1637 + u32_get_bits(info[2], 1638 + HAL_RX_RSSI_LEGACY_INFO_INFO2_RSSI_COMB_PPDU); 1667 1639 1668 1640 ppdu_info->bw = u32_get_bits(info[0], 1669 - HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RX_BW); 1641 + HAL_RX_RSSI_LEGACY_INFO_INFO0_RX_BW); 1670 1642 break; 1671 1643 } 1672 - case HAL_PHYRX_OTHER_RECEIVE_INFO: { 1673 - const struct hal_phyrx_common_user_info *cmn_usr_info = tlv_data; 1674 - 1675 - ppdu_info->gi = le32_get_bits(cmn_usr_info->info0, 1676 - HAL_RX_PHY_CMN_USER_INFO0_GI); 1644 + case HAL_PHYRX_COMMON_USER_INFO: { 1645 + ath12k_parse_cmn_usr_info(tlv_data, ppdu_info); 1677 1646 break; 1678 1647 } 1679 1648 case HAL_RX_PPDU_START_USER_INFO: ··· 2179 2154 spin_unlock_bh(&ar->data_lock); 2180 2155 2181 2156 rxs->flag |= RX_FLAG_MACTIME_START; 2182 - rxs->signal = ppduinfo->rssi_comb + noise_floor; 2183 2157 rxs->nss = ppduinfo->nss + 1; 2158 + if (test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT, 2159 + ar->ab->wmi_ab.svc_map)) 2160 + rxs->signal = ppduinfo->rssi_comb; 2161 + else 2162 + rxs->signal = ppduinfo->rssi_comb + noise_floor; 2184 2163 2185 2164 if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) { 2186 2165 rxs->flag |= RX_FLAG_AMPDU_DETAILS; ··· 2273 2244 2274 2245 static void ath12k_dp_mon_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napi, 2275 2246 struct sk_buff *msdu, 2247 + const struct hal_rx_mon_ppdu_info *ppduinfo, 2276 2248 struct ieee80211_rx_status *status, 2277 2249 u8 decap) 2278 2250 { ··· 2287 2257 struct ieee80211_sta *pubsta = NULL; 2288 2258 struct ath12k_peer *peer; 2289 2259 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 2290 - struct ath12k_dp_rx_info rx_info; 2291 2260 bool is_mcbc = rxcb->is_mcbc; 2292 2261 bool is_eapol_tkip = rxcb->is_eapol; 2293 2262 ··· 2300 2271 } 2301 2272 2302 2273 spin_lock_bh(&ar->ab->base_lock); 2303 - rx_info.addr2_present = false; 2304 - peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu, &rx_info); 2274 + peer = ath12k_peer_find_by_id(ar->ab, ppduinfo->peer_id); 2305 2275 if (peer && peer->sta) { 2306 2276 pubsta = peer->sta; 2307 2277 if (pubsta->valid_links) { ··· 2393 2365 decap = mon_mpdu->decap_format; 2394 2366 2395 2367 ath12k_dp_mon_update_radiotap(ar, ppduinfo, mon_skb, rxs); 2396 - ath12k_dp_mon_rx_deliver_msdu(ar, napi, mon_skb, rxs, decap); 2368 + ath12k_dp_mon_rx_deliver_msdu(ar, napi, mon_skb, ppduinfo, rxs, decap); 2397 2369 mon_skb = skb_next; 2398 2370 } while (mon_skb); 2399 2371 rxs->flag = 0;
+235 -117
drivers/net/wireless/ath/ath12k/dp_rx.c
··· 21 21 22 22 #define ATH12K_DP_RX_FRAGMENT_TIMEOUT_MS (2 * HZ) 23 23 24 + static int ath12k_dp_rx_tid_delete_handler(struct ath12k_base *ab, 25 + struct ath12k_dp_rx_tid_rxq *rx_tid); 26 + 24 27 static enum hal_encrypt_type ath12k_dp_rx_h_enctype(struct ath12k_base *ab, 25 28 struct hal_rx_desc *desc) 26 29 { ··· 584 581 return 0; 585 582 } 586 583 584 + static void ath12k_dp_init_rx_tid_rxq(struct ath12k_dp_rx_tid_rxq *rx_tid_rxq, 585 + struct ath12k_dp_rx_tid *rx_tid) 586 + { 587 + rx_tid_rxq->tid = rx_tid->tid; 588 + rx_tid_rxq->active = rx_tid->active; 589 + rx_tid_rxq->qbuf = rx_tid->qbuf; 590 + } 591 + 592 + static void ath12k_dp_rx_tid_cleanup(struct ath12k_base *ab, 593 + struct ath12k_reoq_buf *tid_qbuf) 594 + { 595 + if (tid_qbuf->vaddr) { 596 + dma_unmap_single(ab->dev, tid_qbuf->paddr_aligned, 597 + tid_qbuf->size, DMA_BIDIRECTIONAL); 598 + kfree(tid_qbuf->vaddr); 599 + tid_qbuf->vaddr = NULL; 600 + } 601 + } 602 + 587 603 void ath12k_dp_rx_reo_cmd_list_cleanup(struct ath12k_base *ab) 588 604 { 589 605 struct ath12k_dp *dp = &ab->dp; 590 606 struct ath12k_dp_rx_reo_cmd *cmd, *tmp; 591 607 struct ath12k_dp_rx_reo_cache_flush_elem *cmd_cache, *tmp_cache; 608 + struct dp_reo_update_rx_queue_elem *cmd_queue, *tmp_queue; 592 609 593 - spin_lock_bh(&dp->reo_cmd_lock); 594 - list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { 595 - list_del(&cmd->list); 596 - dma_unmap_single(ab->dev, cmd->data.qbuf.paddr_aligned, 597 - cmd->data.qbuf.size, DMA_BIDIRECTIONAL); 598 - kfree(cmd->data.qbuf.vaddr); 599 - kfree(cmd); 610 + spin_lock_bh(&dp->reo_rxq_flush_lock); 611 + list_for_each_entry_safe(cmd_queue, tmp_queue, &dp->reo_cmd_update_rx_queue_list, 612 + list) { 613 + list_del(&cmd_queue->list); 614 + ath12k_dp_rx_tid_cleanup(ab, &cmd_queue->rx_tid.qbuf); 615 + kfree(cmd_queue); 600 616 } 601 - 602 617 list_for_each_entry_safe(cmd_cache, tmp_cache, 603 618 &dp->reo_cmd_cache_flush_list, list) { 604 619 list_del(&cmd_cache->list); 605 620 dp->reo_cmd_cache_flush_count--; 606 - dma_unmap_single(ab->dev, cmd_cache->data.qbuf.paddr_aligned, 607 - cmd_cache->data.qbuf.size, DMA_BIDIRECTIONAL); 608 - kfree(cmd_cache->data.qbuf.vaddr); 621 + ath12k_dp_rx_tid_cleanup(ab, &cmd_cache->data.qbuf); 609 622 kfree(cmd_cache); 623 + } 624 + spin_unlock_bh(&dp->reo_rxq_flush_lock); 625 + 626 + spin_lock_bh(&dp->reo_cmd_lock); 627 + list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { 628 + list_del(&cmd->list); 629 + ath12k_dp_rx_tid_cleanup(ab, &cmd->data.qbuf); 630 + kfree(cmd); 610 631 } 611 632 spin_unlock_bh(&dp->reo_cmd_lock); 612 633 } ··· 638 611 static void ath12k_dp_reo_cmd_free(struct ath12k_dp *dp, void *ctx, 639 612 enum hal_reo_cmd_status status) 640 613 { 641 - struct ath12k_dp_rx_tid *rx_tid = ctx; 614 + struct ath12k_dp_rx_tid_rxq *rx_tid = ctx; 642 615 643 616 if (status != HAL_REO_CMD_SUCCESS) 644 617 ath12k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n", 645 618 rx_tid->tid, status); 646 619 647 - dma_unmap_single(dp->ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 648 - DMA_BIDIRECTIONAL); 649 - kfree(rx_tid->qbuf.vaddr); 650 - rx_tid->qbuf.vaddr = NULL; 620 + ath12k_dp_rx_tid_cleanup(dp->ab, &rx_tid->qbuf); 651 621 } 652 622 653 - static int ath12k_dp_reo_cmd_send(struct ath12k_base *ab, struct ath12k_dp_rx_tid *rx_tid, 623 + static int ath12k_dp_reo_cmd_send(struct ath12k_base *ab, 624 + struct ath12k_dp_rx_tid_rxq *rx_tid, 654 625 enum hal_reo_cmd_type type, 655 626 struct ath12k_hal_reo_cmd *cmd, 656 627 void (*cb)(struct ath12k_dp *dp, void *ctx, ··· 693 668 return 0; 694 669 } 695 670 696 - static void ath12k_dp_reo_cache_flush(struct ath12k_base *ab, 697 - struct ath12k_dp_rx_tid *rx_tid) 671 + static int ath12k_dp_reo_cache_flush(struct ath12k_base *ab, 672 + struct ath12k_dp_rx_tid_rxq *rx_tid) 698 673 { 699 674 struct ath12k_hal_reo_cmd cmd = {}; 700 - unsigned long tot_desc_sz, desc_sz; 701 675 int ret; 702 676 703 - tot_desc_sz = rx_tid->qbuf.size; 704 - desc_sz = ath12k_hal_reo_qdesc_size(0, HAL_DESC_REO_NON_QOS_TID); 705 - 706 - while (tot_desc_sz > desc_sz) { 707 - tot_desc_sz -= desc_sz; 708 - cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned + tot_desc_sz); 709 - cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 710 - ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 711 - HAL_REO_CMD_FLUSH_CACHE, &cmd, 712 - NULL); 713 - if (ret) 714 - ath12k_warn(ab, 715 - "failed to send HAL_REO_CMD_FLUSH_CACHE, tid %d (%d)\n", 716 - rx_tid->tid, ret); 717 - } 718 - 719 - memset(&cmd, 0, sizeof(cmd)); 720 677 cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 721 678 cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 722 - cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 679 + /* HAL_REO_CMD_FLG_FLUSH_FWD_ALL_MPDUS - all pending MPDUs 680 + *in the bitmap will be forwarded/flushed to REO output rings 681 + */ 682 + cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS | 683 + HAL_REO_CMD_FLG_FLUSH_FWD_ALL_MPDUS; 684 + 685 + /* For all QoS TIDs (except NON_QOS), the driver allocates a maximum 686 + * window size of 1024. In such cases, the driver can issue a single 687 + * 1KB descriptor flush command instead of sending multiple 128-byte 688 + * flush commands for each QoS TID, improving efficiency. 689 + */ 690 + 691 + if (rx_tid->tid != HAL_DESC_REO_NON_QOS_TID) 692 + cmd.flag |= HAL_REO_CMD_FLG_FLUSH_QUEUE_1K_DESC; 693 + 723 694 ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 724 695 HAL_REO_CMD_FLUSH_CACHE, 725 696 &cmd, ath12k_dp_reo_cmd_free); 726 - if (ret) { 727 - ath12k_err(ab, "failed to send HAL_REO_CMD_FLUSH_CACHE cmd, tid %d (%d)\n", 728 - rx_tid->tid, ret); 729 - dma_unmap_single(ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 730 - DMA_BIDIRECTIONAL); 731 - kfree(rx_tid->qbuf.vaddr); 732 - rx_tid->qbuf.vaddr = NULL; 697 + return ret; 698 + } 699 + 700 + static void ath12k_peer_rx_tid_qref_reset(struct ath12k_base *ab, u16 peer_id, u16 tid) 701 + { 702 + struct ath12k_reo_queue_ref *qref; 703 + struct ath12k_dp *dp = &ab->dp; 704 + bool ml_peer = false; 705 + 706 + if (!ab->hw_params->reoq_lut_support) 707 + return; 708 + 709 + if (peer_id & ATH12K_PEER_ML_ID_VALID) { 710 + peer_id &= ~ATH12K_PEER_ML_ID_VALID; 711 + ml_peer = true; 733 712 } 713 + 714 + if (ml_peer) 715 + qref = (struct ath12k_reo_queue_ref *)dp->ml_reoq_lut.vaddr + 716 + (peer_id * (IEEE80211_NUM_TIDS + 1) + tid); 717 + else 718 + qref = (struct ath12k_reo_queue_ref *)dp->reoq_lut.vaddr + 719 + (peer_id * (IEEE80211_NUM_TIDS + 1) + tid); 720 + 721 + qref->info0 = u32_encode_bits(0, BUFFER_ADDR_INFO0_ADDR); 722 + qref->info1 = u32_encode_bits(0, BUFFER_ADDR_INFO1_ADDR) | 723 + u32_encode_bits(tid, DP_REO_QREF_NUM); 724 + } 725 + 726 + static void ath12k_dp_rx_process_reo_cmd_update_rx_queue_list(struct ath12k_dp *dp) 727 + { 728 + struct ath12k_base *ab = dp->ab; 729 + struct dp_reo_update_rx_queue_elem *elem, *tmp; 730 + 731 + spin_lock_bh(&dp->reo_rxq_flush_lock); 732 + 733 + list_for_each_entry_safe(elem, tmp, &dp->reo_cmd_update_rx_queue_list, list) { 734 + if (elem->rx_tid.active) 735 + continue; 736 + 737 + if (ath12k_dp_rx_tid_delete_handler(ab, &elem->rx_tid)) 738 + break; 739 + 740 + ath12k_peer_rx_tid_qref_reset(ab, 741 + elem->is_ml_peer ? elem->ml_peer_id : 742 + elem->peer_id, 743 + elem->rx_tid.tid); 744 + 745 + if (ab->hw_params->reoq_lut_support) 746 + ath12k_hal_reo_shared_qaddr_cache_clear(ab); 747 + 748 + list_del(&elem->list); 749 + kfree(elem); 750 + } 751 + 752 + spin_unlock_bh(&dp->reo_rxq_flush_lock); 734 753 } 735 754 736 755 static void ath12k_dp_rx_tid_del_func(struct ath12k_dp *dp, void *ctx, 737 756 enum hal_reo_cmd_status status) 738 757 { 739 758 struct ath12k_base *ab = dp->ab; 740 - struct ath12k_dp_rx_tid *rx_tid = ctx; 759 + struct ath12k_dp_rx_tid_rxq *rx_tid = ctx; 741 760 struct ath12k_dp_rx_reo_cache_flush_elem *elem, *tmp; 742 761 743 762 if (status == HAL_REO_CMD_DRAIN) { ··· 793 724 return; 794 725 } 795 726 727 + /* Retry the HAL_REO_CMD_UPDATE_RX_QUEUE command for entries 728 + * in the pending queue list marked TID as inactive 729 + */ 730 + spin_lock_bh(&dp->ab->base_lock); 731 + ath12k_dp_rx_process_reo_cmd_update_rx_queue_list(dp); 732 + spin_unlock_bh(&dp->ab->base_lock); 733 + 796 734 elem = kzalloc(sizeof(*elem), GFP_ATOMIC); 797 735 if (!elem) 798 736 goto free_desc; ··· 807 731 elem->ts = jiffies; 808 732 memcpy(&elem->data, rx_tid, sizeof(*rx_tid)); 809 733 810 - spin_lock_bh(&dp->reo_cmd_lock); 734 + spin_lock_bh(&dp->reo_rxq_flush_lock); 811 735 list_add_tail(&elem->list, &dp->reo_cmd_cache_flush_list); 812 736 dp->reo_cmd_cache_flush_count++; 813 737 ··· 817 741 if (dp->reo_cmd_cache_flush_count > ATH12K_DP_RX_REO_DESC_FREE_THRES || 818 742 time_after(jiffies, elem->ts + 819 743 msecs_to_jiffies(ATH12K_DP_RX_REO_DESC_FREE_TIMEOUT_MS))) { 744 + /* The reo_cmd_cache_flush_list is used in only two contexts, 745 + * one is in this function called from napi and the 746 + * other in ath12k_dp_free during core destroy. 747 + * If cache command sent is success, delete the element in 748 + * the cache list. ath12k_dp_rx_reo_cmd_list_cleanup 749 + * will be called during core destroy. 750 + */ 751 + 752 + if (ath12k_dp_reo_cache_flush(ab, &elem->data)) 753 + break; 754 + 820 755 list_del(&elem->list); 821 756 dp->reo_cmd_cache_flush_count--; 822 - 823 - /* Unlock the reo_cmd_lock before using ath12k_dp_reo_cmd_send() 824 - * within ath12k_dp_reo_cache_flush. The reo_cmd_cache_flush_list 825 - * is used in only two contexts, one is in this function called 826 - * from napi and the other in ath12k_dp_free during core destroy. 827 - * Before dp_free, the irqs would be disabled and would wait to 828 - * synchronize. Hence there wouldn’t be any race against add or 829 - * delete to this list. Hence unlock-lock is safe here. 830 - */ 831 - spin_unlock_bh(&dp->reo_cmd_lock); 832 - 833 - ath12k_dp_reo_cache_flush(ab, &elem->data); 834 757 kfree(elem); 835 - spin_lock_bh(&dp->reo_cmd_lock); 836 758 } 837 759 } 838 - spin_unlock_bh(&dp->reo_cmd_lock); 760 + spin_unlock_bh(&dp->reo_rxq_flush_lock); 839 761 840 762 return; 841 763 free_desc: 842 - dma_unmap_single(ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 843 - DMA_BIDIRECTIONAL); 844 - kfree(rx_tid->qbuf.vaddr); 845 - rx_tid->qbuf.vaddr = NULL; 764 + ath12k_dp_rx_tid_cleanup(ab, &rx_tid->qbuf); 765 + } 766 + 767 + static int ath12k_dp_rx_tid_delete_handler(struct ath12k_base *ab, 768 + struct ath12k_dp_rx_tid_rxq *rx_tid) 769 + { 770 + struct ath12k_hal_reo_cmd cmd = {}; 771 + 772 + cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 773 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 774 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 775 + cmd.upd0 |= HAL_REO_CMD_UPD0_VLD; 776 + /* Observed flush cache failure, to avoid that set vld bit during delete */ 777 + cmd.upd1 |= HAL_REO_CMD_UPD1_VLD; 778 + 779 + return ath12k_dp_reo_cmd_send(ab, rx_tid, 780 + HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, 781 + ath12k_dp_rx_tid_del_func); 846 782 } 847 783 848 784 static void ath12k_peer_rx_tid_qref_setup(struct ath12k_base *ab, u16 peer_id, u16 tid, ··· 887 799 ath12k_hal_reo_shared_qaddr_cache_clear(ab); 888 800 } 889 801 890 - static void ath12k_peer_rx_tid_qref_reset(struct ath12k_base *ab, u16 peer_id, u16 tid) 802 + static void ath12k_dp_mark_tid_as_inactive(struct ath12k_dp *dp, int peer_id, u8 tid) 891 803 { 892 - struct ath12k_reo_queue_ref *qref; 893 - struct ath12k_dp *dp = &ab->dp; 894 - bool ml_peer = false; 804 + struct dp_reo_update_rx_queue_elem *elem; 805 + struct ath12k_dp_rx_tid_rxq *rx_tid; 895 806 896 - if (!ab->hw_params->reoq_lut_support) 897 - return; 898 - 899 - if (peer_id & ATH12K_PEER_ML_ID_VALID) { 900 - peer_id &= ~ATH12K_PEER_ML_ID_VALID; 901 - ml_peer = true; 807 + spin_lock_bh(&dp->reo_rxq_flush_lock); 808 + list_for_each_entry(elem, &dp->reo_cmd_update_rx_queue_list, list) { 809 + if (elem->peer_id == peer_id) { 810 + rx_tid = &elem->rx_tid; 811 + if (rx_tid->tid == tid) { 812 + rx_tid->active = false; 813 + break; 814 + } 815 + } 902 816 } 903 - 904 - if (ml_peer) 905 - qref = (struct ath12k_reo_queue_ref *)dp->ml_reoq_lut.vaddr + 906 - (peer_id * (IEEE80211_NUM_TIDS + 1) + tid); 907 - else 908 - qref = (struct ath12k_reo_queue_ref *)dp->reoq_lut.vaddr + 909 - (peer_id * (IEEE80211_NUM_TIDS + 1) + tid); 910 - 911 - qref->info0 = u32_encode_bits(0, BUFFER_ADDR_INFO0_ADDR); 912 - qref->info1 = u32_encode_bits(0, BUFFER_ADDR_INFO1_ADDR) | 913 - u32_encode_bits(tid, DP_REO_QREF_NUM); 817 + spin_unlock_bh(&dp->reo_rxq_flush_lock); 914 818 } 915 819 916 820 void ath12k_dp_rx_peer_tid_delete(struct ath12k *ar, 917 821 struct ath12k_peer *peer, u8 tid) 918 822 { 919 - struct ath12k_hal_reo_cmd cmd = {}; 920 823 struct ath12k_dp_rx_tid *rx_tid = &peer->rx_tid[tid]; 921 - int ret; 824 + struct ath12k_base *ab = ar->ab; 825 + struct ath12k_dp *dp = &ab->dp; 922 826 923 827 if (!rx_tid->active) 924 828 return; 925 829 926 - cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 927 - cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 928 - cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 929 - cmd.upd0 = HAL_REO_CMD_UPD0_VLD; 930 - ret = ath12k_dp_reo_cmd_send(ar->ab, rx_tid, 931 - HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, 932 - ath12k_dp_rx_tid_del_func); 933 - if (ret) { 934 - ath12k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid %d (%d)\n", 935 - tid, ret); 936 - dma_unmap_single(ar->ab->dev, rx_tid->qbuf.paddr_aligned, 937 - rx_tid->qbuf.size, DMA_BIDIRECTIONAL); 938 - kfree(rx_tid->qbuf.vaddr); 939 - rx_tid->qbuf.vaddr = NULL; 940 - } 941 - 942 - if (peer->mlo) 943 - ath12k_peer_rx_tid_qref_reset(ar->ab, peer->ml_id, tid); 944 - else 945 - ath12k_peer_rx_tid_qref_reset(ar->ab, peer->peer_id, tid); 946 - 947 830 rx_tid->active = false; 831 + 832 + ath12k_dp_mark_tid_as_inactive(dp, peer->peer_id, tid); 833 + ath12k_dp_rx_process_reo_cmd_update_rx_queue_list(dp); 948 834 } 949 835 950 836 int ath12k_dp_rx_link_desc_return(struct ath12k_base *ab, ··· 1003 941 { 1004 942 struct ath12k_hal_reo_cmd cmd = {}; 1005 943 int ret; 944 + struct ath12k_dp_rx_tid_rxq rx_tid_rxq; 1006 945 1007 - cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 1008 - cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 946 + ath12k_dp_init_rx_tid_rxq(&rx_tid_rxq, rx_tid); 947 + 948 + cmd.addr_lo = lower_32_bits(rx_tid_rxq.qbuf.paddr_aligned); 949 + cmd.addr_hi = upper_32_bits(rx_tid_rxq.qbuf.paddr_aligned); 1009 950 cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 1010 951 cmd.upd0 = HAL_REO_CMD_UPD0_BA_WINDOW_SIZE; 1011 952 cmd.ba_window_size = ba_win_sz; ··· 1018 953 cmd.upd2 = u32_encode_bits(ssn, HAL_REO_CMD_UPD2_SSN); 1019 954 } 1020 955 1021 - ret = ath12k_dp_reo_cmd_send(ar->ab, rx_tid, 956 + ret = ath12k_dp_reo_cmd_send(ar->ab, &rx_tid_rxq, 1022 957 HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, 1023 958 NULL); 1024 959 if (ret) { 1025 960 ath12k_warn(ar->ab, "failed to update rx tid queue, tid %d (%d)\n", 1026 - rx_tid->tid, ret); 961 + rx_tid_rxq.tid, ret); 1027 962 return ret; 1028 963 } 1029 964 ··· 1079 1014 1080 1015 rx_tid->qbuf = *buf; 1081 1016 rx_tid->active = true; 1017 + 1018 + return 0; 1019 + } 1020 + 1021 + static int ath12k_dp_prepare_reo_update_elem(struct ath12k_dp *dp, 1022 + struct ath12k_peer *peer, 1023 + struct ath12k_dp_rx_tid *rx_tid) 1024 + { 1025 + struct dp_reo_update_rx_queue_elem *elem; 1026 + 1027 + elem = kzalloc(sizeof(*elem), GFP_ATOMIC); 1028 + if (!elem) 1029 + return -ENOMEM; 1030 + 1031 + elem->peer_id = peer->peer_id; 1032 + elem->is_ml_peer = peer->mlo; 1033 + elem->ml_peer_id = peer->ml_id; 1034 + 1035 + ath12k_dp_init_rx_tid_rxq(&elem->rx_tid, rx_tid); 1036 + 1037 + spin_lock_bh(&dp->reo_rxq_flush_lock); 1038 + list_add_tail(&elem->list, &dp->reo_cmd_update_rx_queue_list); 1039 + spin_unlock_bh(&dp->reo_rxq_flush_lock); 1082 1040 1083 1041 return 0; 1084 1042 } ··· 1183 1095 if (ret) { 1184 1096 spin_unlock_bh(&ab->base_lock); 1185 1097 ath12k_warn(ab, "failed to assign reoq buf for rx tid %u\n", tid); 1098 + return ret; 1099 + } 1100 + 1101 + /* Pre-allocate the update_rxq_list for the corresponding tid 1102 + * This will be used during the tid delete. The reason we are not 1103 + * allocating during tid delete is that, if any alloc fail in update_rxq_list 1104 + * we may not be able to delete the tid vaddr/paddr and may lead to leak 1105 + */ 1106 + ret = ath12k_dp_prepare_reo_update_elem(dp, peer, rx_tid); 1107 + if (ret) { 1108 + ath12k_warn(ab, "failed to alloc update_rxq_list for rx tid %u\n", tid); 1109 + ath12k_dp_rx_tid_cleanup(ab, &rx_tid->qbuf); 1110 + spin_unlock_bh(&ab->base_lock); 1186 1111 return ret; 1187 1112 } 1188 1113 ··· 1308 1207 struct ath12k_hal_reo_cmd cmd = {}; 1309 1208 struct ath12k_peer *peer; 1310 1209 struct ath12k_dp_rx_tid *rx_tid; 1210 + struct ath12k_dp_rx_tid_rxq rx_tid_rxq; 1311 1211 u8 tid; 1312 1212 int ret = 0; 1313 1213 ··· 1355 1253 rx_tid = &peer->rx_tid[tid]; 1356 1254 if (!rx_tid->active) 1357 1255 continue; 1358 - cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 1359 - cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 1360 - ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 1256 + 1257 + ath12k_dp_init_rx_tid_rxq(&rx_tid_rxq, rx_tid); 1258 + cmd.addr_lo = lower_32_bits(rx_tid_rxq.qbuf.paddr_aligned); 1259 + cmd.addr_hi = upper_32_bits(rx_tid_rxq.qbuf.paddr_aligned); 1260 + ret = ath12k_dp_reo_cmd_send(ab, &rx_tid_rxq, 1361 1261 HAL_REO_CMD_UPDATE_RX_QUEUE, 1362 1262 &cmd, NULL); 1363 1263 if (ret) { ··· 2637 2533 channel_num = meta_data; 2638 2534 center_freq = meta_data >> 16; 2639 2535 2536 + rx_status->band = NUM_NL80211_BANDS; 2537 + 2640 2538 if (center_freq >= ATH12K_MIN_6GHZ_FREQ && 2641 2539 center_freq <= ATH12K_MAX_6GHZ_FREQ) { 2642 2540 rx_status->band = NL80211_BAND_6GHZ; ··· 2647 2541 rx_status->band = NL80211_BAND_2GHZ; 2648 2542 } else if (channel_num >= 36 && channel_num <= 173) { 2649 2543 rx_status->band = NL80211_BAND_5GHZ; 2650 - } else { 2544 + } 2545 + 2546 + if (unlikely(rx_status->band == NUM_NL80211_BANDS || 2547 + !ath12k_ar_to_hw(ar)->wiphy->bands[rx_status->band])) { 2548 + ath12k_warn(ar->ab, "sband is NULL for status band %d channel_num %d center_freq %d pdev_id %d\n", 2549 + rx_status->band, channel_num, center_freq, ar->pdev_idx); 2550 + 2651 2551 spin_lock_bh(&ar->data_lock); 2652 2552 channel = ar->rx_channel; 2653 2553 if (channel) { 2654 2554 rx_status->band = channel->band; 2655 2555 channel_num = 2656 2556 ieee80211_frequency_to_channel(channel->center_freq); 2557 + rx_status->freq = ieee80211_channel_to_frequency(channel_num, 2558 + rx_status->band); 2559 + } else { 2560 + ath12k_err(ar->ab, "unable to determine channel, band for rx packet"); 2657 2561 } 2658 2562 spin_unlock_bh(&ar->data_lock); 2563 + goto h_rate; 2659 2564 } 2660 2565 2661 2566 if (rx_status->band != NL80211_BAND_6GHZ) 2662 2567 rx_status->freq = ieee80211_channel_to_frequency(channel_num, 2663 2568 rx_status->band); 2664 2569 2570 + h_rate: 2665 2571 ath12k_dp_rx_h_rate(ar, rx_info); 2666 2572 } 2667 2573
+16 -2
drivers/net/wireless/ath/ath12k/dp_rx.h
··· 31 31 struct ath12k_base *ab; 32 32 }; 33 33 34 + struct ath12k_dp_rx_tid_rxq { 35 + u8 tid; 36 + bool active; 37 + struct ath12k_reoq_buf qbuf; 38 + }; 39 + 34 40 struct ath12k_dp_rx_reo_cache_flush_elem { 35 41 struct list_head list; 36 - struct ath12k_dp_rx_tid data; 42 + struct ath12k_dp_rx_tid_rxq data; 37 43 unsigned long ts; 44 + }; 45 + 46 + struct dp_reo_update_rx_queue_elem { 47 + struct list_head list; 48 + struct ath12k_dp_rx_tid_rxq rx_tid; 49 + int peer_id; 50 + bool is_ml_peer; 51 + u16 ml_peer_id; 38 52 }; 39 53 40 54 struct ath12k_dp_rx_reo_cmd { 41 55 struct list_head list; 42 - struct ath12k_dp_rx_tid data; 56 + struct ath12k_dp_rx_tid_rxq data; 43 57 int cmd_num; 44 58 void (*handler)(struct ath12k_dp *dp, void *ctx, 45 59 enum hal_reo_cmd_status status);
+1
drivers/net/wireless/ath/ath12k/hal.h
··· 832 832 #define HAL_REO_CMD_FLG_FLUSH_ALL BIT(6) 833 833 #define HAL_REO_CMD_FLG_UNBLK_RESOURCE BIT(7) 834 834 #define HAL_REO_CMD_FLG_UNBLK_CACHE BIT(8) 835 + #define HAL_REO_CMD_FLG_FLUSH_QUEUE_1K_DESC BIT(9) 835 836 836 837 /* Should be matching with HAL_REO_UPD_RX_QUEUE_INFO0_UPD_* fields */ 837 838 #define HAL_REO_CMD_UPD0_RX_QUEUE_NUM BIT(8)
+1
drivers/net/wireless/ath/ath12k/hal_desc.h
··· 1225 1225 #define HAL_REO_FLUSH_CACHE_INFO0_FLUSH_WO_INVALIDATE BIT(12) 1226 1226 #define HAL_REO_FLUSH_CACHE_INFO0_BLOCK_CACHE_USAGE BIT(13) 1227 1227 #define HAL_REO_FLUSH_CACHE_INFO0_FLUSH_ALL BIT(14) 1228 + #define HAL_REO_FLUSH_CACHE_INFO0_FLUSH_QUEUE_1K_DESC BIT(15) 1228 1229 1229 1230 struct hal_reo_flush_cache { 1230 1231 struct hal_reo_cmd_hdr cmd;
+3
drivers/net/wireless/ath/ath12k/hal_rx.c
··· 89 89 if (cmd->flag & HAL_REO_CMD_FLG_FLUSH_ALL) 90 90 desc->info0 |= cpu_to_le32(HAL_REO_FLUSH_CACHE_INFO0_FLUSH_ALL); 91 91 92 + if (cmd->flag & HAL_REO_CMD_FLG_FLUSH_QUEUE_1K_DESC) 93 + desc->info0 |= cpu_to_le32(HAL_REO_FLUSH_CACHE_INFO0_FLUSH_QUEUE_1K_DESC); 94 + 92 95 return le32_get_bits(desc->cmd.info0, HAL_REO_CMD_HDR_INFO0_CMD_NUMBER); 93 96 } 94 97
+7 -5
drivers/net/wireless/ath/ath12k/hal_rx.h
··· 483 483 HAL_RECEPTION_TYPE_FRAMELESS 484 484 }; 485 485 486 - #define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RECEPTION GENMASK(3, 0) 487 - #define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RX_BW GENMASK(7, 5) 488 - #define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8) 486 + #define HAL_RX_RSSI_LEGACY_INFO_INFO0_RECEPTION GENMASK(3, 0) 487 + #define HAL_RX_RSSI_LEGACY_INFO_INFO0_RX_BW GENMASK(7, 5) 488 + #define HAL_RX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8) 489 + #define HAL_RX_RSSI_LEGACY_INFO_INFO2_RSSI_COMB_PPDU GENMASK(7, 0) 489 490 490 491 struct hal_rx_phyrx_rssi_legacy_info { 491 492 __le32 info0; 492 493 __le32 rsvd0[39]; 493 494 __le32 info1; 494 - __le32 rsvd1; 495 + __le32 info2; 495 496 } __packed; 496 497 497 498 #define HAL_RX_MPDU_START_INFO0_PPDU_ID GENMASK(31, 16) ··· 696 695 #define HAL_RX_MPDU_ERR_MPDU_LEN BIT(6) 697 696 #define HAL_RX_MPDU_ERR_UNENCRYPTED_FRAME BIT(7) 698 697 699 - #define HAL_RX_PHY_CMN_USER_INFO0_GI GENMASK(17, 16) 698 + #define HAL_RX_CMN_USR_INFO0_CP_SETTING GENMASK(17, 16) 699 + #define HAL_RX_CMN_USR_INFO0_LTF_SIZE GENMASK(19, 18) 700 700 701 701 struct hal_phyrx_common_user_info { 702 702 __le32 rsvd[2];
+85 -32
drivers/net/wireless/ath/ath12k/mac.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 2 /* 3 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. 5 5 */ 6 6 7 7 #include <net/mac80211.h> ··· 1822 1822 skb); 1823 1823 } 1824 1824 1825 - static void ath12k_mac_handle_beacon_miss_iter(void *data, u8 *mac, 1826 - struct ieee80211_vif *vif) 1825 + void ath12k_mac_handle_beacon_miss(struct ath12k *ar, 1826 + struct ath12k_link_vif *arvif) 1827 1827 { 1828 - u32 *vdev_id = data; 1829 - struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif); 1830 - struct ath12k_link_vif *arvif = &ahvif->deflink; 1831 - struct ieee80211_hw *hw; 1828 + struct ieee80211_hw *hw = ath12k_ar_to_hw(ar); 1829 + struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif); 1832 1830 1833 - if (!arvif->is_created || arvif->vdev_id != *vdev_id) 1834 - return; 1835 - 1836 - if (!arvif->is_up) 1831 + if (!(arvif->is_created && arvif->is_up)) 1837 1832 return; 1838 1833 1839 1834 ieee80211_beacon_loss(vif); 1840 - hw = ath12k_ar_to_hw(arvif->ar); 1841 1835 1842 1836 /* Firmware doesn't report beacon loss events repeatedly. If AP probe 1843 1837 * (done by mac80211) succeeds but beacons do not resume then it ··· 1840 1846 */ 1841 1847 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, 1842 1848 ATH12K_CONNECTION_LOSS_HZ); 1843 - } 1844 - 1845 - void ath12k_mac_handle_beacon_miss(struct ath12k *ar, u32 vdev_id) 1846 - { 1847 - ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar), 1848 - IEEE80211_IFACE_ITER_NORMAL, 1849 - ath12k_mac_handle_beacon_miss_iter, 1850 - &vdev_id); 1851 1849 } 1852 1850 1853 1851 static void ath12k_mac_vif_sta_connection_loss_work(struct work_struct *work) ··· 9846 9860 9847 9861 param_id = WMI_VDEV_PARAM_RTS_THRESHOLD; 9848 9862 param_value = hw->wiphy->rts_threshold; 9863 + ar->rts_threshold = param_value; 9849 9864 ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, 9850 9865 param_id, param_value); 9851 9866 if (ret) { ··· 11227 11240 struct ieee80211_channel *chan, *temp_chan; 11228 11241 u8 pwr_lvl_idx, num_pwr_levels, pwr_reduction; 11229 11242 bool is_psd_power = false, is_tpe_present = false; 11230 - s8 max_tx_power[ATH12K_NUM_PWR_LEVELS], 11231 - psd_power, tx_power, eirp_power; 11243 + s8 max_tx_power[ATH12K_NUM_PWR_LEVELS], psd_power, tx_power; 11244 + s8 eirp_power = 0; 11232 11245 struct ath12k_vif *ahvif = arvif->ahvif; 11233 11246 u16 start_freq, center_freq; 11234 11247 u8 reg_6ghz_power_mode; ··· 11434 11447 11435 11448 tpc_info->num_pwr_levels = max(local_psd->count, 11436 11449 reg_psd->count); 11437 - if (tpc_info->num_pwr_levels > ATH12K_NUM_PWR_LEVELS) 11438 - tpc_info->num_pwr_levels = ATH12K_NUM_PWR_LEVELS; 11450 + tpc_info->num_pwr_levels = 11451 + min3(tpc_info->num_pwr_levels, 11452 + IEEE80211_TPE_PSD_ENTRIES_320MHZ, 11453 + ATH12K_NUM_PWR_LEVELS); 11439 11454 11440 11455 for (i = 0; i < tpc_info->num_pwr_levels; i++) { 11441 11456 tpc_info->tpe[i] = min(local_psd->power[i], ··· 11452 11463 11453 11464 tpc_info->num_pwr_levels = max(local_non_psd->count, 11454 11465 reg_non_psd->count); 11455 - if (tpc_info->num_pwr_levels > ATH12K_NUM_PWR_LEVELS) 11456 - tpc_info->num_pwr_levels = ATH12K_NUM_PWR_LEVELS; 11466 + tpc_info->num_pwr_levels = 11467 + min3(tpc_info->num_pwr_levels, 11468 + IEEE80211_TPE_EIRP_ENTRIES_320MHZ, 11469 + ATH12K_NUM_PWR_LEVELS); 11457 11470 11458 11471 for (i = 0; i < tpc_info->num_pwr_levels; i++) { 11459 11472 tpc_info->tpe[i] = min(local_non_psd->power[i], ··· 11678 11687 int radio_idx, u32 value) 11679 11688 { 11680 11689 struct ath12k_hw *ah = ath12k_hw_to_ah(hw); 11690 + struct wiphy *wiphy = hw->wiphy; 11681 11691 struct ath12k *ar; 11682 - int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD, ret = 0, i; 11692 + int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD; 11693 + int ret = 0, ret_err, i; 11683 11694 11684 11695 lockdep_assert_wiphy(hw->wiphy); 11685 11696 11686 - /* Currently we set the rts threshold value to all the vifs across 11687 - * all radios of the single wiphy. 11688 - * TODO Once support for vif specific RTS threshold in mac80211 is 11689 - * available, ath12k can make use of it. 11690 - */ 11697 + if (radio_idx >= wiphy->n_radio || radio_idx < -1) 11698 + return -EINVAL; 11699 + 11700 + if (radio_idx != -1) { 11701 + /* Update RTS threshold in specified radio */ 11702 + ar = ath12k_ah_to_ar(ah, radio_idx); 11703 + ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value); 11704 + if (ret) { 11705 + ath12k_warn(ar->ab, 11706 + "failed to set RTS config for all vdevs of pdev %d", 11707 + ar->pdev->pdev_id); 11708 + return ret; 11709 + } 11710 + 11711 + ar->rts_threshold = value; 11712 + return 0; 11713 + } 11714 + 11715 + /* Radio_index passed is -1, so set RTS threshold for all radios. */ 11691 11716 for_each_ar(ah, ar, i) { 11692 11717 ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value); 11693 11718 if (ret) { ··· 11711 11704 ar->pdev->pdev_id); 11712 11705 break; 11713 11706 } 11707 + } 11708 + if (!ret) { 11709 + /* Setting new RTS threshold for vdevs of all radios passed, so update 11710 + * the RTS threshold value for all radios 11711 + */ 11712 + for_each_ar(ah, ar, i) 11713 + ar->rts_threshold = value; 11714 + return 0; 11715 + } 11716 + 11717 + /* RTS threshold config failed, revert to the previous RTS threshold */ 11718 + for (i = i - 1; i >= 0; i--) { 11719 + ar = ath12k_ah_to_ar(ah, i); 11720 + ret_err = ath12k_set_vdev_param_to_all_vifs(ar, param_id, 11721 + ar->rts_threshold); 11722 + if (ret_err) 11723 + ath12k_warn(ar->ab, 11724 + "failed to restore RTS threshold for all vdevs of pdev %d", 11725 + ar->pdev->pdev_id); 11714 11726 } 11715 11727 11716 11728 return ret; ··· 12636 12610 return 0; 12637 12611 } 12638 12612 12613 + static void ath12k_mac_put_chain_rssi(struct station_info *sinfo, 12614 + struct ath12k_link_sta *arsta) 12615 + { 12616 + s8 rssi; 12617 + int i; 12618 + 12619 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { 12620 + sinfo->chains &= ~BIT(i); 12621 + rssi = arsta->chain_signal[i]; 12622 + 12623 + if (rssi != ATH12K_DEFAULT_NOISE_FLOOR && 12624 + rssi != ATH12K_INVALID_RSSI_FULL && 12625 + rssi != ATH12K_INVALID_RSSI_EMPTY && 12626 + rssi != 0) { 12627 + sinfo->chain_signal[i] = rssi; 12628 + sinfo->chains |= BIT(i); 12629 + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); 12630 + } 12631 + } 12632 + } 12633 + 12639 12634 static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw, 12640 12635 struct ieee80211_vif *vif, 12641 12636 struct ieee80211_sta *sta, ··· 12713 12666 ahsta->ahvif->vdev_type == WMI_VDEV_TYPE_STA && 12714 12667 !(ath12k_mac_get_fw_stats(ar, &params))) 12715 12668 signal = arsta->rssi_beacon; 12669 + 12670 + params.stats_id = WMI_REQUEST_RSSI_PER_CHAIN_STAT; 12671 + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) && 12672 + ahsta->ahvif->vdev_type == WMI_VDEV_TYPE_STA && 12673 + !(ath12k_mac_get_fw_stats(ar, &params))) 12674 + ath12k_mac_put_chain_rssi(sinfo, arsta); 12716 12675 12717 12676 spin_lock_bh(&ar->data_lock); 12718 12677 noise_floor = ath12k_pdev_get_noise_floor(ar);
+2 -1
drivers/net/wireless/ath/ath12k/mac.h
··· 168 168 int ath12k_mac_rfkill_config(struct ath12k *ar); 169 169 int ath12k_mac_wait_tx_complete(struct ath12k *ar); 170 170 void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb); 171 - void ath12k_mac_handle_beacon_miss(struct ath12k *ar, u32 vdev_id); 171 + void ath12k_mac_handle_beacon_miss(struct ath12k *ar, 172 + struct ath12k_link_vif *arvif); 172 173 int ath12k_mac_vif_set_keepalive(struct ath12k_link_vif *arvif, 173 174 enum wmi_sta_keepalive_method method, 174 175 u32 interval);
+16 -8
drivers/net/wireless/ath/ath12k/qmi.c
··· 3307 3307 /* This is number of CE configs */ 3308 3308 req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; 3309 3309 for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { 3310 - req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; 3311 - req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; 3312 - req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; 3313 - req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; 3314 - req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; 3310 + req->tgt_cfg[pipe_num].pipe_num = 3311 + __le32_to_cpu(ce_cfg[pipe_num].pipenum); 3312 + req->tgt_cfg[pipe_num].pipe_dir = 3313 + __le32_to_cpu(ce_cfg[pipe_num].pipedir); 3314 + req->tgt_cfg[pipe_num].nentries = 3315 + __le32_to_cpu(ce_cfg[pipe_num].nentries); 3316 + req->tgt_cfg[pipe_num].nbytes_max = 3317 + __le32_to_cpu(ce_cfg[pipe_num].nbytes_max); 3318 + req->tgt_cfg[pipe_num].flags = 3319 + __le32_to_cpu(ce_cfg[pipe_num].flags); 3315 3320 } 3316 3321 3317 3322 req->svc_cfg_valid = 1; 3318 3323 /* This is number of Service/CE configs */ 3319 3324 req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; 3320 3325 for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { 3321 - req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; 3322 - req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; 3323 - req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; 3326 + req->svc_cfg[pipe_num].service_id = 3327 + __le32_to_cpu(svc_cfg[pipe_num].service_id); 3328 + req->svc_cfg[pipe_num].pipe_dir = 3329 + __le32_to_cpu(svc_cfg[pipe_num].pipedir); 3330 + req->svc_cfg[pipe_num].pipe_num = 3331 + __le32_to_cpu(svc_cfg[pipe_num].pipenum); 3324 3332 } 3325 3333 3326 3334 /* set shadow v3 configuration */
+8 -8
drivers/net/wireless/ath/ath12k/qmi.h
··· 392 392 }; 393 393 394 394 struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01 { 395 - __le32 pipe_num; 396 - __le32 pipe_dir; 397 - __le32 nentries; 398 - __le32 nbytes_max; 399 - __le32 flags; 395 + u32 pipe_num; 396 + u32 pipe_dir; 397 + u32 nentries; 398 + u32 nbytes_max; 399 + u32 flags; 400 400 }; 401 401 402 402 struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01 { 403 - __le32 service_id; 404 - __le32 pipe_dir; 405 - __le32 pipe_num; 403 + u32 service_id; 404 + u32 pipe_dir; 405 + u32 pipe_num; 406 406 }; 407 407 408 408 struct qmi_wlanfw_shadow_reg_cfg_s_v01 {
+142 -16
drivers/net/wireless/ath/ath12k/wmi.c
··· 30 30 struct wmi_tlv_fw_stats_parse { 31 31 const struct wmi_stats_event *ev; 32 32 struct ath12k_fw_stats *stats; 33 + const struct wmi_per_chain_rssi_stat_params *rssi; 34 + int rssi_num; 35 + bool chain_rssi_done; 33 36 }; 34 37 35 38 struct ath12k_wmi_dma_ring_caps_parse { ··· 188 185 .min_len = sizeof(struct wmi_p2p_noa_event) }, 189 186 [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { 190 187 .min_len = sizeof(struct wmi_11d_new_cc_event) }, 188 + [WMI_TAG_PER_CHAIN_RSSI_STATS] = { 189 + .min_len = sizeof(struct wmi_per_chain_rssi_stat_params) }, 191 190 }; 192 191 193 192 __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) ··· 6467 6462 } 6468 6463 6469 6464 arg->mac_addr = ev->peer_macaddr.addr; 6465 + arg->reason = le32_to_cpu(ev->reason); 6466 + arg->rssi = le32_to_cpu(ev->rssi); 6470 6467 6471 6468 kfree(tb); 6472 6469 return 0; ··· 7305 7298 static void ath12k_peer_sta_kickout_event(struct ath12k_base *ab, struct sk_buff *skb) 7306 7299 { 7307 7300 struct wmi_peer_sta_kickout_arg arg = {}; 7301 + struct ath12k_link_vif *arvif; 7308 7302 struct ieee80211_sta *sta; 7309 7303 struct ath12k_peer *peer; 7304 + unsigned int link_id; 7310 7305 struct ath12k *ar; 7311 7306 7312 7307 if (ath12k_pull_peer_sta_kickout_ev(ab, skb, &arg) != 0) { ··· 7328 7319 goto exit; 7329 7320 } 7330 7321 7331 - ar = ath12k_mac_get_ar_by_vdev_id(ab, peer->vdev_id); 7332 - if (!ar) { 7322 + arvif = ath12k_mac_get_arvif_by_vdev_id(ab, peer->vdev_id); 7323 + if (!arvif) { 7333 7324 ath12k_warn(ab, "invalid vdev id in peer sta kickout ev %d", 7334 7325 peer->vdev_id); 7335 7326 goto exit; 7336 7327 } 7337 7328 7338 - sta = ieee80211_find_sta_by_ifaddr(ath12k_ar_to_hw(ar), 7339 - arg.mac_addr, NULL); 7329 + ar = arvif->ar; 7330 + 7331 + if (peer->mlo) { 7332 + sta = ieee80211_find_sta_by_link_addrs(ath12k_ar_to_hw(ar), 7333 + arg.mac_addr, 7334 + NULL, &link_id); 7335 + if (peer->link_id != link_id) { 7336 + ath12k_warn(ab, 7337 + "Spurious quick kickout for MLO STA %pM with invalid link_id, peer: %d, sta: %d\n", 7338 + arg.mac_addr, peer->link_id, link_id); 7339 + goto exit; 7340 + } 7341 + } else { 7342 + sta = ieee80211_find_sta_by_ifaddr(ath12k_ar_to_hw(ar), 7343 + arg.mac_addr, NULL); 7344 + } 7340 7345 if (!sta) { 7341 - ath12k_warn(ab, "Spurious quick kickout for STA %pM\n", 7342 - arg.mac_addr); 7346 + ath12k_warn(ab, "Spurious quick kickout for %sSTA %pM\n", 7347 + peer->mlo ? "MLO " : "", arg.mac_addr); 7343 7348 goto exit; 7344 7349 } 7345 7350 7346 - ath12k_dbg(ab, ATH12K_DBG_WMI, "peer sta kickout event %pM", 7347 - arg.mac_addr); 7351 + ath12k_dbg(ab, ATH12K_DBG_WMI, 7352 + "peer sta kickout event %pM reason: %d rssi: %d\n", 7353 + arg.mac_addr, arg.reason, arg.rssi); 7348 7354 7349 - ieee80211_report_low_ack(sta, 10); 7355 + switch (arg.reason) { 7356 + case WMI_PEER_STA_KICKOUT_REASON_INACTIVITY: 7357 + if (arvif->ahvif->vif->type == NL80211_IFTYPE_STATION) { 7358 + ath12k_mac_handle_beacon_miss(ar, arvif); 7359 + break; 7360 + } 7361 + fallthrough; 7362 + default: 7363 + ieee80211_report_low_ack(sta, 10); 7364 + } 7350 7365 7351 7366 exit: 7352 7367 spin_unlock_bh(&ab->base_lock); ··· 7379 7346 7380 7347 static void ath12k_roam_event(struct ath12k_base *ab, struct sk_buff *skb) 7381 7348 { 7349 + struct ath12k_link_vif *arvif; 7382 7350 struct wmi_roam_event roam_ev = {}; 7383 7351 struct ath12k *ar; 7384 7352 u32 vdev_id; ··· 7398 7364 "wmi roam event vdev %u reason %d rssi %d\n", 7399 7365 vdev_id, roam_reason, roam_ev.rssi); 7400 7366 7401 - rcu_read_lock(); 7402 - ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id); 7403 - if (!ar) { 7367 + guard(rcu)(); 7368 + arvif = ath12k_mac_get_arvif_by_vdev_id(ab, vdev_id); 7369 + if (!arvif) { 7404 7370 ath12k_warn(ab, "invalid vdev id in roam ev %d", vdev_id); 7405 - rcu_read_unlock(); 7406 7371 return; 7407 7372 } 7373 + 7374 + ar = arvif->ar; 7408 7375 7409 7376 if (roam_reason >= WMI_ROAM_REASON_MAX) 7410 7377 ath12k_warn(ab, "ignoring unknown roam event reason %d on vdev %i\n", ··· 7413 7378 7414 7379 switch (roam_reason) { 7415 7380 case WMI_ROAM_REASON_BEACON_MISS: 7416 - ath12k_mac_handle_beacon_miss(ar, vdev_id); 7381 + ath12k_mac_handle_beacon_miss(ar, arvif); 7417 7382 break; 7418 7383 case WMI_ROAM_REASON_BETTER_AP: 7419 7384 case WMI_ROAM_REASON_LOW_RSSI: ··· 7423 7388 roam_reason, vdev_id); 7424 7389 break; 7425 7390 } 7426 - 7427 - rcu_read_unlock(); 7428 7391 } 7429 7392 7430 7393 static void ath12k_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) ··· 8252 8219 return ret; 8253 8220 } 8254 8221 8222 + static int ath12k_wmi_tlv_rssi_chain_parse(struct ath12k_base *ab, 8223 + u16 tag, u16 len, 8224 + const void *ptr, void *data) 8225 + { 8226 + const struct wmi_rssi_stat_params *stats_rssi = ptr; 8227 + struct wmi_tlv_fw_stats_parse *parse = data; 8228 + const struct wmi_stats_event *ev = parse->ev; 8229 + struct ath12k_fw_stats *stats = parse->stats; 8230 + struct ath12k_link_vif *arvif; 8231 + struct ath12k_link_sta *arsta; 8232 + struct ieee80211_sta *sta; 8233 + struct ath12k_sta *ahsta; 8234 + struct ath12k *ar; 8235 + int vdev_id; 8236 + int j; 8237 + 8238 + if (!ev) { 8239 + ath12k_warn(ab, "failed to fetch update stats ev"); 8240 + return -EPROTO; 8241 + } 8242 + 8243 + if (tag != WMI_TAG_RSSI_STATS) 8244 + return -EPROTO; 8245 + 8246 + if (!stats) 8247 + return -EINVAL; 8248 + 8249 + stats->pdev_id = le32_to_cpu(ev->pdev_id); 8250 + vdev_id = le32_to_cpu(stats_rssi->vdev_id); 8251 + guard(rcu)(); 8252 + ar = ath12k_mac_get_ar_by_pdev_id(ab, stats->pdev_id); 8253 + if (!ar) { 8254 + ath12k_warn(ab, "invalid pdev id %d in rssi chain parse\n", 8255 + stats->pdev_id); 8256 + return -EPROTO; 8257 + } 8258 + 8259 + arvif = ath12k_mac_get_arvif(ar, vdev_id); 8260 + if (!arvif) { 8261 + ath12k_warn(ab, "not found vif for vdev id %d\n", vdev_id); 8262 + return -EPROTO; 8263 + } 8264 + 8265 + ath12k_dbg(ab, ATH12K_DBG_WMI, 8266 + "stats bssid %pM vif %p\n", 8267 + arvif->bssid, arvif->ahvif->vif); 8268 + 8269 + sta = ieee80211_find_sta_by_ifaddr(ath12k_ar_to_hw(ar), 8270 + arvif->bssid, 8271 + NULL); 8272 + if (!sta) { 8273 + ath12k_dbg(ab, ATH12K_DBG_WMI, 8274 + "not found station of bssid %pM for rssi chain\n", 8275 + arvif->bssid); 8276 + return -EPROTO; 8277 + } 8278 + 8279 + ahsta = ath12k_sta_to_ahsta(sta); 8280 + arsta = &ahsta->deflink; 8281 + 8282 + BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) > 8283 + ARRAY_SIZE(stats_rssi->rssi_avg_beacon)); 8284 + 8285 + for (j = 0; j < ARRAY_SIZE(arsta->chain_signal); j++) 8286 + arsta->chain_signal[j] = le32_to_cpu(stats_rssi->rssi_avg_beacon[j]); 8287 + 8288 + stats->stats_id = WMI_REQUEST_RSSI_PER_CHAIN_STAT; 8289 + 8290 + return 0; 8291 + } 8292 + 8255 8293 static int ath12k_wmi_tlv_fw_stats_parse(struct ath12k_base *ab, 8256 8294 u16 tag, u16 len, 8257 8295 const void *ptr, void *data) ··· 8336 8232 break; 8337 8233 case WMI_TAG_ARRAY_BYTE: 8338 8234 ret = ath12k_wmi_tlv_fw_stats_data_parse(ab, parse, ptr, len); 8235 + break; 8236 + case WMI_TAG_PER_CHAIN_RSSI_STATS: 8237 + parse->rssi = ptr; 8238 + if (le32_to_cpu(parse->ev->stats_id) & WMI_REQUEST_RSSI_PER_CHAIN_STAT) 8239 + parse->rssi_num = le32_to_cpu(parse->rssi->num_per_chain_rssi); 8240 + break; 8241 + case WMI_TAG_ARRAY_STRUCT: 8242 + if (parse->rssi_num && !parse->chain_rssi_done) { 8243 + ret = ath12k_wmi_tlv_iter(ab, ptr, len, 8244 + ath12k_wmi_tlv_rssi_chain_parse, 8245 + parse); 8246 + if (ret) 8247 + return ret; 8248 + 8249 + parse->chain_rssi_done = true; 8250 + } 8339 8251 break; 8340 8252 default: 8341 8253 break; ··· 8462 8342 /* Handle WMI_REQUEST_PDEV_STAT status update */ 8463 8343 if (stats.stats_id == WMI_REQUEST_PDEV_STAT) { 8464 8344 list_splice_tail_init(&stats.pdevs, &ar->fw_stats.pdevs); 8345 + complete(&ar->fw_stats_done); 8346 + goto complete; 8347 + } 8348 + 8349 + /* Handle WMI_REQUEST_RSSI_PER_CHAIN_STAT status update */ 8350 + if (stats.stats_id == WMI_REQUEST_RSSI_PER_CHAIN_STAT) { 8465 8351 complete(&ar->fw_stats_done); 8466 8352 goto complete; 8467 8353 }
+30 -3
drivers/net/wireless/ath/ath12k/wmi.h
··· 4548 4548 __le32 tsf_timestamp; 4549 4549 } __packed; 4550 4550 4551 + enum wmi_peer_sta_kickout_reason { 4552 + WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED = 0, 4553 + WMI_PEER_STA_KICKOUT_REASON_XRETRY = 1, 4554 + WMI_PEER_STA_KICKOUT_REASON_INACTIVITY = 2, 4555 + WMI_PEER_STA_KICKOUT_REASON_IBSS_DISCONNECT = 3, 4556 + WMI_PEER_STA_KICKOUT_REASON_TDLS_DISCONNECT = 4, 4557 + WMI_PEER_STA_KICKOUT_REASON_SA_QUERY_TIMEOUT = 5, 4558 + WMI_PEER_STA_KICKOUT_REASON_ROAMING_EVENT = 6, 4559 + WMI_PEER_STA_KICKOUT_REASON_PMF_ERROR = 7, 4560 + }; 4561 + 4551 4562 struct wmi_peer_sta_kickout_arg { 4552 4563 const u8 *mac_addr; 4564 + enum wmi_peer_sta_kickout_reason reason; 4565 + u32 rssi; 4553 4566 }; 4554 4567 4555 4568 struct wmi_peer_sta_kickout_event { 4556 4569 struct ath12k_wmi_mac_addr_params peer_macaddr; 4570 + __le32 reason; 4571 + __le32 rssi; 4557 4572 } __packed; 4558 4573 4559 4574 #define WMI_ROAM_REASON_MASK GENMASK(3, 0) ··· 5890 5875 } __packed; 5891 5876 5892 5877 enum wmi_stats_id { 5893 - WMI_REQUEST_PDEV_STAT = BIT(2), 5894 - WMI_REQUEST_VDEV_STAT = BIT(3), 5895 - WMI_REQUEST_BCN_STAT = BIT(11), 5878 + WMI_REQUEST_PDEV_STAT = BIT(2), 5879 + WMI_REQUEST_VDEV_STAT = BIT(3), 5880 + WMI_REQUEST_RSSI_PER_CHAIN_STAT = BIT(8), 5881 + WMI_REQUEST_BCN_STAT = BIT(11), 5896 5882 }; 5897 5883 5898 5884 struct wmi_request_stats_cmd { ··· 5902 5886 __le32 vdev_id; 5903 5887 struct ath12k_wmi_mac_addr_params peer_macaddr; 5904 5888 __le32 pdev_id; 5889 + } __packed; 5890 + 5891 + struct wmi_rssi_stat_params { 5892 + __le32 vdev_id; 5893 + __le32 rssi_avg_beacon[WMI_MAX_CHAINS]; 5894 + __le32 rssi_avg_data[WMI_MAX_CHAINS]; 5895 + struct ath12k_wmi_mac_addr_params peer_macaddr; 5896 + } __packed; 5897 + 5898 + struct wmi_per_chain_rssi_stat_params { 5899 + __le32 num_per_chain_rssi; 5905 5900 } __packed; 5906 5901 5907 5902 #define WLAN_MAX_AC 4