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

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

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

ath12k:
Enable AHB support for IPQ5332.
Add monitor interface support to QCN9274.
Add MLO support to WCN7850.
Add 802.11d scan offload support to WCN7850.

ath11k:
Restore hibernation support

In addition, perform the usual set of bug fixes and cleanups across
all supported drivers.
====================

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

+5284 -1071
+315
Documentation/devicetree/bindings/net/wireless/qcom,ipq5332-wifi.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + # Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 3 + %YAML 1.2 4 + --- 5 + $id: http://devicetree.org/schemas/net/wireless/qcom,ipq5332-wifi.yaml# 6 + $schema: http://devicetree.org/meta-schemas/core.yaml# 7 + 8 + title: Qualcomm Technologies ath12k wireless devices (AHB) 9 + 10 + maintainers: 11 + - Jeff Johnson <jjohnson@kernel.org> 12 + 13 + description: 14 + Qualcomm Technologies IEEE 802.11be AHB devices. 15 + 16 + properties: 17 + compatible: 18 + enum: 19 + - qcom,ipq5332-wifi 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + clocks: 25 + items: 26 + - description: XO clock used for copy engine 27 + 28 + clock-names: 29 + items: 30 + - const: xo 31 + 32 + interrupts: 33 + items: 34 + - description: Fatal interrupt 35 + - description: Ready interrupt 36 + - description: Spawn acknowledge interrupt 37 + - description: Stop acknowledge interrupt 38 + - description: misc-pulse1 interrupt events 39 + - description: misc-latch interrupt events 40 + - description: sw exception interrupt events 41 + - description: interrupt event for ring CE0 42 + - description: interrupt event for ring CE1 43 + - description: interrupt event for ring CE2 44 + - description: interrupt event for ring CE3 45 + - description: interrupt event for ring CE4 46 + - description: interrupt event for ring CE5 47 + - description: interrupt event for ring CE6 48 + - description: interrupt event for ring CE7 49 + - description: interrupt event for ring CE8 50 + - description: interrupt event for ring CE9 51 + - description: interrupt event for ring CE10 52 + - description: interrupt event for ring CE11 53 + - description: interrupt event for ring host2wbm-desc-feed 54 + - description: interrupt event for ring host2reo-re-injection 55 + - description: interrupt event for ring host2reo-command 56 + - description: interrupt event for ring host2rxdma-monitor-ring1 57 + - description: interrupt event for ring reo2ost-exception 58 + - description: interrupt event for ring wbm2host-rx-release 59 + - description: interrupt event for ring reo2host-status 60 + - description: interrupt event for ring reo2host-destination-ring4 61 + - description: interrupt event for ring reo2host-destination-ring3 62 + - description: interrupt event for ring reo2host-destination-ring2 63 + - description: interrupt event for ring reo2host-destination-ring1 64 + - description: interrupt event for ring rxdma2host-monitor-destination-mac3 65 + - description: interrupt event for ring rxdma2host-monitor-destination-mac2 66 + - description: interrupt event for ring rxdma2host-monitor-destination-mac1 67 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac3 68 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac2 69 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac1 70 + - description: interrupt event for ring host2tcl-input-ring4 71 + - description: interrupt event for ring host2tcl-input-ring3 72 + - description: interrupt event for ring host2tcl-input-ring2 73 + - description: interrupt event for ring host2tcl-input-ring1 74 + - description: interrupt event for ring wbm2host-tx-completions-ring4 75 + - description: interrupt event for ring wbm2host-tx-completions-ring3 76 + - description: interrupt event for ring wbm2host-tx-completions-ring2 77 + - description: interrupt event for ring wbm2host-tx-completions-ring1 78 + - description: interrupt event for ring host2tx-monitor-ring1 79 + - description: interrupt event for ring txmon2host-monitor-destination-mac3 80 + - description: interrupt event for ring txmon2host-monitor-destination-mac2 81 + - description: interrupt event for ring txmon2host-monitor-destination-mac1 82 + - description: interrupt event for umac-reset 83 + 84 + interrupt-names: 85 + items: 86 + - const: fatal 87 + - const: ready 88 + - const: spawn 89 + - const: stop-ack 90 + - const: misc-pulse1 91 + - const: misc-latch 92 + - const: sw-exception 93 + - const: ce0 94 + - const: ce1 95 + - const: ce2 96 + - const: ce3 97 + - const: ce4 98 + - const: ce5 99 + - const: ce6 100 + - const: ce7 101 + - const: ce8 102 + - const: ce9 103 + - const: ce10 104 + - const: ce11 105 + - const: host2wbm-desc-feed 106 + - const: host2reo-re-injection 107 + - const: host2reo-command 108 + - const: host2rxdma-monitor-ring1 109 + - const: reo2ost-exception 110 + - const: wbm2host-rx-release 111 + - const: reo2host-status 112 + - const: reo2host-destination-ring4 113 + - const: reo2host-destination-ring3 114 + - const: reo2host-destination-ring2 115 + - const: reo2host-destination-ring1 116 + - const: rxdma2host-monitor-destination-mac3 117 + - const: rxdma2host-monitor-destination-mac2 118 + - const: rxdma2host-monitor-destination-mac1 119 + - const: host2rxdma-host-buf-ring-mac3 120 + - const: host2rxdma-host-buf-ring-mac2 121 + - const: host2rxdma-host-buf-ring-mac1 122 + - const: host2tcl-input-ring4 123 + - const: host2tcl-input-ring3 124 + - const: host2tcl-input-ring2 125 + - const: host2tcl-input-ring1 126 + - const: wbm2host-tx-completions-ring4 127 + - const: wbm2host-tx-completions-ring3 128 + - const: wbm2host-tx-completions-ring2 129 + - const: wbm2host-tx-completions-ring1 130 + - const: host2tx-monitor-ring1 131 + - const: txmon2host-monitor-destination-mac3 132 + - const: txmon2host-monitor-destination-mac2 133 + - const: txmon2host-monitor-destination-mac1 134 + - const: umac-reset 135 + 136 + memory-region: 137 + description: 138 + Memory regions used by the ath12k firmware. 139 + items: 140 + - description: Q6 memory region 141 + - description: m3 dump memory region 142 + - description: Q6 caldata memory region 143 + - description: Multi Link Operation (MLO) Global memory region 144 + 145 + memory-region-names: 146 + items: 147 + - const: q6-region 148 + - const: m3-dump 149 + - const: q6-caldb 150 + - const: mlo-global-mem 151 + 152 + qcom,calibration-variant: 153 + $ref: /schemas/types.yaml#/definitions/string 154 + description: 155 + String to uniquely identify variant of the calibration data for designs 156 + with colliding bus and device ids 157 + 158 + qcom,rproc: 159 + $ref: /schemas/types.yaml#/definitions/phandle 160 + description: 161 + Phandle to the Qualcomm Hexagon DSP(q6 remote processor), which is utilized 162 + for offloading WiFi processing tasks, this q6 remote processor operates in 163 + conjunction with WiFi. 164 + 165 + qcom,smem-states: 166 + $ref: /schemas/types.yaml#/definitions/phandle-array 167 + description: States used by the AP to signal the remote processor 168 + items: 169 + - description: Shutdown WCSS pd 170 + - description: Stop WCSS pd 171 + - description: Spawn WCSS pd 172 + 173 + qcom,smem-state-names: 174 + description: 175 + Names of the states used by the AP to signal the remote processor 176 + items: 177 + - const: shutdown 178 + - const: stop 179 + - const: spawn 180 + 181 + required: 182 + - compatible 183 + - reg 184 + - clocks 185 + - clock-names 186 + - interrupts 187 + - interrupt-names 188 + - memory-region 189 + - memory-region-names 190 + - qcom,rproc 191 + - qcom,smem-states 192 + - qcom,smem-state-names 193 + 194 + additionalProperties: false 195 + 196 + examples: 197 + - | 198 + #include <dt-bindings/interrupt-controller/arm-gic.h> 199 + #include <dt-bindings/clock/qcom,ipq5332-gcc.h> 200 + 201 + wifi0: wifi@c000000 { 202 + compatible = "qcom,ipq5332-wifi"; 203 + reg = <0x0c000000 0x1000000>; 204 + clocks = <&gcc GCC_XO_CLK>; 205 + clock-names = "xo"; 206 + interrupts-extended = <&wcss_smp2p_in 8 IRQ_TYPE_NONE>, 207 + <&wcss_smp2p_in 9 IRQ_TYPE_NONE>, 208 + <&wcss_smp2p_in 12 IRQ_TYPE_NONE>, 209 + <&wcss_smp2p_in 11 IRQ_TYPE_NONE>, 210 + <&intc GIC_SPI 559 IRQ_TYPE_EDGE_RISING>, 211 + <&intc GIC_SPI 560 IRQ_TYPE_EDGE_RISING>, 212 + <&intc GIC_SPI 561 IRQ_TYPE_EDGE_RISING>, 213 + <&intc GIC_SPI 422 IRQ_TYPE_EDGE_RISING>, 214 + <&intc GIC_SPI 423 IRQ_TYPE_EDGE_RISING>, 215 + <&intc GIC_SPI 424 IRQ_TYPE_EDGE_RISING>, 216 + <&intc GIC_SPI 425 IRQ_TYPE_EDGE_RISING>, 217 + <&intc GIC_SPI 426 IRQ_TYPE_EDGE_RISING>, 218 + <&intc GIC_SPI 427 IRQ_TYPE_EDGE_RISING>, 219 + <&intc GIC_SPI 428 IRQ_TYPE_EDGE_RISING>, 220 + <&intc GIC_SPI 429 IRQ_TYPE_EDGE_RISING>, 221 + <&intc GIC_SPI 430 IRQ_TYPE_EDGE_RISING>, 222 + <&intc GIC_SPI 431 IRQ_TYPE_EDGE_RISING>, 223 + <&intc GIC_SPI 432 IRQ_TYPE_EDGE_RISING>, 224 + <&intc GIC_SPI 433 IRQ_TYPE_EDGE_RISING>, 225 + <&intc GIC_SPI 491 IRQ_TYPE_EDGE_RISING>, 226 + <&intc GIC_SPI 495 IRQ_TYPE_EDGE_RISING>, 227 + <&intc GIC_SPI 493 IRQ_TYPE_EDGE_RISING>, 228 + <&intc GIC_SPI 544 IRQ_TYPE_EDGE_RISING>, 229 + <&intc GIC_SPI 457 IRQ_TYPE_EDGE_RISING>, 230 + <&intc GIC_SPI 466 IRQ_TYPE_EDGE_RISING>, 231 + <&intc GIC_SPI 497 IRQ_TYPE_EDGE_RISING>, 232 + <&intc GIC_SPI 454 IRQ_TYPE_EDGE_RISING>, 233 + <&intc GIC_SPI 453 IRQ_TYPE_EDGE_RISING>, 234 + <&intc GIC_SPI 452 IRQ_TYPE_EDGE_RISING>, 235 + <&intc GIC_SPI 451 IRQ_TYPE_EDGE_RISING>, 236 + <&intc GIC_SPI 488 IRQ_TYPE_EDGE_RISING>, 237 + <&intc GIC_SPI 488 IRQ_TYPE_EDGE_RISING>, 238 + <&intc GIC_SPI 484 IRQ_TYPE_EDGE_RISING>, 239 + <&intc GIC_SPI 554 IRQ_TYPE_EDGE_RISING>, 240 + <&intc GIC_SPI 554 IRQ_TYPE_EDGE_RISING>, 241 + <&intc GIC_SPI 549 IRQ_TYPE_EDGE_RISING>, 242 + <&intc GIC_SPI 507 IRQ_TYPE_EDGE_RISING>, 243 + <&intc GIC_SPI 500 IRQ_TYPE_EDGE_RISING>, 244 + <&intc GIC_SPI 499 IRQ_TYPE_EDGE_RISING>, 245 + <&intc GIC_SPI 498 IRQ_TYPE_EDGE_RISING>, 246 + <&intc GIC_SPI 450 IRQ_TYPE_EDGE_RISING>, 247 + <&intc GIC_SPI 449 IRQ_TYPE_EDGE_RISING>, 248 + <&intc GIC_SPI 448 IRQ_TYPE_EDGE_RISING>, 249 + <&intc GIC_SPI 447 IRQ_TYPE_EDGE_RISING>, 250 + <&intc GIC_SPI 543 IRQ_TYPE_EDGE_RISING>, 251 + <&intc GIC_SPI 486 IRQ_TYPE_EDGE_RISING>, 252 + <&intc GIC_SPI 486 IRQ_TYPE_EDGE_RISING>, 253 + <&intc GIC_SPI 482 IRQ_TYPE_EDGE_RISING>, 254 + <&intc GIC_SPI 419 IRQ_TYPE_EDGE_RISING>; 255 + interrupt-names = "fatal", 256 + "ready", 257 + "spawn", 258 + "stop-ack", 259 + "misc-pulse1", 260 + "misc-latch", 261 + "sw-exception", 262 + "ce0", 263 + "ce1", 264 + "ce2", 265 + "ce3", 266 + "ce4", 267 + "ce5", 268 + "ce6", 269 + "ce7", 270 + "ce8", 271 + "ce9", 272 + "ce10", 273 + "ce11", 274 + "host2wbm-desc-feed", 275 + "host2reo-re-injection", 276 + "host2reo-command", 277 + "host2rxdma-monitor-ring1", 278 + "reo2ost-exception", 279 + "wbm2host-rx-release", 280 + "reo2host-status", 281 + "reo2host-destination-ring4", 282 + "reo2host-destination-ring3", 283 + "reo2host-destination-ring2", 284 + "reo2host-destination-ring1", 285 + "rxdma2host-monitor-destination-mac3", 286 + "rxdma2host-monitor-destination-mac2", 287 + "rxdma2host-monitor-destination-mac1", 288 + "host2rxdma-host-buf-ring-mac3", 289 + "host2rxdma-host-buf-ring-mac2", 290 + "host2rxdma-host-buf-ring-mac1", 291 + "host2tcl-input-ring4", 292 + "host2tcl-input-ring3", 293 + "host2tcl-input-ring2", 294 + "host2tcl-input-ring1", 295 + "wbm2host-tx-completions-ring4", 296 + "wbm2host-tx-completions-ring3", 297 + "wbm2host-tx-completions-ring2", 298 + "wbm2host-tx-completions-ring1", 299 + "host2tx-monitor-ring1", 300 + "txmon2host-monitor-destination-mac3", 301 + "txmon2host-monitor-destination-mac2", 302 + "txmon2host-monitor-destination-mac1", 303 + "umac-reset"; 304 + 305 + memory-region = <&q6_region>, <&m3_dump>, <&q6_caldb>, <&mlo_mem>; 306 + memory-region-names = "q6-region", "m3-dump", "q6-caldb", "mlo-global-mem"; 307 + qcom,calibration-variant = "RDP441_1"; 308 + qcom,rproc = <&q6v5_wcss>; 309 + qcom,smem-states = <&wcss_smp2p_out 8>, 310 + <&wcss_smp2p_out 9>, 311 + <&wcss_smp2p_out 10>; 312 + qcom,smem-state-names = "shutdown", 313 + "stop", 314 + "spawn"; 315 + };
+1 -1
drivers/net/wireless/ath/ath10k/ahb.c
··· 497 497 498 498 ath10k_dbg(ar, ATH10K_DBG_BOOT, "irq: %d\n", ar_ahb->irq); 499 499 500 - ath10k_dbg(ar, ATH10K_DBG_BOOT, "mem: 0x%pK mem_len: %lu gcc mem: 0x%pK tcsr_mem: 0x%pK\n", 500 + ath10k_dbg(ar, ATH10K_DBG_BOOT, "mem: 0x%p mem_len: %lu gcc mem: 0x%p tcsr_mem: 0x%p\n", 501 501 ar_ahb->mem, ar_ahb->mem_len, 502 502 ar_ahb->gcc_mem, ar_ahb->tcsr_mem); 503 503 return 0;
+3 -3
drivers/net/wireless/ath/ath10k/bmi.c
··· 349 349 int ret; 350 350 size_t buf_len; 351 351 352 - ath10k_dbg(ar, ATH10K_DBG_BMI, "large bmi lz data buffer 0x%pK length %d\n", 352 + ath10k_dbg(ar, ATH10K_DBG_BMI, "large bmi lz data buffer 0x%p length %d\n", 353 353 buffer, length); 354 354 355 355 if (ar->bmi.done_sent) { ··· 395 395 u32 txlen; 396 396 int ret; 397 397 398 - ath10k_dbg(ar, ATH10K_DBG_BMI, "bmi lz data buffer 0x%pK length %d\n", 398 + ath10k_dbg(ar, ATH10K_DBG_BMI, "bmi lz data buffer 0x%p length %d\n", 399 399 buffer, length); 400 400 401 401 if (ar->bmi.done_sent) { ··· 461 461 int ret; 462 462 463 463 ath10k_dbg(ar, ATH10K_DBG_BMI, 464 - "bmi fast download address 0x%x buffer 0x%pK length %d\n", 464 + "bmi fast download address 0x%x buffer 0x%p length %d\n", 465 465 address, buffer, length); 466 466 467 467 ret = ath10k_bmi_lz_stream_start(ar, address);
+2 -2
drivers/net/wireless/ath/ath10k/ce.c
··· 1388 1388 ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, nentries); 1389 1389 1390 1390 ath10k_dbg(ar, ATH10K_DBG_BOOT, 1391 - "boot init ce src ring id %d entries %d base_addr %pK\n", 1391 + "boot init ce src ring id %d entries %d base_addr %p\n", 1392 1392 ce_id, nentries, src_ring->base_addr_owner_space); 1393 1393 1394 1394 return 0; ··· 1426 1426 ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, nentries); 1427 1427 1428 1428 ath10k_dbg(ar, ATH10K_DBG_BOOT, 1429 - "boot ce dest ring id %d entries %d base_addr %pK\n", 1429 + "boot ce dest ring id %d entries %d base_addr %p\n", 1430 1430 ce_id, nentries, dest_ring->base_addr_owner_space); 1431 1431 1432 1432 return 0;
+2 -2
drivers/net/wireless/ath/ath10k/core.c
··· 1200 1200 } 1201 1201 1202 1202 ath10k_dbg(ar, ATH10K_DBG_BOOT, 1203 - "boot uploading firmware image %pK len %d\n", 1203 + "boot uploading firmware image %p len %d\n", 1204 1204 data, data_len); 1205 1205 1206 1206 /* Check if device supports to download firmware via ··· 1826 1826 1827 1827 if (!ar->running_fw->fw_file.otp_data || 1828 1828 !ar->running_fw->fw_file.otp_len) { 1829 - ath10k_warn(ar, "Not running otp, calibration will be incorrect (otp-data %pK otp_len %zd)!\n", 1829 + ath10k_warn(ar, "Not running otp, calibration will be incorrect (otp-data %p otp_len %zd)!\n", 1830 1830 ar->running_fw->fw_file.otp_data, 1831 1831 ar->running_fw->fw_file.otp_len); 1832 1832 return 0;
+3 -3
drivers/net/wireless/ath/ath10k/htc.c
··· 34 34 skb_cb = ATH10K_SKB_CB(skb); 35 35 memset(skb_cb, 0, sizeof(*skb_cb)); 36 36 37 - ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: skb %pK\n", __func__, skb); 37 + ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: skb %p\n", __func__, skb); 38 38 return skb; 39 39 } 40 40 ··· 54 54 struct ath10k *ar = ep->htc->ar; 55 55 struct ath10k_htc_hdr *hdr; 56 56 57 - ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: ep %d skb %pK\n", __func__, 57 + ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: ep %d skb %p\n", __func__, 58 58 ep->eid, skb); 59 59 60 60 /* A corner case where the copy completion is reaching to host but still ··· 515 515 /* zero length packet with trailer data, just drop these */ 516 516 goto out; 517 517 518 - ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n", 518 + ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %p\n", 519 519 eid, skb); 520 520 ep->ep_ops.ep_rx_complete(ar, skb); 521 521
+1 -1
drivers/net/wireless/ath/ath10k/htt_rx.c
··· 1373 1373 } 1374 1374 1375 1375 ath10k_dbg(ar, ATH10K_DBG_DATA, 1376 - "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", 1376 + "rx skb %p len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", 1377 1377 skb, 1378 1378 skb->len, 1379 1379 ieee80211_get_SA(hdr),
+11 -11
drivers/net/wireless/ath/ath10k/mac.c
··· 875 875 */ 876 876 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { 877 877 if (ar->peer_map[i] == peer) { 878 - ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", 878 + ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n", 879 879 peer->addr, peer, i); 880 880 ar->peer_map[i] = NULL; 881 881 } ··· 4063 4063 4064 4064 if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { 4065 4065 if (!ath10k_mac_tx_frm_has_freq(ar)) { 4066 - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac queued offchannel skb %pK len %d\n", 4066 + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac queued offchannel skb %p len %d\n", 4067 4067 skb, skb->len); 4068 4068 4069 4069 skb_queue_tail(&ar->offchan_tx_queue, skb); ··· 4126 4126 4127 4127 mutex_lock(&ar->conf_mutex); 4128 4128 4129 - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK len %d\n", 4129 + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %p len %d\n", 4130 4130 skb, skb->len); 4131 4131 4132 4132 hdr = (struct ieee80211_hdr *)skb->data; ··· 4181 4181 time_left = 4182 4182 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); 4183 4183 if (time_left == 0) 4184 - ath10k_warn(ar, "timed out waiting for offchannel skb %pK, len: %d\n", 4184 + ath10k_warn(ar, "timed out waiting for offchannel skb %p, len: %d\n", 4185 4185 skb, skb->len); 4186 4186 4187 4187 if (!peer && tmp_peer_created) { ··· 7604 7604 * Existing station deletion. 7605 7605 */ 7606 7606 ath10k_dbg(ar, ATH10K_DBG_STA, 7607 - "mac vdev %d peer delete %pM sta %pK (sta gone)\n", 7607 + "mac vdev %d peer delete %pM sta %p (sta gone)\n", 7608 7608 arvif->vdev_id, sta->addr, sta); 7609 7609 7610 7610 if (sta->tdls) { ··· 7631 7631 continue; 7632 7632 7633 7633 if (peer->sta == sta) { 7634 - ath10k_warn(ar, "found sta peer %pM (ptr %pK id %d) entry on vdev %i after it was supposedly removed\n", 7634 + ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n", 7635 7635 sta->addr, peer, i, arvif->vdev_id); 7636 7636 peer->sta = NULL; 7637 7637 ··· 8811 8811 struct ath10k *ar = hw->priv; 8812 8812 8813 8813 ath10k_dbg(ar, ATH10K_DBG_MAC, 8814 - "mac chanctx add freq %u width %d ptr %pK\n", 8814 + "mac chanctx add freq %u width %d ptr %p\n", 8815 8815 ctx->def.chan->center_freq, ctx->def.width, ctx); 8816 8816 8817 8817 mutex_lock(&ar->conf_mutex); ··· 8835 8835 struct ath10k *ar = hw->priv; 8836 8836 8837 8837 ath10k_dbg(ar, ATH10K_DBG_MAC, 8838 - "mac chanctx remove freq %u width %d ptr %pK\n", 8838 + "mac chanctx remove freq %u width %d ptr %p\n", 8839 8839 ctx->def.chan->center_freq, ctx->def.width, ctx); 8840 8840 8841 8841 mutex_lock(&ar->conf_mutex); ··· 8900 8900 mutex_lock(&ar->conf_mutex); 8901 8901 8902 8902 ath10k_dbg(ar, ATH10K_DBG_MAC, 8903 - "mac chanctx change freq %u width %d ptr %pK changed %x\n", 8903 + "mac chanctx change freq %u width %d ptr %p changed %x\n", 8904 8904 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); 8905 8905 8906 8906 /* This shouldn't really happen because channel switching should use ··· 8959 8959 mutex_lock(&ar->conf_mutex); 8960 8960 8961 8961 ath10k_dbg(ar, ATH10K_DBG_MAC, 8962 - "mac chanctx assign ptr %pK vdev_id %i\n", 8962 + "mac chanctx assign ptr %p vdev_id %i\n", 8963 8963 ctx, arvif->vdev_id); 8964 8964 8965 8965 if (WARN_ON(arvif->is_started)) { ··· 9039 9039 mutex_lock(&ar->conf_mutex); 9040 9040 9041 9041 ath10k_dbg(ar, ATH10K_DBG_MAC, 9042 - "mac chanctx unassign ptr %pK vdev_id %i\n", 9042 + "mac chanctx unassign ptr %p vdev_id %i\n", 9043 9043 ctx, arvif->vdev_id); 9044 9044 9045 9045 WARN_ON(!arvif->is_started);
+1 -1
drivers/net/wireless/ath/ath10k/pci.c
··· 3411 3411 goto err_region; 3412 3412 } 3413 3413 3414 - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot pci_mem 0x%pK\n", ar_pci->mem); 3414 + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot pci_mem 0x%p\n", ar_pci->mem); 3415 3415 return 0; 3416 3416 3417 3417 err_region:
+2 -2
drivers/net/wireless/ath/ath10k/testmode.c
··· 35 35 int ret; 36 36 37 37 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, 38 - "testmode event wmi cmd_id %d skb %pK skb->len %d\n", 38 + "testmode event wmi cmd_id %d skb %p skb->len %d\n", 39 39 cmd_id, skb, skb->len); 40 40 41 41 ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, skb->len); ··· 397 397 cmd_id = nla_get_u32(tb[ATH10K_TM_ATTR_WMI_CMDID]); 398 398 399 399 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, 400 - "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n", 400 + "testmode cmd wmi cmd_id %d buf %p buf_len %d\n", 401 401 cmd_id, buf, buf_len); 402 402 403 403 ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", buf, buf_len);
+1 -1
drivers/net/wireless/ath/ath10k/txrx.c
··· 35 35 complete(&ar->offchan_tx_completed); 36 36 ar->offchan_tx_skb = NULL; /* just for sanity */ 37 37 38 - ath10k_dbg(ar, ATH10K_DBG_HTT, "completed offchannel skb %pK\n", skb); 38 + ath10k_dbg(ar, ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb); 39 39 out: 40 40 spin_unlock_bh(&ar->data_lock); 41 41 }
+2 -2
drivers/net/wireless/ath/ath10k/usb.c
··· 131 131 int status = 0; 132 132 133 133 ath10k_dbg(ar, ATH10K_DBG_USB_BULK, 134 - "usb recv pipe %d stat %d len %d urb 0x%pK\n", 134 + "usb recv pipe %d stat %d len %d urb 0x%p\n", 135 135 pipe->logical_pipe_num, urb->status, urb->actual_length, 136 136 urb); 137 137 ··· 230 230 ath10k_usb_recv_complete, urb_context); 231 231 232 232 ath10k_dbg(ar, ATH10K_DBG_USB_BULK, 233 - "usb bulk recv submit %d 0x%x ep 0x%2.2x len %d buf 0x%pK\n", 233 + "usb bulk recv submit %d 0x%x ep 0x%2.2x len %d buf 0x%p\n", 234 234 recv_pipe->logical_pipe_num, 235 235 recv_pipe->usb_pipe_handle, recv_pipe->ep_address, 236 236 ATH10K_USB_RX_BUFFER_SIZE, urb_context->skb);
+2 -2
drivers/net/wireless/ath/ath10k/wmi.c
··· 2029 2029 ether_addr_copy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr)); 2030 2030 memcpy(cmd->buf, msdu->data, msdu->len); 2031 2031 2032 - ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %pK len %d ftype %02x stype %02x\n", 2032 + ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %p len %d ftype %02x stype %02x\n", 2033 2033 msdu, skb->len, fc & IEEE80211_FCTL_FTYPE, 2034 2034 fc & IEEE80211_FCTL_STYPE); 2035 2035 trace_ath10k_tx_hdr(ar, skb->data, skb->len); ··· 2637 2637 status->boottime_ns = ktime_get_boottime_ns(); 2638 2638 2639 2639 ath10k_dbg(ar, ATH10K_DBG_MGMT, 2640 - "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", 2640 + "event mgmt rx skb %p len %d ftype %02x stype %02x\n", 2641 2641 skb, skb->len, 2642 2642 fc & IEEE80211_FCTL_FTYPE, fc & IEEE80211_FCTL_STYPE); 2643 2643
+2 -2
drivers/net/wireless/ath/ath11k/ahb.c
··· 413 413 return ret; 414 414 } 415 415 416 - static void ath11k_ahb_power_down(struct ath11k_base *ab) 416 + static void ath11k_ahb_power_down(struct ath11k_base *ab, bool is_suspend) 417 417 { 418 418 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); 419 419 ··· 1280 1280 struct ath11k_base *ab = platform_get_drvdata(pdev); 1281 1281 1282 1282 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { 1283 - ath11k_ahb_power_down(ab); 1283 + ath11k_ahb_power_down(ab, false); 1284 1284 ath11k_debugfs_soc_destroy(ab); 1285 1285 ath11k_qmi_deinit_service(ab); 1286 1286 goto qmi_fail;
+278 -28
drivers/net/wireless/ath/ath11k/core.c
··· 907 907 }, 908 908 }; 909 909 910 - static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab) 911 - { 912 - WARN_ON(!ab->hw_params.single_pdev_only); 913 - 914 - return &ab->pdevs[0]; 915 - } 910 + static const struct dmi_system_id ath11k_pm_quirk_table[] = { 911 + { 912 + .driver_data = (void *)ATH11K_PM_WOW, 913 + .matches = { 914 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 915 + DMI_MATCH(DMI_PRODUCT_NAME, "21J4"), 916 + }, 917 + }, 918 + { 919 + .driver_data = (void *)ATH11K_PM_WOW, 920 + .matches = { 921 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 922 + DMI_MATCH(DMI_PRODUCT_NAME, "21K4"), 923 + }, 924 + }, 925 + { 926 + .driver_data = (void *)ATH11K_PM_WOW, 927 + .matches = { 928 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 929 + DMI_MATCH(DMI_PRODUCT_NAME, "21K6"), 930 + }, 931 + }, 932 + { 933 + .driver_data = (void *)ATH11K_PM_WOW, 934 + .matches = { 935 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 936 + DMI_MATCH(DMI_PRODUCT_NAME, "21K8"), 937 + }, 938 + }, 939 + { 940 + .driver_data = (void *)ATH11K_PM_WOW, 941 + .matches = { 942 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 943 + DMI_MATCH(DMI_PRODUCT_NAME, "21KA"), 944 + }, 945 + }, 946 + { 947 + .driver_data = (void *)ATH11K_PM_WOW, 948 + .matches = { 949 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 950 + DMI_MATCH(DMI_PRODUCT_NAME, "21F9"), 951 + }, 952 + }, 953 + {} 954 + }; 916 955 917 956 void ath11k_fw_stats_pdevs_free(struct list_head *head) 918 957 { ··· 1011 972 return ab->hw_params.coldboot_cal_mm; 1012 973 } 1013 974 1014 - int ath11k_core_suspend(struct ath11k_base *ab) 975 + /* Check if we need to continue with suspend/resume operation. 976 + * Return: 977 + * a negative value: error happens and don't continue. 978 + * 0: no error but don't continue. 979 + * positive value: no error and do continue. 980 + */ 981 + static int ath11k_core_continue_suspend_resume(struct ath11k_base *ab) 1015 982 { 1016 - int ret; 1017 - struct ath11k_pdev *pdev; 1018 983 struct ath11k *ar; 1019 984 1020 985 if (!ab->hw_params.supports_suspend) 1021 986 return -EOPNOTSUPP; 1022 987 1023 988 /* so far single_pdev_only chips have supports_suspend as true 1024 - * and only the first pdev is valid. 989 + * so pass 0 as a dummy pdev_id here. 1025 990 */ 1026 - pdev = ath11k_core_get_single_pdev(ab); 1027 - ar = pdev->ar; 991 + ar = ab->pdevs[0].ar; 1028 992 if (!ar || ar->state != ATH11K_STATE_OFF) 1029 993 return 0; 994 + 995 + return 1; 996 + } 997 + 998 + static int ath11k_core_suspend_wow(struct ath11k_base *ab) 999 + { 1000 + int ret; 1030 1001 1031 1002 ret = ath11k_dp_rx_pktlog_stop(ab, true); 1032 1003 if (ret) { ··· 1045 996 return ret; 1046 997 } 1047 998 1048 - ret = ath11k_mac_wait_tx_complete(ar); 999 + /* So far only single_pdev_only devices can reach here, 1000 + * so it is valid to handle the first, and the only, pdev. 1001 + */ 1002 + ret = ath11k_mac_wait_tx_complete(ab->pdevs[0].ar); 1049 1003 if (ret) { 1050 1004 ath11k_warn(ab, "failed to wait tx complete: %d\n", ret); 1051 1005 return ret; ··· 1081 1029 1082 1030 return 0; 1083 1031 } 1084 - EXPORT_SYMBOL(ath11k_core_suspend); 1085 1032 1086 - int ath11k_core_resume(struct ath11k_base *ab) 1033 + static int ath11k_core_suspend_default(struct ath11k_base *ab) 1087 1034 { 1088 1035 int ret; 1089 - struct ath11k_pdev *pdev; 1090 - struct ath11k *ar; 1091 1036 1092 - if (!ab->hw_params.supports_suspend) 1093 - return -EOPNOTSUPP; 1037 + ret = ath11k_dp_rx_pktlog_stop(ab, true); 1038 + if (ret) { 1039 + ath11k_warn(ab, "failed to stop dp rx (and timer) pktlog during suspend: %d\n", 1040 + ret); 1041 + return ret; 1042 + } 1094 1043 1095 - /* so far signle_pdev_only chips have supports_suspend as true 1096 - * and only the first pdev is valid. 1044 + /* So far only single_pdev_only devices can reach here, 1045 + * so it is valid to handle the first, and the only, pdev. 1097 1046 */ 1098 - pdev = ath11k_core_get_single_pdev(ab); 1099 - ar = pdev->ar; 1100 - if (!ar || ar->state != ATH11K_STATE_OFF) 1047 + ret = ath11k_mac_wait_tx_complete(ab->pdevs[0].ar); 1048 + if (ret) { 1049 + ath11k_warn(ab, "failed to wait tx complete: %d\n", ret); 1050 + return ret; 1051 + } 1052 + 1053 + ret = ath11k_dp_rx_pktlog_stop(ab, false); 1054 + if (ret) { 1055 + ath11k_warn(ab, "failed to stop dp rx pktlog during suspend: %d\n", 1056 + ret); 1057 + return ret; 1058 + } 1059 + 1060 + ath11k_ce_stop_shadow_timers(ab); 1061 + ath11k_dp_stop_shadow_timers(ab); 1062 + 1063 + /* PM framework skips suspend_late/resume_early callbacks 1064 + * if other devices report errors in their suspend callbacks. 1065 + * However ath11k_core_resume() would still be called because 1066 + * here we return success thus kernel put us on dpm_suspended_list. 1067 + * Since we won't go through a power down/up cycle, there is 1068 + * no chance to call complete(&ab->restart_completed) in 1069 + * ath11k_core_restart(), making ath11k_core_resume() timeout. 1070 + * So call it here to avoid this issue. This also works in case 1071 + * no error happens thus suspend_late/resume_early get called, 1072 + * because it will be reinitialized in ath11k_core_resume_early(). 1073 + */ 1074 + complete(&ab->restart_completed); 1075 + 1076 + return 0; 1077 + } 1078 + 1079 + int ath11k_core_suspend(struct ath11k_base *ab) 1080 + { 1081 + int ret; 1082 + 1083 + ret = ath11k_core_continue_suspend_resume(ab); 1084 + if (ret <= 0) 1085 + return ret; 1086 + 1087 + if (ab->actual_pm_policy == ATH11K_PM_WOW) 1088 + return ath11k_core_suspend_wow(ab); 1089 + 1090 + return ath11k_core_suspend_default(ab); 1091 + } 1092 + EXPORT_SYMBOL(ath11k_core_suspend); 1093 + 1094 + int ath11k_core_suspend_late(struct ath11k_base *ab) 1095 + { 1096 + int ret; 1097 + 1098 + ret = ath11k_core_continue_suspend_resume(ab); 1099 + if (ret <= 0) 1100 + return ret; 1101 + 1102 + if (ab->actual_pm_policy == ATH11K_PM_WOW) 1101 1103 return 0; 1104 + 1105 + ath11k_hif_irq_disable(ab); 1106 + ath11k_hif_ce_irq_disable(ab); 1107 + 1108 + ath11k_hif_power_down(ab, true); 1109 + 1110 + return 0; 1111 + } 1112 + EXPORT_SYMBOL(ath11k_core_suspend_late); 1113 + 1114 + int ath11k_core_resume_early(struct ath11k_base *ab) 1115 + { 1116 + int ret; 1117 + 1118 + ret = ath11k_core_continue_suspend_resume(ab); 1119 + if (ret <= 0) 1120 + return ret; 1121 + 1122 + if (ab->actual_pm_policy == ATH11K_PM_WOW) 1123 + return 0; 1124 + 1125 + reinit_completion(&ab->restart_completed); 1126 + ret = ath11k_hif_power_up(ab); 1127 + if (ret) 1128 + ath11k_warn(ab, "failed to power up hif during resume: %d\n", ret); 1129 + 1130 + return ret; 1131 + } 1132 + EXPORT_SYMBOL(ath11k_core_resume_early); 1133 + 1134 + static int ath11k_core_resume_default(struct ath11k_base *ab) 1135 + { 1136 + struct ath11k *ar; 1137 + long time_left; 1138 + int ret; 1139 + 1140 + time_left = wait_for_completion_timeout(&ab->restart_completed, 1141 + ATH11K_RESET_TIMEOUT_HZ); 1142 + if (time_left == 0) { 1143 + ath11k_warn(ab, "timeout while waiting for restart complete"); 1144 + return -ETIMEDOUT; 1145 + } 1146 + 1147 + /* So far only single_pdev_only devices can reach here, 1148 + * so it is valid to handle the first, and the only, pdev. 1149 + */ 1150 + ar = ab->pdevs[0].ar; 1151 + if (ab->hw_params.current_cc_support && 1152 + ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { 1153 + ret = ath11k_reg_set_cc(ar); 1154 + if (ret) { 1155 + ath11k_warn(ab, "failed to set country code during resume: %d\n", 1156 + ret); 1157 + return ret; 1158 + } 1159 + } 1160 + 1161 + ret = ath11k_dp_rx_pktlog_start(ab); 1162 + if (ret) 1163 + ath11k_warn(ab, "failed to start rx pktlog during resume: %d\n", 1164 + ret); 1165 + 1166 + return ret; 1167 + } 1168 + 1169 + static int ath11k_core_resume_wow(struct ath11k_base *ab) 1170 + { 1171 + int ret; 1102 1172 1103 1173 ret = ath11k_hif_resume(ab); 1104 1174 if (ret) { ··· 1245 1071 } 1246 1072 1247 1073 return 0; 1074 + } 1075 + 1076 + int ath11k_core_resume(struct ath11k_base *ab) 1077 + { 1078 + int ret; 1079 + 1080 + ret = ath11k_core_continue_suspend_resume(ab); 1081 + if (ret <= 0) 1082 + return ret; 1083 + 1084 + if (ab->actual_pm_policy == ATH11K_PM_WOW) 1085 + return ath11k_core_resume_wow(ab); 1086 + 1087 + return ath11k_core_resume_default(ab); 1248 1088 } 1249 1089 EXPORT_SYMBOL(ath11k_core_resume); 1250 1090 ··· 2238 2050 void ath11k_core_halt(struct ath11k *ar) 2239 2051 { 2240 2052 struct ath11k_base *ab = ar->ab; 2053 + struct list_head *pos, *n; 2241 2054 2242 2055 lockdep_assert_held(&ar->conf_mutex); 2243 2056 ··· 2254 2065 2255 2066 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); 2256 2067 synchronize_rcu(); 2257 - INIT_LIST_HEAD(&ar->arvifs); 2068 + 2069 + spin_lock_bh(&ar->data_lock); 2070 + list_for_each_safe(pos, n, &ar->arvifs) 2071 + list_del_init(pos); 2072 + spin_unlock_bh(&ar->data_lock); 2073 + 2258 2074 idr_init(&ar->txmgmt_idr); 2259 2075 } 2260 2076 ··· 2399 2205 2400 2206 if (!ab->is_reset) 2401 2207 ath11k_core_post_reconfigure_recovery(ab); 2208 + 2209 + complete(&ab->restart_completed); 2402 2210 } 2403 2211 2404 2212 static void ath11k_core_reset(struct work_struct *work) ··· 2471 2275 ath11k_hif_irq_disable(ab); 2472 2276 ath11k_hif_ce_irq_disable(ab); 2473 2277 2474 - ath11k_hif_power_down(ab); 2278 + ath11k_hif_power_down(ab, false); 2475 2279 ath11k_hif_power_up(ab); 2476 2280 2477 2281 ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset started\n"); ··· 2521 2325 } 2522 2326 EXPORT_SYMBOL(ath11k_core_pre_init); 2523 2327 2524 - int ath11k_core_init(struct ath11k_base *ab) 2328 + static int ath11k_core_pm_notify(struct notifier_block *nb, 2329 + unsigned long action, void *nouse) 2330 + { 2331 + struct ath11k_base *ab = container_of(nb, struct ath11k_base, 2332 + pm_nb); 2333 + 2334 + switch (action) { 2335 + case PM_SUSPEND_PREPARE: 2336 + ab->actual_pm_policy = ab->pm_policy; 2337 + break; 2338 + case PM_HIBERNATION_PREPARE: 2339 + ab->actual_pm_policy = ATH11K_PM_DEFAULT; 2340 + break; 2341 + default: 2342 + break; 2343 + } 2344 + 2345 + return NOTIFY_OK; 2346 + } 2347 + 2348 + static int ath11k_core_pm_notifier_register(struct ath11k_base *ab) 2349 + { 2350 + ab->pm_nb.notifier_call = ath11k_core_pm_notify; 2351 + return register_pm_notifier(&ab->pm_nb); 2352 + } 2353 + 2354 + void ath11k_core_pm_notifier_unregister(struct ath11k_base *ab) 2525 2355 { 2526 2356 int ret; 2357 + 2358 + ret = unregister_pm_notifier(&ab->pm_nb); 2359 + if (ret) 2360 + /* just warn here, there is nothing can be done in fail case */ 2361 + ath11k_warn(ab, "failed to unregister PM notifier %d\n", ret); 2362 + } 2363 + EXPORT_SYMBOL(ath11k_core_pm_notifier_unregister); 2364 + 2365 + int ath11k_core_init(struct ath11k_base *ab) 2366 + { 2367 + const struct dmi_system_id *dmi_id; 2368 + int ret; 2369 + 2370 + dmi_id = dmi_first_match(ath11k_pm_quirk_table); 2371 + if (dmi_id) 2372 + ab->pm_policy = (kernel_ulong_t)dmi_id->driver_data; 2373 + else 2374 + ab->pm_policy = ATH11K_PM_DEFAULT; 2375 + 2376 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "pm policy %u\n", ab->pm_policy); 2377 + 2378 + ret = ath11k_core_pm_notifier_register(ab); 2379 + if (ret) { 2380 + ath11k_err(ab, "failed to register PM notifier: %d\n", ret); 2381 + return ret; 2382 + } 2527 2383 2528 2384 ret = ath11k_core_soc_create(ab); 2529 2385 if (ret) { ··· 2596 2348 2597 2349 mutex_unlock(&ab->core_lock); 2598 2350 2599 - ath11k_hif_power_down(ab); 2351 + ath11k_hif_power_down(ab, false); 2600 2352 ath11k_mac_destroy(ab); 2601 2353 ath11k_core_soc_destroy(ab); 2354 + ath11k_core_pm_notifier_unregister(ab); 2602 2355 } 2603 2356 EXPORT_SYMBOL(ath11k_core_deinit); 2604 2357 ··· 2650 2401 timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0); 2651 2402 init_completion(&ab->htc_suspend); 2652 2403 init_completion(&ab->wow.wakeup_completed); 2404 + init_completion(&ab->restart_completed); 2653 2405 2654 2406 ab->dev = dev; 2655 2407 ab->hif.bus = bus;
+16
drivers/net/wireless/ath/ath11k/core.h
··· 16 16 #include <linux/rhashtable.h> 17 17 #include <linux/average.h> 18 18 #include <linux/firmware.h> 19 + #include <linux/suspend.h> 19 20 20 21 #include "qmi.h" 21 22 #include "htc.h" ··· 893 892 u16 hw_rev; 894 893 }; 895 894 895 + enum ath11k_pm_policy { 896 + ATH11K_PM_DEFAULT, 897 + ATH11K_PM_WOW, 898 + }; 899 + 896 900 /* Master structure to hold the hw data which may be used in core module */ 897 901 struct ath11k_base { 898 902 enum ath11k_hw_rev hw_rev; ··· 1056 1050 DECLARE_BITMAP(fw_features, ATH11K_FW_FEATURE_COUNT); 1057 1051 } fw; 1058 1052 1053 + struct completion restart_completed; 1054 + 1059 1055 #ifdef CONFIG_NL80211_TESTMODE 1060 1056 struct { 1061 1057 u32 data_pos; ··· 1065 1057 u8 *eventdata; 1066 1058 } testmode; 1067 1059 #endif 1060 + 1061 + enum ath11k_pm_policy pm_policy; 1062 + enum ath11k_pm_policy actual_pm_policy; 1063 + struct notifier_block pm_nb; 1068 1064 1069 1065 /* must be last */ 1070 1066 u8 drv_priv[] __aligned(sizeof(void *)); ··· 1261 1249 int ath11k_core_check_dt(struct ath11k_base *ath11k); 1262 1250 int ath11k_core_check_smbios(struct ath11k_base *ab); 1263 1251 void ath11k_core_halt(struct ath11k *ar); 1252 + int ath11k_core_resume_early(struct ath11k_base *ab); 1264 1253 int ath11k_core_resume(struct ath11k_base *ab); 1265 1254 int ath11k_core_suspend(struct ath11k_base *ab); 1255 + int ath11k_core_suspend_late(struct ath11k_base *ab); 1266 1256 void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); 1267 1257 bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab); 1268 1258 ··· 1335 1321 1336 1322 return "unknown"; 1337 1323 } 1324 + 1325 + void ath11k_core_pm_notifier_unregister(struct ath11k_base *ab); 1338 1326 1339 1327 #endif /* _CORE_H_ */
+10 -4
drivers/net/wireless/ath/ath11k/hif.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef _HIF_H_ ··· 18 18 int (*start)(struct ath11k_base *ab); 19 19 void (*stop)(struct ath11k_base *ab); 20 20 int (*power_up)(struct ath11k_base *ab); 21 - void (*power_down)(struct ath11k_base *ab); 21 + void (*power_down)(struct ath11k_base *ab, bool is_suspend); 22 22 int (*suspend)(struct ath11k_base *ab); 23 23 int (*resume)(struct ath11k_base *ab); 24 24 int (*map_service_to_pipe)(struct ath11k_base *ab, u16 service_id, ··· 68 68 69 69 static inline int ath11k_hif_power_up(struct ath11k_base *ab) 70 70 { 71 + if (!ab->hif.ops->power_up) 72 + return -EOPNOTSUPP; 73 + 71 74 return ab->hif.ops->power_up(ab); 72 75 } 73 76 74 - static inline void ath11k_hif_power_down(struct ath11k_base *ab) 77 + static inline void ath11k_hif_power_down(struct ath11k_base *ab, bool is_suspend) 75 78 { 76 - ab->hif.ops->power_down(ab); 79 + if (!ab->hif.ops->power_down) 80 + return; 81 + 82 + ab->hif.ops->power_down(ab, is_suspend); 77 83 } 78 84 79 85 static inline int ath11k_hif_suspend(struct ath11k_base *ab)
+11 -3
drivers/net/wireless/ath/ath11k/mhi.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 2 /* 3 3 * Copyright (c) 2020 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include <linux/msi.h> ··· 454 454 return 0; 455 455 } 456 456 457 - void ath11k_mhi_stop(struct ath11k_pci *ab_pci) 457 + void ath11k_mhi_stop(struct ath11k_pci *ab_pci, bool is_suspend) 458 458 { 459 - mhi_power_down(ab_pci->mhi_ctrl, true); 459 + /* During suspend we need to use mhi_power_down_keep_dev() 460 + * workaround, otherwise ath11k_core_resume() will timeout 461 + * during resume. 462 + */ 463 + if (is_suspend) 464 + mhi_power_down_keep_dev(ab_pci->mhi_ctrl, true); 465 + else 466 + mhi_power_down(ab_pci->mhi_ctrl, true); 467 + 460 468 mhi_unprepare_after_power_down(ab_pci->mhi_ctrl); 461 469 } 462 470
+2 -2
drivers/net/wireless/ath/ath11k/mhi.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 3 * Copyright (c) 2020 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 #ifndef _ATH11K_MHI_H 7 7 #define _ATH11K_MHI_H ··· 18 18 #define MHICTRL_RESET_MASK 0x2 19 19 20 20 int ath11k_mhi_start(struct ath11k_pci *ar_pci); 21 - void ath11k_mhi_stop(struct ath11k_pci *ar_pci); 21 + void ath11k_mhi_stop(struct ath11k_pci *ar_pci, bool is_suspend); 22 22 int ath11k_mhi_register(struct ath11k_pci *ar_pci); 23 23 void ath11k_mhi_unregister(struct ath11k_pci *ar_pci); 24 24 void ath11k_mhi_set_mhictrl_reset(struct ath11k_base *ab);
+40 -10
drivers/net/wireless/ath/ath11k/pci.c
··· 821 821 return 0; 822 822 } 823 823 824 - static void ath11k_pci_power_down(struct ath11k_base *ab) 824 + static void ath11k_pci_power_down(struct ath11k_base *ab, bool is_suspend) 825 825 { 826 826 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); 827 827 ··· 832 832 833 833 ath11k_pci_msi_disable(ab_pci); 834 834 835 - ath11k_mhi_stop(ab_pci); 835 + ath11k_mhi_stop(ab_pci, is_suspend); 836 836 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); 837 837 ath11k_pci_sw_reset(ab_pci->ab, false); 838 838 } ··· 929 929 { 930 930 struct ath11k_base *ab; 931 931 struct ath11k_pci *ab_pci; 932 - u32 soc_hw_version_major, soc_hw_version_minor, addr; 932 + u32 soc_hw_version_major, soc_hw_version_minor; 933 933 int ret; 934 934 u32 sub_version; 935 935 ··· 955 955 * from DT. If memory is reserved from DT for FW, ath11k driver need not 956 956 * allocate memory. 957 957 */ 958 - ret = of_property_read_u32(ab->dev->of_node, "memory-region", &addr); 959 - if (!ret) 958 + if (of_property_present(ab->dev->of_node, "memory-region")) 960 959 set_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags); 961 960 962 961 ret = ath11k_pci_claim(ab_pci, pdev); ··· 1160 1161 ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); 1161 1162 1162 1163 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { 1163 - ath11k_pci_power_down(ab); 1164 + ath11k_pci_power_down(ab, false); 1164 1165 ath11k_debugfs_soc_destroy(ab); 1165 1166 ath11k_qmi_deinit_service(ab); 1167 + ath11k_core_pm_notifier_unregister(ab); 1166 1168 goto qmi_fail; 1167 1169 } 1168 1170 ··· 1192 1192 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); 1193 1193 1194 1194 ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); 1195 - ath11k_pci_power_down(ab); 1195 + ath11k_pci_power_down(ab, false); 1196 1196 } 1197 1197 1198 1198 static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev) ··· 1229 1229 return ret; 1230 1230 } 1231 1231 1232 - static SIMPLE_DEV_PM_OPS(ath11k_pci_pm_ops, 1233 - ath11k_pci_pm_suspend, 1234 - ath11k_pci_pm_resume); 1232 + static __maybe_unused int ath11k_pci_pm_suspend_late(struct device *dev) 1233 + { 1234 + struct ath11k_base *ab = dev_get_drvdata(dev); 1235 + int ret; 1236 + 1237 + ret = ath11k_core_suspend_late(ab); 1238 + if (ret) 1239 + ath11k_warn(ab, "failed to late suspend core: %d\n", ret); 1240 + 1241 + /* Similar to ath11k_pci_pm_suspend(), we return success here 1242 + * even error happens, to allow system suspend/hibernation survive. 1243 + */ 1244 + return 0; 1245 + } 1246 + 1247 + static __maybe_unused int ath11k_pci_pm_resume_early(struct device *dev) 1248 + { 1249 + struct ath11k_base *ab = dev_get_drvdata(dev); 1250 + int ret; 1251 + 1252 + ret = ath11k_core_resume_early(ab); 1253 + if (ret) 1254 + ath11k_warn(ab, "failed to early resume core: %d\n", ret); 1255 + 1256 + return ret; 1257 + } 1258 + 1259 + static const struct dev_pm_ops __maybe_unused ath11k_pci_pm_ops = { 1260 + SET_SYSTEM_SLEEP_PM_OPS(ath11k_pci_pm_suspend, 1261 + ath11k_pci_pm_resume) 1262 + SET_LATE_SYSTEM_SLEEP_PM_OPS(ath11k_pci_pm_suspend_late, 1263 + ath11k_pci_pm_resume_early) 1264 + }; 1235 1265 1236 1266 static struct pci_driver ath11k_pci_driver = { 1237 1267 .name = "ath11k_pci",
+2 -2
drivers/net/wireless/ath/ath11k/qmi.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 2 /* 3 3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include <linux/elf.h> ··· 2887 2887 } 2888 2888 2889 2889 /* reset the firmware */ 2890 - ath11k_hif_power_down(ab); 2890 + ath11k_hif_power_down(ab, false); 2891 2891 ath11k_hif_power_up(ab); 2892 2892 ath11k_dbg(ab, ATH11K_DBG_QMI, "exit wait for cold boot done\n"); 2893 2893 return 0;
+1 -1
drivers/net/wireless/ath/ath11k/testmode.c
··· 107 107 u32 pdev_id; 108 108 109 109 ath11k_dbg(ab, ATH11K_DBG_TESTMODE, 110 - "event wmi cmd_id %d ftm event msg %pK datalen %d\n", 110 + "event wmi cmd_id %d ftm event msg %p datalen %d\n", 111 111 cmd_id, ftm_msg, length); 112 112 ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", ftm_msg, length); 113 113 pdev_id = DP_HW2SW_MACID(ftm_msg->seg_hdr.pdev_id);
+8
drivers/net/wireless/ath/ath12k/Kconfig
··· 15 15 16 16 If you choose to build a module, it'll be called ath12k. 17 17 18 + config ATH12K_AHB 19 + bool "QTI ath12k AHB support" 20 + depends on ATH12K && REMOTEPROC 21 + select QCOM_MDT_LOADER 22 + select QCOM_SCM 23 + help 24 + Enable support for Ath12k AHB bus chipsets, example IPQ5332. 25 + 18 26 config ATH12K_DEBUG 19 27 bool "ath12k debugging" 20 28 depends on ATH12K
+1
drivers/net/wireless/ath/ath12k/Makefile
··· 23 23 fw.o \ 24 24 p2p.o 25 25 26 + ath12k-$(CONFIG_ATH12K_AHB) += ahb.o 26 27 ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o 27 28 ath12k-$(CONFIG_ACPI) += acpi.o 28 29 ath12k-$(CONFIG_ATH12K_TRACING) += trace.o
+1156
drivers/net/wireless/ath/ath12k/ahb.c
··· 1 + // SPDX-License-Identifier: BSD-3-Clause-Clear 2 + /* 3 + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 + */ 6 + 7 + #include <linux/dma-mapping.h> 8 + #include <linux/firmware/qcom/qcom_scm.h> 9 + #include <linux/of.h> 10 + #include <linux/of_device.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/remoteproc.h> 13 + #include <linux/soc/qcom/mdt_loader.h> 14 + #include <linux/soc/qcom/smem_state.h> 15 + #include "ahb.h" 16 + #include "debug.h" 17 + #include "hif.h" 18 + 19 + static const struct of_device_id ath12k_ahb_of_match[] = { 20 + { .compatible = "qcom,ipq5332-wifi", 21 + .data = (void *)ATH12K_HW_IPQ5332_HW10, 22 + }, 23 + { } 24 + }; 25 + 26 + MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match); 27 + 28 + #define ATH12K_IRQ_CE0_OFFSET 4 29 + #define ATH12K_MAX_UPDS 1 30 + #define ATH12K_UPD_IRQ_WRD_LEN 18 31 + static const char ath12k_userpd_irq[][9] = {"spawn", 32 + "ready", 33 + "stop-ack"}; 34 + 35 + static const char *irq_name[ATH12K_IRQ_NUM_MAX] = { 36 + "misc-pulse1", 37 + "misc-latch", 38 + "sw-exception", 39 + "watchdog", 40 + "ce0", 41 + "ce1", 42 + "ce2", 43 + "ce3", 44 + "ce4", 45 + "ce5", 46 + "ce6", 47 + "ce7", 48 + "ce8", 49 + "ce9", 50 + "ce10", 51 + "ce11", 52 + "host2wbm-desc-feed", 53 + "host2reo-re-injection", 54 + "host2reo-command", 55 + "host2rxdma-monitor-ring3", 56 + "host2rxdma-monitor-ring2", 57 + "host2rxdma-monitor-ring1", 58 + "reo2ost-exception", 59 + "wbm2host-rx-release", 60 + "reo2host-status", 61 + "reo2host-destination-ring4", 62 + "reo2host-destination-ring3", 63 + "reo2host-destination-ring2", 64 + "reo2host-destination-ring1", 65 + "rxdma2host-monitor-destination-mac3", 66 + "rxdma2host-monitor-destination-mac2", 67 + "rxdma2host-monitor-destination-mac1", 68 + "ppdu-end-interrupts-mac3", 69 + "ppdu-end-interrupts-mac2", 70 + "ppdu-end-interrupts-mac1", 71 + "rxdma2host-monitor-status-ring-mac3", 72 + "rxdma2host-monitor-status-ring-mac2", 73 + "rxdma2host-monitor-status-ring-mac1", 74 + "host2rxdma-host-buf-ring-mac3", 75 + "host2rxdma-host-buf-ring-mac2", 76 + "host2rxdma-host-buf-ring-mac1", 77 + "rxdma2host-destination-ring-mac3", 78 + "rxdma2host-destination-ring-mac2", 79 + "rxdma2host-destination-ring-mac1", 80 + "host2tcl-input-ring4", 81 + "host2tcl-input-ring3", 82 + "host2tcl-input-ring2", 83 + "host2tcl-input-ring1", 84 + "wbm2host-tx-completions-ring4", 85 + "wbm2host-tx-completions-ring3", 86 + "wbm2host-tx-completions-ring2", 87 + "wbm2host-tx-completions-ring1", 88 + "tcl2host-status-ring", 89 + }; 90 + 91 + enum ext_irq_num { 92 + host2wbm_desc_feed = 16, 93 + host2reo_re_injection, 94 + host2reo_command, 95 + host2rxdma_monitor_ring3, 96 + host2rxdma_monitor_ring2, 97 + host2rxdma_monitor_ring1, 98 + reo2host_exception, 99 + wbm2host_rx_release, 100 + reo2host_status, 101 + reo2host_destination_ring4, 102 + reo2host_destination_ring3, 103 + reo2host_destination_ring2, 104 + reo2host_destination_ring1, 105 + rxdma2host_monitor_destination_mac3, 106 + rxdma2host_monitor_destination_mac2, 107 + rxdma2host_monitor_destination_mac1, 108 + ppdu_end_interrupts_mac3, 109 + ppdu_end_interrupts_mac2, 110 + ppdu_end_interrupts_mac1, 111 + rxdma2host_monitor_status_ring_mac3, 112 + rxdma2host_monitor_status_ring_mac2, 113 + rxdma2host_monitor_status_ring_mac1, 114 + host2rxdma_host_buf_ring_mac3, 115 + host2rxdma_host_buf_ring_mac2, 116 + host2rxdma_host_buf_ring_mac1, 117 + rxdma2host_destination_ring_mac3, 118 + rxdma2host_destination_ring_mac2, 119 + rxdma2host_destination_ring_mac1, 120 + host2tcl_input_ring4, 121 + host2tcl_input_ring3, 122 + host2tcl_input_ring2, 123 + host2tcl_input_ring1, 124 + wbm2host_tx_completions_ring4, 125 + wbm2host_tx_completions_ring3, 126 + wbm2host_tx_completions_ring2, 127 + wbm2host_tx_completions_ring1, 128 + tcl2host_status_ring, 129 + }; 130 + 131 + static u32 ath12k_ahb_read32(struct ath12k_base *ab, u32 offset) 132 + { 133 + if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET) 134 + return ioread32(ab->mem_ce + offset); 135 + return ioread32(ab->mem + offset); 136 + } 137 + 138 + static void ath12k_ahb_write32(struct ath12k_base *ab, u32 offset, 139 + u32 value) 140 + { 141 + if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET) 142 + iowrite32(value, ab->mem_ce + offset); 143 + else 144 + iowrite32(value, ab->mem + offset); 145 + } 146 + 147 + static void ath12k_ahb_cancel_workqueue(struct ath12k_base *ab) 148 + { 149 + int i; 150 + 151 + for (i = 0; i < ab->hw_params->ce_count; i++) { 152 + struct ath12k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; 153 + 154 + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) 155 + continue; 156 + 157 + cancel_work_sync(&ce_pipe->intr_wq); 158 + } 159 + } 160 + 161 + static void ath12k_ahb_ext_grp_disable(struct ath12k_ext_irq_grp *irq_grp) 162 + { 163 + int i; 164 + 165 + for (i = 0; i < irq_grp->num_irq; i++) 166 + disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); 167 + } 168 + 169 + static void __ath12k_ahb_ext_irq_disable(struct ath12k_base *ab) 170 + { 171 + int i; 172 + 173 + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { 174 + struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 175 + 176 + ath12k_ahb_ext_grp_disable(irq_grp); 177 + if (irq_grp->napi_enabled) { 178 + napi_synchronize(&irq_grp->napi); 179 + napi_disable(&irq_grp->napi); 180 + irq_grp->napi_enabled = false; 181 + } 182 + } 183 + } 184 + 185 + static void ath12k_ahb_ext_grp_enable(struct ath12k_ext_irq_grp *irq_grp) 186 + { 187 + int i; 188 + 189 + for (i = 0; i < irq_grp->num_irq; i++) 190 + enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); 191 + } 192 + 193 + static void ath12k_ahb_setbit32(struct ath12k_base *ab, u8 bit, u32 offset) 194 + { 195 + u32 val; 196 + 197 + val = ath12k_ahb_read32(ab, offset); 198 + ath12k_ahb_write32(ab, offset, val | BIT(bit)); 199 + } 200 + 201 + static void ath12k_ahb_clearbit32(struct ath12k_base *ab, u8 bit, u32 offset) 202 + { 203 + u32 val; 204 + 205 + val = ath12k_ahb_read32(ab, offset); 206 + ath12k_ahb_write32(ab, offset, val & ~BIT(bit)); 207 + } 208 + 209 + static void ath12k_ahb_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) 210 + { 211 + const struct ce_attr *ce_attr; 212 + const struct ce_ie_addr *ce_ie_addr = ab->hw_params->ce_ie_addr; 213 + u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; 214 + 215 + ie1_reg_addr = ce_ie_addr->ie1_reg_addr; 216 + ie2_reg_addr = ce_ie_addr->ie2_reg_addr; 217 + ie3_reg_addr = ce_ie_addr->ie3_reg_addr; 218 + 219 + ce_attr = &ab->hw_params->host_ce_config[ce_id]; 220 + if (ce_attr->src_nentries) 221 + ath12k_ahb_setbit32(ab, ce_id, ie1_reg_addr); 222 + 223 + if (ce_attr->dest_nentries) { 224 + ath12k_ahb_setbit32(ab, ce_id, ie2_reg_addr); 225 + ath12k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, 226 + ie3_reg_addr); 227 + } 228 + } 229 + 230 + static void ath12k_ahb_ce_irq_disable(struct ath12k_base *ab, u16 ce_id) 231 + { 232 + const struct ce_attr *ce_attr; 233 + const struct ce_ie_addr *ce_ie_addr = ab->hw_params->ce_ie_addr; 234 + u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; 235 + 236 + ie1_reg_addr = ce_ie_addr->ie1_reg_addr; 237 + ie2_reg_addr = ce_ie_addr->ie2_reg_addr; 238 + ie3_reg_addr = ce_ie_addr->ie3_reg_addr; 239 + 240 + ce_attr = &ab->hw_params->host_ce_config[ce_id]; 241 + if (ce_attr->src_nentries) 242 + ath12k_ahb_clearbit32(ab, ce_id, ie1_reg_addr); 243 + 244 + if (ce_attr->dest_nentries) { 245 + ath12k_ahb_clearbit32(ab, ce_id, ie2_reg_addr); 246 + ath12k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, 247 + ie3_reg_addr); 248 + } 249 + } 250 + 251 + static void ath12k_ahb_sync_ce_irqs(struct ath12k_base *ab) 252 + { 253 + int i; 254 + int irq_idx; 255 + 256 + for (i = 0; i < ab->hw_params->ce_count; i++) { 257 + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) 258 + continue; 259 + 260 + irq_idx = ATH12K_IRQ_CE0_OFFSET + i; 261 + synchronize_irq(ab->irq_num[irq_idx]); 262 + } 263 + } 264 + 265 + static void ath12k_ahb_sync_ext_irqs(struct ath12k_base *ab) 266 + { 267 + int i, j; 268 + int irq_idx; 269 + 270 + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { 271 + struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 272 + 273 + for (j = 0; j < irq_grp->num_irq; j++) { 274 + irq_idx = irq_grp->irqs[j]; 275 + synchronize_irq(ab->irq_num[irq_idx]); 276 + } 277 + } 278 + } 279 + 280 + static void ath12k_ahb_ce_irqs_enable(struct ath12k_base *ab) 281 + { 282 + int i; 283 + 284 + for (i = 0; i < ab->hw_params->ce_count; i++) { 285 + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) 286 + continue; 287 + ath12k_ahb_ce_irq_enable(ab, i); 288 + } 289 + } 290 + 291 + static void ath12k_ahb_ce_irqs_disable(struct ath12k_base *ab) 292 + { 293 + int i; 294 + 295 + for (i = 0; i < ab->hw_params->ce_count; i++) { 296 + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) 297 + continue; 298 + ath12k_ahb_ce_irq_disable(ab, i); 299 + } 300 + } 301 + 302 + static int ath12k_ahb_start(struct ath12k_base *ab) 303 + { 304 + ath12k_ahb_ce_irqs_enable(ab); 305 + ath12k_ce_rx_post_buf(ab); 306 + 307 + return 0; 308 + } 309 + 310 + static void ath12k_ahb_ext_irq_enable(struct ath12k_base *ab) 311 + { 312 + struct ath12k_ext_irq_grp *irq_grp; 313 + int i; 314 + 315 + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { 316 + irq_grp = &ab->ext_irq_grp[i]; 317 + if (!irq_grp->napi_enabled) { 318 + napi_enable(&irq_grp->napi); 319 + irq_grp->napi_enabled = true; 320 + } 321 + ath12k_ahb_ext_grp_enable(irq_grp); 322 + } 323 + } 324 + 325 + static void ath12k_ahb_ext_irq_disable(struct ath12k_base *ab) 326 + { 327 + __ath12k_ahb_ext_irq_disable(ab); 328 + ath12k_ahb_sync_ext_irqs(ab); 329 + } 330 + 331 + static void ath12k_ahb_stop(struct ath12k_base *ab) 332 + { 333 + if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) 334 + ath12k_ahb_ce_irqs_disable(ab); 335 + ath12k_ahb_sync_ce_irqs(ab); 336 + ath12k_ahb_cancel_workqueue(ab); 337 + timer_delete_sync(&ab->rx_replenish_retry); 338 + ath12k_ce_cleanup_pipes(ab); 339 + } 340 + 341 + static int ath12k_ahb_power_up(struct ath12k_base *ab) 342 + { 343 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 344 + char fw_name[ATH12K_USERPD_FW_NAME_LEN]; 345 + char fw2_name[ATH12K_USERPD_FW_NAME_LEN]; 346 + struct device *dev = ab->dev; 347 + const struct firmware *fw, *fw2; 348 + struct reserved_mem *rmem = NULL; 349 + unsigned long time_left; 350 + phys_addr_t mem_phys; 351 + void *mem_region; 352 + size_t mem_size; 353 + u32 pasid; 354 + int ret; 355 + 356 + rmem = ath12k_core_get_reserved_mem(ab, 0); 357 + if (!rmem) 358 + return -ENODEV; 359 + 360 + mem_phys = rmem->base; 361 + mem_size = rmem->size; 362 + mem_region = devm_memremap(dev, mem_phys, mem_size, MEMREMAP_WC); 363 + if (IS_ERR(mem_region)) { 364 + ath12k_err(ab, "unable to map memory region: %pa+%pa\n", 365 + &rmem->base, &rmem->size); 366 + return PTR_ERR(mem_region); 367 + } 368 + 369 + snprintf(fw_name, sizeof(fw_name), "%s/%s/%s%d%s", ATH12K_FW_DIR, 370 + ab->hw_params->fw.dir, ATH12K_AHB_FW_PREFIX, ab_ahb->userpd_id, 371 + ATH12K_AHB_FW_SUFFIX); 372 + 373 + ret = request_firmware(&fw, fw_name, dev); 374 + if (ret < 0) { 375 + ath12k_err(ab, "request_firmware failed\n"); 376 + return ret; 377 + } 378 + 379 + ath12k_dbg(ab, ATH12K_DBG_AHB, "Booting fw image %s, size %zd\n", fw_name, 380 + fw->size); 381 + 382 + if (!fw->size) { 383 + ath12k_err(ab, "Invalid firmware size\n"); 384 + ret = -EINVAL; 385 + goto err_fw; 386 + } 387 + 388 + pasid = (u32_encode_bits(ab_ahb->userpd_id, ATH12K_USERPD_ID_MASK)) | 389 + ATH12K_AHB_UPD_SWID; 390 + 391 + /* Load FW image to a reserved memory location */ 392 + ret = qcom_mdt_load(dev, fw, fw_name, pasid, mem_region, mem_phys, mem_size, 393 + &mem_phys); 394 + if (ret) { 395 + ath12k_err(ab, "Failed to load MDT segments: %d\n", ret); 396 + goto err_fw; 397 + } 398 + 399 + snprintf(fw2_name, sizeof(fw2_name), "%s/%s/%s", ATH12K_FW_DIR, 400 + ab->hw_params->fw.dir, ATH12K_AHB_FW2); 401 + 402 + ret = request_firmware(&fw2, fw2_name, dev); 403 + if (ret < 0) { 404 + ath12k_err(ab, "request_firmware failed\n"); 405 + goto err_fw; 406 + } 407 + 408 + ath12k_dbg(ab, ATH12K_DBG_AHB, "Booting fw image %s, size %zd\n", fw2_name, 409 + fw2->size); 410 + 411 + if (!fw2->size) { 412 + ath12k_err(ab, "Invalid firmware size\n"); 413 + ret = -EINVAL; 414 + goto err_fw2; 415 + } 416 + 417 + ret = qcom_mdt_load_no_init(dev, fw2, fw2_name, pasid, mem_region, mem_phys, 418 + mem_size, &mem_phys); 419 + if (ret) { 420 + ath12k_err(ab, "Failed to load MDT segments: %d\n", ret); 421 + goto err_fw2; 422 + } 423 + 424 + /* Authenticate FW image using peripheral ID */ 425 + ret = qcom_scm_pas_auth_and_reset(pasid); 426 + if (ret) { 427 + ath12k_err(ab, "failed to boot the remote processor %d\n", ret); 428 + goto err_fw2; 429 + } 430 + 431 + /* Instruct Q6 to spawn userPD thread */ 432 + ret = qcom_smem_state_update_bits(ab_ahb->spawn_state, BIT(ab_ahb->spawn_bit), 433 + BIT(ab_ahb->spawn_bit)); 434 + if (ret) { 435 + ath12k_err(ab, "Failed to update spawn state %d\n", ret); 436 + goto err_fw2; 437 + } 438 + 439 + time_left = wait_for_completion_timeout(&ab_ahb->userpd_spawned, 440 + ATH12K_USERPD_SPAWN_TIMEOUT); 441 + if (!time_left) { 442 + ath12k_err(ab, "UserPD spawn wait timed out\n"); 443 + ret = -ETIMEDOUT; 444 + goto err_fw2; 445 + } 446 + 447 + time_left = wait_for_completion_timeout(&ab_ahb->userpd_ready, 448 + ATH12K_USERPD_READY_TIMEOUT); 449 + if (!time_left) { 450 + ath12k_err(ab, "UserPD ready wait timed out\n"); 451 + ret = -ETIMEDOUT; 452 + goto err_fw2; 453 + } 454 + 455 + qcom_smem_state_update_bits(ab_ahb->spawn_state, BIT(ab_ahb->spawn_bit), 0); 456 + 457 + ath12k_dbg(ab, ATH12K_DBG_AHB, "UserPD%d is now UP\n", ab_ahb->userpd_id); 458 + 459 + err_fw2: 460 + release_firmware(fw2); 461 + err_fw: 462 + release_firmware(fw); 463 + return ret; 464 + } 465 + 466 + static void ath12k_ahb_power_down(struct ath12k_base *ab, bool is_suspend) 467 + { 468 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 469 + unsigned long time_left; 470 + u32 pasid; 471 + int ret; 472 + 473 + qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit), 474 + BIT(ab_ahb->stop_bit)); 475 + 476 + time_left = wait_for_completion_timeout(&ab_ahb->userpd_stopped, 477 + ATH12K_USERPD_STOP_TIMEOUT); 478 + if (!time_left) { 479 + ath12k_err(ab, "UserPD stop wait timed out\n"); 480 + return; 481 + } 482 + 483 + qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit), 0); 484 + 485 + pasid = (u32_encode_bits(ab_ahb->userpd_id, ATH12K_USERPD_ID_MASK)) | 486 + ATH12K_AHB_UPD_SWID; 487 + /* Release the firmware */ 488 + ret = qcom_scm_pas_shutdown(pasid); 489 + if (ret) 490 + ath12k_err(ab, "scm pas shutdown failed for userPD%d: %d\n", 491 + ab_ahb->userpd_id, ret); 492 + } 493 + 494 + static void ath12k_ahb_init_qmi_ce_config(struct ath12k_base *ab) 495 + { 496 + struct ath12k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; 497 + 498 + cfg->tgt_ce_len = ab->hw_params->target_ce_count; 499 + cfg->tgt_ce = ab->hw_params->target_ce_config; 500 + cfg->svc_to_ce_map_len = ab->hw_params->svc_to_ce_map_len; 501 + cfg->svc_to_ce_map = ab->hw_params->svc_to_ce_map; 502 + ab->qmi.service_ins_id = ab->hw_params->qmi_service_ins_id; 503 + } 504 + 505 + static void ath12k_ahb_ce_workqueue(struct work_struct *work) 506 + { 507 + struct ath12k_ce_pipe *ce_pipe = from_work(ce_pipe, work, intr_wq); 508 + 509 + ath12k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); 510 + 511 + ath12k_ahb_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); 512 + } 513 + 514 + static irqreturn_t ath12k_ahb_ce_interrupt_handler(int irq, void *arg) 515 + { 516 + struct ath12k_ce_pipe *ce_pipe = arg; 517 + 518 + /* last interrupt received for this CE */ 519 + ce_pipe->timestamp = jiffies; 520 + 521 + ath12k_ahb_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); 522 + 523 + queue_work(system_bh_wq, &ce_pipe->intr_wq); 524 + 525 + return IRQ_HANDLED; 526 + } 527 + 528 + static int ath12k_ahb_ext_grp_napi_poll(struct napi_struct *napi, int budget) 529 + { 530 + struct ath12k_ext_irq_grp *irq_grp = container_of(napi, 531 + struct ath12k_ext_irq_grp, 532 + napi); 533 + struct ath12k_base *ab = irq_grp->ab; 534 + int work_done; 535 + 536 + work_done = ath12k_dp_service_srng(ab, irq_grp, budget); 537 + if (work_done < budget) { 538 + napi_complete_done(napi, work_done); 539 + ath12k_ahb_ext_grp_enable(irq_grp); 540 + } 541 + 542 + if (work_done > budget) 543 + work_done = budget; 544 + 545 + return work_done; 546 + } 547 + 548 + static irqreturn_t ath12k_ahb_ext_interrupt_handler(int irq, void *arg) 549 + { 550 + struct ath12k_ext_irq_grp *irq_grp = arg; 551 + 552 + /* last interrupt received for this group */ 553 + irq_grp->timestamp = jiffies; 554 + 555 + ath12k_ahb_ext_grp_disable(irq_grp); 556 + 557 + napi_schedule(&irq_grp->napi); 558 + 559 + return IRQ_HANDLED; 560 + } 561 + 562 + static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab) 563 + { 564 + const struct ath12k_hw_ring_mask *ring_mask; 565 + struct ath12k_ext_irq_grp *irq_grp; 566 + const struct hal_ops *hal_ops; 567 + int i, j, irq, irq_idx, ret; 568 + u32 num_irq; 569 + 570 + ring_mask = ab->hw_params->ring_mask; 571 + hal_ops = ab->hw_params->hal_ops; 572 + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { 573 + irq_grp = &ab->ext_irq_grp[i]; 574 + num_irq = 0; 575 + 576 + irq_grp->ab = ab; 577 + irq_grp->grp_id = i; 578 + 579 + irq_grp->napi_ndev = alloc_netdev_dummy(0); 580 + if (!irq_grp->napi_ndev) 581 + return -ENOMEM; 582 + 583 + netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, 584 + ath12k_ahb_ext_grp_napi_poll); 585 + 586 + for (j = 0; j < ATH12K_EXT_IRQ_NUM_MAX; j++) { 587 + /* For TX ring, ensure that the ring mask and the 588 + * tcl_to_wbm_rbm_map point to the same ring number. 589 + */ 590 + if (ring_mask->tx[i] & 591 + BIT(hal_ops->tcl_to_wbm_rbm_map[j].wbm_ring_num)) { 592 + irq_grp->irqs[num_irq++] = 593 + wbm2host_tx_completions_ring1 - j; 594 + } 595 + 596 + if (ring_mask->rx[i] & BIT(j)) { 597 + irq_grp->irqs[num_irq++] = 598 + reo2host_destination_ring1 - j; 599 + } 600 + 601 + if (ring_mask->rx_err[i] & BIT(j)) 602 + irq_grp->irqs[num_irq++] = reo2host_exception; 603 + 604 + if (ring_mask->rx_wbm_rel[i] & BIT(j)) 605 + irq_grp->irqs[num_irq++] = wbm2host_rx_release; 606 + 607 + if (ring_mask->reo_status[i] & BIT(j)) 608 + irq_grp->irqs[num_irq++] = reo2host_status; 609 + 610 + if (ring_mask->rx_mon_dest[i] & BIT(j)) 611 + irq_grp->irqs[num_irq++] = 612 + rxdma2host_monitor_destination_mac1; 613 + } 614 + 615 + irq_grp->num_irq = num_irq; 616 + 617 + for (j = 0; j < irq_grp->num_irq; j++) { 618 + irq_idx = irq_grp->irqs[j]; 619 + 620 + irq = platform_get_irq_byname(ab->pdev, 621 + irq_name[irq_idx]); 622 + ab->irq_num[irq_idx] = irq; 623 + irq_set_status_flags(irq, IRQ_NOAUTOEN | IRQ_DISABLE_UNLAZY); 624 + ret = devm_request_irq(ab->dev, irq, 625 + ath12k_ahb_ext_interrupt_handler, 626 + IRQF_TRIGGER_RISING, 627 + irq_name[irq_idx], irq_grp); 628 + if (ret) 629 + ath12k_warn(ab, "failed request_irq for %d\n", irq); 630 + } 631 + } 632 + 633 + return 0; 634 + } 635 + 636 + static int ath12k_ahb_config_irq(struct ath12k_base *ab) 637 + { 638 + int irq, irq_idx, i; 639 + int ret; 640 + 641 + /* Configure CE irqs */ 642 + for (i = 0; i < ab->hw_params->ce_count; i++) { 643 + struct ath12k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; 644 + 645 + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) 646 + continue; 647 + 648 + irq_idx = ATH12K_IRQ_CE0_OFFSET + i; 649 + 650 + INIT_WORK(&ce_pipe->intr_wq, ath12k_ahb_ce_workqueue); 651 + irq = platform_get_irq_byname(ab->pdev, irq_name[irq_idx]); 652 + ret = devm_request_irq(ab->dev, irq, ath12k_ahb_ce_interrupt_handler, 653 + IRQF_TRIGGER_RISING, irq_name[irq_idx], 654 + ce_pipe); 655 + if (ret) 656 + return ret; 657 + 658 + ab->irq_num[irq_idx] = irq; 659 + } 660 + 661 + /* Configure external interrupts */ 662 + ret = ath12k_ahb_config_ext_irq(ab); 663 + 664 + return ret; 665 + } 666 + 667 + static int ath12k_ahb_map_service_to_pipe(struct ath12k_base *ab, u16 service_id, 668 + u8 *ul_pipe, u8 *dl_pipe) 669 + { 670 + const struct service_to_pipe *entry; 671 + bool ul_set = false, dl_set = false; 672 + u32 pipedir; 673 + int i; 674 + 675 + for (i = 0; i < ab->hw_params->svc_to_ce_map_len; i++) { 676 + entry = &ab->hw_params->svc_to_ce_map[i]; 677 + 678 + if (__le32_to_cpu(entry->service_id) != service_id) 679 + continue; 680 + 681 + pipedir = __le32_to_cpu(entry->pipedir); 682 + if (pipedir == PIPEDIR_IN || pipedir == PIPEDIR_INOUT) { 683 + WARN_ON(dl_set); 684 + *dl_pipe = __le32_to_cpu(entry->pipenum); 685 + dl_set = true; 686 + } 687 + 688 + if (pipedir == PIPEDIR_OUT || pipedir == PIPEDIR_INOUT) { 689 + WARN_ON(ul_set); 690 + *ul_pipe = __le32_to_cpu(entry->pipenum); 691 + ul_set = true; 692 + } 693 + } 694 + 695 + if (WARN_ON(!ul_set || !dl_set)) 696 + return -ENOENT; 697 + 698 + return 0; 699 + } 700 + 701 + static const struct ath12k_hif_ops ath12k_ahb_hif_ops_ipq5332 = { 702 + .start = ath12k_ahb_start, 703 + .stop = ath12k_ahb_stop, 704 + .read32 = ath12k_ahb_read32, 705 + .write32 = ath12k_ahb_write32, 706 + .irq_enable = ath12k_ahb_ext_irq_enable, 707 + .irq_disable = ath12k_ahb_ext_irq_disable, 708 + .map_service_to_pipe = ath12k_ahb_map_service_to_pipe, 709 + .power_up = ath12k_ahb_power_up, 710 + .power_down = ath12k_ahb_power_down, 711 + }; 712 + 713 + static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data) 714 + { 715 + struct ath12k_base *ab = data; 716 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 717 + 718 + if (irq == ab_ahb->userpd_irq_num[ATH12K_USERPD_SPAWN_IRQ]) { 719 + complete(&ab_ahb->userpd_spawned); 720 + } else if (irq == ab_ahb->userpd_irq_num[ATH12K_USERPD_READY_IRQ]) { 721 + complete(&ab_ahb->userpd_ready); 722 + } else if (irq == ab_ahb->userpd_irq_num[ATH12K_USERPD_STOP_ACK_IRQ]) { 723 + complete(&ab_ahb->userpd_stopped); 724 + } else { 725 + ath12k_err(ab, "Invalid userpd interrupt\n"); 726 + return IRQ_NONE; 727 + } 728 + 729 + return IRQ_HANDLED; 730 + } 731 + 732 + static int ath12k_ahb_config_rproc_irq(struct ath12k_base *ab) 733 + { 734 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 735 + int i, ret; 736 + char *upd_irq_name; 737 + 738 + for (i = 0; i < ATH12K_USERPD_MAX_IRQ; i++) { 739 + ab_ahb->userpd_irq_num[i] = platform_get_irq_byname(ab->pdev, 740 + ath12k_userpd_irq[i]); 741 + if (ab_ahb->userpd_irq_num[i] < 0) 742 + return ab_ahb->userpd_irq_num[i]; 743 + 744 + upd_irq_name = devm_kzalloc(&ab->pdev->dev, ATH12K_UPD_IRQ_WRD_LEN, 745 + GFP_KERNEL); 746 + if (!upd_irq_name) 747 + return -ENOMEM; 748 + 749 + scnprintf(upd_irq_name, ATH12K_UPD_IRQ_WRD_LEN, "UserPD%u-%s", 750 + ab_ahb->userpd_id, ath12k_userpd_irq[i]); 751 + ret = devm_request_threaded_irq(&ab->pdev->dev, ab_ahb->userpd_irq_num[i], 752 + NULL, ath12k_userpd_irq_handler, 753 + IRQF_TRIGGER_RISING | IRQF_ONESHOT, 754 + upd_irq_name, ab); 755 + if (ret) 756 + return dev_err_probe(&ab->pdev->dev, ret, 757 + "Request %s irq failed: %d\n", 758 + ath12k_userpd_irq[i], ret); 759 + } 760 + 761 + ab_ahb->spawn_state = devm_qcom_smem_state_get(&ab->pdev->dev, "spawn", 762 + &ab_ahb->spawn_bit); 763 + if (IS_ERR(ab_ahb->spawn_state)) 764 + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->spawn_state), 765 + "Failed to acquire spawn state\n"); 766 + 767 + ab_ahb->stop_state = devm_qcom_smem_state_get(&ab->pdev->dev, "stop", 768 + &ab_ahb->stop_bit); 769 + if (IS_ERR(ab_ahb->stop_state)) 770 + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->stop_state), 771 + "Failed to acquire stop state\n"); 772 + 773 + init_completion(&ab_ahb->userpd_spawned); 774 + init_completion(&ab_ahb->userpd_ready); 775 + init_completion(&ab_ahb->userpd_stopped); 776 + return 0; 777 + } 778 + 779 + static int ath12k_ahb_root_pd_state_notifier(struct notifier_block *nb, 780 + const unsigned long event, void *data) 781 + { 782 + struct ath12k_ahb *ab_ahb = container_of(nb, struct ath12k_ahb, root_pd_nb); 783 + struct ath12k_base *ab = ab_ahb->ab; 784 + 785 + if (event == ATH12K_RPROC_AFTER_POWERUP) { 786 + ath12k_dbg(ab, ATH12K_DBG_AHB, "Root PD is UP\n"); 787 + complete(&ab_ahb->rootpd_ready); 788 + } 789 + 790 + return 0; 791 + } 792 + 793 + static int ath12k_ahb_register_rproc_notifier(struct ath12k_base *ab) 794 + { 795 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 796 + 797 + ab_ahb->root_pd_nb.notifier_call = ath12k_ahb_root_pd_state_notifier; 798 + init_completion(&ab_ahb->rootpd_ready); 799 + 800 + ab_ahb->root_pd_notifier = qcom_register_ssr_notifier(ab_ahb->tgt_rproc->name, 801 + &ab_ahb->root_pd_nb); 802 + if (IS_ERR(ab_ahb->root_pd_notifier)) 803 + return PTR_ERR(ab_ahb->root_pd_notifier); 804 + 805 + return 0; 806 + } 807 + 808 + static void ath12k_ahb_unregister_rproc_notifier(struct ath12k_base *ab) 809 + { 810 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 811 + 812 + if (!ab_ahb->root_pd_notifier) { 813 + ath12k_err(ab, "Rproc notifier not registered\n"); 814 + return; 815 + } 816 + 817 + qcom_unregister_ssr_notifier(ab_ahb->root_pd_notifier, 818 + &ab_ahb->root_pd_nb); 819 + ab_ahb->root_pd_notifier = NULL; 820 + } 821 + 822 + static int ath12k_ahb_get_rproc(struct ath12k_base *ab) 823 + { 824 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 825 + struct device *dev = ab->dev; 826 + struct device_node *np; 827 + struct rproc *prproc; 828 + 829 + np = of_parse_phandle(dev->of_node, "qcom,rproc", 0); 830 + if (!np) { 831 + ath12k_err(ab, "failed to get q6_rproc handle\n"); 832 + return -ENOENT; 833 + } 834 + 835 + prproc = rproc_get_by_phandle(np->phandle); 836 + of_node_put(np); 837 + if (!prproc) 838 + return dev_err_probe(&ab->pdev->dev, -EPROBE_DEFER, 839 + "failed to get rproc\n"); 840 + 841 + ab_ahb->tgt_rproc = prproc; 842 + 843 + return 0; 844 + } 845 + 846 + static int ath12k_ahb_boot_root_pd(struct ath12k_base *ab) 847 + { 848 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 849 + unsigned long time_left; 850 + int ret; 851 + 852 + ret = rproc_boot(ab_ahb->tgt_rproc); 853 + if (ret < 0) { 854 + ath12k_err(ab, "RootPD boot failed\n"); 855 + return ret; 856 + } 857 + 858 + time_left = wait_for_completion_timeout(&ab_ahb->rootpd_ready, 859 + ATH12K_ROOTPD_READY_TIMEOUT); 860 + if (!time_left) { 861 + ath12k_err(ab, "RootPD ready wait timed out\n"); 862 + return -ETIMEDOUT; 863 + } 864 + 865 + return 0; 866 + } 867 + 868 + static int ath12k_ahb_configure_rproc(struct ath12k_base *ab) 869 + { 870 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 871 + int ret; 872 + 873 + ret = ath12k_ahb_get_rproc(ab); 874 + if (ret < 0) 875 + return ret; 876 + 877 + ret = ath12k_ahb_register_rproc_notifier(ab); 878 + if (ret < 0) { 879 + ret = dev_err_probe(&ab->pdev->dev, ret, 880 + "failed to register rproc notifier\n"); 881 + goto err_put_rproc; 882 + } 883 + 884 + if (ab_ahb->tgt_rproc->state != RPROC_RUNNING) { 885 + ret = ath12k_ahb_boot_root_pd(ab); 886 + if (ret < 0) { 887 + ath12k_err(ab, "failed to boot the remote processor Q6\n"); 888 + goto err_unreg_notifier; 889 + } 890 + } 891 + 892 + return ath12k_ahb_config_rproc_irq(ab); 893 + 894 + err_unreg_notifier: 895 + ath12k_ahb_unregister_rproc_notifier(ab); 896 + 897 + err_put_rproc: 898 + rproc_put(ab_ahb->tgt_rproc); 899 + return ret; 900 + } 901 + 902 + static void ath12k_ahb_deconfigure_rproc(struct ath12k_base *ab) 903 + { 904 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 905 + 906 + ath12k_ahb_unregister_rproc_notifier(ab); 907 + rproc_put(ab_ahb->tgt_rproc); 908 + } 909 + 910 + static int ath12k_ahb_resource_init(struct ath12k_base *ab) 911 + { 912 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 913 + struct platform_device *pdev = ab->pdev; 914 + struct resource *mem_res; 915 + int ret; 916 + 917 + ab->mem = devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res); 918 + if (IS_ERR(ab->mem)) { 919 + ret = dev_err_probe(&pdev->dev, PTR_ERR(ab->mem), "ioremap error\n"); 920 + goto out; 921 + } 922 + 923 + ab->mem_len = resource_size(mem_res); 924 + 925 + if (ab->hw_params->ce_remap) { 926 + const struct ce_remap *ce_remap = ab->hw_params->ce_remap; 927 + /* CE register space is moved out of WCSS and the space is not 928 + * contiguous, hence remapping the CE registers to a new space 929 + * for accessing them. 930 + */ 931 + ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); 932 + if (!ab->mem_ce) { 933 + dev_err(&pdev->dev, "ce ioremap error\n"); 934 + ret = -ENOMEM; 935 + goto err_mem_unmap; 936 + } 937 + ab->ce_remap = true; 938 + ab->ce_remap_base_addr = HAL_IPQ5332_CE_WFSS_REG_BASE; 939 + } 940 + 941 + ab_ahb->xo_clk = devm_clk_get(ab->dev, "xo"); 942 + if (IS_ERR(ab_ahb->xo_clk)) { 943 + ret = dev_err_probe(&pdev->dev, PTR_ERR(ab_ahb->xo_clk), 944 + "failed to get xo clock\n"); 945 + goto err_mem_ce_unmap; 946 + } 947 + 948 + ret = clk_prepare_enable(ab_ahb->xo_clk); 949 + if (ret) { 950 + dev_err(&pdev->dev, "failed to enable gcc_xo_clk: %d\n", ret); 951 + goto err_clock_deinit; 952 + } 953 + 954 + return 0; 955 + 956 + err_clock_deinit: 957 + devm_clk_put(ab->dev, ab_ahb->xo_clk); 958 + 959 + err_mem_ce_unmap: 960 + ab_ahb->xo_clk = NULL; 961 + if (ab->hw_params->ce_remap) 962 + iounmap(ab->mem_ce); 963 + 964 + err_mem_unmap: 965 + ab->mem_ce = NULL; 966 + devm_iounmap(ab->dev, ab->mem); 967 + 968 + out: 969 + ab->mem = NULL; 970 + return ret; 971 + } 972 + 973 + static void ath12k_ahb_resource_deinit(struct ath12k_base *ab) 974 + { 975 + struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab); 976 + 977 + if (ab->mem) 978 + devm_iounmap(ab->dev, ab->mem); 979 + 980 + if (ab->mem_ce) 981 + iounmap(ab->mem_ce); 982 + 983 + ab->mem = NULL; 984 + ab->mem_ce = NULL; 985 + 986 + clk_disable_unprepare(ab_ahb->xo_clk); 987 + devm_clk_put(ab->dev, ab_ahb->xo_clk); 988 + ab_ahb->xo_clk = NULL; 989 + } 990 + 991 + static int ath12k_ahb_probe(struct platform_device *pdev) 992 + { 993 + struct ath12k_base *ab; 994 + const struct ath12k_hif_ops *hif_ops; 995 + struct ath12k_ahb *ab_ahb; 996 + enum ath12k_hw_rev hw_rev; 997 + u32 addr, userpd_id; 998 + int ret; 999 + 1000 + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1001 + if (ret) { 1002 + dev_err(&pdev->dev, "Failed to set 32-bit coherent dma\n"); 1003 + return ret; 1004 + } 1005 + 1006 + ab = ath12k_core_alloc(&pdev->dev, sizeof(struct ath12k_ahb), 1007 + ATH12K_BUS_AHB); 1008 + if (!ab) 1009 + return -ENOMEM; 1010 + 1011 + hw_rev = (enum ath12k_hw_rev)(kernel_ulong_t)of_device_get_match_data(&pdev->dev); 1012 + switch (hw_rev) { 1013 + case ATH12K_HW_IPQ5332_HW10: 1014 + hif_ops = &ath12k_ahb_hif_ops_ipq5332; 1015 + userpd_id = ATH12K_IPQ5332_USERPD_ID; 1016 + break; 1017 + default: 1018 + ret = -EOPNOTSUPP; 1019 + goto err_core_free; 1020 + } 1021 + 1022 + ab->hif.ops = hif_ops; 1023 + ab->pdev = pdev; 1024 + ab->hw_rev = hw_rev; 1025 + platform_set_drvdata(pdev, ab); 1026 + ab_ahb = ath12k_ab_to_ahb(ab); 1027 + ab_ahb->ab = ab; 1028 + ab_ahb->userpd_id = userpd_id; 1029 + 1030 + /* Set fixed_mem_region to true for platforms that support fixed memory 1031 + * reservation from DT. If memory is reserved from DT for FW, ath12k driver 1032 + * need not to allocate memory. 1033 + */ 1034 + if (!of_property_read_u32(ab->dev->of_node, "memory-region", &addr)) 1035 + set_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags); 1036 + 1037 + ret = ath12k_core_pre_init(ab); 1038 + if (ret) 1039 + goto err_core_free; 1040 + 1041 + ret = ath12k_ahb_resource_init(ab); 1042 + if (ret) 1043 + goto err_core_free; 1044 + 1045 + ret = ath12k_hal_srng_init(ab); 1046 + if (ret) 1047 + goto err_resource_deinit; 1048 + 1049 + ret = ath12k_ce_alloc_pipes(ab); 1050 + if (ret) { 1051 + ath12k_err(ab, "failed to allocate ce pipes: %d\n", ret); 1052 + goto err_hal_srng_deinit; 1053 + } 1054 + 1055 + ath12k_ahb_init_qmi_ce_config(ab); 1056 + 1057 + ret = ath12k_ahb_configure_rproc(ab); 1058 + if (ret) 1059 + goto err_ce_free; 1060 + 1061 + ret = ath12k_ahb_config_irq(ab); 1062 + if (ret) { 1063 + ath12k_err(ab, "failed to configure irq: %d\n", ret); 1064 + goto err_rproc_deconfigure; 1065 + } 1066 + 1067 + ret = ath12k_core_init(ab); 1068 + if (ret) { 1069 + ath12k_err(ab, "failed to init core: %d\n", ret); 1070 + goto err_rproc_deconfigure; 1071 + } 1072 + 1073 + return 0; 1074 + 1075 + err_rproc_deconfigure: 1076 + ath12k_ahb_deconfigure_rproc(ab); 1077 + 1078 + err_ce_free: 1079 + ath12k_ce_free_pipes(ab); 1080 + 1081 + err_hal_srng_deinit: 1082 + ath12k_hal_srng_deinit(ab); 1083 + 1084 + err_resource_deinit: 1085 + ath12k_ahb_resource_deinit(ab); 1086 + 1087 + err_core_free: 1088 + ath12k_core_free(ab); 1089 + platform_set_drvdata(pdev, NULL); 1090 + 1091 + return ret; 1092 + } 1093 + 1094 + static void ath12k_ahb_remove_prepare(struct ath12k_base *ab) 1095 + { 1096 + unsigned long left; 1097 + 1098 + if (test_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags)) { 1099 + left = wait_for_completion_timeout(&ab->driver_recovery, 1100 + ATH12K_AHB_RECOVERY_TIMEOUT); 1101 + if (!left) 1102 + ath12k_warn(ab, "failed to receive recovery response completion\n"); 1103 + } 1104 + 1105 + set_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags); 1106 + cancel_work_sync(&ab->restart_work); 1107 + cancel_work_sync(&ab->qmi.event_work); 1108 + } 1109 + 1110 + static void ath12k_ahb_free_resources(struct ath12k_base *ab) 1111 + { 1112 + struct platform_device *pdev = ab->pdev; 1113 + 1114 + ath12k_hal_srng_deinit(ab); 1115 + ath12k_ce_free_pipes(ab); 1116 + ath12k_ahb_resource_deinit(ab); 1117 + ath12k_ahb_deconfigure_rproc(ab); 1118 + ath12k_core_free(ab); 1119 + platform_set_drvdata(pdev, NULL); 1120 + } 1121 + 1122 + static void ath12k_ahb_remove(struct platform_device *pdev) 1123 + { 1124 + struct ath12k_base *ab = platform_get_drvdata(pdev); 1125 + 1126 + if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { 1127 + ath12k_ahb_power_down(ab, false); 1128 + ath12k_qmi_deinit_service(ab); 1129 + goto qmi_fail; 1130 + } 1131 + 1132 + ath12k_ahb_remove_prepare(ab); 1133 + ath12k_core_deinit(ab); 1134 + 1135 + qmi_fail: 1136 + ath12k_ahb_free_resources(ab); 1137 + } 1138 + 1139 + static struct platform_driver ath12k_ahb_driver = { 1140 + .driver = { 1141 + .name = "ath12k_ahb", 1142 + .of_match_table = ath12k_ahb_of_match, 1143 + }, 1144 + .probe = ath12k_ahb_probe, 1145 + .remove = ath12k_ahb_remove, 1146 + }; 1147 + 1148 + int ath12k_ahb_init(void) 1149 + { 1150 + return platform_driver_register(&ath12k_ahb_driver); 1151 + } 1152 + 1153 + void ath12k_ahb_exit(void) 1154 + { 1155 + platform_driver_unregister(&ath12k_ahb_driver); 1156 + }
+80
drivers/net/wireless/ath/ath12k/ahb.h
··· 1 + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 + /* 3 + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2022-2025, Qualcomm Innovation Center, Inc. All rights reserved. 5 + */ 6 + #ifndef ATH12K_AHB_H 7 + #define ATH12K_AHB_H 8 + 9 + #include <linux/clk.h> 10 + #include <linux/remoteproc/qcom_rproc.h> 11 + #include "core.h" 12 + 13 + #define ATH12K_AHB_RECOVERY_TIMEOUT (3 * HZ) 14 + 15 + #define ATH12K_AHB_SMP2P_SMEM_MSG GENMASK(15, 0) 16 + #define ATH12K_AHB_SMP2P_SMEM_SEQ_NO GENMASK(31, 16) 17 + #define ATH12K_AHB_SMP2P_SMEM_VALUE_MASK 0xFFFFFFFF 18 + #define ATH12K_PCI_CE_WAKE_IRQ 2 19 + #define ATH12K_PCI_IRQ_CE0_OFFSET 3 20 + #define ATH12K_ROOTPD_READY_TIMEOUT (5 * HZ) 21 + #define ATH12K_RPROC_AFTER_POWERUP QCOM_SSR_AFTER_POWERUP 22 + #define ATH12K_AHB_FW_PREFIX "q6_fw" 23 + #define ATH12K_AHB_FW_SUFFIX ".mdt" 24 + #define ATH12K_AHB_FW2 "iu_fw.mdt" 25 + #define ATH12K_AHB_UPD_SWID 0x12 26 + #define ATH12K_USERPD_SPAWN_TIMEOUT (5 * HZ) 27 + #define ATH12K_USERPD_READY_TIMEOUT (10 * HZ) 28 + #define ATH12K_USERPD_STOP_TIMEOUT (5 * HZ) 29 + #define ATH12K_USERPD_ID_MASK GENMASK(9, 8) 30 + #define ATH12K_USERPD_FW_NAME_LEN 35 31 + 32 + enum ath12k_ahb_smp2p_msg_id { 33 + ATH12K_AHB_POWER_SAVE_ENTER = 1, 34 + ATH12K_AHB_POWER_SAVE_EXIT, 35 + }; 36 + 37 + enum ath12k_ahb_userpd_irq { 38 + ATH12K_USERPD_SPAWN_IRQ, 39 + ATH12K_USERPD_READY_IRQ, 40 + ATH12K_USERPD_STOP_ACK_IRQ, 41 + ATH12K_USERPD_MAX_IRQ, 42 + }; 43 + 44 + struct ath12k_base; 45 + 46 + struct ath12k_ahb { 47 + struct ath12k_base *ab; 48 + struct rproc *tgt_rproc; 49 + struct clk *xo_clk; 50 + struct completion rootpd_ready; 51 + struct notifier_block root_pd_nb; 52 + void *root_pd_notifier; 53 + struct qcom_smem_state *spawn_state; 54 + struct qcom_smem_state *stop_state; 55 + struct completion userpd_spawned; 56 + struct completion userpd_ready; 57 + struct completion userpd_stopped; 58 + u32 userpd_id; 59 + u32 spawn_bit; 60 + u32 stop_bit; 61 + int userpd_irq_num[ATH12K_USERPD_MAX_IRQ]; 62 + }; 63 + 64 + static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab) 65 + { 66 + return (struct ath12k_ahb *)ab->drv_priv; 67 + } 68 + 69 + #ifdef CONFIG_ATH12K_AHB 70 + int ath12k_ahb_init(void); 71 + void ath12k_ahb_exit(void); 72 + #else 73 + static inline int ath12k_ahb_init(void) 74 + { 75 + return 0; 76 + } 77 + 78 + static inline void ath12k_ahb_exit(void) {}; 79 + #endif 80 + #endif
+91 -1
drivers/net/wireless/ath/ath12k/ce.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-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include "dp_rx.h" ··· 217 217 .dest_nentries = 0, 218 218 }, 219 219 220 + }; 221 + 222 + const struct ce_attr ath12k_host_ce_config_ipq5332[] = { 223 + /* CE0: host->target HTC control and raw streams */ 224 + { 225 + .flags = CE_ATTR_FLAGS, 226 + .src_nentries = 16, 227 + .src_sz_max = 2048, 228 + .dest_nentries = 0, 229 + }, 230 + /* CE1: target->host HTT + HTC control */ 231 + { 232 + .flags = CE_ATTR_FLAGS, 233 + .src_nentries = 0, 234 + .src_sz_max = 2048, 235 + .dest_nentries = 512, 236 + .recv_cb = ath12k_htc_rx_completion_handler, 237 + }, 238 + /* CE2: target->host WMI */ 239 + { 240 + .flags = CE_ATTR_FLAGS, 241 + .src_nentries = 0, 242 + .src_sz_max = 2048, 243 + .dest_nentries = 128, 244 + .recv_cb = ath12k_htc_rx_completion_handler, 245 + }, 246 + /* CE3: host->target WMI */ 247 + { 248 + .flags = CE_ATTR_FLAGS, 249 + .src_nentries = 32, 250 + .src_sz_max = 2048, 251 + .dest_nentries = 0, 252 + }, 253 + /* CE4: host->target HTT */ 254 + { 255 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 256 + .src_nentries = 2048, 257 + .src_sz_max = 256, 258 + .dest_nentries = 0, 259 + }, 260 + /* CE5: target -> host PKTLOG */ 261 + { 262 + .flags = CE_ATTR_FLAGS, 263 + .src_nentries = 0, 264 + .src_sz_max = 2048, 265 + .dest_nentries = 512, 266 + .recv_cb = ath12k_dp_htt_htc_t2h_msg_handler, 267 + }, 268 + /* CE6: Target autonomous HIF_memcpy */ 269 + { 270 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 271 + .src_nentries = 0, 272 + .src_sz_max = 0, 273 + .dest_nentries = 0, 274 + }, 275 + /* CE7: CV Prefetch */ 276 + { 277 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 278 + .src_nentries = 0, 279 + .src_sz_max = 0, 280 + .dest_nentries = 0, 281 + }, 282 + /* CE8: Target HIF memcpy (Generic HIF memcypy) */ 283 + { 284 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 285 + .src_nentries = 0, 286 + .src_sz_max = 0, 287 + .dest_nentries = 0, 288 + }, 289 + /* CE9: WMI logging/CFR/Spectral/Radar */ 290 + { 291 + .flags = CE_ATTR_FLAGS, 292 + .src_nentries = 0, 293 + .src_sz_max = 2048, 294 + .dest_nentries = 128, 295 + }, 296 + /* CE10: Unused */ 297 + { 298 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 299 + .src_nentries = 0, 300 + .src_sz_max = 0, 301 + .dest_nentries = 0, 302 + }, 303 + /* CE11: Unused */ 304 + { 305 + .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 306 + .src_nentries = 0, 307 + .src_sz_max = 0, 308 + .dest_nentries = 0, 309 + }, 220 310 }; 221 311 222 312 static int ath12k_ce_rx_buf_enqueue_pipe(struct ath12k_ce_pipe *pipe,
+15 -3
drivers/net/wireless/ath/ath12k/ce.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-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_CE_H ··· 39 39 #define PIPEDIR_INOUT_H2H 4 /* bidirectional, host to host */ 40 40 41 41 /* CE address/mask */ 42 - #define CE_HOST_IE_ADDRESS 0x00A1803C 43 - #define CE_HOST_IE_2_ADDRESS 0x00A18040 42 + #define CE_HOST_IE_ADDRESS 0x75804C 43 + #define CE_HOST_IE_2_ADDRESS 0x758050 44 44 #define CE_HOST_IE_3_ADDRESS CE_HOST_IE_ADDRESS 45 45 46 46 #define CE_HOST_IE_3_SHIFT 0xC ··· 74 74 __le32 nbytes_max; 75 75 __le32 flags; 76 76 __le32 reserved; 77 + }; 78 + 79 + struct ce_ie_addr { 80 + u32 ie1_reg_addr; 81 + u32 ie2_reg_addr; 82 + u32 ie3_reg_addr; 83 + }; 84 + 85 + struct ce_remap { 86 + u32 base; 87 + u32 size; 77 88 }; 78 89 79 90 struct ce_attr { ··· 175 164 176 165 extern const struct ce_attr ath12k_host_ce_config_qcn9274[]; 177 166 extern const struct ce_attr ath12k_host_ce_config_wcn7850[]; 167 + extern const struct ce_attr ath12k_host_ce_config_ipq5332[]; 178 168 179 169 void ath12k_ce_cleanup_pipes(struct ath12k_base *ab); 180 170 void ath12k_ce_rx_replenish_retry(struct timer_list *t);
+267 -25
drivers/net/wireless/ath/ath12k/core.c
··· 10 10 #include <linux/firmware.h> 11 11 #include <linux/of.h> 12 12 #include <linux/of_graph.h> 13 + #include "ahb.h" 13 14 #include "core.h" 14 15 #include "dp_tx.h" 15 16 #include "dp_rx.h" 16 17 #include "debug.h" 17 - #include "hif.h" 18 - #include "fw.h" 19 18 #include "debugfs.h" 19 + #include "fw.h" 20 + #include "hif.h" 21 + #include "pci.h" 20 22 #include "wow.h" 21 23 24 + static int ahb_err, pci_err; 22 25 unsigned int ath12k_debug_mask; 23 26 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644); 24 27 MODULE_PARM_DESC(debug_mask, "Debugging mask"); ··· 615 612 return TARGET_NUM_TIDS(SINGLE); 616 613 } 617 614 615 + struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab, 616 + int index) 617 + { 618 + struct device *dev = ab->dev; 619 + struct reserved_mem *rmem; 620 + struct device_node *node; 621 + 622 + node = of_parse_phandle(dev->of_node, "memory-region", index); 623 + if (!node) { 624 + ath12k_dbg(ab, ATH12K_DBG_BOOT, 625 + "failed to parse memory-region for index %d\n", index); 626 + return NULL; 627 + } 628 + 629 + rmem = of_reserved_mem_lookup(node); 630 + of_node_put(node); 631 + if (!rmem) { 632 + ath12k_dbg(ab, ATH12K_DBG_BOOT, 633 + "unable to get memory-region for index %d\n", index); 634 + return NULL; 635 + } 636 + 637 + return rmem; 638 + } 639 + 640 + static inline 641 + void ath12k_core_to_group_ref_get(struct ath12k_base *ab) 642 + { 643 + struct ath12k_hw_group *ag = ab->ag; 644 + 645 + lockdep_assert_held(&ag->mutex); 646 + 647 + if (ab->hw_group_ref) { 648 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core already attached to group %d\n", 649 + ag->id); 650 + return; 651 + } 652 + 653 + ab->hw_group_ref = true; 654 + ag->num_started++; 655 + 656 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core attached to group %d, num_started %d\n", 657 + ag->id, ag->num_started); 658 + } 659 + 660 + static inline 661 + void ath12k_core_to_group_ref_put(struct ath12k_base *ab) 662 + { 663 + struct ath12k_hw_group *ag = ab->ag; 664 + 665 + lockdep_assert_held(&ag->mutex); 666 + 667 + if (!ab->hw_group_ref) { 668 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core already de-attached from group %d\n", 669 + ag->id); 670 + return; 671 + } 672 + 673 + ab->hw_group_ref = false; 674 + ag->num_started--; 675 + 676 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core de-attached from group %d, num_started %d\n", 677 + ag->id, ag->num_started); 678 + } 679 + 618 680 static void ath12k_core_stop(struct ath12k_base *ab) 619 681 { 620 - ath12k_core_stopped(ab); 682 + ath12k_core_to_group_ref_put(ab); 621 683 622 684 if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) 623 685 ath12k_qmi_firmware_stop(ab); ··· 919 851 920 852 ath12k_acpi_set_dsm_func(ab); 921 853 922 - if (!test_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags)) 923 - /* Indicate the core start in the appropriate group */ 924 - ath12k_core_started(ab); 854 + /* Indicate the core start in the appropriate group */ 855 + ath12k_core_to_group_ref_get(ab); 925 856 926 857 return 0; 927 858 ··· 958 891 ab = ag->ab[i]; 959 892 if (!ab) 960 893 continue; 894 + 895 + clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 896 + 961 897 ath12k_core_device_cleanup(ab); 962 898 } 963 899 ··· 1096 1026 1097 1027 mutex_lock(&ab->core_lock); 1098 1028 1029 + set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 1030 + 1099 1031 ret = ath12k_core_pdev_create(ab); 1100 1032 if (ret) { 1101 1033 ath12k_err(ab, "failed to create pdev core %d\n", ret); ··· 1154 1082 lockdep_assert_held(&ag->mutex); 1155 1083 1156 1084 return (ag->num_started == ag->num_devices); 1085 + } 1086 + 1087 + static void ath12k_fw_stats_pdevs_free(struct list_head *head) 1088 + { 1089 + struct ath12k_fw_stats_pdev *i, *tmp; 1090 + 1091 + list_for_each_entry_safe(i, tmp, head, list) { 1092 + list_del(&i->list); 1093 + kfree(i); 1094 + } 1095 + } 1096 + 1097 + void ath12k_fw_stats_bcn_free(struct list_head *head) 1098 + { 1099 + struct ath12k_fw_stats_bcn *i, *tmp; 1100 + 1101 + list_for_each_entry_safe(i, tmp, head, list) { 1102 + list_del(&i->list); 1103 + kfree(i); 1104 + } 1105 + } 1106 + 1107 + static void ath12k_fw_stats_vdevs_free(struct list_head *head) 1108 + { 1109 + struct ath12k_fw_stats_vdev *i, *tmp; 1110 + 1111 + list_for_each_entry_safe(i, tmp, head, list) { 1112 + list_del(&i->list); 1113 + kfree(i); 1114 + } 1115 + } 1116 + 1117 + void ath12k_fw_stats_init(struct ath12k *ar) 1118 + { 1119 + INIT_LIST_HEAD(&ar->fw_stats.vdevs); 1120 + INIT_LIST_HEAD(&ar->fw_stats.pdevs); 1121 + INIT_LIST_HEAD(&ar->fw_stats.bcn); 1122 + init_completion(&ar->fw_stats_complete); 1123 + } 1124 + 1125 + void ath12k_fw_stats_free(struct ath12k_fw_stats *stats) 1126 + { 1127 + ath12k_fw_stats_pdevs_free(&stats->pdevs); 1128 + ath12k_fw_stats_vdevs_free(&stats->vdevs); 1129 + ath12k_fw_stats_bcn_free(&stats->bcn); 1130 + } 1131 + 1132 + void ath12k_fw_stats_reset(struct ath12k *ar) 1133 + { 1134 + spin_lock_bh(&ar->data_lock); 1135 + ar->fw_stats.fw_stats_done = false; 1136 + ath12k_fw_stats_free(&ar->fw_stats); 1137 + spin_unlock_bh(&ar->data_lock); 1157 1138 } 1158 1139 1159 1140 static void ath12k_core_trigger_partner(struct ath12k_base *ab) ··· 1371 1246 1372 1247 void ath12k_core_halt(struct ath12k *ar) 1373 1248 { 1249 + struct list_head *pos, *n; 1374 1250 struct ath12k_base *ab = ar->ab; 1375 1251 1376 1252 lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ··· 1384 1258 cancel_delayed_work_sync(&ar->scan.timeout); 1385 1259 cancel_work_sync(&ar->regd_update_work); 1386 1260 cancel_work_sync(&ab->rfkill_work); 1261 + cancel_work_sync(&ab->update_11d_work); 1387 1262 1388 1263 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); 1389 1264 synchronize_rcu(); 1390 - INIT_LIST_HEAD(&ar->arvifs); 1265 + 1266 + spin_lock_bh(&ar->data_lock); 1267 + list_for_each_safe(pos, n, &ar->arvifs) 1268 + list_del_init(pos); 1269 + spin_unlock_bh(&ar->data_lock); 1270 + 1391 1271 idr_init(&ar->txmgmt_idr); 1392 1272 } 1393 1273 ··· 1417 1285 ah->state == ATH12K_HW_STATE_TM) 1418 1286 continue; 1419 1287 1288 + wiphy_lock(ah->hw->wiphy); 1289 + 1290 + /* If queue 0 is stopped, it is safe to assume that all 1291 + * other queues are stopped by driver via 1292 + * ieee80211_stop_queues() below. This means, there is 1293 + * no need to stop it again and hence continue 1294 + */ 1295 + if (ieee80211_queue_stopped(ah->hw, 0)) { 1296 + wiphy_unlock(ah->hw->wiphy); 1297 + continue; 1298 + } 1299 + 1420 1300 ieee80211_stop_queues(ah->hw); 1421 1301 1422 1302 for (j = 0; j < ah->num_radio; j++) { 1423 1303 ar = &ah->radio[j]; 1424 1304 1425 1305 ath12k_mac_drain_tx(ar); 1306 + ar->state_11d = ATH12K_11D_IDLE; 1307 + complete(&ar->completed_11d_scan); 1426 1308 complete(&ar->scan.started); 1427 - complete(&ar->scan.completed); 1309 + complete_all(&ar->scan.completed); 1428 1310 complete(&ar->scan.on_channel); 1429 1311 complete(&ar->peer_assoc_done); 1430 1312 complete(&ar->peer_delete_done); ··· 1452 1306 ath12k_mac_tx_mgmt_pending_free, ar); 1453 1307 idr_destroy(&ar->txmgmt_idr); 1454 1308 wake_up(&ar->txmgmt_empty_waitq); 1309 + 1310 + ar->monitor_vdev_id = -1; 1311 + ar->monitor_vdev_created = false; 1312 + ar->monitor_started = false; 1455 1313 } 1314 + 1315 + wiphy_unlock(ah->hw->wiphy); 1456 1316 } 1457 1317 1458 1318 wake_up(&ab->wmi_ab.tx_credits_wq); 1459 1319 wake_up(&ab->peer_mapping_wq); 1320 + } 1321 + 1322 + static void ath12k_update_11d(struct work_struct *work) 1323 + { 1324 + struct ath12k_base *ab = container_of(work, struct ath12k_base, update_11d_work); 1325 + struct ath12k *ar; 1326 + struct ath12k_pdev *pdev; 1327 + struct wmi_set_current_country_arg arg = {}; 1328 + int ret, i; 1329 + 1330 + spin_lock_bh(&ab->base_lock); 1331 + memcpy(&arg.alpha2, &ab->new_alpha2, 2); 1332 + spin_unlock_bh(&ab->base_lock); 1333 + 1334 + ath12k_dbg(ab, ATH12K_DBG_WMI, "update 11d new cc %c%c\n", 1335 + arg.alpha2[0], arg.alpha2[1]); 1336 + 1337 + for (i = 0; i < ab->num_radios; i++) { 1338 + pdev = &ab->pdevs[i]; 1339 + ar = pdev->ar; 1340 + 1341 + memcpy(&ar->alpha2, &arg.alpha2, 2); 1342 + ret = ath12k_wmi_send_set_current_country_cmd(ar, &arg); 1343 + if (ret) 1344 + ath12k_warn(ar->ab, 1345 + "pdev id %d failed set current country code: %d\n", 1346 + i, ret); 1347 + } 1460 1348 } 1461 1349 1462 1350 static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab) ··· 1566 1386 ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset success\n"); 1567 1387 } 1568 1388 1389 + mutex_lock(&ag->mutex); 1390 + 1391 + if (!ath12k_core_hw_group_start_ready(ag)) { 1392 + mutex_unlock(&ag->mutex); 1393 + goto exit_restart; 1394 + } 1395 + 1569 1396 for (i = 0; i < ag->num_hw; i++) { 1570 - ah = ath12k_ag_to_ah(ab->ag, i); 1397 + ah = ath12k_ag_to_ah(ag, i); 1571 1398 ieee80211_restart_hw(ah->hw); 1572 1399 } 1400 + 1401 + mutex_unlock(&ag->mutex); 1573 1402 } 1574 1403 1404 + exit_restart: 1575 1405 complete(&ab->restart_completed); 1576 1406 } 1577 1407 1578 1408 static void ath12k_core_reset(struct work_struct *work) 1579 1409 { 1580 1410 struct ath12k_base *ab = container_of(work, struct ath12k_base, reset_work); 1581 - int reset_count, fail_cont_count; 1411 + struct ath12k_hw_group *ag = ab->ag; 1412 + int reset_count, fail_cont_count, i; 1582 1413 long time_left; 1583 1414 1584 1415 if (!(test_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags))) { ··· 1648 1457 ath12k_hif_ce_irq_disable(ab); 1649 1458 1650 1459 ath12k_hif_power_down(ab, false); 1651 - ath12k_hif_power_up(ab); 1652 1460 1653 - ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); 1461 + /* prepare for power up */ 1462 + ab->qmi.num_radios = U8_MAX; 1463 + 1464 + mutex_lock(&ag->mutex); 1465 + ath12k_core_to_group_ref_put(ab); 1466 + 1467 + if (ag->num_started > 0) { 1468 + ath12k_dbg(ab, ATH12K_DBG_BOOT, 1469 + "waiting for %d partner device(s) to reset\n", 1470 + ag->num_started); 1471 + mutex_unlock(&ag->mutex); 1472 + return; 1473 + } 1474 + 1475 + /* Prepare MLO global memory region for power up */ 1476 + ath12k_qmi_reset_mlo_mem(ag); 1477 + 1478 + for (i = 0; i < ag->num_devices; i++) { 1479 + ab = ag->ab[i]; 1480 + if (!ab) 1481 + continue; 1482 + 1483 + ath12k_hif_power_up(ab); 1484 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); 1485 + } 1486 + 1487 + mutex_unlock(&ag->mutex); 1654 1488 } 1655 1489 1656 1490 int ath12k_core_pre_init(struct ath12k_base *ab) ··· 2059 1843 2060 1844 lockdep_assert_held(&ag->mutex); 2061 1845 2062 - /* If more than one devices are grouped, then inter MLO 2063 - * functionality can work still independent of whether internally 2064 - * each device supports single_chip_mlo or not. 2065 - * Only when there is one device, then disable for WCN chipsets 2066 - * till the required driver implementation is in place. 2067 - */ 2068 1846 if (ag->num_devices == 1) { 2069 1847 ab = ag->ab[0]; 2070 - 2071 - /* WCN chipsets does not advertise in firmware features 2072 - * hence skip checking 2073 - */ 2074 - if (ab->hw_params->def_num_link) 1848 + /* QCN9274 firmware uses firmware IE for MLO advertisement */ 1849 + if (ab->fw.fw_features_valid) { 1850 + ag->mlo_capable = 1851 + ath12k_fw_feature_supported(ab, ATH12K_FW_FEATURE_MLO); 2075 1852 return; 1853 + } 1854 + 1855 + /* while WCN7850 firmware uses QMI single_chip_mlo_support bit */ 1856 + ag->mlo_capable = ab->single_chip_mlo_support; 1857 + return; 2076 1858 } 2077 1859 2078 1860 ag->mlo_capable = true; ··· 2083 1869 /* even if 1 device's firmware feature indicates MLO 2084 1870 * unsupported, make MLO unsupported for the whole group 2085 1871 */ 2086 - if (!test_bit(ATH12K_FW_FEATURE_MLO, ab->fw.fw_features)) { 1872 + if (!ath12k_fw_feature_supported(ab, ATH12K_FW_FEATURE_MLO)) { 2087 1873 ag->mlo_capable = false; 2088 1874 return; 2089 1875 } ··· 2180 1966 INIT_WORK(&ab->reset_work, ath12k_core_reset); 2181 1967 INIT_WORK(&ab->rfkill_work, ath12k_rfkill_work); 2182 1968 INIT_WORK(&ab->dump_work, ath12k_coredump_upload); 1969 + INIT_WORK(&ab->update_11d_work, ath12k_update_11d); 2183 1970 2184 1971 timer_setup(&ab->rx_replenish_retry, ath12k_ce_rx_replenish_retry, 0); 2185 1972 init_completion(&ab->htc_suspend); ··· 2190 1975 ab->dev = dev; 2191 1976 ab->hif.bus = bus; 2192 1977 ab->qmi.num_radios = U8_MAX; 1978 + ab->single_chip_mlo_support = false; 2193 1979 2194 1980 /* Device index used to identify the devices in a group. 2195 1981 * ··· 2211 1995 return NULL; 2212 1996 } 2213 1997 2214 - MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards."); 1998 + static int ath12k_init(void) 1999 + { 2000 + ahb_err = ath12k_ahb_init(); 2001 + if (ahb_err) 2002 + pr_warn("Failed to initialize ath12k AHB device: %d\n", ahb_err); 2003 + 2004 + pci_err = ath12k_pci_init(); 2005 + if (pci_err) 2006 + pr_warn("Failed to initialize ath12k PCI device: %d\n", pci_err); 2007 + 2008 + /* If both failed, return one of the failures (arbitrary) */ 2009 + return ahb_err && pci_err ? ahb_err : 0; 2010 + } 2011 + 2012 + static void ath12k_exit(void) 2013 + { 2014 + if (!pci_err) 2015 + ath12k_pci_exit(); 2016 + 2017 + if (!ahb_err) 2018 + ath12k_ahb_exit(); 2019 + } 2020 + 2021 + module_init(ath12k_init); 2022 + module_exit(ath12k_exit); 2023 + 2024 + MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN devices"); 2215 2025 MODULE_LICENSE("Dual BSD/GPL");
+76 -21
drivers/net/wireless/ath/ath12k/core.h
··· 14 14 #include <linux/dmi.h> 15 15 #include <linux/ctype.h> 16 16 #include <linux/firmware.h> 17 + #include <linux/of_reserved_mem.h> 17 18 #include <linux/panic_notifier.h> 18 19 #include <linux/average.h> 19 20 #include "qmi.h" ··· 148 147 enum ath12k_hw_rev { 149 148 ATH12K_HW_QCN9274_HW10, 150 149 ATH12K_HW_QCN9274_HW20, 151 - ATH12K_HW_WCN7850_HW20 150 + ATH12K_HW_WCN7850_HW20, 151 + ATH12K_HW_IPQ5332_HW10, 152 152 }; 153 153 154 154 enum ath12k_firmware_mode { ··· 162 160 163 161 #define ATH12K_IRQ_NUM_MAX 57 164 162 #define ATH12K_EXT_IRQ_NUM_MAX 16 163 + #define ATH12K_MAX_TCL_RING_NUM 3 165 164 166 165 struct ath12k_ext_irq_grp { 167 166 struct ath12k_base *ab; ··· 222 219 ATH12K_SCAN_ABORTING, 223 220 }; 224 221 222 + enum ath12k_11d_state { 223 + ATH12K_11D_IDLE, 224 + ATH12K_11D_PREPARING, 225 + ATH12K_11D_RUNNING, 226 + }; 227 + 225 228 enum ath12k_hw_group_flags { 226 229 ATH12K_GROUP_FLAG_REGISTERED, 227 230 ATH12K_GROUP_FLAG_UNREGISTER, ··· 247 238 ATH12K_FLAG_EXT_IRQ_ENABLED, 248 239 ATH12K_FLAG_QMI_FW_READY_COMPLETE, 249 240 ATH12K_FLAG_FTM_SEGMENTED, 241 + ATH12K_FLAG_FIXED_MEM_REGION, 250 242 }; 251 243 252 244 struct ath12k_tx_conf { ··· 305 295 int txpower; 306 296 bool rsnie_present; 307 297 bool wpaie_present; 308 - struct ieee80211_chanctx_conf chanctx; 309 298 u8 vdev_stats_id; 310 299 u32 punct_bitmap; 311 300 u8 link_id; 312 301 struct ath12k_vif *ahvif; 313 302 struct ath12k_rekey_data rekey_data; 303 + struct ath12k_link_stats link_stats; 304 + spinlock_t link_stats_lock; /* Protects updates to link_stats */ 314 305 315 306 u8 current_cntdown_counter; 307 + 308 + /* only used in station mode */ 309 + bool is_sta_assoc_link; 316 310 }; 317 311 318 312 struct ath12k_vif { ··· 377 363 #define HAL_RX_MAX_MCS_BE 15 378 364 #define HAL_RX_MAX_NSS 8 379 365 #define HAL_RX_MAX_NUM_LEGACY_RATES 12 366 + 367 + #define ATH12K_SCAN_TIMEOUT_HZ (20 * HZ) 380 368 381 369 struct ath12k_rx_peer_rate_stats { 382 370 u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1]; ··· 535 519 u8 link_idx; 536 520 }; 537 521 522 + struct ath12k_reoq_buf { 523 + void *vaddr; 524 + dma_addr_t paddr_aligned; 525 + u32 size; 526 + }; 527 + 538 528 struct ath12k_sta { 539 529 struct ath12k_vif *ahvif; 540 530 enum hal_pn_type pn_type; ··· 553 531 u8 num_peer; 554 532 555 533 enum ieee80211_sta_state state; 534 + 535 + struct ath12k_reoq_buf reoq_bufs[IEEE80211_NUM_TIDS + 1]; 556 536 }; 557 537 558 - #define ATH12K_MIN_5G_FREQ 4150 559 - #define ATH12K_MIN_6G_FREQ 5925 560 - #define ATH12K_MAX_6G_FREQ 7115 538 + #define ATH12K_HALF_20MHZ_BW 10 539 + #define ATH12K_2GHZ_MIN_CENTER 2412 540 + #define ATH12K_2GHZ_MAX_CENTER 2484 541 + #define ATH12K_5GHZ_MIN_CENTER 4900 542 + #define ATH12K_5GHZ_MAX_CENTER 5920 543 + #define ATH12K_6GHZ_MIN_CENTER 5935 544 + #define ATH12K_6GHZ_MAX_CENTER 7115 545 + #define ATH12K_MIN_2GHZ_FREQ (ATH12K_2GHZ_MIN_CENTER - ATH12K_HALF_20MHZ_BW - 1) 546 + #define ATH12K_MAX_2GHZ_FREQ (ATH12K_2GHZ_MAX_CENTER + ATH12K_HALF_20MHZ_BW + 1) 547 + #define ATH12K_MIN_5GHZ_FREQ (ATH12K_5GHZ_MIN_CENTER - ATH12K_HALF_20MHZ_BW) 548 + #define ATH12K_MAX_5GHZ_FREQ (ATH12K_5GHZ_MAX_CENTER + ATH12K_HALF_20MHZ_BW) 549 + #define ATH12K_MIN_6GHZ_FREQ (ATH12K_6GHZ_MIN_CENTER - ATH12K_HALF_20MHZ_BW) 550 + #define ATH12K_MAX_6GHZ_FREQ (ATH12K_6GHZ_MAX_CENTER + ATH12K_HALF_20MHZ_BW) 561 551 #define ATH12K_NUM_CHANS 101 562 - #define ATH12K_MAX_5G_CHAN 173 552 + #define ATH12K_MAX_5GHZ_CHAN 173 563 553 564 554 enum ath12k_hw_state { 565 555 ATH12K_HW_STATE_OFF, ··· 762 728 #endif 763 729 764 730 bool dfs_block_radar_events; 765 - bool monitor_conf_enabled; 766 731 bool monitor_vdev_created; 767 732 bool monitor_started; 768 733 int monitor_vdev_id; ··· 770 737 771 738 bool nlo_enabled; 772 739 740 + /* Protected by wiphy::mtx lock. */ 741 + u32 vdev_id_11d_scan; 742 + struct completion completed_11d_scan; 743 + enum ath12k_11d_state state_11d; 744 + u8 alpha2[REG_ALPHA2_LEN]; 745 + bool regdom_set_by_user; 746 + 773 747 struct completion fw_stats_complete; 774 748 775 749 struct completion mlo_setup_done; 776 750 u32 mlo_setup_status; 777 751 u8 ftm_msgref; 778 752 struct ath12k_fw_stats fw_stats; 753 + unsigned long last_tx_power_update; 779 754 }; 780 755 781 756 struct ath12k_hw { ··· 893 852 struct ath12k_soc_dp_tx_err_stats tx_err; 894 853 }; 895 854 855 + struct ath12k_reg_freq { 856 + u32 start_freq; 857 + u32 end_freq; 858 + }; 859 + 896 860 struct ath12k_mlo_memory { 897 861 struct target_mem_chunk chunk[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01]; 898 862 int mlo_mem_size; ··· 968 922 969 923 void __iomem *mem; 970 924 unsigned long mem_len; 925 + 926 + void __iomem *mem_ce; 927 + u32 ce_remap_base_addr; 928 + bool ce_remap; 971 929 972 930 struct { 973 931 enum ath12k_bus bus; ··· 1061 1011 /* continuous recovery fail count */ 1062 1012 atomic_t fail_cont_count; 1063 1013 unsigned long reset_fail_timeout; 1014 + struct work_struct update_11d_work; 1015 + u8 new_alpha2[2]; 1064 1016 struct { 1065 1017 /* protected by data_lock */ 1066 1018 u32 fw_crash_counter; ··· 1103 1051 size_t m3_len; 1104 1052 1105 1053 DECLARE_BITMAP(fw_features, ATH12K_FW_FEATURE_COUNT); 1054 + bool fw_features_valid; 1106 1055 } fw; 1107 1056 1108 1057 const struct hal_rx_ops *hal_rx_ops; ··· 1140 1087 struct ath12k_wsi_info wsi_info; 1141 1088 enum ath12k_firmware_mode fw_mode; 1142 1089 struct ath12k_ftm_event_obj ftm_event_obj; 1090 + bool hw_group_ref; 1091 + 1092 + /* Denote whether MLO is possible within the device */ 1093 + bool single_chip_mlo_support; 1094 + 1095 + struct ath12k_reg_freq reg_freq_2ghz; 1096 + struct ath12k_reg_freq reg_freq_5ghz; 1097 + struct ath12k_reg_freq reg_freq_6ghz; 1143 1098 1144 1099 /* must be last */ 1145 1100 u8 drv_priv[] __aligned(sizeof(void *)); ··· 1276 1215 u32 ath12k_core_get_max_num_tids(struct ath12k_base *ab); 1277 1216 1278 1217 void ath12k_core_hw_group_set_mlo_capable(struct ath12k_hw_group *ag); 1218 + void ath12k_fw_stats_init(struct ath12k *ar); 1219 + void ath12k_fw_stats_bcn_free(struct list_head *head); 1220 + void ath12k_fw_stats_free(struct ath12k_fw_stats *stats); 1221 + void ath12k_fw_stats_reset(struct ath12k *ar); 1222 + struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab, 1223 + int index); 1279 1224 1280 1225 static inline const char *ath12k_scan_state_str(enum ath12k_scan_state state) 1281 1226 { ··· 1351 1284 switch (bus) { 1352 1285 case ATH12K_BUS_PCI: 1353 1286 return "pci"; 1287 + case ATH12K_BUS_AHB: 1288 + return "ahb"; 1354 1289 } 1355 1290 1356 1291 return "unknown"; ··· 1400 1331 static inline struct ath12k_hw_group *ath12k_ab_to_ag(struct ath12k_base *ab) 1401 1332 { 1402 1333 return ab->ag; 1403 - } 1404 - 1405 - static inline void ath12k_core_started(struct ath12k_base *ab) 1406 - { 1407 - lockdep_assert_held(&ab->ag->mutex); 1408 - 1409 - ab->ag->num_started++; 1410 - } 1411 - 1412 - static inline void ath12k_core_stopped(struct ath12k_base *ab) 1413 - { 1414 - lockdep_assert_held(&ab->ag->mutex); 1415 - 1416 - ab->ag->num_started--; 1417 1334 } 1418 1335 1419 1336 static inline struct ath12k_base *ath12k_ag_to_ab(struct ath12k_hw_group *ag,
+124 -110
drivers/net/wireless/ath/ath12k/debugfs.c
··· 88 88 u32 chan_freq = le32_to_cpu(tpc_stats->tpc_config.chan_freq); 89 89 u8 band; 90 90 91 - band = ((chan_freq > ATH12K_MIN_6G_FREQ) ? NL80211_BAND_6GHZ : 92 - ((chan_freq > ATH12K_MIN_5G_FREQ) ? NL80211_BAND_5GHZ : 91 + band = ((chan_freq > ATH12K_MIN_6GHZ_FREQ) ? NL80211_BAND_6GHZ : 92 + ((chan_freq > ATH12K_MIN_5GHZ_FREQ) ? NL80211_BAND_5GHZ : 93 93 NL80211_BAND_2GHZ)); 94 94 95 95 if (band == NL80211_BAND_5GHZ || band == NL80211_BAND_6GHZ) { ··· 833 833 .open = simple_open, 834 834 }; 835 835 836 + static int ath12k_open_link_stats(struct inode *inode, struct file *file) 837 + { 838 + struct ath12k_vif *ahvif = inode->i_private; 839 + size_t len = 0, buf_len = (PAGE_SIZE * 2); 840 + struct ath12k_link_stats linkstat; 841 + struct ath12k_link_vif *arvif; 842 + unsigned long links_map; 843 + struct wiphy *wiphy; 844 + int link_id, i; 845 + char *buf; 846 + 847 + if (!ahvif) 848 + return -EINVAL; 849 + 850 + buf = kzalloc(buf_len, GFP_KERNEL); 851 + if (!buf) 852 + return -ENOMEM; 853 + 854 + wiphy = ahvif->ah->hw->wiphy; 855 + wiphy_lock(wiphy); 856 + 857 + links_map = ahvif->links_map; 858 + for_each_set_bit(link_id, &links_map, 859 + IEEE80211_MLD_MAX_NUM_LINKS) { 860 + arvif = rcu_dereference_protected(ahvif->link[link_id], 861 + lockdep_is_held(&wiphy->mtx)); 862 + 863 + spin_lock_bh(&arvif->link_stats_lock); 864 + linkstat = arvif->link_stats; 865 + spin_unlock_bh(&arvif->link_stats_lock); 866 + 867 + len += scnprintf(buf + len, buf_len - len, 868 + "link[%d] Tx Unicast Frames Enqueued = %d\n", 869 + link_id, linkstat.tx_enqueued); 870 + len += scnprintf(buf + len, buf_len - len, 871 + "link[%d] Tx Broadcast Frames Enqueued = %d\n", 872 + link_id, linkstat.tx_bcast_mcast); 873 + len += scnprintf(buf + len, buf_len - len, 874 + "link[%d] Tx Frames Completed = %d\n", 875 + link_id, linkstat.tx_completed); 876 + len += scnprintf(buf + len, buf_len - len, 877 + "link[%d] Tx Frames Dropped = %d\n", 878 + link_id, linkstat.tx_dropped); 879 + 880 + len += scnprintf(buf + len, buf_len - len, 881 + "link[%d] Tx Frame descriptor Encap Type = ", 882 + link_id); 883 + 884 + len += scnprintf(buf + len, buf_len - len, 885 + " raw:%d", 886 + linkstat.tx_encap_type[0]); 887 + 888 + len += scnprintf(buf + len, buf_len - len, 889 + " native_wifi:%d", 890 + linkstat.tx_encap_type[1]); 891 + 892 + len += scnprintf(buf + len, buf_len - len, 893 + " ethernet:%d", 894 + linkstat.tx_encap_type[2]); 895 + 896 + len += scnprintf(buf + len, buf_len - len, 897 + "\nlink[%d] Tx Frame descriptor Encrypt Type = ", 898 + link_id); 899 + 900 + for (i = 0; i < HAL_ENCRYPT_TYPE_MAX; i++) { 901 + len += scnprintf(buf + len, buf_len - len, 902 + " %d:%d", i, 903 + linkstat.tx_encrypt_type[i]); 904 + } 905 + len += scnprintf(buf + len, buf_len - len, 906 + "\nlink[%d] Tx Frame descriptor Type = buffer:%d extension:%d\n", 907 + link_id, linkstat.tx_desc_type[0], 908 + linkstat.tx_desc_type[1]); 909 + 910 + len += scnprintf(buf + len, buf_len - len, 911 + "------------------------------------------------------\n"); 912 + } 913 + 914 + wiphy_unlock(wiphy); 915 + 916 + file->private_data = buf; 917 + 918 + return 0; 919 + } 920 + 921 + static int ath12k_release_link_stats(struct inode *inode, struct file *file) 922 + { 923 + kfree(file->private_data); 924 + return 0; 925 + } 926 + 927 + static ssize_t ath12k_read_link_stats(struct file *file, 928 + char __user *user_buf, 929 + size_t count, loff_t *ppos) 930 + { 931 + const char *buf = file->private_data; 932 + size_t len = strlen(buf); 933 + 934 + return simple_read_from_buffer(user_buf, count, ppos, buf, len); 935 + } 936 + 937 + static const struct file_operations ath12k_fops_link_stats = { 938 + .open = ath12k_open_link_stats, 939 + .release = ath12k_release_link_stats, 940 + .read = ath12k_read_link_stats, 941 + .owner = THIS_MODULE, 942 + .llseek = default_llseek, 943 + }; 944 + 945 + void ath12k_debugfs_op_vif_add(struct ieee80211_hw *hw, 946 + struct ieee80211_vif *vif) 947 + { 948 + struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif); 949 + 950 + debugfs_create_file("link_stats", 0400, vif->debugfs_dir, ahvif, 951 + &ath12k_fops_link_stats); 952 + } 953 + 836 954 void ath12k_debugfs_soc_create(struct ath12k_base *ab) 837 955 { 838 956 bool dput_needed; ··· 986 868 * a minor cosmetic issue to leave an empty ath12k directory to 987 869 * debugfs. 988 870 */ 989 - } 990 - 991 - static void ath12k_fw_stats_pdevs_free(struct list_head *head) 992 - { 993 - struct ath12k_fw_stats_pdev *i, *tmp; 994 - 995 - list_for_each_entry_safe(i, tmp, head, list) { 996 - list_del(&i->list); 997 - kfree(i); 998 - } 999 - } 1000 - 1001 - static void ath12k_fw_stats_bcn_free(struct list_head *head) 1002 - { 1003 - struct ath12k_fw_stats_bcn *i, *tmp; 1004 - 1005 - list_for_each_entry_safe(i, tmp, head, list) { 1006 - list_del(&i->list); 1007 - kfree(i); 1008 - } 1009 - } 1010 - 1011 - static void ath12k_fw_stats_vdevs_free(struct list_head *head) 1012 - { 1013 - struct ath12k_fw_stats_vdev *i, *tmp; 1014 - 1015 - list_for_each_entry_safe(i, tmp, head, list) { 1016 - list_del(&i->list); 1017 - kfree(i); 1018 - } 1019 - } 1020 - 1021 - void ath12k_debugfs_fw_stats_reset(struct ath12k *ar) 1022 - { 1023 - spin_lock_bh(&ar->data_lock); 1024 - ar->fw_stats.fw_stats_done = false; 1025 - ath12k_fw_stats_vdevs_free(&ar->fw_stats.vdevs); 1026 - ath12k_fw_stats_bcn_free(&ar->fw_stats.bcn); 1027 - ath12k_fw_stats_pdevs_free(&ar->fw_stats.pdevs); 1028 - spin_unlock_bh(&ar->data_lock); 1029 - } 1030 - 1031 - static int ath12k_debugfs_fw_stats_request(struct ath12k *ar, 1032 - struct ath12k_fw_stats_req_params *param) 1033 - { 1034 - struct ath12k_base *ab = ar->ab; 1035 - unsigned long timeout, time_left; 1036 - int ret; 1037 - 1038 - lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 1039 - 1040 - /* FW stats can get split when exceeding the stats data buffer limit. 1041 - * In that case, since there is no end marking for the back-to-back 1042 - * received 'update stats' event, we keep a 3 seconds timeout in case, 1043 - * fw_stats_done is not marked yet 1044 - */ 1045 - timeout = jiffies + msecs_to_jiffies(3 * 1000); 1046 - 1047 - ath12k_debugfs_fw_stats_reset(ar); 1048 - 1049 - reinit_completion(&ar->fw_stats_complete); 1050 - 1051 - ret = ath12k_wmi_send_stats_request_cmd(ar, param->stats_id, 1052 - param->vdev_id, param->pdev_id); 1053 - 1054 - if (ret) { 1055 - ath12k_warn(ab, "could not request fw stats (%d)\n", 1056 - ret); 1057 - return ret; 1058 - } 1059 - 1060 - time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1061 - 1 * HZ); 1062 - /* If the wait timed out, return -ETIMEDOUT */ 1063 - if (!time_left) 1064 - return -ETIMEDOUT; 1065 - 1066 - /* Firmware sends WMI_UPDATE_STATS_EVENTID back-to-back 1067 - * when stats data buffer limit is reached. fw_stats_complete 1068 - * is completed once host receives first event from firmware, but 1069 - * still end might not be marked in the TLV. 1070 - * Below loop is to confirm that firmware completed sending all the event 1071 - * and fw_stats_done is marked true when end is marked in the TLV 1072 - */ 1073 - for (;;) { 1074 - if (time_after(jiffies, timeout)) 1075 - break; 1076 - 1077 - spin_lock_bh(&ar->data_lock); 1078 - if (ar->fw_stats.fw_stats_done) { 1079 - spin_unlock_bh(&ar->data_lock); 1080 - break; 1081 - } 1082 - spin_unlock_bh(&ar->data_lock); 1083 - } 1084 - return 0; 1085 871 } 1086 872 1087 873 void ··· 1044 1022 num_bcn = 0; 1045 1023 } 1046 1024 } 1047 - if (stats->stats_id == WMI_REQUEST_PDEV_STAT) { 1048 - list_splice_tail_init(&stats->pdevs, &ar->fw_stats.pdevs); 1049 - ar->fw_stats.fw_stats_done = true; 1050 - } 1051 1025 } 1052 1026 1053 1027 static int ath12k_open_vdev_stats(struct inode *inode, struct file *file) ··· 1070 1052 param.vdev_id = 0; 1071 1053 param.stats_id = WMI_REQUEST_VDEV_STAT; 1072 1054 1073 - ret = ath12k_debugfs_fw_stats_request(ar, &param); 1055 + ret = ath12k_mac_get_fw_stats(ar, &param); 1074 1056 if (ret) { 1075 1057 ath12k_warn(ar->ab, "failed to request fw vdev stats: %d\n", ret); 1076 1058 return ret; ··· 1135 1117 continue; 1136 1118 1137 1119 param.vdev_id = arvif->vdev_id; 1138 - ret = ath12k_debugfs_fw_stats_request(ar, &param); 1120 + ret = ath12k_mac_get_fw_stats(ar, &param); 1139 1121 if (ret) { 1140 1122 ath12k_warn(ar->ab, "failed to request fw bcn stats: %d\n", ret); 1141 1123 return ret; ··· 1202 1184 param.vdev_id = 0; 1203 1185 param.stats_id = WMI_REQUEST_PDEV_STAT; 1204 1186 1205 - ret = ath12k_debugfs_fw_stats_request(ar, &param); 1187 + ret = ath12k_mac_get_fw_stats(ar, &param); 1206 1188 if (ret) { 1207 1189 ath12k_warn(ab, "failed to request fw pdev stats: %d\n", ret); 1208 1190 return ret; ··· 1257 1239 debugfs_create_file("pdev_stats", 0600, fwstats_dir, ar, 1258 1240 &fops_pdev_stats); 1259 1241 1260 - INIT_LIST_HEAD(&ar->fw_stats.vdevs); 1261 - INIT_LIST_HEAD(&ar->fw_stats.bcn); 1262 - INIT_LIST_HEAD(&ar->fw_stats.pdevs); 1263 - 1264 - init_completion(&ar->fw_stats_complete); 1242 + ath12k_fw_stats_init(ar); 1265 1243 } 1266 1244 1267 1245 void ath12k_debugfs_register(struct ath12k *ar)
+7 -5
drivers/net/wireless/ath/ath12k/debugfs.h
··· 14 14 void ath12k_debugfs_unregister(struct ath12k *ar); 15 15 void ath12k_debugfs_fw_stats_process(struct ath12k *ar, 16 16 struct ath12k_fw_stats *stats); 17 - void ath12k_debugfs_fw_stats_reset(struct ath12k *ar); 17 + void ath12k_debugfs_op_vif_add(struct ieee80211_hw *hw, 18 + struct ieee80211_vif *vif); 18 19 19 20 static inline bool ath12k_debugfs_is_extd_rx_stats_enabled(struct ath12k *ar) 20 21 { ··· 130 129 { 131 130 } 132 131 133 - static inline void ath12k_debugfs_fw_stats_reset(struct ath12k *ar) 134 - { 135 - } 136 - 137 132 static inline bool ath12k_debugfs_is_extd_rx_stats_enabled(struct ath12k *ar) 138 133 { 139 134 return false; ··· 138 141 static inline int ath12k_debugfs_rx_filter(struct ath12k *ar) 139 142 { 140 143 return 0; 144 + } 145 + 146 + static inline void ath12k_debugfs_op_vif_add(struct ieee80211_hw *hw, 147 + struct ieee80211_vif *vif) 148 + { 141 149 } 142 150 #endif /* CONFIG_ATH12K_DEBUGFS */ 143 151
+3
drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
··· 5377 5377 const int size = 32; 5378 5378 int num_args; 5379 5379 5380 + if (count > size) 5381 + return -EINVAL; 5382 + 5380 5383 char *buf __free(kfree) = kzalloc(size, GFP_KERNEL); 5381 5384 if (!buf) 5382 5385 return -ENOMEM;
+63 -25
drivers/net/wireless/ath/ath12k/dp.c
··· 1206 1206 if (!skb) 1207 1207 continue; 1208 1208 1209 + skb_cb = ATH12K_SKB_CB(skb); 1210 + if (skb_cb->paddr_ext_desc) { 1211 + dma_unmap_single(ab->dev, 1212 + skb_cb->paddr_ext_desc, 1213 + tx_desc_info->skb_ext_desc->len, 1214 + DMA_TO_DEVICE); 1215 + dev_kfree_skb_any(tx_desc_info->skb_ext_desc); 1216 + } 1217 + 1209 1218 /* if we are unregistering, hw would've been destroyed and 1210 1219 * ar is no longer valid. 1211 1220 */ 1212 1221 if (!(test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags))) { 1213 - skb_cb = ATH12K_SKB_CB(skb); 1214 1222 ar = skb_cb->ar; 1215 1223 1216 1224 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) ··· 1269 1261 if (!ab->hw_params->reoq_lut_support) 1270 1262 return; 1271 1263 1272 - if (dp->reoq_lut.vaddr) { 1264 + if (dp->reoq_lut.vaddr_unaligned) { 1273 1265 ath12k_hif_write32(ab, 1274 1266 HAL_SEQ_WCSS_UMAC_REO_REG + 1275 1267 HAL_REO1_QDESC_LUT_BASE0(ab), 0); 1276 - dma_free_coherent(ab->dev, DP_REOQ_LUT_SIZE, 1277 - dp->reoq_lut.vaddr, dp->reoq_lut.paddr); 1278 - dp->reoq_lut.vaddr = NULL; 1268 + dma_free_coherent(ab->dev, dp->reoq_lut.size, 1269 + dp->reoq_lut.vaddr_unaligned, 1270 + dp->reoq_lut.paddr_unaligned); 1271 + dp->reoq_lut.vaddr_unaligned = NULL; 1279 1272 } 1280 1273 1281 - if (dp->ml_reoq_lut.vaddr) { 1274 + if (dp->ml_reoq_lut.vaddr_unaligned) { 1282 1275 ath12k_hif_write32(ab, 1283 1276 HAL_SEQ_WCSS_UMAC_REO_REG + 1284 1277 HAL_REO1_QDESC_LUT_BASE1(ab), 0); 1285 - dma_free_coherent(ab->dev, DP_REOQ_LUT_SIZE, 1286 - dp->ml_reoq_lut.vaddr, dp->ml_reoq_lut.paddr); 1287 - dp->ml_reoq_lut.vaddr = NULL; 1278 + dma_free_coherent(ab->dev, dp->ml_reoq_lut.size, 1279 + dp->ml_reoq_lut.vaddr_unaligned, 1280 + dp->ml_reoq_lut.paddr_unaligned); 1281 + dp->ml_reoq_lut.vaddr_unaligned = NULL; 1288 1282 } 1289 1283 } 1290 1284 ··· 1618 1608 return ret; 1619 1609 } 1620 1610 1611 + static int ath12k_dp_alloc_reoq_lut(struct ath12k_base *ab, 1612 + struct ath12k_reo_q_addr_lut *lut) 1613 + { 1614 + lut->size = DP_REOQ_LUT_SIZE + HAL_REO_QLUT_ADDR_ALIGN - 1; 1615 + lut->vaddr_unaligned = dma_alloc_coherent(ab->dev, lut->size, 1616 + &lut->paddr_unaligned, 1617 + GFP_KERNEL | __GFP_ZERO); 1618 + if (!lut->vaddr_unaligned) 1619 + return -ENOMEM; 1620 + 1621 + lut->vaddr = PTR_ALIGN(lut->vaddr_unaligned, HAL_REO_QLUT_ADDR_ALIGN); 1622 + lut->paddr = lut->paddr_unaligned + 1623 + ((unsigned long)lut->vaddr - (unsigned long)lut->vaddr_unaligned); 1624 + return 0; 1625 + } 1626 + 1621 1627 static int ath12k_dp_reoq_lut_setup(struct ath12k_base *ab) 1622 1628 { 1623 1629 struct ath12k_dp *dp = &ab->dp; 1630 + u32 val; 1631 + int ret; 1624 1632 1625 1633 if (!ab->hw_params->reoq_lut_support) 1626 1634 return 0; 1627 1635 1628 - dp->reoq_lut.vaddr = dma_alloc_coherent(ab->dev, 1629 - DP_REOQ_LUT_SIZE, 1630 - &dp->reoq_lut.paddr, 1631 - GFP_KERNEL | __GFP_ZERO); 1632 - if (!dp->reoq_lut.vaddr) { 1636 + ret = ath12k_dp_alloc_reoq_lut(ab, &dp->reoq_lut); 1637 + if (ret) { 1633 1638 ath12k_warn(ab, "failed to allocate memory for reoq table"); 1634 - return -ENOMEM; 1639 + return ret; 1635 1640 } 1636 1641 1637 - dp->ml_reoq_lut.vaddr = dma_alloc_coherent(ab->dev, 1638 - DP_REOQ_LUT_SIZE, 1639 - &dp->ml_reoq_lut.paddr, 1640 - GFP_KERNEL | __GFP_ZERO); 1641 - if (!dp->ml_reoq_lut.vaddr) { 1642 + ret = ath12k_dp_alloc_reoq_lut(ab, &dp->ml_reoq_lut); 1643 + if (ret) { 1642 1644 ath12k_warn(ab, "failed to allocate memory for ML reoq table"); 1643 - dma_free_coherent(ab->dev, DP_REOQ_LUT_SIZE, 1644 - dp->reoq_lut.vaddr, dp->reoq_lut.paddr); 1645 - dp->reoq_lut.vaddr = NULL; 1646 - return -ENOMEM; 1645 + dma_free_coherent(ab->dev, dp->reoq_lut.size, 1646 + dp->reoq_lut.vaddr_unaligned, 1647 + dp->reoq_lut.paddr_unaligned); 1648 + dp->reoq_lut.vaddr_unaligned = NULL; 1649 + return ret; 1647 1650 } 1651 + 1652 + /* Bits in the register have address [39:8] LUT base address to be 1653 + * allocated such that LSBs are assumed to be zero. Also, current 1654 + * design supports paddr up to 4 GB max hence it fits in 32 bit 1655 + * register only 1656 + */ 1648 1657 1649 1658 ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_LUT_BASE0(ab), 1650 - dp->reoq_lut.paddr); 1659 + dp->reoq_lut.paddr >> 8); 1660 + 1651 1661 ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_LUT_BASE1(ab), 1652 1662 dp->ml_reoq_lut.paddr >> 8); 1663 + 1664 + val = ath12k_hif_read32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_ADDR(ab)); 1665 + 1666 + ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_ADDR(ab), 1667 + val | HAL_REO_QDESC_ADDR_READ_LUT_ENABLE); 1668 + 1669 + ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_MAX_PEERID(ab), 1670 + HAL_REO_QDESC_MAX_PEERID); 1653 1671 1654 1672 return 0; 1655 1673 }
+24 -1
drivers/net/wireless/ath/ath12k/dp.h
··· 7 7 #ifndef ATH12K_DP_H 8 8 #define ATH12K_DP_H 9 9 10 + #include "hal_desc.h" 10 11 #include "hal_rx.h" 11 12 #include "hw.h" 12 13 ··· 107 106 struct list_head list; 108 107 struct sk_buff *head; 109 108 struct sk_buff *tail; 109 + u32 err_bitmap; 110 + u8 decap_format; 110 111 }; 111 112 112 113 #define DP_MON_MAX_STATUS_BUF 32 ··· 296 293 struct ath12k_tx_desc_info { 297 294 struct list_head list; 298 295 struct sk_buff *skb; 296 + struct sk_buff *skb_ext_desc; 299 297 u32 desc_id; /* Cookie */ 300 298 u8 mac_id; 301 299 u8 pool_id; 300 + }; 301 + 302 + struct ath12k_tx_desc_params { 303 + struct sk_buff *skb; 304 + struct sk_buff *skb_ext_desc; 305 + u8 mac_id; 302 306 }; 303 307 304 308 struct ath12k_spt_info { ··· 319 309 } __packed; 320 310 321 311 struct ath12k_reo_q_addr_lut { 322 - dma_addr_t paddr; 312 + u32 *vaddr_unaligned; 323 313 u32 *vaddr; 314 + dma_addr_t paddr_unaligned; 315 + dma_addr_t paddr; 316 + u32 size; 317 + }; 318 + 319 + struct ath12k_link_stats { 320 + u32 tx_enqueued; 321 + u32 tx_completed; 322 + u32 tx_bcast_mcast; 323 + u32 tx_dropped; 324 + u32 tx_encap_type[HAL_TCL_ENCAP_TYPE_MAX]; 325 + u32 tx_encrypt_type[HAL_ENCRYPT_TYPE_MAX]; 326 + u32 tx_desc_type[HAL_TCL_DESC_TYPE_MAX]; 324 327 }; 325 328 326 329 struct ath12k_dp {
+315 -62
drivers/net/wireless/ath/ath12k/dp_mon.c
··· 1647 1647 u32_get_bits(info[0], HAL_RX_MPDU_START_INFO0_PPDU_ID); 1648 1648 } 1649 1649 1650 - break; 1650 + return HAL_RX_MON_STATUS_MPDU_START; 1651 1651 } 1652 1652 case HAL_RX_MSDU_START: 1653 1653 /* TODO: add msdu start parsing logic */ ··· 1688 1688 return HAL_RX_MON_STATUS_PPDU_NOT_DONE; 1689 1689 } 1690 1690 1691 - static void ath12k_dp_mon_rx_msdus_set_payload(struct ath12k *ar, 1692 - struct sk_buff *head_msdu, 1693 - struct sk_buff *tail_msdu) 1691 + static void 1692 + ath12k_dp_mon_fill_rx_stats_info(struct ath12k *ar, 1693 + struct hal_rx_mon_ppdu_info *ppdu_info, 1694 + struct ieee80211_rx_status *rx_status) 1694 1695 { 1695 - u32 rx_pkt_offset, l2_hdr_offset; 1696 + u32 center_freq = ppdu_info->freq; 1696 1697 1697 - rx_pkt_offset = ar->ab->hal.hal_desc_sz; 1698 - l2_hdr_offset = 1699 - ath12k_dp_rx_h_l3pad(ar->ab, (struct hal_rx_desc *)tail_msdu->data); 1700 - skb_pull(head_msdu, rx_pkt_offset + l2_hdr_offset); 1698 + rx_status->freq = center_freq; 1699 + rx_status->bw = ath12k_mac_bw_to_mac80211_bw(ppdu_info->bw); 1700 + rx_status->nss = ppdu_info->nss; 1701 + rx_status->rate_idx = 0; 1702 + rx_status->encoding = RX_ENC_LEGACY; 1703 + rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; 1704 + 1705 + if (center_freq >= ATH12K_MIN_6GHZ_FREQ && 1706 + center_freq <= ATH12K_MAX_6GHZ_FREQ) { 1707 + rx_status->band = NL80211_BAND_6GHZ; 1708 + } else if (center_freq >= ATH12K_MIN_2GHZ_FREQ && 1709 + center_freq <= ATH12K_MAX_2GHZ_FREQ) { 1710 + rx_status->band = NL80211_BAND_2GHZ; 1711 + } else if (center_freq >= ATH12K_MIN_5GHZ_FREQ && 1712 + center_freq <= ATH12K_MAX_5GHZ_FREQ) { 1713 + rx_status->band = NL80211_BAND_5GHZ; 1714 + } else { 1715 + rx_status->band = NUM_NL80211_BANDS; 1716 + } 1717 + } 1718 + 1719 + static void 1720 + ath12k_dp_mon_fill_rx_rate(struct ath12k *ar, 1721 + struct hal_rx_mon_ppdu_info *ppdu_info, 1722 + struct ieee80211_rx_status *rx_status) 1723 + { 1724 + struct ieee80211_supported_band *sband; 1725 + enum rx_msdu_start_pkt_type pkt_type; 1726 + u8 rate_mcs, nss, sgi; 1727 + bool is_cck; 1728 + 1729 + pkt_type = ppdu_info->preamble_type; 1730 + rate_mcs = ppdu_info->rate; 1731 + nss = ppdu_info->nss; 1732 + sgi = ppdu_info->gi; 1733 + 1734 + switch (pkt_type) { 1735 + case RX_MSDU_START_PKT_TYPE_11A: 1736 + case RX_MSDU_START_PKT_TYPE_11B: 1737 + is_cck = (pkt_type == RX_MSDU_START_PKT_TYPE_11B); 1738 + if (rx_status->band < NUM_NL80211_BANDS) { 1739 + sband = &ar->mac.sbands[rx_status->band]; 1740 + rx_status->rate_idx = ath12k_mac_hw_rate_to_idx(sband, rate_mcs, 1741 + is_cck); 1742 + } 1743 + break; 1744 + case RX_MSDU_START_PKT_TYPE_11N: 1745 + rx_status->encoding = RX_ENC_HT; 1746 + if (rate_mcs > ATH12K_HT_MCS_MAX) { 1747 + ath12k_warn(ar->ab, 1748 + "Received with invalid mcs in HT mode %d\n", 1749 + rate_mcs); 1750 + break; 1751 + } 1752 + rx_status->rate_idx = rate_mcs + (8 * (nss - 1)); 1753 + if (sgi) 1754 + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; 1755 + break; 1756 + case RX_MSDU_START_PKT_TYPE_11AC: 1757 + rx_status->encoding = RX_ENC_VHT; 1758 + rx_status->rate_idx = rate_mcs; 1759 + if (rate_mcs > ATH12K_VHT_MCS_MAX) { 1760 + ath12k_warn(ar->ab, 1761 + "Received with invalid mcs in VHT mode %d\n", 1762 + rate_mcs); 1763 + break; 1764 + } 1765 + if (sgi) 1766 + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; 1767 + break; 1768 + case RX_MSDU_START_PKT_TYPE_11AX: 1769 + rx_status->rate_idx = rate_mcs; 1770 + if (rate_mcs > ATH12K_HE_MCS_MAX) { 1771 + ath12k_warn(ar->ab, 1772 + "Received with invalid mcs in HE mode %d\n", 1773 + rate_mcs); 1774 + break; 1775 + } 1776 + rx_status->encoding = RX_ENC_HE; 1777 + rx_status->he_gi = ath12k_he_gi_to_nl80211_he_gi(sgi); 1778 + break; 1779 + case RX_MSDU_START_PKT_TYPE_11BE: 1780 + rx_status->rate_idx = rate_mcs; 1781 + if (rate_mcs > ATH12K_EHT_MCS_MAX) { 1782 + ath12k_warn(ar->ab, 1783 + "Received with invalid mcs in EHT mode %d\n", 1784 + rate_mcs); 1785 + break; 1786 + } 1787 + rx_status->encoding = RX_ENC_EHT; 1788 + rx_status->he_gi = ath12k_he_gi_to_nl80211_he_gi(sgi); 1789 + break; 1790 + default: 1791 + ath12k_dbg(ar->ab, ATH12K_DBG_DATA, 1792 + "monitor receives invalid preamble type %d", 1793 + pkt_type); 1794 + break; 1795 + } 1701 1796 } 1702 1797 1703 1798 static struct sk_buff * 1704 1799 ath12k_dp_mon_rx_merg_msdus(struct ath12k *ar, 1705 - struct sk_buff *head_msdu, struct sk_buff *tail_msdu, 1706 - struct ieee80211_rx_status *rxs, bool *fcs_err) 1800 + struct dp_mon_mpdu *mon_mpdu, 1801 + struct hal_rx_mon_ppdu_info *ppdu_info, 1802 + struct ieee80211_rx_status *rxs) 1707 1803 { 1708 1804 struct ath12k_base *ab = ar->ab; 1709 1805 struct sk_buff *msdu, *mpdu_buf, *prev_buf, *head_frag_list; 1710 - struct hal_rx_desc *rx_desc, *tail_rx_desc; 1711 - u8 *hdr_desc, *dest, decap_format; 1806 + struct sk_buff *head_msdu; 1807 + struct hal_rx_desc *rx_desc; 1808 + u8 *hdr_desc, *dest, decap_format = mon_mpdu->decap_format; 1712 1809 struct ieee80211_hdr_3addr *wh; 1713 - u32 err_bitmap, frag_list_sum_len = 0; 1810 + struct ieee80211_channel *channel; 1811 + u32 frag_list_sum_len = 0; 1812 + u8 channel_num = ppdu_info->chan_num; 1714 1813 1715 1814 mpdu_buf = NULL; 1815 + head_msdu = mon_mpdu->head; 1716 1816 1717 1817 if (!head_msdu) 1718 1818 goto err_merge_fail; 1719 1819 1720 - rx_desc = (struct hal_rx_desc *)head_msdu->data; 1721 - tail_rx_desc = (struct hal_rx_desc *)tail_msdu->data; 1820 + ath12k_dp_mon_fill_rx_stats_info(ar, ppdu_info, rxs); 1722 1821 1723 - err_bitmap = ath12k_dp_rx_h_mpdu_err(ab, tail_rx_desc); 1724 - if (err_bitmap & HAL_RX_MPDU_ERR_FCS) 1725 - *fcs_err = true; 1822 + if (unlikely(rxs->band == NUM_NL80211_BANDS || 1823 + !ath12k_ar_to_hw(ar)->wiphy->bands[rxs->band])) { 1824 + ath12k_dbg(ar->ab, ATH12K_DBG_DATA, 1825 + "sband is NULL for status band %d channel_num %d center_freq %d pdev_id %d\n", 1826 + rxs->band, channel_num, ppdu_info->freq, ar->pdev_idx); 1726 1827 1727 - decap_format = ath12k_dp_rx_h_decap_type(ab, tail_rx_desc); 1828 + spin_lock_bh(&ar->data_lock); 1829 + channel = ar->rx_channel; 1830 + if (channel) { 1831 + rxs->band = channel->band; 1832 + channel_num = 1833 + ieee80211_frequency_to_channel(channel->center_freq); 1834 + } 1835 + spin_unlock_bh(&ar->data_lock); 1836 + } 1728 1837 1729 - ath12k_dp_rx_h_ppdu(ar, tail_rx_desc, rxs); 1838 + if (rxs->band < NUM_NL80211_BANDS) 1839 + rxs->freq = ieee80211_channel_to_frequency(channel_num, 1840 + rxs->band); 1841 + 1842 + ath12k_dp_mon_fill_rx_rate(ar, ppdu_info, rxs); 1730 1843 1731 1844 if (decap_format == DP_RX_DECAP_TYPE_RAW) { 1732 - ath12k_dp_mon_rx_msdus_set_payload(ar, head_msdu, tail_msdu); 1845 + skb_pull(head_msdu, ATH12K_MON_RX_PKT_OFFSET); 1733 1846 1734 1847 prev_buf = head_msdu; 1735 1848 msdu = head_msdu->next; 1736 1849 head_frag_list = NULL; 1737 1850 1738 1851 while (msdu) { 1739 - ath12k_dp_mon_rx_msdus_set_payload(ar, msdu, tail_msdu); 1852 + skb_pull(msdu, ATH12K_MON_RX_PKT_OFFSET); 1740 1853 1741 1854 if (!head_frag_list) 1742 1855 head_frag_list = msdu; ··· 1861 1748 1862 1749 prev_buf->next = NULL; 1863 1750 1864 - skb_trim(prev_buf, prev_buf->len - HAL_RX_FCS_LEN); 1751 + skb_trim(prev_buf, prev_buf->len); 1865 1752 if (head_frag_list) { 1866 1753 skb_shinfo(head_msdu)->frag_list = head_frag_list; 1867 1754 head_msdu->data_len = frag_list_sum_len; ··· 1884 1771 msdu = head_msdu; 1885 1772 1886 1773 while (msdu) { 1887 - ath12k_dp_mon_rx_msdus_set_payload(ar, msdu, tail_msdu); 1774 + skb_pull(msdu, ATH12K_MON_RX_PKT_OFFSET); 1888 1775 if (qos_pkt) { 1889 1776 dest = skb_push(msdu, sizeof(__le16)); 1890 1777 if (!dest) ··· 2067 1954 2068 1955 static void ath12k_dp_mon_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napi, 2069 1956 struct sk_buff *msdu, 2070 - struct ieee80211_rx_status *status) 1957 + struct ieee80211_rx_status *status, 1958 + u8 decap) 2071 1959 { 2072 1960 static const struct ieee80211_radiotap_he known = { 2073 1961 .data1 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | ··· 2080 1966 struct ieee80211_sta *pubsta = NULL; 2081 1967 struct ath12k_peer *peer; 2082 1968 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 2083 - u8 decap = DP_RX_DECAP_TYPE_RAW; 1969 + struct ath12k_dp_rx_info rx_info; 2084 1970 bool is_mcbc = rxcb->is_mcbc; 2085 1971 bool is_eapol_tkip = rxcb->is_eapol; 1972 + 1973 + status->link_valid = 0; 2086 1974 2087 1975 if ((status->encoding == RX_ENC_HE) && !(status->flag & RX_FLAG_RADIOTAP_HE) && 2088 1976 !(status->flag & RX_FLAG_SKIP_MONITOR)) { ··· 2093 1977 status->flag |= RX_FLAG_RADIOTAP_HE; 2094 1978 } 2095 1979 2096 - if (!(status->flag & RX_FLAG_ONLY_MONITOR)) 2097 - decap = ath12k_dp_rx_h_decap_type(ar->ab, rxcb->rx_desc); 2098 1980 spin_lock_bh(&ar->ab->base_lock); 2099 - peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu); 1981 + rx_info.addr2_present = false; 1982 + peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu, &rx_info); 2100 1983 if (peer && peer->sta) { 2101 1984 pubsta = peer->sta; 2102 1985 if (pubsta->valid_links) { ··· 2150 2035 } 2151 2036 2152 2037 static int ath12k_dp_mon_rx_deliver(struct ath12k *ar, 2153 - struct sk_buff *head_msdu, struct sk_buff *tail_msdu, 2038 + struct dp_mon_mpdu *mon_mpdu, 2154 2039 struct hal_rx_mon_ppdu_info *ppduinfo, 2155 2040 struct napi_struct *napi) 2156 2041 { 2157 2042 struct ath12k_pdev_dp *dp = &ar->dp; 2158 2043 struct sk_buff *mon_skb, *skb_next, *header; 2159 2044 struct ieee80211_rx_status *rxs = &dp->rx_status; 2160 - bool fcs_err = false; 2045 + u8 decap = DP_RX_DECAP_TYPE_RAW; 2161 2046 2162 - mon_skb = ath12k_dp_mon_rx_merg_msdus(ar, 2163 - head_msdu, tail_msdu, 2164 - rxs, &fcs_err); 2047 + mon_skb = ath12k_dp_mon_rx_merg_msdus(ar, mon_mpdu, ppduinfo, rxs); 2165 2048 if (!mon_skb) 2166 2049 goto mon_deliver_fail; 2167 2050 2168 2051 header = mon_skb; 2169 2052 rxs->flag = 0; 2170 2053 2171 - if (fcs_err) 2054 + if (mon_mpdu->err_bitmap & HAL_RX_MPDU_ERR_FCS) 2172 2055 rxs->flag = RX_FLAG_FAILED_FCS_CRC; 2173 2056 2174 2057 do { ··· 2183 2070 rxs->flag |= RX_FLAG_ALLOW_SAME_PN; 2184 2071 } 2185 2072 rxs->flag |= RX_FLAG_ONLY_MONITOR; 2073 + 2074 + if (!(rxs->flag & RX_FLAG_ONLY_MONITOR)) 2075 + decap = mon_mpdu->decap_format; 2076 + 2186 2077 ath12k_dp_mon_update_radiotap(ar, ppduinfo, mon_skb, rxs); 2187 - ath12k_dp_mon_rx_deliver_msdu(ar, napi, mon_skb, rxs); 2078 + ath12k_dp_mon_rx_deliver_msdu(ar, napi, mon_skb, rxs, decap); 2188 2079 mon_skb = skb_next; 2189 2080 } while (mon_skb); 2190 2081 rxs->flag = 0; ··· 2196 2079 return 0; 2197 2080 2198 2081 mon_deliver_fail: 2199 - mon_skb = head_msdu; 2082 + mon_skb = mon_mpdu->head; 2200 2083 while (mon_skb) { 2201 2084 skb_next = mon_skb->next; 2202 2085 dev_kfree_skb_any(mon_skb); 2203 2086 mon_skb = skb_next; 2204 2087 } 2205 2088 return -EINVAL; 2089 + } 2090 + 2091 + static int ath12k_dp_pkt_set_pktlen(struct sk_buff *skb, u32 len) 2092 + { 2093 + if (skb->len > len) { 2094 + skb_trim(skb, len); 2095 + } else { 2096 + if (skb_tailroom(skb) < len - skb->len) { 2097 + if ((pskb_expand_head(skb, 0, 2098 + len - skb->len - skb_tailroom(skb), 2099 + GFP_ATOMIC))) { 2100 + return -ENOMEM; 2101 + } 2102 + } 2103 + skb_put(skb, (len - skb->len)); 2104 + } 2105 + 2106 + return 0; 2107 + } 2108 + 2109 + static void ath12k_dp_mon_parse_rx_msdu_end_err(u32 info, u32 *errmap) 2110 + { 2111 + if (info & RX_MSDU_END_INFO13_FCS_ERR) 2112 + *errmap |= HAL_RX_MPDU_ERR_FCS; 2113 + 2114 + if (info & RX_MSDU_END_INFO13_DECRYPT_ERR) 2115 + *errmap |= HAL_RX_MPDU_ERR_DECRYPT; 2116 + 2117 + if (info & RX_MSDU_END_INFO13_TKIP_MIC_ERR) 2118 + *errmap |= HAL_RX_MPDU_ERR_TKIP_MIC; 2119 + 2120 + if (info & RX_MSDU_END_INFO13_A_MSDU_ERROR) 2121 + *errmap |= HAL_RX_MPDU_ERR_AMSDU_ERR; 2122 + 2123 + if (info & RX_MSDU_END_INFO13_OVERFLOW_ERR) 2124 + *errmap |= HAL_RX_MPDU_ERR_OVERFLOW; 2125 + 2126 + if (info & RX_MSDU_END_INFO13_MSDU_LEN_ERR) 2127 + *errmap |= HAL_RX_MPDU_ERR_MSDU_LEN; 2128 + 2129 + if (info & RX_MSDU_END_INFO13_MPDU_LEN_ERR) 2130 + *errmap |= HAL_RX_MPDU_ERR_MPDU_LEN; 2131 + } 2132 + 2133 + static int 2134 + ath12k_dp_mon_parse_status_msdu_end(struct ath12k_mon_data *pmon, 2135 + const struct hal_rx_msdu_end *msdu_end) 2136 + { 2137 + struct dp_mon_mpdu *mon_mpdu = pmon->mon_mpdu; 2138 + 2139 + ath12k_dp_mon_parse_rx_msdu_end_err(__le32_to_cpu(msdu_end->info2), 2140 + &mon_mpdu->err_bitmap); 2141 + 2142 + mon_mpdu->decap_format = le32_get_bits(msdu_end->info1, 2143 + RX_MSDU_END_INFO11_DECAP_FORMAT); 2144 + 2145 + return 0; 2146 + } 2147 + 2148 + static int 2149 + ath12k_dp_mon_parse_status_buf(struct ath12k *ar, 2150 + struct ath12k_mon_data *pmon, 2151 + const struct dp_mon_packet_info *packet_info) 2152 + { 2153 + struct ath12k_base *ab = ar->ab; 2154 + struct dp_rxdma_mon_ring *buf_ring = &ab->dp.rxdma_mon_buf_ring; 2155 + struct sk_buff *msdu; 2156 + int buf_id; 2157 + u32 offset; 2158 + 2159 + buf_id = u32_get_bits(packet_info->cookie, DP_RXDMA_BUF_COOKIE_BUF_ID); 2160 + 2161 + spin_lock_bh(&buf_ring->idr_lock); 2162 + msdu = idr_remove(&buf_ring->bufs_idr, buf_id); 2163 + spin_unlock_bh(&buf_ring->idr_lock); 2164 + 2165 + if (unlikely(!msdu)) { 2166 + ath12k_warn(ab, "mon dest desc with inval buf_id %d\n", buf_id); 2167 + return 0; 2168 + } 2169 + 2170 + dma_unmap_single(ab->dev, ATH12K_SKB_RXCB(msdu)->paddr, 2171 + msdu->len + skb_tailroom(msdu), 2172 + DMA_FROM_DEVICE); 2173 + 2174 + offset = packet_info->dma_length + ATH12K_MON_RX_DOT11_OFFSET; 2175 + if (ath12k_dp_pkt_set_pktlen(msdu, offset)) { 2176 + dev_kfree_skb_any(msdu); 2177 + goto dest_replenish; 2178 + } 2179 + 2180 + if (!pmon->mon_mpdu->head) 2181 + pmon->mon_mpdu->head = msdu; 2182 + else 2183 + pmon->mon_mpdu->tail->next = msdu; 2184 + 2185 + pmon->mon_mpdu->tail = msdu; 2186 + 2187 + dest_replenish: 2188 + ath12k_dp_mon_buf_replenish(ab, buf_ring, 1); 2189 + 2190 + return 0; 2191 + } 2192 + 2193 + static int 2194 + ath12k_dp_mon_parse_rx_dest_tlv(struct ath12k *ar, 2195 + struct ath12k_mon_data *pmon, 2196 + enum hal_rx_mon_status hal_status, 2197 + const void *tlv_data) 2198 + { 2199 + switch (hal_status) { 2200 + case HAL_RX_MON_STATUS_MPDU_START: 2201 + if (WARN_ON_ONCE(pmon->mon_mpdu)) 2202 + break; 2203 + 2204 + pmon->mon_mpdu = kzalloc(sizeof(*pmon->mon_mpdu), GFP_ATOMIC); 2205 + if (!pmon->mon_mpdu) 2206 + return -ENOMEM; 2207 + break; 2208 + case HAL_RX_MON_STATUS_BUF_ADDR: 2209 + return ath12k_dp_mon_parse_status_buf(ar, pmon, tlv_data); 2210 + case HAL_RX_MON_STATUS_MPDU_END: 2211 + /* If no MSDU then free empty MPDU */ 2212 + if (pmon->mon_mpdu->tail) { 2213 + pmon->mon_mpdu->tail->next = NULL; 2214 + list_add_tail(&pmon->mon_mpdu->list, &pmon->dp_rx_mon_mpdu_list); 2215 + } else { 2216 + kfree(pmon->mon_mpdu); 2217 + } 2218 + pmon->mon_mpdu = NULL; 2219 + break; 2220 + case HAL_RX_MON_STATUS_MSDU_END: 2221 + return ath12k_dp_mon_parse_status_msdu_end(pmon, tlv_data); 2222 + default: 2223 + break; 2224 + } 2225 + 2226 + return 0; 2206 2227 } 2207 2228 2208 2229 static enum hal_rx_mon_status ··· 2369 2114 tlv_len = le64_get_bits(tlv->tl, HAL_TLV_64_HDR_LEN); 2370 2115 2371 2116 hal_status = ath12k_dp_mon_rx_parse_status_tlv(ar, pmon, tlv); 2117 + 2118 + if (ar->monitor_started && 2119 + ath12k_dp_mon_parse_rx_dest_tlv(ar, pmon, hal_status, tlv->value)) 2120 + return HAL_RX_MON_STATUS_PPDU_DONE; 2121 + 2372 2122 ptr += sizeof(*tlv) + tlv_len; 2373 2123 ptr = PTR_ALIGN(ptr, HAL_TLV_64_ALIGN); 2374 2124 2375 - if ((ptr - skb->data) >= DP_RX_BUFFER_SIZE) 2125 + if ((ptr - skb->data) > skb->len) 2376 2126 break; 2377 2127 2378 2128 } while ((hal_status == HAL_RX_MON_STATUS_PPDU_NOT_DONE) || 2379 2129 (hal_status == HAL_RX_MON_STATUS_BUF_ADDR) || 2130 + (hal_status == HAL_RX_MON_STATUS_MPDU_START) || 2380 2131 (hal_status == HAL_RX_MON_STATUS_MPDU_END) || 2381 2132 (hal_status == HAL_RX_MON_STATUS_MSDU_END)); 2382 2133 ··· 2402 2141 struct hal_rx_mon_ppdu_info *ppdu_info = &pmon->mon_ppdu_info; 2403 2142 struct dp_mon_mpdu *tmp; 2404 2143 struct dp_mon_mpdu *mon_mpdu = pmon->mon_mpdu; 2405 - struct sk_buff *head_msdu, *tail_msdu; 2406 - enum hal_rx_mon_status hal_status = HAL_RX_MON_STATUS_BUF_DONE; 2144 + enum hal_rx_mon_status hal_status; 2407 2145 2408 - ath12k_dp_mon_parse_rx_dest(ar, pmon, skb); 2146 + hal_status = ath12k_dp_mon_parse_rx_dest(ar, pmon, skb); 2147 + if (hal_status != HAL_RX_MON_STATUS_PPDU_DONE) 2148 + return hal_status; 2409 2149 2410 2150 list_for_each_entry_safe(mon_mpdu, tmp, &pmon->dp_rx_mon_mpdu_list, list) { 2411 2151 list_del(&mon_mpdu->list); 2412 - head_msdu = mon_mpdu->head; 2413 - tail_msdu = mon_mpdu->tail; 2414 2152 2415 - if (head_msdu && tail_msdu) { 2416 - ath12k_dp_mon_rx_deliver(ar, head_msdu, 2417 - tail_msdu, ppdu_info, napi); 2418 - } 2153 + if (mon_mpdu->head && mon_mpdu->tail) 2154 + ath12k_dp_mon_rx_deliver(ar, mon_mpdu, ppdu_info, napi); 2419 2155 2420 2156 kfree(mon_mpdu); 2421 2157 } 2158 + 2422 2159 return hal_status; 2423 2160 } 2424 2161 ··· 3097 2838 struct dp_mon_tx_ppdu_info *tx_ppdu_info) 3098 2839 { 3099 2840 struct dp_mon_mpdu *tmp, *mon_mpdu; 3100 - struct sk_buff *head_msdu, *tail_msdu; 3101 2841 3102 2842 list_for_each_entry_safe(mon_mpdu, tmp, 3103 2843 &tx_ppdu_info->dp_tx_mon_mpdu_list, list) { 3104 2844 list_del(&mon_mpdu->list); 3105 - head_msdu = mon_mpdu->head; 3106 - tail_msdu = mon_mpdu->tail; 3107 2845 3108 - if (head_msdu) 3109 - ath12k_dp_mon_rx_deliver(ar, head_msdu, tail_msdu, 2846 + if (mon_mpdu->head) 2847 + ath12k_dp_mon_rx_deliver(ar, mon_mpdu, 3110 2848 &tx_ppdu_info->rx_status, napi); 3111 2849 3112 2850 kfree(mon_mpdu); ··· 3205 2949 struct ath12k_rx_peer_stats *rx_stats = arsta->rx_stats; 3206 2950 u32 num_msdu; 3207 2951 3208 - if (!rx_stats) 3209 - return; 3210 - 3211 2952 arsta->rssi_comb = ppdu_info->rssi_comb; 3212 2953 ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); 2954 + if (!rx_stats) 2955 + return; 3213 2956 3214 2957 num_msdu = ppdu_info->tcp_msdu_count + ppdu_info->tcp_ack_msdu_count + 3215 2958 ppdu_info->udp_msdu_count + ppdu_info->other_msdu_count; ··· 3381 3126 3382 3127 ahsta = ath12k_sta_to_ahsta(peer->sta); 3383 3128 arsta = &ahsta->deflink; 3384 - rx_stats = arsta->rx_stats; 3385 - 3386 - if (!rx_stats) 3387 - return; 3388 - 3389 3129 arsta->rssi_comb = ppdu_info->rssi_comb; 3390 3130 ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); 3131 + rx_stats = arsta->rx_stats; 3132 + if (!rx_stats) 3133 + return; 3391 3134 3392 3135 num_msdu = user_stats->tcp_msdu_count + user_stats->tcp_ack_msdu_count + 3393 3136 user_stats->udp_msdu_count + user_stats->other_msdu_count; ··· 3599 3346 ath12k_dp_mon_rx_memset_ppdu_info(ppdu_info); 3600 3347 3601 3348 while ((skb = __skb_dequeue(&skb_list))) { 3602 - hal_status = ath12k_dp_mon_parse_rx_dest(ar, pmon, skb); 3349 + hal_status = ath12k_dp_mon_rx_parse_mon_status(ar, pmon, skb, napi); 3603 3350 if (hal_status != HAL_RX_MON_STATUS_PPDU_DONE) { 3604 3351 ppdu_info->ppdu_continuation = true; 3605 3352 dev_kfree_skb_any(skb);
+4 -1
drivers/net/wireless/ath/ath12k/dp_mon.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 3 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_DP_MON_H 8 8 #define ATH12K_DP_MON_H 9 9 10 10 #include "core.h" 11 + 12 + #define ATH12K_MON_RX_DOT11_OFFSET 5 13 + #define ATH12K_MON_RX_PKT_OFFSET 8 11 14 12 15 enum dp_monitor_mode { 13 16 ATH12K_DP_TX_MONITOR_MODE,
+242 -182
drivers/net/wireless/ath/ath12k/dp_rx.c
··· 228 228 ab->hal_rx_ops->rx_desc_get_crypto_header(desc, crypto_hdr, enctype); 229 229 } 230 230 231 - static u16 ath12k_dp_rxdesc_get_mpdu_frame_ctrl(struct ath12k_base *ab, 232 - struct hal_rx_desc *desc) 233 - { 234 - return ab->hal_rx_ops->rx_desc_get_mpdu_frame_ctl(desc); 235 - } 236 - 237 231 static inline u8 ath12k_dp_rx_get_msdu_src_link(struct ath12k_base *ab, 238 232 struct hal_rx_desc *desc) 239 233 { ··· 550 556 spin_lock_bh(&dp->reo_cmd_lock); 551 557 list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { 552 558 list_del(&cmd->list); 553 - dma_unmap_single(ab->dev, cmd->data.paddr, 554 - cmd->data.size, DMA_BIDIRECTIONAL); 555 - kfree(cmd->data.vaddr); 559 + dma_unmap_single(ab->dev, cmd->data.qbuf.paddr_aligned, 560 + cmd->data.qbuf.size, DMA_BIDIRECTIONAL); 561 + kfree(cmd->data.qbuf.vaddr); 556 562 kfree(cmd); 557 563 } 558 564 ··· 560 566 &dp->reo_cmd_cache_flush_list, list) { 561 567 list_del(&cmd_cache->list); 562 568 dp->reo_cmd_cache_flush_count--; 563 - dma_unmap_single(ab->dev, cmd_cache->data.paddr, 564 - cmd_cache->data.size, DMA_BIDIRECTIONAL); 565 - kfree(cmd_cache->data.vaddr); 569 + dma_unmap_single(ab->dev, cmd_cache->data.qbuf.paddr_aligned, 570 + cmd_cache->data.qbuf.size, DMA_BIDIRECTIONAL); 571 + kfree(cmd_cache->data.qbuf.vaddr); 566 572 kfree(cmd_cache); 567 573 } 568 574 spin_unlock_bh(&dp->reo_cmd_lock); ··· 577 583 ath12k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n", 578 584 rx_tid->tid, status); 579 585 580 - dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, 586 + dma_unmap_single(dp->ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 581 587 DMA_BIDIRECTIONAL); 582 - kfree(rx_tid->vaddr); 583 - rx_tid->vaddr = NULL; 588 + kfree(rx_tid->qbuf.vaddr); 589 + rx_tid->qbuf.vaddr = NULL; 584 590 } 585 591 586 592 static int ath12k_dp_reo_cmd_send(struct ath12k_base *ab, struct ath12k_dp_rx_tid *rx_tid, ··· 635 641 unsigned long tot_desc_sz, desc_sz; 636 642 int ret; 637 643 638 - tot_desc_sz = rx_tid->size; 644 + tot_desc_sz = rx_tid->qbuf.size; 639 645 desc_sz = ath12k_hal_reo_qdesc_size(0, HAL_DESC_REO_NON_QOS_TID); 640 646 641 647 while (tot_desc_sz > desc_sz) { 642 648 tot_desc_sz -= desc_sz; 643 - cmd.addr_lo = lower_32_bits(rx_tid->paddr + tot_desc_sz); 644 - cmd.addr_hi = upper_32_bits(rx_tid->paddr); 649 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned + tot_desc_sz); 650 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 645 651 ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 646 652 HAL_REO_CMD_FLUSH_CACHE, &cmd, 647 653 NULL); ··· 652 658 } 653 659 654 660 memset(&cmd, 0, sizeof(cmd)); 655 - cmd.addr_lo = lower_32_bits(rx_tid->paddr); 656 - cmd.addr_hi = upper_32_bits(rx_tid->paddr); 661 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 662 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 657 663 cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 658 664 ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 659 665 HAL_REO_CMD_FLUSH_CACHE, ··· 661 667 if (ret) { 662 668 ath12k_err(ab, "failed to send HAL_REO_CMD_FLUSH_CACHE cmd, tid %d (%d)\n", 663 669 rx_tid->tid, ret); 664 - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, 670 + dma_unmap_single(ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 665 671 DMA_BIDIRECTIONAL); 666 - kfree(rx_tid->vaddr); 667 - rx_tid->vaddr = NULL; 672 + kfree(rx_tid->qbuf.vaddr); 673 + rx_tid->qbuf.vaddr = NULL; 668 674 } 669 675 } 670 676 ··· 723 729 724 730 return; 725 731 free_desc: 726 - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, 732 + dma_unmap_single(ab->dev, rx_tid->qbuf.paddr_aligned, rx_tid->qbuf.size, 727 733 DMA_BIDIRECTIONAL); 728 - kfree(rx_tid->vaddr); 729 - rx_tid->vaddr = NULL; 734 + kfree(rx_tid->qbuf.vaddr); 735 + rx_tid->qbuf.vaddr = NULL; 730 736 } 731 737 732 738 static void ath12k_peer_rx_tid_qref_setup(struct ath12k_base *ab, u16 peer_id, u16 tid, ··· 756 762 qref->info1 = u32_encode_bits(upper_32_bits(paddr), 757 763 BUFFER_ADDR_INFO1_ADDR) | 758 764 u32_encode_bits(tid, DP_REO_QREF_NUM); 765 + ath12k_hal_reo_shared_qaddr_cache_clear(ab); 759 766 } 760 767 761 768 static void ath12k_peer_rx_tid_qref_reset(struct ath12k_base *ab, u16 peer_id, u16 tid) ··· 796 801 return; 797 802 798 803 cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 799 - cmd.addr_lo = lower_32_bits(rx_tid->paddr); 800 - cmd.addr_hi = upper_32_bits(rx_tid->paddr); 804 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 805 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 801 806 cmd.upd0 = HAL_REO_CMD_UPD0_VLD; 802 807 ret = ath12k_dp_reo_cmd_send(ar->ab, rx_tid, 803 808 HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, ··· 805 810 if (ret) { 806 811 ath12k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid %d (%d)\n", 807 812 tid, ret); 808 - dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size, 809 - DMA_BIDIRECTIONAL); 810 - kfree(rx_tid->vaddr); 811 - rx_tid->vaddr = NULL; 813 + dma_unmap_single(ar->ab->dev, rx_tid->qbuf.paddr_aligned, 814 + rx_tid->qbuf.size, DMA_BIDIRECTIONAL); 815 + kfree(rx_tid->qbuf.vaddr); 816 + rx_tid->qbuf.vaddr = NULL; 812 817 } 813 818 814 819 if (peer->mlo) ··· 904 909 struct ath12k_hal_reo_cmd cmd = {0}; 905 910 int ret; 906 911 907 - cmd.addr_lo = lower_32_bits(rx_tid->paddr); 908 - cmd.addr_hi = upper_32_bits(rx_tid->paddr); 912 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 913 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 909 914 cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; 910 915 cmd.upd0 = HAL_REO_CMD_UPD0_BA_WINDOW_SIZE; 911 916 cmd.ba_window_size = ba_win_sz; ··· 929 934 return 0; 930 935 } 931 936 937 + static int ath12k_dp_rx_assign_reoq(struct ath12k_base *ab, 938 + struct ath12k_sta *ahsta, 939 + struct ath12k_dp_rx_tid *rx_tid, 940 + u16 ssn, enum hal_pn_type pn_type) 941 + { 942 + u32 ba_win_sz = rx_tid->ba_win_sz; 943 + struct ath12k_reoq_buf *buf; 944 + void *vaddr, *vaddr_aligned; 945 + dma_addr_t paddr_aligned; 946 + u8 tid = rx_tid->tid; 947 + u32 hw_desc_sz; 948 + int ret; 949 + 950 + buf = &ahsta->reoq_bufs[tid]; 951 + if (!buf->vaddr) { 952 + /* TODO: Optimize the memory allocation for qos tid based on 953 + * the actual BA window size in REO tid update path. 954 + */ 955 + if (tid == HAL_DESC_REO_NON_QOS_TID) 956 + hw_desc_sz = ath12k_hal_reo_qdesc_size(ba_win_sz, tid); 957 + else 958 + hw_desc_sz = ath12k_hal_reo_qdesc_size(DP_BA_WIN_SZ_MAX, tid); 959 + 960 + vaddr = kzalloc(hw_desc_sz + HAL_LINK_DESC_ALIGN - 1, GFP_ATOMIC); 961 + if (!vaddr) 962 + return -ENOMEM; 963 + 964 + vaddr_aligned = PTR_ALIGN(vaddr, HAL_LINK_DESC_ALIGN); 965 + 966 + ath12k_hal_reo_qdesc_setup(vaddr_aligned, tid, ba_win_sz, 967 + ssn, pn_type); 968 + 969 + paddr_aligned = dma_map_single(ab->dev, vaddr_aligned, hw_desc_sz, 970 + DMA_BIDIRECTIONAL); 971 + ret = dma_mapping_error(ab->dev, paddr_aligned); 972 + if (ret) { 973 + kfree(vaddr); 974 + return ret; 975 + } 976 + 977 + buf->vaddr = vaddr; 978 + buf->paddr_aligned = paddr_aligned; 979 + buf->size = hw_desc_sz; 980 + } 981 + 982 + rx_tid->qbuf = *buf; 983 + rx_tid->active = true; 984 + 985 + return 0; 986 + } 987 + 932 988 int ath12k_dp_rx_peer_tid_setup(struct ath12k *ar, const u8 *peer_mac, int vdev_id, 933 989 u8 tid, u32 ba_win_sz, u16 ssn, 934 990 enum hal_pn_type pn_type) 935 991 { 936 992 struct ath12k_base *ab = ar->ab; 937 993 struct ath12k_dp *dp = &ab->dp; 938 - struct hal_rx_reo_queue *addr_aligned; 939 994 struct ath12k_peer *peer; 995 + struct ath12k_sta *ahsta; 940 996 struct ath12k_dp_rx_tid *rx_tid; 941 - u32 hw_desc_sz; 942 - void *vaddr; 943 - dma_addr_t paddr; 997 + dma_addr_t paddr_aligned; 944 998 int ret; 945 999 946 1000 spin_lock_bh(&ab->base_lock); ··· 1001 957 return -ENOENT; 1002 958 } 1003 959 1004 - if (!peer->primary_link) { 960 + if (ab->hw_params->dp_primary_link_only && 961 + !peer->primary_link) { 1005 962 spin_unlock_bh(&ab->base_lock); 1006 963 return 0; 1007 964 } ··· 1022 977 } 1023 978 1024 979 rx_tid = &peer->rx_tid[tid]; 980 + paddr_aligned = rx_tid->qbuf.paddr_aligned; 1025 981 /* Update the tid queue if it is already setup */ 1026 982 if (rx_tid->active) { 1027 - paddr = rx_tid->paddr; 1028 983 ret = ath12k_peer_rx_tid_reo_update(ar, peer, rx_tid, 1029 984 ba_win_sz, ssn, true); 1030 985 spin_unlock_bh(&ab->base_lock); ··· 1036 991 if (!ab->hw_params->reoq_lut_support) { 1037 992 ret = ath12k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, 1038 993 peer_mac, 1039 - paddr, tid, 1, 1040 - ba_win_sz); 994 + paddr_aligned, tid, 995 + 1, ba_win_sz); 1041 996 if (ret) { 1042 997 ath12k_warn(ab, "failed to setup peer rx reorder queuefor tid %d: %d\n", 1043 998 tid, ret); ··· 1052 1007 1053 1008 rx_tid->ba_win_sz = ba_win_sz; 1054 1009 1055 - /* TODO: Optimize the memory allocation for qos tid based on 1056 - * the actual BA window size in REO tid update path. 1057 - */ 1058 - if (tid == HAL_DESC_REO_NON_QOS_TID) 1059 - hw_desc_sz = ath12k_hal_reo_qdesc_size(ba_win_sz, tid); 1060 - else 1061 - hw_desc_sz = ath12k_hal_reo_qdesc_size(DP_BA_WIN_SZ_MAX, tid); 1062 - 1063 - vaddr = kzalloc(hw_desc_sz + HAL_LINK_DESC_ALIGN - 1, GFP_ATOMIC); 1064 - if (!vaddr) { 1065 - spin_unlock_bh(&ab->base_lock); 1066 - return -ENOMEM; 1067 - } 1068 - 1069 - addr_aligned = PTR_ALIGN(vaddr, HAL_LINK_DESC_ALIGN); 1070 - 1071 - ath12k_hal_reo_qdesc_setup(addr_aligned, tid, ba_win_sz, 1072 - ssn, pn_type); 1073 - 1074 - paddr = dma_map_single(ab->dev, addr_aligned, hw_desc_sz, 1075 - DMA_BIDIRECTIONAL); 1076 - 1077 - ret = dma_mapping_error(ab->dev, paddr); 1010 + ahsta = ath12k_sta_to_ahsta(peer->sta); 1011 + ret = ath12k_dp_rx_assign_reoq(ab, ahsta, rx_tid, ssn, pn_type); 1078 1012 if (ret) { 1079 1013 spin_unlock_bh(&ab->base_lock); 1080 - goto err_mem_free; 1014 + ath12k_warn(ab, "failed to assign reoq buf for rx tid %u\n", tid); 1015 + return ret; 1081 1016 } 1082 - 1083 - rx_tid->vaddr = vaddr; 1084 - rx_tid->paddr = paddr; 1085 - rx_tid->size = hw_desc_sz; 1086 - rx_tid->active = true; 1087 1017 1088 1018 if (ab->hw_params->reoq_lut_support) { 1089 1019 /* Update the REO queue LUT at the corresponding peer id 1090 1020 * and tid with qaddr. 1091 1021 */ 1092 1022 if (peer->mlo) 1093 - ath12k_peer_rx_tid_qref_setup(ab, peer->ml_id, tid, paddr); 1023 + ath12k_peer_rx_tid_qref_setup(ab, peer->ml_id, tid, 1024 + paddr_aligned); 1094 1025 else 1095 - ath12k_peer_rx_tid_qref_setup(ab, peer->peer_id, tid, paddr); 1026 + ath12k_peer_rx_tid_qref_setup(ab, peer->peer_id, tid, 1027 + paddr_aligned); 1096 1028 1097 1029 spin_unlock_bh(&ab->base_lock); 1098 1030 } else { 1099 1031 spin_unlock_bh(&ab->base_lock); 1100 1032 ret = ath12k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac, 1101 - paddr, tid, 1, ba_win_sz); 1033 + paddr_aligned, tid, 1, 1034 + ba_win_sz); 1102 1035 } 1103 - 1104 - return ret; 1105 - 1106 - err_mem_free: 1107 - kfree(vaddr); 1108 1036 1109 1037 return ret; 1110 1038 } ··· 1214 1196 rx_tid = &peer->rx_tid[tid]; 1215 1197 if (!rx_tid->active) 1216 1198 continue; 1217 - cmd.addr_lo = lower_32_bits(rx_tid->paddr); 1218 - cmd.addr_hi = upper_32_bits(rx_tid->paddr); 1199 + cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned); 1200 + cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 1219 1201 ret = ath12k_dp_reo_cmd_send(ab, rx_tid, 1220 1202 HAL_REO_CMD_UPDATE_RX_QUEUE, 1221 1203 &cmd, NULL); ··· 1841 1823 struct hal_rx_desc *ldesc; 1842 1824 int space_extra, rem_len, buf_len; 1843 1825 u32 hal_rx_desc_sz = ar->ab->hal.hal_desc_sz; 1826 + bool is_continuation; 1844 1827 1845 1828 /* As the msdu is spread across multiple rx buffers, 1846 1829 * find the offset to the start of msdu for computing ··· 1890 1871 rem_len = msdu_len - buf_first_len; 1891 1872 while ((skb = __skb_dequeue(msdu_list)) != NULL && rem_len > 0) { 1892 1873 rxcb = ATH12K_SKB_RXCB(skb); 1893 - if (rxcb->is_continuation) 1874 + is_continuation = rxcb->is_continuation; 1875 + if (is_continuation) 1894 1876 buf_len = DP_RX_BUFFER_SIZE - hal_rx_desc_sz; 1895 1877 else 1896 1878 buf_len = rem_len; ··· 1909 1889 dev_kfree_skb_any(skb); 1910 1890 1911 1891 rem_len -= buf_len; 1912 - if (!rxcb->is_continuation) 1892 + if (!is_continuation) 1913 1893 break; 1914 1894 } 1915 1895 ··· 1934 1914 return NULL; 1935 1915 } 1936 1916 1937 - static void ath12k_dp_rx_h_csum_offload(struct ath12k *ar, struct sk_buff *msdu) 1917 + static void ath12k_dp_rx_h_csum_offload(struct sk_buff *msdu, 1918 + struct ath12k_dp_rx_info *rx_info) 1938 1919 { 1939 - struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 1940 - struct ath12k_base *ab = ar->ab; 1941 - bool ip_csum_fail, l4_csum_fail; 1942 - 1943 - ip_csum_fail = ath12k_dp_rx_h_ip_cksum_fail(ab, rxcb->rx_desc); 1944 - l4_csum_fail = ath12k_dp_rx_h_l4_cksum_fail(ab, rxcb->rx_desc); 1945 - 1946 - msdu->ip_summed = (ip_csum_fail || l4_csum_fail) ? 1947 - CHECKSUM_NONE : CHECKSUM_UNNECESSARY; 1920 + msdu->ip_summed = (rx_info->ip_csum_fail || rx_info->l4_csum_fail) ? 1921 + CHECKSUM_NONE : CHECKSUM_UNNECESSARY; 1948 1922 } 1949 1923 1950 - static int ath12k_dp_rx_crypto_mic_len(struct ath12k *ar, 1951 - enum hal_encrypt_type enctype) 1924 + int ath12k_dp_rx_crypto_mic_len(struct ath12k *ar, enum hal_encrypt_type enctype) 1952 1925 { 1953 1926 switch (enctype) { 1954 1927 case HAL_ENCRYPT_TYPE_OPEN: ··· 2135 2122 struct hal_rx_desc *rx_desc = rxcb->rx_desc; 2136 2123 struct ath12k_base *ab = ar->ab; 2137 2124 size_t hdr_len, crypto_len; 2138 - struct ieee80211_hdr *hdr; 2139 - u16 qos_ctl; 2140 - __le16 fc; 2141 - u8 *crypto_hdr; 2125 + struct ieee80211_hdr hdr; 2126 + __le16 qos_ctl; 2127 + u8 *crypto_hdr, mesh_ctrl; 2128 + 2129 + ath12k_dp_rx_desc_get_dot11_hdr(ab, rx_desc, &hdr); 2130 + hdr_len = ieee80211_hdrlen(hdr.frame_control); 2131 + mesh_ctrl = ath12k_dp_rx_h_mesh_ctl_present(ab, rx_desc); 2142 2132 2143 2133 if (!(status->flag & RX_FLAG_IV_STRIPPED)) { 2144 2134 crypto_len = ath12k_dp_rx_crypto_param_len(ar, enctype); ··· 2149 2133 ath12k_dp_rx_desc_get_crypto_header(ab, rx_desc, crypto_hdr, enctype); 2150 2134 } 2151 2135 2152 - fc = cpu_to_le16(ath12k_dp_rxdesc_get_mpdu_frame_ctrl(ab, rx_desc)); 2153 - hdr_len = ieee80211_hdrlen(fc); 2154 2136 skb_push(msdu, hdr_len); 2155 - hdr = (struct ieee80211_hdr *)msdu->data; 2156 - hdr->frame_control = fc; 2157 - 2158 - /* Get wifi header from rx_desc */ 2159 - ath12k_dp_rx_desc_get_dot11_hdr(ab, rx_desc, hdr); 2137 + memcpy(msdu->data, &hdr, min(hdr_len, sizeof(hdr))); 2160 2138 2161 2139 if (rxcb->is_mcbc) 2162 2140 status->flag &= ~RX_FLAG_PN_VALIDATED; 2163 2141 2164 2142 /* Add QOS header */ 2165 - if (ieee80211_is_data_qos(hdr->frame_control)) { 2166 - qos_ctl = rxcb->tid; 2167 - if (ath12k_dp_rx_h_mesh_ctl_present(ab, rx_desc)) 2168 - qos_ctl |= IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT; 2143 + if (ieee80211_is_data_qos(hdr.frame_control)) { 2144 + struct ieee80211_hdr *qos_ptr = (struct ieee80211_hdr *)msdu->data; 2169 2145 2170 - /* TODO: Add other QoS ctl fields when required */ 2171 - memcpy(msdu->data + (hdr_len - IEEE80211_QOS_CTL_LEN), 2172 - &qos_ctl, IEEE80211_QOS_CTL_LEN); 2146 + qos_ctl = cpu_to_le16(rxcb->tid & IEEE80211_QOS_CTL_TID_MASK); 2147 + if (mesh_ctrl) 2148 + qos_ctl |= cpu_to_le16(IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT); 2149 + 2150 + memcpy(ieee80211_get_qos_ctl(qos_ptr), &qos_ctl, IEEE80211_QOS_CTL_LEN); 2173 2151 } 2174 2152 } 2175 2153 ··· 2239 2229 } 2240 2230 2241 2231 struct ath12k_peer * 2242 - ath12k_dp_rx_h_find_peer(struct ath12k_base *ab, struct sk_buff *msdu) 2232 + ath12k_dp_rx_h_find_peer(struct ath12k_base *ab, struct sk_buff *msdu, 2233 + struct ath12k_dp_rx_info *rx_info) 2243 2234 { 2244 2235 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 2245 - struct hal_rx_desc *rx_desc = rxcb->rx_desc; 2246 2236 struct ath12k_peer *peer = NULL; 2247 2237 2248 2238 lockdep_assert_held(&ab->base_lock); ··· 2253 2243 if (peer) 2254 2244 return peer; 2255 2245 2256 - if (!rx_desc || !(ath12k_dp_rxdesc_mac_addr2_valid(ab, rx_desc))) 2257 - return NULL; 2246 + if (rx_info->addr2_present) 2247 + peer = ath12k_peer_find_by_addr(ab, rx_info->addr2); 2258 2248 2259 - peer = ath12k_peer_find_by_addr(ab, 2260 - ath12k_dp_rxdesc_get_mpdu_start_addr2(ab, 2261 - rx_desc)); 2262 2249 return peer; 2263 2250 } 2264 2251 2265 2252 static void ath12k_dp_rx_h_mpdu(struct ath12k *ar, 2266 2253 struct sk_buff *msdu, 2267 2254 struct hal_rx_desc *rx_desc, 2268 - struct ieee80211_rx_status *rx_status) 2255 + struct ath12k_dp_rx_info *rx_info) 2269 2256 { 2270 - bool fill_crypto_hdr; 2271 2257 struct ath12k_base *ab = ar->ab; 2272 2258 struct ath12k_skb_rxcb *rxcb; 2273 2259 enum hal_encrypt_type enctype; 2274 2260 bool is_decrypted = false; 2275 2261 struct ieee80211_hdr *hdr; 2276 2262 struct ath12k_peer *peer; 2263 + struct ieee80211_rx_status *rx_status = rx_info->rx_status; 2277 2264 u32 err_bitmap; 2278 2265 2279 2266 /* PN for multicast packets will be checked in mac80211 */ 2280 2267 rxcb = ATH12K_SKB_RXCB(msdu); 2281 - fill_crypto_hdr = ath12k_dp_rx_h_is_da_mcbc(ar->ab, rx_desc); 2282 - rxcb->is_mcbc = fill_crypto_hdr; 2268 + rxcb->is_mcbc = rx_info->is_mcbc; 2283 2269 2284 2270 if (rxcb->is_mcbc) 2285 - rxcb->peer_id = ath12k_dp_rx_h_peer_id(ar->ab, rx_desc); 2271 + rxcb->peer_id = rx_info->peer_id; 2286 2272 2287 2273 spin_lock_bh(&ar->ab->base_lock); 2288 - peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu); 2274 + peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu, rx_info); 2289 2275 if (peer) { 2276 + /* resetting mcbc bit because mcbc packets are unicast 2277 + * packets only for AP as STA sends unicast packets. 2278 + */ 2279 + rxcb->is_mcbc = rxcb->is_mcbc && !peer->ucast_ra_only; 2280 + 2290 2281 if (rxcb->is_mcbc) 2291 2282 enctype = peer->sec_type_grp; 2292 2283 else ··· 2316 2305 if (is_decrypted) { 2317 2306 rx_status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_MMIC_STRIPPED; 2318 2307 2319 - if (fill_crypto_hdr) 2308 + if (rx_info->is_mcbc) 2320 2309 rx_status->flag |= RX_FLAG_MIC_STRIPPED | 2321 2310 RX_FLAG_ICV_STRIPPED; 2322 2311 else ··· 2324 2313 RX_FLAG_PN_VALIDATED; 2325 2314 } 2326 2315 2327 - ath12k_dp_rx_h_csum_offload(ar, msdu); 2316 + ath12k_dp_rx_h_csum_offload(msdu, rx_info); 2328 2317 ath12k_dp_rx_h_undecap(ar, msdu, rx_desc, 2329 2318 enctype, rx_status, is_decrypted); 2330 2319 2331 - if (!is_decrypted || fill_crypto_hdr) 2320 + if (!is_decrypted || rx_info->is_mcbc) 2332 2321 return; 2333 2322 2334 - if (ath12k_dp_rx_h_decap_type(ar->ab, rx_desc) != 2335 - DP_RX_DECAP_TYPE_ETHERNET2_DIX) { 2323 + if (rx_info->decap_type != DP_RX_DECAP_TYPE_ETHERNET2_DIX) { 2336 2324 hdr = (void *)msdu->data; 2337 2325 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED); 2338 2326 } 2339 2327 } 2340 2328 2341 - static void ath12k_dp_rx_h_rate(struct ath12k *ar, struct hal_rx_desc *rx_desc, 2342 - struct ieee80211_rx_status *rx_status) 2329 + static void ath12k_dp_rx_h_rate(struct ath12k *ar, struct ath12k_dp_rx_info *rx_info) 2343 2330 { 2344 - struct ath12k_base *ab = ar->ab; 2345 2331 struct ieee80211_supported_band *sband; 2346 - enum rx_msdu_start_pkt_type pkt_type; 2347 - u8 bw; 2348 - u8 rate_mcs, nss; 2349 - u8 sgi; 2332 + struct ieee80211_rx_status *rx_status = rx_info->rx_status; 2333 + enum rx_msdu_start_pkt_type pkt_type = rx_info->pkt_type; 2334 + u8 bw = rx_info->bw, sgi = rx_info->sgi; 2335 + u8 rate_mcs = rx_info->rate_mcs, nss = rx_info->nss; 2350 2336 bool is_cck; 2351 - 2352 - pkt_type = ath12k_dp_rx_h_pkt_type(ab, rx_desc); 2353 - bw = ath12k_dp_rx_h_rx_bw(ab, rx_desc); 2354 - rate_mcs = ath12k_dp_rx_h_rate_mcs(ab, rx_desc); 2355 - nss = ath12k_dp_rx_h_nss(ab, rx_desc); 2356 - sgi = ath12k_dp_rx_h_sgi(ab, rx_desc); 2357 2337 2358 2338 switch (pkt_type) { 2359 2339 case RX_MSDU_START_PKT_TYPE_11A: ··· 2414 2412 } 2415 2413 } 2416 2414 2417 - void ath12k_dp_rx_h_ppdu(struct ath12k *ar, struct hal_rx_desc *rx_desc, 2418 - struct ieee80211_rx_status *rx_status) 2415 + void ath12k_dp_rx_h_fetch_info(struct ath12k_base *ab, struct hal_rx_desc *rx_desc, 2416 + struct ath12k_dp_rx_info *rx_info) 2419 2417 { 2420 - struct ath12k_base *ab = ar->ab; 2418 + rx_info->ip_csum_fail = ath12k_dp_rx_h_ip_cksum_fail(ab, rx_desc); 2419 + rx_info->l4_csum_fail = ath12k_dp_rx_h_l4_cksum_fail(ab, rx_desc); 2420 + rx_info->is_mcbc = ath12k_dp_rx_h_is_da_mcbc(ab, rx_desc); 2421 + rx_info->decap_type = ath12k_dp_rx_h_decap_type(ab, rx_desc); 2422 + rx_info->pkt_type = ath12k_dp_rx_h_pkt_type(ab, rx_desc); 2423 + rx_info->sgi = ath12k_dp_rx_h_sgi(ab, rx_desc); 2424 + rx_info->rate_mcs = ath12k_dp_rx_h_rate_mcs(ab, rx_desc); 2425 + rx_info->bw = ath12k_dp_rx_h_rx_bw(ab, rx_desc); 2426 + rx_info->nss = ath12k_dp_rx_h_nss(ab, rx_desc); 2427 + rx_info->tid = ath12k_dp_rx_h_tid(ab, rx_desc); 2428 + rx_info->peer_id = ath12k_dp_rx_h_peer_id(ab, rx_desc); 2429 + rx_info->phy_meta_data = ath12k_dp_rx_h_freq(ab, rx_desc); 2430 + 2431 + if (ath12k_dp_rxdesc_mac_addr2_valid(ab, rx_desc)) { 2432 + ether_addr_copy(rx_info->addr2, 2433 + ath12k_dp_rxdesc_get_mpdu_start_addr2(ab, rx_desc)); 2434 + rx_info->addr2_present = true; 2435 + } 2436 + 2437 + ath12k_dbg_dump(ab, ATH12K_DBG_DATA, NULL, "rx_desc: ", 2438 + rx_desc, sizeof(*rx_desc)); 2439 + } 2440 + 2441 + void ath12k_dp_rx_h_ppdu(struct ath12k *ar, struct ath12k_dp_rx_info *rx_info) 2442 + { 2443 + struct ieee80211_rx_status *rx_status = rx_info->rx_status; 2421 2444 u8 channel_num; 2422 2445 u32 center_freq, meta_data; 2423 2446 struct ieee80211_channel *channel; ··· 2456 2429 2457 2430 rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; 2458 2431 2459 - meta_data = ath12k_dp_rx_h_freq(ab, rx_desc); 2432 + meta_data = rx_info->phy_meta_data; 2460 2433 channel_num = meta_data; 2461 2434 center_freq = meta_data >> 16; 2462 2435 2463 - if (center_freq >= ATH12K_MIN_6G_FREQ && 2464 - center_freq <= ATH12K_MAX_6G_FREQ) { 2436 + if (center_freq >= ATH12K_MIN_6GHZ_FREQ && 2437 + center_freq <= ATH12K_MAX_6GHZ_FREQ) { 2465 2438 rx_status->band = NL80211_BAND_6GHZ; 2466 2439 rx_status->freq = center_freq; 2467 2440 } else if (channel_num >= 1 && channel_num <= 14) { ··· 2477 2450 ieee80211_frequency_to_channel(channel->center_freq); 2478 2451 } 2479 2452 spin_unlock_bh(&ar->data_lock); 2480 - ath12k_dbg_dump(ar->ab, ATH12K_DBG_DATA, NULL, "rx_desc: ", 2481 - rx_desc, sizeof(*rx_desc)); 2482 2453 } 2483 2454 2484 2455 if (rx_status->band != NL80211_BAND_6GHZ) 2485 2456 rx_status->freq = ieee80211_channel_to_frequency(channel_num, 2486 2457 rx_status->band); 2487 2458 2488 - ath12k_dp_rx_h_rate(ar, rx_desc, rx_status); 2459 + ath12k_dp_rx_h_rate(ar, rx_info); 2489 2460 } 2490 2461 2491 2462 static void ath12k_dp_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napi, 2492 2463 struct sk_buff *msdu, 2493 - struct ieee80211_rx_status *status) 2464 + struct ath12k_dp_rx_info *rx_info) 2494 2465 { 2495 2466 struct ath12k_base *ab = ar->ab; 2496 2467 static const struct ieee80211_radiotap_he known = { ··· 2501 2476 struct ieee80211_sta *pubsta; 2502 2477 struct ath12k_peer *peer; 2503 2478 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 2479 + struct ieee80211_rx_status *status = rx_info->rx_status; 2504 2480 u8 decap = DP_RX_DECAP_TYPE_RAW; 2505 2481 bool is_mcbc = rxcb->is_mcbc; 2506 2482 bool is_eapol = rxcb->is_eapol; ··· 2514 2488 } 2515 2489 2516 2490 if (!(status->flag & RX_FLAG_ONLY_MONITOR)) 2517 - decap = ath12k_dp_rx_h_decap_type(ab, rxcb->rx_desc); 2491 + decap = rx_info->decap_type; 2518 2492 2519 2493 spin_lock_bh(&ab->base_lock); 2520 - peer = ath12k_dp_rx_h_find_peer(ab, msdu); 2494 + peer = ath12k_dp_rx_h_find_peer(ab, msdu, rx_info); 2521 2495 2522 2496 pubsta = peer ? peer->sta : NULL; 2523 2497 ··· 2600 2574 static int ath12k_dp_rx_process_msdu(struct ath12k *ar, 2601 2575 struct sk_buff *msdu, 2602 2576 struct sk_buff_head *msdu_list, 2603 - struct ieee80211_rx_status *rx_status) 2577 + struct ath12k_dp_rx_info *rx_info) 2604 2578 { 2605 2579 struct ath12k_base *ab = ar->ab; 2606 2580 struct hal_rx_desc *rx_desc, *lrx_desc; ··· 2660 2634 goto free_out; 2661 2635 } 2662 2636 2663 - ath12k_dp_rx_h_ppdu(ar, rx_desc, rx_status); 2664 - ath12k_dp_rx_h_mpdu(ar, msdu, rx_desc, rx_status); 2637 + ath12k_dp_rx_h_fetch_info(ab, rx_desc, rx_info); 2638 + ath12k_dp_rx_h_ppdu(ar, rx_info); 2639 + ath12k_dp_rx_h_mpdu(ar, msdu, rx_desc, rx_info); 2665 2640 2666 - rx_status->flag |= RX_FLAG_SKIP_MONITOR | RX_FLAG_DUP_VALIDATED; 2641 + rx_info->rx_status->flag |= RX_FLAG_SKIP_MONITOR | RX_FLAG_DUP_VALIDATED; 2667 2642 2668 2643 return 0; 2669 2644 ··· 2684 2657 struct ath12k *ar; 2685 2658 struct ath12k_hw_link *hw_links = ag->hw_links; 2686 2659 struct ath12k_base *partner_ab; 2660 + struct ath12k_dp_rx_info rx_info; 2687 2661 u8 hw_link_id, pdev_id; 2688 2662 int ret; 2689 2663 2690 2664 if (skb_queue_empty(msdu_list)) 2691 2665 return; 2666 + 2667 + rx_info.addr2_present = false; 2668 + rx_info.rx_status = &rx_status; 2692 2669 2693 2670 rcu_read_lock(); 2694 2671 ··· 2714 2683 continue; 2715 2684 } 2716 2685 2717 - ret = ath12k_dp_rx_process_msdu(ar, msdu, msdu_list, &rx_status); 2686 + ret = ath12k_dp_rx_process_msdu(ar, msdu, msdu_list, &rx_info); 2718 2687 if (ret) { 2719 2688 ath12k_dbg(ab, ATH12K_DBG_DATA, 2720 2689 "Unable to process msdu %d", ret); ··· 2722 2691 continue; 2723 2692 } 2724 2693 2725 - ath12k_dp_rx_deliver_msdu(ar, napi, msdu, &rx_status); 2694 + ath12k_dp_rx_deliver_msdu(ar, napi, msdu, &rx_info); 2726 2695 } 2727 2696 2728 2697 rcu_read_unlock(); ··· 3015 2984 struct ieee80211_rx_status *rxs = IEEE80211_SKB_RXCB(msdu); 3016 2985 struct ieee80211_key_conf *key_conf; 3017 2986 struct ieee80211_hdr *hdr; 2987 + struct ath12k_dp_rx_info rx_info; 3018 2988 u8 mic[IEEE80211_CCMP_MIC_LEN]; 3019 2989 int head_len, tail_len, ret; 3020 2990 size_t data_len; ··· 3025 2993 3026 2994 if (ath12k_dp_rx_h_enctype(ab, rx_desc) != HAL_ENCRYPT_TYPE_TKIP_MIC) 3027 2995 return 0; 2996 + 2997 + rx_info.addr2_present = false; 2998 + rx_info.rx_status = rxs; 3028 2999 3029 3000 hdr = (struct ieee80211_hdr *)(msdu->data + hal_rx_desc_sz); 3030 3001 hdr_len = ieee80211_hdrlen(hdr->frame_control); ··· 3055 3020 (ATH12K_SKB_RXCB(msdu))->is_first_msdu = true; 3056 3021 (ATH12K_SKB_RXCB(msdu))->is_last_msdu = true; 3057 3022 3023 + ath12k_dp_rx_h_fetch_info(ab, rx_desc, &rx_info); 3024 + 3058 3025 rxs->flag |= RX_FLAG_MMIC_ERROR | RX_FLAG_MMIC_STRIPPED | 3059 3026 RX_FLAG_IV_STRIPPED | RX_FLAG_DECRYPTED; 3060 3027 skb_pull(msdu, hal_rx_desc_sz); ··· 3064 3027 if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, rx_desc, msdu))) 3065 3028 return -EINVAL; 3066 3029 3067 - ath12k_dp_rx_h_ppdu(ar, rx_desc, rxs); 3030 + ath12k_dp_rx_h_ppdu(ar, &rx_info); 3068 3031 ath12k_dp_rx_h_undecap(ar, msdu, rx_desc, 3069 3032 HAL_ENCRYPT_TYPE_TKIP_MIC, rxs, true); 3070 3033 ieee80211_rx(ath12k_ar_to_hw(ar), msdu); ··· 3279 3242 reo_ent_ring->rx_mpdu_info.peer_meta_data = 3280 3243 reo_dest_ring->rx_mpdu_info.peer_meta_data; 3281 3244 3282 - reo_ent_ring->queue_addr_lo = cpu_to_le32(lower_32_bits(rx_tid->paddr)); 3283 - queue_addr_hi = upper_32_bits(rx_tid->paddr); 3245 + if (ab->hw_params->reoq_lut_support) { 3246 + reo_ent_ring->queue_addr_lo = reo_dest_ring->rx_mpdu_info.peer_meta_data; 3247 + queue_addr_hi = 0; 3248 + } else { 3249 + reo_ent_ring->queue_addr_lo = 3250 + cpu_to_le32(lower_32_bits(rx_tid->qbuf.paddr_aligned)); 3251 + queue_addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned); 3252 + } 3253 + 3284 3254 reo_ent_ring->info0 = le32_encode_bits(queue_addr_hi, 3285 3255 HAL_REO_ENTR_RING_INFO0_QUEUE_ADDR_HI) | 3286 3256 le32_encode_bits(dst_ind, ··· 3760 3716 } 3761 3717 3762 3718 static int ath12k_dp_rx_h_null_q_desc(struct ath12k *ar, struct sk_buff *msdu, 3763 - struct ieee80211_rx_status *status, 3719 + struct ath12k_dp_rx_info *rx_info, 3764 3720 struct sk_buff_head *msdu_list) 3765 3721 { 3766 3722 struct ath12k_base *ab = ar->ab; ··· 3816 3772 if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, desc, msdu))) 3817 3773 return -EINVAL; 3818 3774 3819 - ath12k_dp_rx_h_ppdu(ar, desc, status); 3775 + ath12k_dp_rx_h_fetch_info(ab, desc, rx_info); 3776 + ath12k_dp_rx_h_ppdu(ar, rx_info); 3777 + ath12k_dp_rx_h_mpdu(ar, msdu, desc, rx_info); 3820 3778 3821 - ath12k_dp_rx_h_mpdu(ar, msdu, desc, status); 3822 - 3823 - rxcb->tid = ath12k_dp_rx_h_tid(ab, desc); 3779 + rxcb->tid = rx_info->tid; 3824 3780 3825 3781 /* Please note that caller will having the access to msdu and completing 3826 3782 * rx with mac80211. Need not worry about cleaning up amsdu_list. ··· 3830 3786 } 3831 3787 3832 3788 static bool ath12k_dp_rx_h_reo_err(struct ath12k *ar, struct sk_buff *msdu, 3833 - struct ieee80211_rx_status *status, 3789 + struct ath12k_dp_rx_info *rx_info, 3834 3790 struct sk_buff_head *msdu_list) 3835 3791 { 3836 3792 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); ··· 3840 3796 3841 3797 switch (rxcb->err_code) { 3842 3798 case HAL_REO_DEST_RING_ERROR_CODE_DESC_ADDR_ZERO: 3843 - if (ath12k_dp_rx_h_null_q_desc(ar, msdu, status, msdu_list)) 3799 + if (ath12k_dp_rx_h_null_q_desc(ar, msdu, rx_info, msdu_list)) 3844 3800 drop = true; 3845 3801 break; 3846 3802 case HAL_REO_DEST_RING_ERROR_CODE_PN_CHECK_FAILED: ··· 3861 3817 } 3862 3818 3863 3819 static bool ath12k_dp_rx_h_tkip_mic_err(struct ath12k *ar, struct sk_buff *msdu, 3864 - struct ieee80211_rx_status *status) 3820 + struct ath12k_dp_rx_info *rx_info) 3865 3821 { 3866 3822 struct ath12k_base *ab = ar->ab; 3867 3823 u16 msdu_len; ··· 3875 3831 3876 3832 l3pad_bytes = ath12k_dp_rx_h_l3pad(ab, desc); 3877 3833 msdu_len = ath12k_dp_rx_h_msdu_len(ab, desc); 3834 + 3835 + if ((hal_rx_desc_sz + l3pad_bytes + msdu_len) > DP_RX_BUFFER_SIZE) { 3836 + ath12k_dbg(ab, ATH12K_DBG_DATA, 3837 + "invalid msdu len in tkip mic err %u\n", msdu_len); 3838 + ath12k_dbg_dump(ab, ATH12K_DBG_DATA, NULL, "", desc, 3839 + sizeof(*desc)); 3840 + return true; 3841 + } 3842 + 3878 3843 skb_put(msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len); 3879 3844 skb_pull(msdu, hal_rx_desc_sz + l3pad_bytes); 3880 3845 3881 3846 if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, desc, msdu))) 3882 3847 return true; 3883 3848 3884 - ath12k_dp_rx_h_ppdu(ar, desc, status); 3849 + ath12k_dp_rx_h_ppdu(ar, rx_info); 3885 3850 3886 - status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR | 3887 - RX_FLAG_DECRYPTED); 3851 + rx_info->rx_status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR | 3852 + RX_FLAG_DECRYPTED); 3888 3853 3889 3854 ath12k_dp_rx_h_undecap(ar, msdu, desc, 3890 - HAL_ENCRYPT_TYPE_TKIP_MIC, status, false); 3855 + HAL_ENCRYPT_TYPE_TKIP_MIC, rx_info->rx_status, false); 3891 3856 return false; 3892 3857 } 3893 3858 3894 3859 static bool ath12k_dp_rx_h_rxdma_err(struct ath12k *ar, struct sk_buff *msdu, 3895 - struct ieee80211_rx_status *status) 3860 + struct ath12k_dp_rx_info *rx_info) 3896 3861 { 3897 3862 struct ath12k_base *ab = ar->ab; 3898 3863 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); ··· 3916 3863 case HAL_REO_ENTR_RING_RXDMA_ECODE_TKIP_MIC_ERR: 3917 3864 err_bitmap = ath12k_dp_rx_h_mpdu_err(ab, rx_desc); 3918 3865 if (err_bitmap & HAL_RX_MPDU_ERR_TKIP_MIC) { 3919 - drop = ath12k_dp_rx_h_tkip_mic_err(ar, msdu, status); 3866 + ath12k_dp_rx_h_fetch_info(ab, rx_desc, rx_info); 3867 + drop = ath12k_dp_rx_h_tkip_mic_err(ar, msdu, rx_info); 3920 3868 break; 3921 3869 } 3922 3870 fallthrough; ··· 3939 3885 { 3940 3886 struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu); 3941 3887 struct ieee80211_rx_status rxs = {0}; 3888 + struct ath12k_dp_rx_info rx_info; 3942 3889 bool drop = true; 3890 + 3891 + rx_info.addr2_present = false; 3892 + rx_info.rx_status = &rxs; 3943 3893 3944 3894 switch (rxcb->err_rel_src) { 3945 3895 case HAL_WBM_REL_SRC_MODULE_REO: 3946 - drop = ath12k_dp_rx_h_reo_err(ar, msdu, &rxs, msdu_list); 3896 + drop = ath12k_dp_rx_h_reo_err(ar, msdu, &rx_info, msdu_list); 3947 3897 break; 3948 3898 case HAL_WBM_REL_SRC_MODULE_RXDMA: 3949 - drop = ath12k_dp_rx_h_rxdma_err(ar, msdu, &rxs); 3899 + drop = ath12k_dp_rx_h_rxdma_err(ar, msdu, &rx_info); 3950 3900 break; 3951 3901 default: 3952 3902 /* msdu will get freed */ ··· 3962 3904 return; 3963 3905 } 3964 3906 3965 - ath12k_dp_rx_deliver_msdu(ar, napi, msdu, &rxs); 3907 + ath12k_dp_rx_deliver_msdu(ar, napi, msdu, &rx_info); 3966 3908 } 3967 3909 3968 3910 int ath12k_dp_rx_process_wbm_err(struct ath12k_base *ab, ··· 4538 4480 4539 4481 pmon->mon_last_linkdesc_paddr = 0; 4540 4482 pmon->mon_last_buf_cookie = DP_RX_DESC_COOKIE_MAX + 1; 4483 + INIT_LIST_HEAD(&pmon->dp_rx_mon_mpdu_list); 4484 + pmon->mon_mpdu = NULL; 4541 4485 spin_lock_init(&pmon->mon_lock); 4542 4486 4543 4487 return 0;
+27 -6
drivers/net/wireless/ath/ath12k/dp_rx.h
··· 14 14 15 15 struct ath12k_dp_rx_tid { 16 16 u8 tid; 17 - u32 *vaddr; 18 - dma_addr_t paddr; 19 - u32 size; 20 17 u32 ba_win_sz; 21 18 bool active; 19 + struct ath12k_reoq_buf qbuf; 22 20 23 21 /* Info related to rx fragments */ 24 22 u32 cur_sn; ··· 62 64 u8 snap_oui[3]; 63 65 __be16 snap_type; 64 66 } __packed; 67 + 68 + struct ath12k_dp_rx_info { 69 + struct ieee80211_rx_status *rx_status; 70 + u32 phy_meta_data; 71 + u16 peer_id; 72 + u8 decap_type; 73 + u8 pkt_type; 74 + u8 sgi; 75 + u8 rate_mcs; 76 + u8 bw; 77 + u8 nss; 78 + u8 addr2[ETH_ALEN]; 79 + u8 tid; 80 + bool ip_csum_fail; 81 + bool l4_csum_fail; 82 + bool is_mcbc; 83 + bool addr2_present; 84 + }; 65 85 66 86 static inline u32 ath12k_he_gi_to_nl80211_he_gi(u8 sgi) 67 87 { ··· 147 131 u8 ath12k_dp_rx_h_l3pad(struct ath12k_base *ab, 148 132 struct hal_rx_desc *desc); 149 133 struct ath12k_peer * 150 - ath12k_dp_rx_h_find_peer(struct ath12k_base *ab, struct sk_buff *msdu); 134 + ath12k_dp_rx_h_find_peer(struct ath12k_base *ab, struct sk_buff *msdu, 135 + struct ath12k_dp_rx_info *rx_info); 151 136 u8 ath12k_dp_rx_h_decap_type(struct ath12k_base *ab, 152 137 struct hal_rx_desc *desc); 153 138 u32 ath12k_dp_rx_h_mpdu_err(struct ath12k_base *ab, 154 139 struct hal_rx_desc *desc); 155 - void ath12k_dp_rx_h_ppdu(struct ath12k *ar, struct hal_rx_desc *rx_desc, 156 - struct ieee80211_rx_status *rx_status); 140 + void ath12k_dp_rx_h_ppdu(struct ath12k *ar, struct ath12k_dp_rx_info *rx_info); 157 141 int ath12k_dp_rxdma_ring_sel_config_qcn9274(struct ath12k_base *ab); 158 142 int ath12k_dp_rxdma_ring_sel_config_wcn7850(struct ath12k_base *ab); 159 143 ··· 161 145 int (*iter)(struct ath12k_base *ar, u16 tag, u16 len, 162 146 const void *ptr, void *data), 163 147 void *data); 148 + void ath12k_dp_rx_h_fetch_info(struct ath12k_base *ab, struct hal_rx_desc *rx_desc, 149 + struct ath12k_dp_rx_info *rx_info); 150 + 151 + int ath12k_dp_rx_crypto_mic_len(struct ath12k *ar, enum hal_encrypt_type enctype); 152 + 164 153 #endif /* ATH12K_DP_RX_H */
+105 -42
drivers/net/wireless/ath/ath12k/dp_tx.c
··· 7 7 #include "core.h" 8 8 #include "dp_tx.h" 9 9 #include "debug.h" 10 + #include "debugfs.h" 10 11 #include "hw.h" 11 12 #include "peer.h" 12 13 #include "mac.h" ··· 84 83 u8 pool_id) 85 84 { 86 85 spin_lock_bh(&dp->tx_desc_lock[pool_id]); 86 + tx_desc->skb_ext_desc = NULL; 87 87 list_move_tail(&tx_desc->list, &dp->tx_desc_free_list[pool_id]); 88 88 spin_unlock_bh(&dp->tx_desc_lock[pool_id]); 89 89 } ··· 221 219 } 222 220 223 221 int ath12k_dp_tx(struct ath12k *ar, struct ath12k_link_vif *arvif, 224 - struct sk_buff *skb, bool gsn_valid, int mcbc_gsn) 222 + struct sk_buff *skb, bool gsn_valid, int mcbc_gsn, 223 + bool is_mcast) 225 224 { 226 225 struct ath12k_base *ab = ar->ab; 227 226 struct ath12k_dp *dp = &ab->dp; ··· 232 229 struct ath12k_skb_cb *skb_cb = ATH12K_SKB_CB(skb); 233 230 struct hal_tcl_data_cmd *hal_tcl_desc; 234 231 struct hal_tx_msdu_ext_desc *msg; 235 - struct sk_buff *skb_ext_desc; 232 + struct sk_buff *skb_ext_desc = NULL; 236 233 struct hal_srng *tcl_ring; 237 234 struct ieee80211_hdr *hdr = (void *)skb->data; 238 235 struct ath12k_vif *ahvif = arvif->ahvif; ··· 418 415 if (ret < 0) { 419 416 ath12k_dbg(ab, ATH12K_DBG_DP_TX, 420 417 "Failed to add HTT meta data, dropping packet\n"); 421 - kfree_skb(skb_ext_desc); 422 - goto fail_unmap_dma; 418 + goto fail_free_ext_skb; 423 419 } 424 420 } 425 421 426 422 ti.paddr = dma_map_single(ab->dev, skb_ext_desc->data, 427 423 skb_ext_desc->len, DMA_TO_DEVICE); 428 424 ret = dma_mapping_error(ab->dev, ti.paddr); 429 - if (ret) { 430 - kfree_skb(skb_ext_desc); 431 - goto fail_unmap_dma; 432 - } 425 + if (ret) 426 + goto fail_free_ext_skb; 433 427 434 428 ti.data_len = skb_ext_desc->len; 435 429 ti.type = HAL_TCL_DESC_TYPE_EXT_DESC; 436 430 437 431 skb_cb->paddr_ext_desc = ti.paddr; 432 + tx_desc->skb_ext_desc = skb_ext_desc; 438 433 } 439 434 440 435 hal_ring_id = tx_ring->tcl_data_ring.ring_id; ··· 463 462 ring_selector++; 464 463 } 465 464 466 - goto fail_unmap_dma; 465 + goto fail_unmap_dma_ext; 467 466 } 467 + 468 + spin_lock_bh(&arvif->link_stats_lock); 469 + arvif->link_stats.tx_encap_type[ti.encap_type]++; 470 + arvif->link_stats.tx_encrypt_type[ti.encrypt_type]++; 471 + arvif->link_stats.tx_desc_type[ti.type]++; 472 + 473 + if (is_mcast) 474 + arvif->link_stats.tx_bcast_mcast++; 475 + else 476 + arvif->link_stats.tx_enqueued++; 477 + spin_unlock_bh(&arvif->link_stats_lock); 468 478 469 479 ath12k_hal_tx_cmd_desc_setup(ab, hal_tcl_desc, &ti); 470 480 ··· 490 478 491 479 return 0; 492 480 481 + fail_unmap_dma_ext: 482 + if (skb_cb->paddr_ext_desc) 483 + dma_unmap_single(ab->dev, skb_cb->paddr_ext_desc, 484 + skb_ext_desc->len, 485 + DMA_TO_DEVICE); 486 + fail_free_ext_skb: 487 + kfree_skb(skb_ext_desc); 488 + 493 489 fail_unmap_dma: 494 490 dma_unmap_single(ab->dev, ti.paddr, ti.data_len, DMA_TO_DEVICE); 495 491 496 - if (skb_cb->paddr_ext_desc) 497 - dma_unmap_single(ab->dev, skb_cb->paddr_ext_desc, 498 - sizeof(struct hal_tx_msdu_ext_desc), 499 - DMA_TO_DEVICE); 500 - 501 492 fail_remove_tx_buf: 502 493 ath12k_dp_tx_release_txbuf(dp, tx_desc, pool_id); 494 + 495 + spin_lock_bh(&arvif->link_stats_lock); 496 + arvif->link_stats.tx_dropped++; 497 + spin_unlock_bh(&arvif->link_stats_lock); 498 + 503 499 if (tcl_ring_retry) 504 500 goto tcl_ring_sel; 505 501 ··· 515 495 } 516 496 517 497 static void ath12k_dp_tx_free_txbuf(struct ath12k_base *ab, 518 - struct sk_buff *msdu, u8 mac_id, 519 - struct dp_tx_ring *tx_ring) 498 + struct dp_tx_ring *tx_ring, 499 + struct ath12k_tx_desc_params *desc_params) 520 500 { 521 501 struct ath12k *ar; 502 + struct sk_buff *msdu = desc_params->skb; 522 503 struct ath12k_skb_cb *skb_cb; 523 - u8 pdev_id = ath12k_hw_mac_id_to_pdev_id(ab->hw_params, mac_id); 504 + u8 pdev_id = ath12k_hw_mac_id_to_pdev_id(ab->hw_params, desc_params->mac_id); 524 505 525 506 skb_cb = ATH12K_SKB_CB(msdu); 526 507 ar = ab->pdevs[pdev_id].ar; 527 508 528 509 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); 529 - if (skb_cb->paddr_ext_desc) 510 + if (skb_cb->paddr_ext_desc) { 530 511 dma_unmap_single(ab->dev, skb_cb->paddr_ext_desc, 531 - sizeof(struct hal_tx_msdu_ext_desc), DMA_TO_DEVICE); 512 + desc_params->skb_ext_desc->len, DMA_TO_DEVICE); 513 + dev_kfree_skb_any(desc_params->skb_ext_desc); 514 + } 532 515 533 516 ieee80211_free_txskb(ar->ah->hw, msdu); 534 517 ··· 541 518 542 519 static void 543 520 ath12k_dp_tx_htt_tx_complete_buf(struct ath12k_base *ab, 544 - struct sk_buff *msdu, 521 + struct ath12k_tx_desc_params *desc_params, 545 522 struct dp_tx_ring *tx_ring, 546 523 struct ath12k_dp_htt_wbm_tx_status *ts) 547 524 { 548 525 struct ieee80211_tx_info *info; 526 + struct ath12k_link_vif *arvif; 549 527 struct ath12k_skb_cb *skb_cb; 528 + struct ieee80211_vif *vif; 529 + struct ath12k_vif *ahvif; 550 530 struct ath12k *ar; 531 + struct sk_buff *msdu = desc_params->skb; 551 532 552 533 skb_cb = ATH12K_SKB_CB(msdu); 553 534 info = IEEE80211_SKB_CB(msdu); ··· 562 535 wake_up(&ar->dp.tx_empty_waitq); 563 536 564 537 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); 565 - if (skb_cb->paddr_ext_desc) 538 + if (skb_cb->paddr_ext_desc) { 566 539 dma_unmap_single(ab->dev, skb_cb->paddr_ext_desc, 567 - sizeof(struct hal_tx_msdu_ext_desc), DMA_TO_DEVICE); 540 + desc_params->skb_ext_desc->len, DMA_TO_DEVICE); 541 + dev_kfree_skb_any(desc_params->skb_ext_desc); 542 + } 543 + 544 + vif = skb_cb->vif; 545 + if (vif) { 546 + ahvif = ath12k_vif_to_ahvif(vif); 547 + rcu_read_lock(); 548 + arvif = rcu_dereference(ahvif->link[skb_cb->link_id]); 549 + if (arvif) { 550 + spin_lock_bh(&arvif->link_stats_lock); 551 + arvif->link_stats.tx_completed++; 552 + spin_unlock_bh(&arvif->link_stats_lock); 553 + } 554 + rcu_read_unlock(); 555 + } 568 556 569 557 memset(&info->status, 0, sizeof(info->status)); 570 558 ··· 602 560 } 603 561 604 562 static void 605 - ath12k_dp_tx_process_htt_tx_complete(struct ath12k_base *ab, 606 - void *desc, u8 mac_id, 607 - struct sk_buff *msdu, 608 - struct dp_tx_ring *tx_ring) 563 + ath12k_dp_tx_process_htt_tx_complete(struct ath12k_base *ab, void *desc, 564 + struct dp_tx_ring *tx_ring, 565 + struct ath12k_tx_desc_params *desc_params) 609 566 { 610 567 struct htt_tx_wbm_completion *status_desc; 611 568 struct ath12k_dp_htt_wbm_tx_status ts = {0}; ··· 620 579 ts.acked = (wbm_status == HAL_WBM_REL_HTT_TX_COMP_STATUS_OK); 621 580 ts.ack_rssi = le32_get_bits(status_desc->info2, 622 581 HTT_TX_WBM_COMP_INFO2_ACK_RSSI); 623 - ath12k_dp_tx_htt_tx_complete_buf(ab, msdu, tx_ring, &ts); 582 + ath12k_dp_tx_htt_tx_complete_buf(ab, desc_params, tx_ring, &ts); 624 583 break; 625 584 case HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP: 626 585 case HAL_WBM_REL_HTT_TX_COMP_STATUS_TTL: 627 586 case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ: 628 587 case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT: 629 - ath12k_dp_tx_free_txbuf(ab, msdu, mac_id, tx_ring); 588 + case HAL_WBM_REL_HTT_TX_COMP_STATUS_VDEVID_MISMATCH: 589 + ath12k_dp_tx_free_txbuf(ab, tx_ring, desc_params); 630 590 break; 631 591 case HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY: 632 592 /* This event is to be handled only when the driver decides to ··· 635 593 */ 636 594 break; 637 595 default: 638 - ath12k_warn(ab, "Unknown htt tx status %d\n", wbm_status); 596 + ath12k_warn(ab, "Unknown htt wbm tx status %d\n", wbm_status); 639 597 break; 640 598 } 641 599 } ··· 759 717 } 760 718 761 719 static void ath12k_dp_tx_complete_msdu(struct ath12k *ar, 762 - struct sk_buff *msdu, 720 + struct ath12k_tx_desc_params *desc_params, 763 721 struct hal_tx_status *ts) 764 722 { 765 723 struct ath12k_base *ab = ar->ab; 766 724 struct ath12k_hw *ah = ar->ah; 767 725 struct ieee80211_tx_info *info; 726 + struct ath12k_link_vif *arvif; 768 727 struct ath12k_skb_cb *skb_cb; 728 + struct ieee80211_vif *vif; 729 + struct ath12k_vif *ahvif; 730 + struct sk_buff *msdu = desc_params->skb; 769 731 770 732 if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) { 771 733 /* Must not happen */ ··· 779 733 skb_cb = ATH12K_SKB_CB(msdu); 780 734 781 735 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); 782 - if (skb_cb->paddr_ext_desc) 736 + if (skb_cb->paddr_ext_desc) { 783 737 dma_unmap_single(ab->dev, skb_cb->paddr_ext_desc, 784 - sizeof(struct hal_tx_msdu_ext_desc), DMA_TO_DEVICE); 738 + desc_params->skb_ext_desc->len, DMA_TO_DEVICE); 739 + dev_kfree_skb_any(desc_params->skb_ext_desc); 740 + } 785 741 786 742 rcu_read_lock(); 787 743 ··· 795 747 if (!skb_cb->vif) { 796 748 ieee80211_free_txskb(ah->hw, msdu); 797 749 goto exit; 750 + } 751 + 752 + vif = skb_cb->vif; 753 + if (vif) { 754 + ahvif = ath12k_vif_to_ahvif(vif); 755 + arvif = rcu_dereference(ahvif->link[skb_cb->link_id]); 756 + if (arvif) { 757 + spin_lock_bh(&arvif->link_stats_lock); 758 + arvif->link_stats.tx_completed++; 759 + spin_unlock_bh(&arvif->link_stats_lock); 760 + } 798 761 } 799 762 800 763 info = IEEE80211_SKB_CB(msdu); ··· 901 842 int hal_ring_id = dp->tx_ring[ring_id].tcl_comp_ring.ring_id; 902 843 struct hal_srng *status_ring = &ab->hal.srng_list[hal_ring_id]; 903 844 struct ath12k_tx_desc_info *tx_desc = NULL; 904 - struct sk_buff *msdu; 905 845 struct hal_tx_status ts = { 0 }; 846 + struct ath12k_tx_desc_params desc_params; 906 847 struct dp_tx_ring *tx_ring = &dp->tx_ring[ring_id]; 907 848 struct hal_wbm_release_ring *desc; 908 - u8 mac_id, pdev_id; 849 + u8 pdev_id; 909 850 u64 desc_va; 910 851 911 852 spin_lock_bh(&status_ring->lock); ··· 959 900 continue; 960 901 } 961 902 962 - msdu = tx_desc->skb; 963 - mac_id = tx_desc->mac_id; 903 + desc_params.mac_id = tx_desc->mac_id; 904 + desc_params.skb = tx_desc->skb; 905 + desc_params.skb_ext_desc = tx_desc->skb_ext_desc; 964 906 965 907 /* Release descriptor as soon as extracting necessary info 966 908 * to reduce contention 967 909 */ 968 910 ath12k_dp_tx_release_txbuf(dp, tx_desc, tx_desc->pool_id); 969 911 if (ts.buf_rel_source == HAL_WBM_REL_SRC_MODULE_FW) { 970 - ath12k_dp_tx_process_htt_tx_complete(ab, 971 - (void *)tx_status, 972 - mac_id, msdu, 973 - tx_ring); 912 + ath12k_dp_tx_process_htt_tx_complete(ab, (void *)tx_status, 913 + tx_ring, &desc_params); 974 914 continue; 975 915 } 976 916 977 - pdev_id = ath12k_hw_mac_id_to_pdev_id(ab->hw_params, mac_id); 917 + pdev_id = ath12k_hw_mac_id_to_pdev_id(ab->hw_params, desc_params.mac_id); 978 918 ar = ab->pdevs[pdev_id].ar; 979 919 980 920 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) 981 921 wake_up(&ar->dp.tx_empty_waitq); 982 922 983 - ath12k_dp_tx_complete_msdu(ar, msdu, &ts); 923 + ath12k_dp_tx_complete_msdu(ar, &desc_params, &ts); 984 924 } 985 925 } 986 926 ··· 1489 1431 HTT_RX_MON_MO_CTRL_FILTER_FLASG3 | 1490 1432 HTT_RX_MON_FP_DATA_FILTER_FLASG3 | 1491 1433 HTT_RX_MON_MO_DATA_FILTER_FLASG3; 1434 + } else { 1435 + tlv_filter = ath12k_mac_mon_status_filter_default; 1436 + 1437 + if (ath12k_debugfs_is_extd_rx_stats_enabled(ar)) 1438 + tlv_filter.rx_filter = ath12k_debugfs_rx_filter(ar); 1492 1439 } 1493 1440 1494 1441 if (ab->hw_params->rxdma1_enable) {
+2 -1
drivers/net/wireless/ath/ath12k/dp_tx.h
··· 17 17 18 18 int ath12k_dp_tx_htt_h2t_ver_req_msg(struct ath12k_base *ab); 19 19 int ath12k_dp_tx(struct ath12k *ar, struct ath12k_link_vif *arvif, 20 - struct sk_buff *skb, bool gsn_valid, int mcbc_gsn); 20 + struct sk_buff *skb, bool gsn_valid, int mcbc_gsn, 21 + bool is_mcast); 21 22 void ath12k_dp_tx_completion_handler(struct ath12k_base *ab, int ring_id); 22 23 23 24 int ath12k_dp_tx_htt_h2t_ppdu_stats_req(struct ath12k *ar, u32 mask);
+8 -1
drivers/net/wireless/ath/ath12k/fw.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 2 /* 3 - * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. 4 4 */ 5 5 6 6 #include "core.h" ··· 99 99 __set_bit(i, ab->fw.fw_features); 100 100 } 101 101 102 + ab->fw.fw_features_valid = true; 103 + 102 104 ath12k_dbg_dump(ab, ATH12K_DBG_BOOT, "features", "", 103 105 ab->fw.fw_features, 104 106 sizeof(ab->fw.fw_features)); ··· 170 168 { 171 169 release_firmware(ab->fw.fw); 172 170 memset(&ab->fw, 0, sizeof(ab->fw)); 171 + } 172 + 173 + bool ath12k_fw_feature_supported(struct ath12k_base *ab, enum ath12k_fw_features feat) 174 + { 175 + return ab->fw.fw_features_valid && test_bit(feat, ab->fw.fw_features); 173 176 }
+2 -1
drivers/net/wireless/ath/ath12k/fw.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 - * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. 4 4 */ 5 5 6 6 #ifndef ATH12K_FW_H ··· 32 32 33 33 void ath12k_fw_map(struct ath12k_base *ab); 34 34 void ath12k_fw_unmap(struct ath12k_base *ab); 35 + bool ath12k_fw_feature_supported(struct ath12k_base *ab, enum ath12k_fw_features feat); 35 36 36 37 #endif /* ATH12K_FW_H */
+46 -65
drivers/net/wireless/ath/ath12k/hal.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 #include <linux/dma-mapping.h> 7 7 #include "hal_tx.h" ··· 449 449 450 450 static bool ath12k_hw_qcn9274_rx_desc_is_da_mcbc(struct hal_rx_desc *desc) 451 451 { 452 - return __le32_to_cpu(desc->u.qcn9274.mpdu_start.info6) & 453 - RX_MPDU_START_INFO6_MCAST_BCAST; 452 + return __le16_to_cpu(desc->u.qcn9274.msdu_end.info5) & 453 + RX_MSDU_END_INFO5_DA_IS_MCBC; 454 454 } 455 455 456 456 static void ath12k_hw_qcn9274_rx_desc_get_dot11_hdr(struct hal_rx_desc *desc, ··· 511 511 crypto_hdr[7] = HAL_RX_MPDU_INFO_PN_GET_BYTE2(desc->u.qcn9274.mpdu_start.pn[1]); 512 512 } 513 513 514 - static u16 ath12k_hw_qcn9274_rx_desc_get_mpdu_frame_ctl(struct hal_rx_desc *desc) 515 - { 516 - return __le16_to_cpu(desc->u.qcn9274.mpdu_start.frame_ctrl); 517 - } 518 - 519 514 static int ath12k_hal_srng_create_config_qcn9274(struct ath12k_base *ab) 520 515 { 521 516 struct ath12k_hal *hal = &ab->hal; ··· 547 552 s->reg_start[1] = HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO_STATUS_HP; 548 553 549 554 s = &hal->srng_config[HAL_TCL_DATA]; 550 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB; 555 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB(ab); 551 556 s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_HP; 552 - s->reg_size[0] = HAL_TCL2_RING_BASE_LSB - HAL_TCL1_RING_BASE_LSB; 557 + s->reg_size[0] = HAL_TCL2_RING_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB(ab); 553 558 s->reg_size[1] = HAL_TCL2_RING_HP - HAL_TCL1_RING_HP; 554 559 555 560 s = &hal->srng_config[HAL_TCL_CMD]; ··· 561 566 s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL_STATUS_RING_HP; 562 567 563 568 s = &hal->srng_config[HAL_CE_SRC]; 564 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_BASE_LSB; 565 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_HP; 566 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - 567 - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; 568 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - 569 - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; 569 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB; 570 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP; 571 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - 572 + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); 573 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - 574 + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); 570 575 571 576 s = &hal->srng_config[HAL_CE_DST]; 572 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_BASE_LSB; 573 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_HP; 574 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 575 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 576 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 577 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 577 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB; 578 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP; 579 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 580 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 581 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 582 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 578 583 579 584 s = &hal->srng_config[HAL_CE_DST_STATUS]; 580 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + 585 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + 581 586 HAL_CE_DST_STATUS_RING_BASE_LSB; 582 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_STATUS_RING_HP; 583 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 584 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 585 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 586 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 587 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP; 588 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 589 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 590 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 591 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 587 592 588 593 s = &hal->srng_config[HAL_WBM_IDLE_LINK]; 589 594 s->reg_start[0] = HAL_SEQ_WCSS_UMAC_WBM_REG + HAL_WBM_IDLE_LINK_RING_BASE_LSB(ab); ··· 731 736 .rx_desc_is_da_mcbc = ath12k_hw_qcn9274_rx_desc_is_da_mcbc, 732 737 .rx_desc_get_dot11_hdr = ath12k_hw_qcn9274_rx_desc_get_dot11_hdr, 733 738 .rx_desc_get_crypto_header = ath12k_hw_qcn9274_rx_desc_get_crypto_hdr, 734 - .rx_desc_get_mpdu_frame_ctl = ath12k_hw_qcn9274_rx_desc_get_mpdu_frame_ctl, 735 739 .dp_rx_h_msdu_done = ath12k_hw_qcn9274_dp_rx_h_msdu_done, 736 740 .dp_rx_h_l4_cksum_fail = ath12k_hw_qcn9274_dp_rx_h_l4_cksum_fail, 737 741 .dp_rx_h_ip_cksum_fail = ath12k_hw_qcn9274_dp_rx_h_ip_cksum_fail, ··· 902 908 903 909 static bool ath12k_hw_qcn9274_compact_rx_desc_is_da_mcbc(struct hal_rx_desc *desc) 904 910 { 905 - return __le32_to_cpu(desc->u.qcn9274_compact.mpdu_start.info6) & 906 - RX_MPDU_START_INFO6_MCAST_BCAST; 911 + return __le16_to_cpu(desc->u.qcn9274_compact.msdu_end.info5) & 912 + RX_MSDU_END_INFO5_DA_IS_MCBC; 907 913 } 908 914 909 915 static void ath12k_hw_qcn9274_compact_rx_desc_get_dot11_hdr(struct hal_rx_desc *desc, ··· 967 973 HAL_RX_MPDU_INFO_PN_GET_BYTE1(desc->u.qcn9274_compact.mpdu_start.pn[1]); 968 974 crypto_hdr[7] = 969 975 HAL_RX_MPDU_INFO_PN_GET_BYTE2(desc->u.qcn9274_compact.mpdu_start.pn[1]); 970 - } 971 - 972 - static u16 ath12k_hw_qcn9274_compact_rx_desc_get_mpdu_frame_ctl(struct hal_rx_desc *desc) 973 - { 974 - return __le16_to_cpu(desc->u.qcn9274_compact.mpdu_start.frame_ctrl); 975 976 } 976 977 977 978 static bool ath12k_hw_qcn9274_compact_dp_rx_h_msdu_done(struct hal_rx_desc *desc) ··· 1069 1080 .rx_desc_is_da_mcbc = ath12k_hw_qcn9274_compact_rx_desc_is_da_mcbc, 1070 1081 .rx_desc_get_dot11_hdr = ath12k_hw_qcn9274_compact_rx_desc_get_dot11_hdr, 1071 1082 .rx_desc_get_crypto_header = ath12k_hw_qcn9274_compact_rx_desc_get_crypto_hdr, 1072 - .rx_desc_get_mpdu_frame_ctl = 1073 - ath12k_hw_qcn9274_compact_rx_desc_get_mpdu_frame_ctl, 1074 1083 .dp_rx_h_msdu_done = ath12k_hw_qcn9274_compact_dp_rx_h_msdu_done, 1075 1084 .dp_rx_h_l4_cksum_fail = ath12k_hw_qcn9274_compact_dp_rx_h_l4_cksum_fail, 1076 1085 .dp_rx_h_ip_cksum_fail = ath12k_hw_qcn9274_compact_dp_rx_h_ip_cksum_fail, ··· 1317 1330 crypto_hdr[7] = HAL_RX_MPDU_INFO_PN_GET_BYTE2(desc->u.wcn7850.mpdu_start.pn[1]); 1318 1331 } 1319 1332 1320 - static u16 ath12k_hw_wcn7850_rx_desc_get_mpdu_frame_ctl(struct hal_rx_desc *desc) 1321 - { 1322 - return __le16_to_cpu(desc->u.wcn7850.mpdu_start.frame_ctrl); 1323 - } 1324 - 1325 1333 static int ath12k_hal_srng_create_config_wcn7850(struct ath12k_base *ab) 1326 1334 { 1327 1335 struct ath12k_hal *hal = &ab->hal; ··· 1353 1371 1354 1372 s = &hal->srng_config[HAL_TCL_DATA]; 1355 1373 s->max_rings = 5; 1356 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB; 1374 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB(ab); 1357 1375 s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_HP; 1358 - s->reg_size[0] = HAL_TCL2_RING_BASE_LSB - HAL_TCL1_RING_BASE_LSB; 1376 + s->reg_size[0] = HAL_TCL2_RING_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB(ab); 1359 1377 s->reg_size[1] = HAL_TCL2_RING_HP - HAL_TCL1_RING_HP; 1360 1378 1361 1379 s = &hal->srng_config[HAL_TCL_CMD]; ··· 1368 1386 1369 1387 s = &hal->srng_config[HAL_CE_SRC]; 1370 1388 s->max_rings = 12; 1371 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_BASE_LSB; 1372 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_HP; 1373 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - 1374 - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; 1375 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - 1376 - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; 1389 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB; 1390 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP; 1391 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - 1392 + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); 1393 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - 1394 + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); 1377 1395 1378 1396 s = &hal->srng_config[HAL_CE_DST]; 1379 1397 s->max_rings = 12; 1380 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_BASE_LSB; 1381 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_HP; 1382 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 1383 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 1384 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 1385 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 1398 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB; 1399 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP; 1400 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 1401 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 1402 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 1403 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 1386 1404 1387 1405 s = &hal->srng_config[HAL_CE_DST_STATUS]; 1388 1406 s->max_rings = 12; 1389 - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + 1407 + s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + 1390 1408 HAL_CE_DST_STATUS_RING_BASE_LSB; 1391 - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_STATUS_RING_HP; 1392 - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 1393 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 1394 - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG - 1395 - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; 1409 + s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP; 1410 + s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 1411 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 1412 + s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - 1413 + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); 1396 1414 1397 1415 s = &hal->srng_config[HAL_WBM_IDLE_LINK]; 1398 1416 s->reg_start[0] = HAL_SEQ_WCSS_UMAC_WBM_REG + HAL_WBM_IDLE_LINK_RING_BASE_LSB(ab); ··· 1537 1555 .rx_desc_is_da_mcbc = ath12k_hw_wcn7850_rx_desc_is_da_mcbc, 1538 1556 .rx_desc_get_dot11_hdr = ath12k_hw_wcn7850_rx_desc_get_dot11_hdr, 1539 1557 .rx_desc_get_crypto_header = ath12k_hw_wcn7850_rx_desc_get_crypto_hdr, 1540 - .rx_desc_get_mpdu_frame_ctl = ath12k_hw_wcn7850_rx_desc_get_mpdu_frame_ctl, 1541 1558 .dp_rx_h_msdu_done = ath12k_hw_wcn7850_dp_rx_h_msdu_done, 1542 1559 .dp_rx_h_l4_cksum_fail = ath12k_hw_wcn7850_dp_rx_h_l4_cksum_fail, 1543 1560 .dp_rx_h_ip_cksum_fail = ath12k_hw_wcn7850_dp_rx_h_ip_cksum_fail, ··· 1737 1756 HAL_TCL1_RING_BASE_MSB_RING_BASE_ADDR_MSB) | 1738 1757 u32_encode_bits((srng->entry_size * srng->num_entries), 1739 1758 HAL_TCL1_RING_BASE_MSB_RING_SIZE); 1740 - ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_BASE_MSB_OFFSET, val); 1759 + ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_BASE_MSB_OFFSET(ab), val); 1741 1760 1742 1761 val = u32_encode_bits(srng->entry_size, HAL_REO1_RING_ID_ENTRY_SIZE); 1743 1762 ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_ID_OFFSET(ab), val);
+47 -29
drivers/net/wireless/ath/ath12k/hal.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_HAL_H ··· 11 11 #include "rx_desc.h" 12 12 13 13 struct ath12k_base; 14 + #define HAL_CE_REMAP_REG_BASE (ab->ce_remap_base_addr) 14 15 15 16 #define HAL_LINK_DESC_SIZE (32 << 2) 16 17 #define HAL_LINK_DESC_ALIGN 128 ··· 22 21 #define HAL_MAX_AVAIL_BLK_RES 3 23 22 24 23 #define HAL_RING_BASE_ALIGN 8 24 + #define HAL_REO_QLUT_ADDR_ALIGN 256 25 25 26 26 #define HAL_WBM_IDLE_SCATTER_BUF_SIZE_MAX 32704 27 27 /* TODO: Check with hw team on the supported scatter buf size */ ··· 41 39 #define HAL_OFFSET_FROM_HP_TO_TP 4 42 40 43 41 #define HAL_SHADOW_REG(x) (HAL_SHADOW_BASE_ADDR + (4 * (x))) 42 + #define HAL_REO_QDESC_MAX_PEERID 8191 44 43 45 44 /* WCSS Relative address */ 45 + #define HAL_SEQ_WCSS_CMEM_OFFSET 0x00100000 46 46 #define HAL_SEQ_WCSS_UMAC_OFFSET 0x00a00000 47 47 #define HAL_SEQ_WCSS_UMAC_REO_REG 0x00a38000 48 48 #define HAL_SEQ_WCSS_UMAC_TCL_REG 0x00a44000 49 - #define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG 0x01b80000 50 - #define HAL_SEQ_WCSS_UMAC_CE0_DST_REG 0x01b81000 51 - #define HAL_SEQ_WCSS_UMAC_CE1_SRC_REG 0x01b82000 52 - #define HAL_SEQ_WCSS_UMAC_CE1_DST_REG 0x01b83000 49 + #define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) \ 50 + ((ab)->hw_params->regs->hal_umac_ce0_src_reg_base) 51 + #define HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) \ 52 + ((ab)->hw_params->regs->hal_umac_ce0_dest_reg_base) 53 + #define HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) \ 54 + ((ab)->hw_params->regs->hal_umac_ce1_src_reg_base) 55 + #define HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) \ 56 + ((ab)->hw_params->regs->hal_umac_ce1_dest_reg_base) 53 57 #define HAL_SEQ_WCSS_UMAC_WBM_REG 0x00a34000 54 58 55 59 #define HAL_CE_WFSS_CE_REG_BASE 0x01b80000 ··· 65 57 /* SW2TCL(x) R0 ring configuration address */ 66 58 #define HAL_TCL1_RING_CMN_CTRL_REG 0x00000020 67 59 #define HAL_TCL1_RING_DSCP_TID_MAP 0x00000240 68 - #define HAL_TCL1_RING_BASE_LSB 0x00000900 69 - #define HAL_TCL1_RING_BASE_MSB 0x00000904 60 + #define HAL_TCL1_RING_BASE_LSB(ab) \ 61 + ((ab)->hw_params->regs->hal_tcl1_ring_base_lsb) 62 + #define HAL_TCL1_RING_BASE_MSB(ab) \ 63 + ((ab)->hw_params->regs->hal_tcl1_ring_base_msb) 70 64 #define HAL_TCL1_RING_ID(ab) ((ab)->hw_params->regs->hal_tcl1_ring_id) 71 65 #define HAL_TCL1_RING_MISC(ab) \ 72 66 ((ab)->hw_params->regs->hal_tcl1_ring_misc) ··· 86 76 ((ab)->hw_params->regs->hal_tcl1_ring_msi1_base_msb) 87 77 #define HAL_TCL1_RING_MSI1_DATA(ab) \ 88 78 ((ab)->hw_params->regs->hal_tcl1_ring_msi1_data) 89 - #define HAL_TCL2_RING_BASE_LSB 0x00000978 79 + #define HAL_TCL2_RING_BASE_LSB(ab) \ 80 + ((ab)->hw_params->regs->hal_tcl2_ring_base_lsb) 90 81 #define HAL_TCL_RING_BASE_LSB(ab) \ 91 82 ((ab)->hw_params->regs->hal_tcl_ring_base_lsb) 92 83 93 - #define HAL_TCL1_RING_MSI1_BASE_LSB_OFFSET(ab) \ 94 - (HAL_TCL1_RING_MSI1_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB) 95 - #define HAL_TCL1_RING_MSI1_BASE_MSB_OFFSET(ab) \ 96 - (HAL_TCL1_RING_MSI1_BASE_MSB(ab) - HAL_TCL1_RING_BASE_LSB) 97 - #define HAL_TCL1_RING_MSI1_DATA_OFFSET(ab) \ 98 - (HAL_TCL1_RING_MSI1_DATA(ab) - HAL_TCL1_RING_BASE_LSB) 99 - #define HAL_TCL1_RING_BASE_MSB_OFFSET \ 100 - (HAL_TCL1_RING_BASE_MSB - HAL_TCL1_RING_BASE_LSB) 101 - #define HAL_TCL1_RING_ID_OFFSET(ab) \ 102 - (HAL_TCL1_RING_ID(ab) - HAL_TCL1_RING_BASE_LSB) 103 - #define HAL_TCL1_RING_CONSR_INT_SETUP_IX0_OFFSET(ab) \ 104 - (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX0(ab) - HAL_TCL1_RING_BASE_LSB) 105 - #define HAL_TCL1_RING_CONSR_INT_SETUP_IX1_OFFSET(ab) \ 106 - (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX1(ab) - HAL_TCL1_RING_BASE_LSB) 107 - #define HAL_TCL1_RING_TP_ADDR_LSB_OFFSET(ab) \ 108 - (HAL_TCL1_RING_TP_ADDR_LSB(ab) - HAL_TCL1_RING_BASE_LSB) 109 - #define HAL_TCL1_RING_TP_ADDR_MSB_OFFSET(ab) \ 110 - (HAL_TCL1_RING_TP_ADDR_MSB(ab) - HAL_TCL1_RING_BASE_LSB) 111 - #define HAL_TCL1_RING_MISC_OFFSET(ab) \ 112 - (HAL_TCL1_RING_MISC(ab) - HAL_TCL1_RING_BASE_LSB) 84 + #define HAL_TCL1_RING_MSI1_BASE_LSB_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 85 + (HAL_TCL1_RING_MSI1_BASE_LSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 86 + #define HAL_TCL1_RING_MSI1_BASE_MSB_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 87 + (HAL_TCL1_RING_MSI1_BASE_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 88 + #define HAL_TCL1_RING_MSI1_DATA_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 89 + (HAL_TCL1_RING_MSI1_DATA(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 90 + #define HAL_TCL1_RING_BASE_MSB_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 91 + (HAL_TCL1_RING_BASE_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 92 + #define HAL_TCL1_RING_ID_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 93 + (HAL_TCL1_RING_ID(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 94 + #define HAL_TCL1_RING_CONSR_INT_SETUP_IX0_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 95 + (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX0(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 96 + #define HAL_TCL1_RING_CONSR_INT_SETUP_IX1_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 97 + (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX1(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 98 + #define HAL_TCL1_RING_TP_ADDR_LSB_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 99 + (HAL_TCL1_RING_TP_ADDR_LSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 100 + #define HAL_TCL1_RING_TP_ADDR_MSB_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 101 + (HAL_TCL1_RING_TP_ADDR_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 102 + #define HAL_TCL1_RING_MISC_OFFSET(ab) ({ typeof(ab) _ab = (ab); \ 103 + (HAL_TCL1_RING_MISC(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) 113 104 114 105 /* SW2TCL(x) R2 ring pointers (head/tail) address */ 115 106 #define HAL_TCL1_RING_HP 0x00002000 ··· 143 132 #define HAL_REO1_DEST_RING_CTRL_IX_1 0x00000008 144 133 #define HAL_REO1_DEST_RING_CTRL_IX_2 0x0000000c 145 134 #define HAL_REO1_DEST_RING_CTRL_IX_3 0x00000010 135 + #define HAL_REO1_QDESC_ADDR(ab) ((ab)->hw_params->regs->hal_reo1_qdesc_addr) 136 + #define HAL_REO1_QDESC_MAX_PEERID(ab) ((ab)->hw_params->regs->hal_reo1_qdesc_max_peerid) 146 137 #define HAL_REO1_SW_COOKIE_CFG0(ab) ((ab)->hw_params->regs->hal_reo1_sw_cookie_cfg0) 147 138 #define HAL_REO1_SW_COOKIE_CFG1(ab) ((ab)->hw_params->regs->hal_reo1_sw_cookie_cfg1) 148 139 #define HAL_REO1_QDESC_LUT_BASE0(ab) ((ab)->hw_params->regs->hal_reo1_qdesc_lut_base0) ··· 332 319 #define HAL_REO1_SW_COOKIE_CFG_ALIGN BIT(18) 333 320 #define HAL_REO1_SW_COOKIE_CFG_ENABLE BIT(19) 334 321 #define HAL_REO1_SW_COOKIE_CFG_GLOBAL_ENABLE BIT(20) 322 + #define HAL_REO_QDESC_ADDR_READ_LUT_ENABLE BIT(7) 323 + #define HAL_REO_QDESC_ADDR_READ_CLEAR_QDESC_ARRAY BIT(6) 335 324 336 325 /* CE ring bit field mask and shift */ 337 326 #define HAL_CE_DST_R0_DEST_CTRL_MAX_LEN GENMASK(15, 0) ··· 379 364 /* Add any other errors here and return them in 380 365 * ath12k_hal_rx_desc_get_err(). 381 366 */ 367 + 368 + #define HAL_IPQ5332_CE_WFSS_REG_BASE 0x740000 369 + #define HAL_IPQ5332_CE_SIZE 0x100000 382 370 383 371 enum hal_srng_ring_id { 384 372 HAL_SRNG_RING_ID_REO2SW0 = 0, ··· 1086 1068 bool (*rx_desc_is_da_mcbc)(struct hal_rx_desc *desc); 1087 1069 void (*rx_desc_get_dot11_hdr)(struct hal_rx_desc *desc, 1088 1070 struct ieee80211_hdr *hdr); 1089 - u16 (*rx_desc_get_mpdu_frame_ctl)(struct hal_rx_desc *desc); 1090 1071 void (*rx_desc_get_crypto_header)(struct hal_rx_desc *desc, 1091 1072 u8 *crypto_hdr, 1092 1073 enum hal_encrypt_type enctype); ··· 1171 1154 void ath12k_hal_srng_shadow_config(struct ath12k_base *ab); 1172 1155 void ath12k_hal_srng_shadow_update_hp_tp(struct ath12k_base *ab, 1173 1156 struct hal_srng *srng); 1157 + void ath12k_hal_reo_shared_qaddr_cache_clear(struct ath12k_base *ab); 1174 1158 #endif
+5 -1
drivers/net/wireless/ath/ath12k/hal_desc.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-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 #include "core.h" 7 7 ··· 1284 1284 HAL_TCL_ENCAP_TYPE_NATIVE_WIFI, 1285 1285 HAL_TCL_ENCAP_TYPE_ETHERNET, 1286 1286 HAL_TCL_ENCAP_TYPE_802_3 = 3, 1287 + HAL_TCL_ENCAP_TYPE_MAX 1287 1288 }; 1288 1289 1289 1290 enum hal_tcl_desc_type { 1290 1291 HAL_TCL_DESC_TYPE_BUFFER, 1291 1292 HAL_TCL_DESC_TYPE_EXT_DESC, 1293 + HAL_TCL_DESC_TYPE_MAX, 1292 1294 }; 1293 1295 1294 1296 enum hal_wbm_htt_tx_comp_status { ··· 1300 1298 HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ, 1301 1299 HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT, 1302 1300 HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY, 1301 + HAL_WBM_REL_HTT_TX_COMP_STATUS_VDEVID_MISMATCH, 1303 1302 HAL_WBM_REL_HTT_TX_COMP_STATUS_MAX, 1304 1303 }; 1305 1304 ··· 2001 1998 #define HAL_WBM_RELEASE_INFO3_CONTINUATION BIT(2) 2002 1999 2003 2000 #define HAL_WBM_RELEASE_INFO5_LOOPING_COUNT GENMASK(31, 28) 2001 + #define HAL_ENCRYPT_TYPE_MAX 12 2004 2002 2005 2003 struct hal_wbm_release_ring { 2006 2004 struct ath12k_buffer_addr buf_addr_info;
+18 -1
drivers/net/wireless/ath/ath12k/hal_rx.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include "debug.h" ··· 850 850 ring_hash_map); 851 851 ath12k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, 852 852 ring_hash_map); 853 + } 854 + 855 + void ath12k_hal_reo_shared_qaddr_cache_clear(struct ath12k_base *ab) 856 + { 857 + u32 val; 858 + 859 + lockdep_assert_held(&ab->base_lock); 860 + val = ath12k_hif_read32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + 861 + HAL_REO1_QDESC_ADDR(ab)); 862 + 863 + val |= u32_encode_bits(1, HAL_REO_QDESC_ADDR_READ_CLEAR_QDESC_ARRAY); 864 + ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + 865 + HAL_REO1_QDESC_ADDR(ab), val); 866 + 867 + val &= ~HAL_REO_QDESC_ADDR_READ_CLEAR_QDESC_ARRAY; 868 + ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + 869 + HAL_REO1_QDESC_ADDR(ab), val); 853 870 }
+14 -1
drivers/net/wireless/ath/ath12k/hal_rx.h
··· 108 108 HAL_RX_MON_STATUS_PPDU_DONE, 109 109 HAL_RX_MON_STATUS_BUF_DONE, 110 110 HAL_RX_MON_STATUS_BUF_ADDR, 111 + HAL_RX_MON_STATUS_MPDU_START, 111 112 HAL_RX_MON_STATUS_MPDU_END, 112 113 HAL_RX_MON_STATUS_MSDU_END, 113 114 }; 114 115 115 - #define HAL_RX_MAX_MPDU 256 116 + #define HAL_RX_MAX_MPDU 1024 116 117 #define HAL_RX_NUM_WORDS_PER_PPDU_BITMAP (HAL_RX_MAX_MPDU >> 5) 117 118 118 119 struct hal_rx_user_status { ··· 505 504 __le32 rsvd1[2]; 506 505 __le32 info2; 507 506 __le32 rsvd2[16]; 507 + } __packed; 508 + 509 + struct hal_rx_msdu_end { 510 + __le32 info0; 511 + __le32 rsvd0[9]; 512 + __le16 info00; 513 + __le16 info01; 514 + __le32 rsvd00[8]; 515 + __le32 info1; 516 + __le32 rsvd1[10]; 517 + __le32 info2; 518 + __le32 rsvd2; 508 519 } __packed; 509 520 510 521 #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0)
+496 -3
drivers/net/wireless/ath/ath12k/hw.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include <linux/types.h> ··· 535 535 }, 536 536 }; 537 537 538 + static const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = { 539 + /* host->target HTC control and raw streams */ 540 + { 541 + .pipenum = __cpu_to_le32(0), 542 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), 543 + .nentries = __cpu_to_le32(32), 544 + .nbytes_max = __cpu_to_le32(2048), 545 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 546 + .reserved = __cpu_to_le32(0), 547 + }, 548 + /* target->host HTT */ 549 + { 550 + .pipenum = __cpu_to_le32(1), 551 + .pipedir = __cpu_to_le32(PIPEDIR_IN), 552 + .nentries = __cpu_to_le32(32), 553 + .nbytes_max = __cpu_to_le32(2048), 554 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 555 + .reserved = __cpu_to_le32(0), 556 + }, 557 + /* target->host WMI + HTC control */ 558 + { 559 + .pipenum = __cpu_to_le32(2), 560 + .pipedir = __cpu_to_le32(PIPEDIR_IN), 561 + .nentries = __cpu_to_le32(32), 562 + .nbytes_max = __cpu_to_le32(2048), 563 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 564 + .reserved = __cpu_to_le32(0), 565 + }, 566 + /* host->target WMI */ 567 + { 568 + .pipenum = __cpu_to_le32(3), 569 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), 570 + .nentries = __cpu_to_le32(32), 571 + .nbytes_max = __cpu_to_le32(2048), 572 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 573 + .reserved = __cpu_to_le32(0), 574 + }, 575 + /* host->target HTT */ 576 + { 577 + .pipenum = __cpu_to_le32(4), 578 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), 579 + .nentries = __cpu_to_le32(256), 580 + .nbytes_max = __cpu_to_le32(256), 581 + .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 582 + .reserved = __cpu_to_le32(0), 583 + }, 584 + /* Target -> host PKTLOG */ 585 + { 586 + .pipenum = __cpu_to_le32(5), 587 + .pipedir = __cpu_to_le32(PIPEDIR_IN), 588 + .nentries = __cpu_to_le32(32), 589 + .nbytes_max = __cpu_to_le32(2048), 590 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 591 + .reserved = __cpu_to_le32(0), 592 + }, 593 + /* Reserved for target autonomous HIF_memcpy */ 594 + { 595 + .pipenum = __cpu_to_le32(6), 596 + .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 597 + .nentries = __cpu_to_le32(32), 598 + .nbytes_max = __cpu_to_le32(16384), 599 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 600 + .reserved = __cpu_to_le32(0), 601 + }, 602 + /* CE7 Reserved for CV Prefetch */ 603 + { 604 + .pipenum = __cpu_to_le32(7), 605 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), 606 + .nentries = __cpu_to_le32(32), 607 + .nbytes_max = __cpu_to_le32(2048), 608 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 609 + .reserved = __cpu_to_le32(0), 610 + }, 611 + /* CE8 Reserved for target generic HIF memcpy */ 612 + { 613 + .pipenum = __cpu_to_le32(8), 614 + .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 615 + .nentries = __cpu_to_le32(32), 616 + .nbytes_max = __cpu_to_le32(16384), 617 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 618 + .reserved = __cpu_to_le32(0), 619 + }, 620 + /* CE9 WMI logging/CFR/Spectral/Radar/ */ 621 + { 622 + .pipenum = __cpu_to_le32(9), 623 + .pipedir = __cpu_to_le32(PIPEDIR_IN), 624 + .nentries = __cpu_to_le32(32), 625 + .nbytes_max = __cpu_to_le32(2048), 626 + .flags = __cpu_to_le32(CE_ATTR_FLAGS), 627 + .reserved = __cpu_to_le32(0), 628 + }, 629 + /* Unused TBD */ 630 + { 631 + .pipenum = __cpu_to_le32(10), 632 + .pipedir = __cpu_to_le32(PIPEDIR_NONE), 633 + .nentries = __cpu_to_le32(0), 634 + .nbytes_max = __cpu_to_le32(0), 635 + .flags = __cpu_to_le32(0), 636 + .reserved = __cpu_to_le32(0), 637 + }, 638 + /* Unused TBD */ 639 + { 640 + .pipenum = __cpu_to_le32(11), 641 + .pipedir = __cpu_to_le32(PIPEDIR_NONE), 642 + .nentries = __cpu_to_le32(0), 643 + .nbytes_max = __cpu_to_le32(0), 644 + .flags = __cpu_to_le32(0), 645 + .reserved = __cpu_to_le32(0), 646 + }, 647 + }; 648 + 649 + static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[] = { 650 + { 651 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO), 652 + __cpu_to_le32(PIPEDIR_OUT), 653 + __cpu_to_le32(3), 654 + }, 655 + { 656 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO), 657 + __cpu_to_le32(PIPEDIR_IN), 658 + __cpu_to_le32(2), 659 + }, 660 + { 661 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK), 662 + __cpu_to_le32(PIPEDIR_OUT), 663 + __cpu_to_le32(3), 664 + }, 665 + { 666 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK), 667 + __cpu_to_le32(PIPEDIR_IN), 668 + __cpu_to_le32(2), 669 + }, 670 + { 671 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE), 672 + __cpu_to_le32(PIPEDIR_OUT), 673 + __cpu_to_le32(3), 674 + }, 675 + { 676 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE), 677 + __cpu_to_le32(PIPEDIR_IN), 678 + __cpu_to_le32(2), 679 + }, 680 + { 681 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI), 682 + __cpu_to_le32(PIPEDIR_OUT), 683 + __cpu_to_le32(3), 684 + }, 685 + { 686 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI), 687 + __cpu_to_le32(PIPEDIR_IN), 688 + __cpu_to_le32(2), 689 + }, 690 + { 691 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL), 692 + __cpu_to_le32(PIPEDIR_OUT), 693 + __cpu_to_le32(3), 694 + }, 695 + { 696 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL), 697 + __cpu_to_le32(PIPEDIR_IN), 698 + __cpu_to_le32(2), 699 + }, 700 + { 701 + __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL), 702 + __cpu_to_le32(PIPEDIR_OUT), 703 + __cpu_to_le32(0), 704 + }, 705 + { 706 + __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL), 707 + __cpu_to_le32(PIPEDIR_IN), 708 + __cpu_to_le32(1), 709 + }, 710 + { 711 + __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS), 712 + __cpu_to_le32(PIPEDIR_OUT), 713 + __cpu_to_le32(0), 714 + }, 715 + { 716 + __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS), 717 + __cpu_to_le32(PIPEDIR_IN), 718 + __cpu_to_le32(1), 719 + }, 720 + { 721 + __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG), 722 + __cpu_to_le32(PIPEDIR_OUT), 723 + __cpu_to_le32(4), 724 + }, 725 + { 726 + __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG), 727 + __cpu_to_le32(PIPEDIR_IN), 728 + __cpu_to_le32(1), 729 + }, 730 + { 731 + __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG), 732 + __cpu_to_le32(PIPEDIR_IN), 733 + __cpu_to_le32(5), 734 + }, 735 + { 736 + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG), 737 + __cpu_to_le32(PIPEDIR_IN), 738 + __cpu_to_le32(9), 739 + }, 740 + /* (Additions here) */ 741 + 742 + { /* must be last */ 743 + __cpu_to_le32(0), 744 + __cpu_to_le32(0), 745 + __cpu_to_le32(0), 746 + }, 747 + }; 748 + 538 749 static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 = { 539 750 .tx = { 540 751 ATH12K_TX_RING_MASK_0, ··· 785 574 }, 786 575 .tx_mon_dest = { 787 576 0, 0, 0, 577 + }, 578 + }; 579 + 580 + static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_ipq5332 = { 581 + .tx = { 582 + ATH12K_TX_RING_MASK_0, 583 + ATH12K_TX_RING_MASK_1, 584 + ATH12K_TX_RING_MASK_2, 585 + ATH12K_TX_RING_MASK_3, 586 + }, 587 + .rx_mon_dest = { 588 + 0, 0, 0, 0, 0, 0, 0, 0, 589 + ATH12K_RX_MON_RING_MASK_0, 590 + }, 591 + .rx = { 592 + 0, 0, 0, 0, 593 + ATH12K_RX_RING_MASK_0, 594 + ATH12K_RX_RING_MASK_1, 595 + ATH12K_RX_RING_MASK_2, 596 + ATH12K_RX_RING_MASK_3, 597 + }, 598 + .rx_err = { 599 + 0, 0, 0, 600 + ATH12K_RX_ERR_RING_MASK_0, 601 + }, 602 + .rx_wbm_rel = { 603 + 0, 0, 0, 604 + ATH12K_RX_WBM_REL_RING_MASK_0, 605 + }, 606 + .reo_status = { 607 + 0, 0, 0, 608 + ATH12K_REO_STATUS_RING_MASK_0, 609 + }, 610 + .host2rxdma = { 611 + 0, 0, 0, 612 + ATH12K_HOST2RXDMA_RING_MASK_0, 613 + }, 614 + .tx_mon_dest = { 615 + ATH12K_TX_MON_RING_MASK_0, 616 + ATH12K_TX_MON_RING_MASK_1, 788 617 }, 789 618 }; 790 619 ··· 870 619 .hal_tcl1_ring_msi1_base_msb = 0x0000094c, 871 620 .hal_tcl1_ring_msi1_data = 0x00000950, 872 621 .hal_tcl_ring_base_lsb = 0x00000b58, 622 + .hal_tcl1_ring_base_lsb = 0x00000900, 623 + .hal_tcl1_ring_base_msb = 0x00000904, 624 + .hal_tcl2_ring_base_lsb = 0x00000978, 873 625 874 626 /* TCL STATUS ring address */ 875 627 .hal_tcl_status_ring_base_lsb = 0x00000d38, ··· 935 681 936 682 /* REO status ring address */ 937 683 .hal_reo_status_ring_base = 0x00000a84, 684 + 685 + /* CE base address */ 686 + .hal_umac_ce0_src_reg_base = 0x01b80000, 687 + .hal_umac_ce0_dest_reg_base = 0x01b81000, 688 + .hal_umac_ce1_src_reg_base = 0x01b82000, 689 + .hal_umac_ce1_dest_reg_base = 0x01b83000, 938 690 }; 939 691 940 692 static const struct ath12k_hw_regs qcn9274_v2_regs = { ··· 955 695 .hal_tcl1_ring_msi1_base_msb = 0x0000094c, 956 696 .hal_tcl1_ring_msi1_data = 0x00000950, 957 697 .hal_tcl_ring_base_lsb = 0x00000b58, 698 + .hal_tcl1_ring_base_lsb = 0x00000900, 699 + .hal_tcl1_ring_base_msb = 0x00000904, 700 + .hal_tcl2_ring_base_lsb = 0x00000978, 958 701 959 702 /* TCL STATUS ring address */ 960 703 .hal_tcl_status_ring_base_lsb = 0x00000d38, ··· 997 734 .hal_reo1_sw_cookie_cfg1 = 0x00000070, 998 735 .hal_reo1_qdesc_lut_base0 = 0x00000074, 999 736 .hal_reo1_qdesc_lut_base1 = 0x00000078, 737 + .hal_reo1_qdesc_addr = 0x0000007c, 738 + .hal_reo1_qdesc_max_peerid = 0x00000088, 1000 739 .hal_reo1_ring_base_lsb = 0x00000500, 1001 740 .hal_reo1_ring_base_msb = 0x00000504, 1002 741 .hal_reo1_ring_id = 0x00000508, ··· 1026 761 1027 762 /* REO status ring address */ 1028 763 .hal_reo_status_ring_base = 0x00000aa0, 764 + 765 + /* CE base address */ 766 + .hal_umac_ce0_src_reg_base = 0x01b80000, 767 + .hal_umac_ce0_dest_reg_base = 0x01b81000, 768 + .hal_umac_ce1_src_reg_base = 0x01b82000, 769 + .hal_umac_ce1_dest_reg_base = 0x01b83000, 770 + }; 771 + 772 + static const struct ath12k_hw_regs ipq5332_regs = { 773 + /* SW2TCL(x) R0 ring configuration address */ 774 + .hal_tcl1_ring_id = 0x00000918, 775 + .hal_tcl1_ring_misc = 0x00000920, 776 + .hal_tcl1_ring_tp_addr_lsb = 0x0000092c, 777 + .hal_tcl1_ring_tp_addr_msb = 0x00000930, 778 + .hal_tcl1_ring_consumer_int_setup_ix0 = 0x00000940, 779 + .hal_tcl1_ring_consumer_int_setup_ix1 = 0x00000944, 780 + .hal_tcl1_ring_msi1_base_lsb = 0x00000958, 781 + .hal_tcl1_ring_msi1_base_msb = 0x0000095c, 782 + .hal_tcl1_ring_base_lsb = 0x00000910, 783 + .hal_tcl1_ring_base_msb = 0x00000914, 784 + .hal_tcl1_ring_msi1_data = 0x00000960, 785 + .hal_tcl2_ring_base_lsb = 0x00000988, 786 + .hal_tcl_ring_base_lsb = 0x00000b68, 787 + 788 + /* TCL STATUS ring address */ 789 + .hal_tcl_status_ring_base_lsb = 0x00000d48, 790 + 791 + /* REO DEST ring address */ 792 + .hal_reo2_ring_base = 0x00000578, 793 + .hal_reo1_misc_ctrl_addr = 0x00000b9c, 794 + .hal_reo1_sw_cookie_cfg0 = 0x0000006c, 795 + .hal_reo1_sw_cookie_cfg1 = 0x00000070, 796 + .hal_reo1_qdesc_lut_base0 = 0x00000074, 797 + .hal_reo1_qdesc_lut_base1 = 0x00000078, 798 + .hal_reo1_ring_base_lsb = 0x00000500, 799 + .hal_reo1_ring_base_msb = 0x00000504, 800 + .hal_reo1_ring_id = 0x00000508, 801 + .hal_reo1_ring_misc = 0x00000510, 802 + .hal_reo1_ring_hp_addr_lsb = 0x00000514, 803 + .hal_reo1_ring_hp_addr_msb = 0x00000518, 804 + .hal_reo1_ring_producer_int_setup = 0x00000524, 805 + .hal_reo1_ring_msi1_base_lsb = 0x00000548, 806 + .hal_reo1_ring_msi1_base_msb = 0x0000054C, 807 + .hal_reo1_ring_msi1_data = 0x00000550, 808 + .hal_reo1_aging_thres_ix0 = 0x00000B28, 809 + .hal_reo1_aging_thres_ix1 = 0x00000B2C, 810 + .hal_reo1_aging_thres_ix2 = 0x00000B30, 811 + .hal_reo1_aging_thres_ix3 = 0x00000B34, 812 + 813 + /* REO Exception ring address */ 814 + .hal_reo2_sw0_ring_base = 0x000008c0, 815 + 816 + /* REO Reinject ring address */ 817 + .hal_sw2reo_ring_base = 0x00000320, 818 + .hal_sw2reo1_ring_base = 0x00000398, 819 + 820 + /* REO cmd ring address */ 821 + .hal_reo_cmd_ring_base = 0x000002A8, 822 + 823 + /* REO status ring address */ 824 + .hal_reo_status_ring_base = 0x00000aa0, 825 + 826 + /* WBM idle link ring address */ 827 + .hal_wbm_idle_ring_base_lsb = 0x00000d3c, 828 + .hal_wbm_idle_ring_misc_addr = 0x00000d4c, 829 + .hal_wbm_r0_idle_list_cntl_addr = 0x00000240, 830 + .hal_wbm_r0_idle_list_size_addr = 0x00000244, 831 + .hal_wbm_scattered_ring_base_lsb = 0x00000250, 832 + .hal_wbm_scattered_ring_base_msb = 0x00000254, 833 + .hal_wbm_scattered_desc_head_info_ix0 = 0x00000260, 834 + .hal_wbm_scattered_desc_head_info_ix1 = 0x00000264, 835 + .hal_wbm_scattered_desc_tail_info_ix0 = 0x00000270, 836 + .hal_wbm_scattered_desc_tail_info_ix1 = 0x00000274, 837 + .hal_wbm_scattered_desc_ptr_hp_addr = 0x0000027c, 838 + 839 + /* SW2WBM release ring address */ 840 + .hal_wbm_sw_release_ring_base_lsb = 0x0000037c, 841 + 842 + /* WBM2SW release ring address */ 843 + .hal_wbm0_release_ring_base_lsb = 0x00000e08, 844 + .hal_wbm1_release_ring_base_lsb = 0x00000e80, 845 + 846 + /* PPE release ring address */ 847 + .hal_ppe_rel_ring_base = 0x0000046c, 848 + 849 + /* CE address */ 850 + .hal_umac_ce0_src_reg_base = 0x00740000 - 851 + HAL_IPQ5332_CE_WFSS_REG_BASE, 852 + .hal_umac_ce0_dest_reg_base = 0x00741000 - 853 + HAL_IPQ5332_CE_WFSS_REG_BASE, 854 + .hal_umac_ce1_src_reg_base = 0x00742000 - 855 + HAL_IPQ5332_CE_WFSS_REG_BASE, 856 + .hal_umac_ce1_dest_reg_base = 0x00743000 - 857 + HAL_IPQ5332_CE_WFSS_REG_BASE, 1029 858 }; 1030 859 1031 860 static const struct ath12k_hw_regs wcn7850_regs = { ··· 1134 775 .hal_tcl1_ring_msi1_base_msb = 0x0000094c, 1135 776 .hal_tcl1_ring_msi1_data = 0x00000950, 1136 777 .hal_tcl_ring_base_lsb = 0x00000b58, 778 + .hal_tcl1_ring_base_lsb = 0x00000900, 779 + .hal_tcl1_ring_base_msb = 0x00000904, 780 + .hal_tcl2_ring_base_lsb = 0x00000978, 1137 781 1138 782 /* TCL STATUS ring address */ 1139 783 .hal_tcl_status_ring_base_lsb = 0x00000d38, ··· 1199 837 1200 838 /* REO status ring address */ 1201 839 .hal_reo_status_ring_base = 0x00000a84, 840 + 841 + /* CE base address */ 842 + .hal_umac_ce0_src_reg_base = 0x01b80000, 843 + .hal_umac_ce0_dest_reg_base = 0x01b81000, 844 + .hal_umac_ce1_src_reg_base = 0x01b82000, 845 + .hal_umac_ce1_dest_reg_base = 0x01b83000, 1202 846 }; 1203 847 1204 848 static const struct ath12k_hw_hal_params ath12k_hw_hal_params_qcn9274 = { ··· 1224 856 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN, 1225 857 }; 1226 858 859 + static const struct ath12k_hw_hal_params ath12k_hw_hal_params_ipq5332 = { 860 + .rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM, 861 + .wbm2sw_cc_enable = HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN | 862 + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW1_EN | 863 + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW2_EN | 864 + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW3_EN | 865 + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN, 866 + }; 867 + 868 + static const struct ce_ie_addr ath12k_ce_ie_addr_ipq5332 = { 869 + .ie1_reg_addr = CE_HOST_IE_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, 870 + .ie2_reg_addr = CE_HOST_IE_2_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, 871 + .ie3_reg_addr = CE_HOST_IE_3_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, 872 + }; 873 + 874 + static const struct ce_remap ath12k_ce_remap_ipq5332 = { 875 + .base = HAL_IPQ5332_CE_WFSS_REG_BASE, 876 + .size = HAL_IPQ5332_CE_SIZE, 877 + }; 878 + 1227 879 static const struct ath12k_hw_params ath12k_hw_params[] = { 1228 880 { 1229 881 .name = "qcn9274 hw1.0", ··· 1252 864 .dir = "QCN9274/hw1.0", 1253 865 .board_size = 256 * 1024, 1254 866 .cal_offset = 128 * 1024, 867 + .m3_loader = ath12k_m3_fw_loader_driver, 1255 868 }, 1256 869 .max_radios = 1, 1257 870 .single_pdev_only = false, ··· 1288 899 .download_calib = true, 1289 900 .supports_suspend = false, 1290 901 .tcl_ring_retry = true, 1291 - .reoq_lut_support = false, 902 + .reoq_lut_support = true, 1292 903 .supports_shadow_regs = false, 1293 904 1294 905 .num_tcl_banks = 48, ··· 1321 932 .iova_mask = 0, 1322 933 1323 934 .supports_aspm = false, 935 + 936 + .ce_ie_addr = NULL, 937 + .ce_remap = NULL, 938 + .bdf_addr_offset = 0, 939 + 940 + .current_cc_support = false, 941 + 942 + .dp_primary_link_only = true, 1324 943 }, 1325 944 { 1326 945 .name = "wcn7850 hw2.0", ··· 1338 941 .dir = "WCN7850/hw2.0", 1339 942 .board_size = 256 * 1024, 1340 943 .cal_offset = 256 * 1024, 944 + .m3_loader = ath12k_m3_fw_loader_driver, 1341 945 }, 1342 946 1343 947 .max_radios = 1, ··· 1410 1012 .iova_mask = ATH12K_PCIE_MAX_PAYLOAD_SIZE - 1, 1411 1013 1412 1014 .supports_aspm = true, 1015 + 1016 + .ce_ie_addr = NULL, 1017 + .ce_remap = NULL, 1018 + .bdf_addr_offset = 0, 1019 + 1020 + .current_cc_support = true, 1021 + 1022 + .dp_primary_link_only = false, 1413 1023 }, 1414 1024 { 1415 1025 .name = "qcn9274 hw2.0", ··· 1426 1020 .dir = "QCN9274/hw2.0", 1427 1021 .board_size = 256 * 1024, 1428 1022 .cal_offset = 128 * 1024, 1023 + .m3_loader = ath12k_m3_fw_loader_driver, 1429 1024 }, 1430 1025 .max_radios = 2, 1431 1026 .single_pdev_only = false, ··· 1456 1049 BIT(NL80211_IFTYPE_AP) | 1457 1050 BIT(NL80211_IFTYPE_MESH_POINT) | 1458 1051 BIT(NL80211_IFTYPE_AP_VLAN), 1459 - .supports_monitor = false, 1052 + .supports_monitor = true, 1460 1053 1461 1054 .idle_ps = false, 1462 1055 .download_calib = true, ··· 1495 1088 .iova_mask = 0, 1496 1089 1497 1090 .supports_aspm = false, 1091 + 1092 + .ce_ie_addr = NULL, 1093 + .ce_remap = NULL, 1094 + .bdf_addr_offset = 0, 1095 + 1096 + .current_cc_support = false, 1097 + 1098 + .dp_primary_link_only = true, 1099 + }, 1100 + { 1101 + .name = "ipq5332 hw1.0", 1102 + .hw_rev = ATH12K_HW_IPQ5332_HW10, 1103 + .fw = { 1104 + .dir = "IPQ5332/hw1.0", 1105 + .board_size = 256 * 1024, 1106 + .cal_offset = 128 * 1024, 1107 + .m3_loader = ath12k_m3_fw_loader_remoteproc, 1108 + }, 1109 + .max_radios = 1, 1110 + .single_pdev_only = false, 1111 + .qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332, 1112 + .internal_sleep_clock = false, 1113 + 1114 + .hw_ops = &qcn9274_ops, 1115 + .regs = &ipq5332_regs, 1116 + .ring_mask = &ath12k_hw_ring_mask_ipq5332, 1117 + 1118 + .host_ce_config = ath12k_host_ce_config_ipq5332, 1119 + .ce_count = 12, 1120 + .target_ce_config = ath12k_target_ce_config_wlan_ipq5332, 1121 + .target_ce_count = 12, 1122 + .svc_to_ce_map = ath12k_target_service_to_ce_map_wlan_ipq5332, 1123 + .svc_to_ce_map_len = 18, 1124 + 1125 + .hal_params = &ath12k_hw_hal_params_ipq5332, 1126 + 1127 + .rxdma1_enable = false, 1128 + .num_rxdma_per_pdev = 1, 1129 + .num_rxdma_dst_ring = 0, 1130 + .rx_mac_buf_ring = false, 1131 + .vdev_start_delay = false, 1132 + 1133 + .interface_modes = BIT(NL80211_IFTYPE_STATION) | 1134 + BIT(NL80211_IFTYPE_AP) | 1135 + BIT(NL80211_IFTYPE_MESH_POINT), 1136 + .supports_monitor = false, 1137 + 1138 + .idle_ps = false, 1139 + .download_calib = true, 1140 + .supports_suspend = false, 1141 + .tcl_ring_retry = true, 1142 + .reoq_lut_support = false, 1143 + .supports_shadow_regs = false, 1144 + 1145 + .num_tcl_banks = 48, 1146 + .max_tx_ring = 4, 1147 + 1148 + .wmi_init = &ath12k_wmi_init_qcn9274, 1149 + 1150 + .hal_ops = &hal_qcn9274_ops, 1151 + 1152 + .qmi_cnss_feature_bitmap = BIT(CNSS_QDSS_CFG_MISS_V01), 1153 + 1154 + .rfkill_pin = 0, 1155 + .rfkill_cfg = 0, 1156 + .rfkill_on_level = 0, 1157 + 1158 + .rddm_size = 0, 1159 + 1160 + .def_num_link = 0, 1161 + .max_mlo_peer = 256, 1162 + 1163 + .otp_board_id_register = 0, 1164 + 1165 + .supports_sta_ps = false, 1166 + 1167 + .acpi_guid = NULL, 1168 + .supports_dynamic_smps_6ghz = false, 1169 + .iova_mask = 0, 1170 + .supports_aspm = false, 1171 + 1172 + .ce_ie_addr = &ath12k_ce_ie_addr_ipq5332, 1173 + .ce_remap = &ath12k_ce_remap_ipq5332, 1174 + .bdf_addr_offset = 0xC00000, 1175 + 1176 + .dp_primary_link_only = true, 1498 1177 }, 1499 1178 }; 1500 1179
+28 -1
drivers/net/wireless/ath/ath12k/hw.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_HW_H ··· 97 97 #define ATH12K_REGDB_FILE_NAME "regdb.bin" 98 98 99 99 #define ATH12K_PCIE_MAX_PAYLOAD_SIZE 128 100 + #define ATH12K_IPQ5332_USERPD_ID 1 100 101 101 102 enum ath12k_hw_rate_cck { 102 103 ATH12K_HW_RATE_CCK_LP_11M = 0, ··· 122 121 123 122 enum ath12k_bus { 124 123 ATH12K_BUS_PCI, 124 + ATH12K_BUS_AHB, 125 125 }; 126 126 127 127 #define ATH12K_EXT_IRQ_GRP_NUM_MAX 11 ··· 148 146 u32 wbm2sw_cc_enable; 149 147 }; 150 148 149 + enum ath12k_m3_fw_loaders { 150 + ath12k_m3_fw_loader_driver, 151 + ath12k_m3_fw_loader_remoteproc, 152 + }; 153 + 151 154 struct ath12k_hw_params { 152 155 const char *name; 153 156 u16 hw_rev; ··· 161 154 const char *dir; 162 155 size_t board_size; 163 156 size_t cal_offset; 157 + enum ath12k_m3_fw_loaders m3_loader; 164 158 } fw; 165 159 166 160 u8 max_radios; ··· 198 190 bool reoq_lut_support:1; 199 191 bool supports_shadow_regs:1; 200 192 bool supports_aspm:1; 193 + bool current_cc_support:1; 201 194 202 195 u32 num_tcl_banks; 203 196 u32 max_tx_ring; ··· 229 220 bool supports_dynamic_smps_6ghz; 230 221 231 222 u32 iova_mask; 223 + 224 + const struct ce_ie_addr *ce_ie_addr; 225 + const struct ce_remap *ce_remap; 226 + u32 bdf_addr_offset; 227 + 228 + /* setup REO queue, frag etc only for primary link peer */ 229 + bool dp_primary_link_only:1; 232 230 }; 233 231 234 232 struct ath12k_hw_ops { ··· 309 293 u32 hal_tcl1_ring_msi1_base_msb; 310 294 u32 hal_tcl1_ring_msi1_data; 311 295 u32 hal_tcl_ring_base_lsb; 296 + u32 hal_tcl1_ring_base_lsb; 297 + u32 hal_tcl1_ring_base_msb; 298 + u32 hal_tcl2_ring_base_lsb; 312 299 313 300 u32 hal_tcl_status_ring_base_lsb; 301 + 302 + u32 hal_reo1_qdesc_addr; 303 + u32 hal_reo1_qdesc_max_peerid; 314 304 315 305 u32 hal_wbm_idle_ring_base_lsb; 316 306 u32 hal_wbm_idle_ring_misc_addr; ··· 337 315 338 316 u32 pcie_qserdes_sysclk_en_sel; 339 317 u32 pcie_pcs_osc_dtct_config_base; 318 + 319 + u32 hal_umac_ce0_src_reg_base; 320 + u32 hal_umac_ce0_dest_reg_base; 321 + u32 hal_umac_ce1_src_reg_base; 322 + u32 hal_umac_ce1_dest_reg_base; 340 323 341 324 u32 hal_ppe_rel_ring_base; 342 325
+542 -253
drivers/net/wireless/ath/ath12k/mac.c
··· 888 888 { 889 889 switch (band1) { 890 890 case NL80211_BAND_2GHZ: 891 - if (band2 & WMI_HOST_WLAN_2G_CAP) 891 + if (band2 & WMI_HOST_WLAN_2GHZ_CAP) 892 892 return true; 893 893 break; 894 894 case NL80211_BAND_5GHZ: 895 895 case NL80211_BAND_6GHZ: 896 - if (band2 & WMI_HOST_WLAN_5G_CAP) 896 + if (band2 & WMI_HOST_WLAN_5GHZ_CAP) 897 897 return true; 898 898 break; 899 899 default: ··· 994 994 ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "txpower to set in hw %d\n", 995 995 txpower / 2); 996 996 997 - if ((pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) && 997 + if ((pdev->cap.supported_bands & WMI_HOST_WLAN_2GHZ_CAP) && 998 998 ar->txpower_limit_2g != txpower) { 999 999 param = WMI_PDEV_PARAM_TXPOWER_LIMIT2G; 1000 1000 ret = ath12k_wmi_pdev_set_param(ar, param, ··· 1004 1004 ar->txpower_limit_2g = txpower; 1005 1005 } 1006 1006 1007 - if ((pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) && 1007 + if ((pdev->cap.supported_bands & WMI_HOST_WLAN_5GHZ_CAP) && 1008 1008 ar->txpower_limit_5g != txpower) { 1009 1009 param = WMI_PDEV_PARAM_TXPOWER_LIMIT5G; 1010 1010 ret = ath12k_wmi_pdev_set_param(ar, param, ··· 1259 1259 return ret; 1260 1260 } 1261 1261 1262 - static int ath12k_mac_monitor_vdev_create(struct ath12k *ar) 1263 - { 1264 - struct ath12k_pdev *pdev = ar->pdev; 1265 - struct ath12k_wmi_vdev_create_arg arg = {}; 1266 - int bit, ret; 1267 - u8 tmp_addr[6]; 1268 - 1269 - lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 1270 - 1271 - if (ar->monitor_vdev_created) 1272 - return 0; 1273 - 1274 - if (ar->ab->free_vdev_map == 0) { 1275 - ath12k_warn(ar->ab, "failed to find free vdev id for monitor vdev\n"); 1276 - return -ENOMEM; 1277 - } 1278 - 1279 - bit = __ffs64(ar->ab->free_vdev_map); 1280 - 1281 - ar->monitor_vdev_id = bit; 1282 - 1283 - arg.if_id = ar->monitor_vdev_id; 1284 - arg.type = WMI_VDEV_TYPE_MONITOR; 1285 - arg.subtype = WMI_VDEV_SUBTYPE_NONE; 1286 - arg.pdev_id = pdev->pdev_id; 1287 - arg.if_stats_id = ATH12K_INVAL_VDEV_STATS_ID; 1288 - 1289 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { 1290 - arg.chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; 1291 - arg.chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; 1292 - } 1293 - 1294 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { 1295 - arg.chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; 1296 - arg.chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; 1297 - } 1298 - 1299 - ret = ath12k_wmi_vdev_create(ar, tmp_addr, &arg); 1300 - if (ret) { 1301 - ath12k_warn(ar->ab, "failed to request monitor vdev %i creation: %d\n", 1302 - ar->monitor_vdev_id, ret); 1303 - ar->monitor_vdev_id = -1; 1304 - return ret; 1305 - } 1306 - 1307 - ar->allocated_vdev_map |= 1LL << ar->monitor_vdev_id; 1308 - ar->ab->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); 1309 - ar->num_created_vdevs++; 1310 - ar->monitor_vdev_created = true; 1311 - ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac monitor vdev %d created\n", 1312 - ar->monitor_vdev_id); 1313 - 1314 - return 0; 1315 - } 1316 - 1317 1262 static int ath12k_mac_monitor_vdev_delete(struct ath12k *ar) 1318 1263 { 1319 1264 int ret; ··· 1295 1350 return ret; 1296 1351 } 1297 1352 1298 - static void 1299 - ath12k_mac_get_any_chandef_iter(struct ieee80211_hw *hw, 1300 - struct ieee80211_chanctx_conf *conf, 1301 - void *data) 1302 - { 1303 - struct cfg80211_chan_def **def = data; 1304 - 1305 - *def = &conf->def; 1306 - } 1307 - 1308 1353 static int ath12k_mac_monitor_start(struct ath12k *ar) 1309 1354 { 1310 - struct cfg80211_chan_def *chandef = NULL; 1355 + struct ath12k_mac_get_any_chanctx_conf_arg arg; 1311 1356 int ret; 1312 1357 1313 1358 lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ··· 1305 1370 if (ar->monitor_started) 1306 1371 return 0; 1307 1372 1373 + arg.ar = ar; 1374 + arg.chanctx_conf = NULL; 1308 1375 ieee80211_iter_chan_contexts_atomic(ath12k_ar_to_hw(ar), 1309 - ath12k_mac_get_any_chandef_iter, 1310 - &chandef); 1311 - if (!chandef) 1376 + ath12k_mac_get_any_chanctx_conf_iter, 1377 + &arg); 1378 + if (!arg.chanctx_conf) 1312 1379 return 0; 1313 1380 1314 - ret = ath12k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, chandef); 1381 + ret = ath12k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, 1382 + &arg.chanctx_conf->def); 1315 1383 if (ret) { 1316 1384 ath12k_warn(ar->ab, "failed to start monitor vdev: %d\n", ret); 1317 - ath12k_mac_monitor_vdev_delete(ar); 1385 + return ret; 1386 + } 1387 + 1388 + ret = ath12k_dp_tx_htt_monitor_mode_ring_config(ar, false); 1389 + if (ret) { 1390 + ath12k_warn(ar->ab, "fail to set monitor filter: %d\n", ret); 1318 1391 return ret; 1319 1392 } 1320 1393 1321 1394 ar->monitor_started = true; 1322 1395 ar->num_started_vdevs++; 1323 - ret = ath12k_dp_tx_htt_monitor_mode_ring_config(ar, false); 1324 - ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac monitor started ret %d\n", ret); 1325 1396 1326 - return ret; 1397 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac monitor started\n"); 1398 + 1399 + return 0; 1327 1400 } 1328 1401 1329 1402 static int ath12k_mac_monitor_stop(struct ath12k *ar) ··· 1397 1454 return ret; 1398 1455 } 1399 1456 1400 - static int ath12k_mac_config(struct ath12k *ar, u32 changed) 1401 - { 1402 - struct ieee80211_hw *hw = ath12k_ar_to_hw(ar); 1403 - struct ieee80211_conf *conf = &hw->conf; 1404 - int ret = 0; 1405 - 1406 - lockdep_assert_wiphy(hw->wiphy); 1407 - 1408 - if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1409 - ar->monitor_conf_enabled = conf->flags & IEEE80211_CONF_MONITOR; 1410 - if (ar->monitor_conf_enabled) { 1411 - if (ar->monitor_vdev_created) 1412 - return ret; 1413 - ret = ath12k_mac_monitor_vdev_create(ar); 1414 - if (ret) 1415 - return ret; 1416 - ret = ath12k_mac_monitor_start(ar); 1417 - if (ret) 1418 - goto err_mon_del; 1419 - } else { 1420 - if (!ar->monitor_vdev_created) 1421 - return ret; 1422 - ret = ath12k_mac_monitor_stop(ar); 1423 - if (ret) 1424 - return ret; 1425 - ath12k_mac_monitor_vdev_delete(ar); 1426 - } 1427 - } 1428 - 1429 - return ret; 1430 - 1431 - err_mon_del: 1432 - ath12k_mac_monitor_vdev_delete(ar); 1433 - return ret; 1434 - } 1435 - 1436 1457 static int ath12k_mac_op_config(struct ieee80211_hw *hw, u32 changed) 1437 1458 { 1438 - struct ath12k_hw *ah = ath12k_hw_to_ah(hw); 1439 - struct ath12k *ar; 1440 - int ret; 1441 - 1442 - lockdep_assert_wiphy(hw->wiphy); 1443 - 1444 - ar = ath12k_ah_to_ar(ah, 0); 1445 - 1446 - ret = ath12k_mac_config(ar, changed); 1447 - if (ret) 1448 - ath12k_warn(ar->ab, "failed to update config pdev idx %d: %d\n", 1449 - ar->pdev_idx, ret); 1450 - 1451 - return ret; 1459 + return 0; 1452 1460 } 1453 1461 1454 1462 static int ath12k_mac_setup_bcn_p2p_ie(struct ath12k_link_vif *arvif, ··· 3285 3391 if (ret) 3286 3392 ath12k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", 3287 3393 arvif->vdev_id, ret); 3394 + 3395 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map) && 3396 + ahvif->vdev_type == WMI_VDEV_TYPE_STA && 3397 + ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) 3398 + ath12k_mac_11d_scan_stop_all(ar->ab); 3288 3399 } 3289 3400 3290 3401 static void ath12k_bss_disassoc(struct ath12k *ar, ··· 3363 3464 } 3364 3465 3365 3466 sband = hw->wiphy->bands[def->chan->band]; 3366 - basic_rate_idx = ffs(bss_conf->basic_rates) - 1; 3467 + if (bss_conf->basic_rates) 3468 + basic_rate_idx = __ffs(bss_conf->basic_rates); 3469 + else 3470 + basic_rate_idx = 0; 3367 3471 bitrate = sband->bitrates[basic_rate_idx].bitrate; 3368 3472 3369 3473 hw_rate_code = ath12k_mac_get_rate_hw_value(bitrate); ··· 3411 3509 arvif->ahvif = ahvif; 3412 3510 arvif->link_id = _link_id; 3413 3511 3512 + /* Protects the datapath stats update on a per link basis */ 3513 + spin_lock_init(&arvif->link_stats_lock); 3514 + 3414 3515 INIT_LIST_HEAD(&arvif->list); 3415 3516 INIT_DELAYED_WORK(&arvif->connection_loss_work, 3416 3517 ath12k_mac_vif_sta_connection_loss_work); ··· 3453 3548 ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac remove link interface (vdev %d link id %d)", 3454 3549 arvif->vdev_id, arvif->link_id); 3455 3550 3551 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map) && 3552 + ahvif->vdev_type == WMI_VDEV_TYPE_STA && 3553 + ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) 3554 + ath12k_mac_11d_scan_stop(ar); 3555 + 3456 3556 if (ahvif->vdev_type == WMI_VDEV_TYPE_AP) { 3457 3557 ret = ath12k_peer_delete(ar, arvif->vdev_id, arvif->bssid); 3458 3558 if (ret) ··· 3491 3581 */ 3492 3582 if (!ahvif->links_map && link_id != ATH12K_DEFAULT_SCAN_LINK) { 3493 3583 arvif = &ahvif->deflink; 3584 + if (vif->type == NL80211_IFTYPE_STATION) 3585 + arvif->is_sta_assoc_link = true; 3494 3586 } else { 3495 3587 arvif = (struct ath12k_link_vif *) 3496 3588 kzalloc(sizeof(struct ath12k_link_vif), GFP_KERNEL); ··· 3628 3716 unsigned long links = ahvif->links_map; 3629 3717 struct ieee80211_bss_conf *info; 3630 3718 struct ath12k_link_vif *arvif; 3719 + struct ieee80211_sta *sta; 3720 + struct ath12k_sta *ahsta; 3631 3721 struct ath12k *ar; 3632 3722 u8 link_id; 3633 3723 ··· 3642 3728 } 3643 3729 3644 3730 if (changed & BSS_CHANGED_ASSOC) { 3731 + if (vif->cfg.assoc) { 3732 + /* only in station mode we can get here, so it's safe 3733 + * to use ap_addr 3734 + */ 3735 + rcu_read_lock(); 3736 + sta = ieee80211_find_sta(vif, vif->cfg.ap_addr); 3737 + if (!sta) { 3738 + rcu_read_unlock(); 3739 + WARN_ONCE(1, "failed to find sta with addr %pM\n", 3740 + vif->cfg.ap_addr); 3741 + return; 3742 + } 3743 + 3744 + ahsta = ath12k_sta_to_ahsta(sta); 3745 + arvif = wiphy_dereference(hw->wiphy, 3746 + ahvif->link[ahsta->assoc_link_id]); 3747 + rcu_read_unlock(); 3748 + 3749 + ar = arvif->ar; 3750 + /* there is no reason for which an assoc link's 3751 + * bss info does not exist 3752 + */ 3753 + info = ath12k_mac_get_link_bss_conf(arvif); 3754 + ath12k_bss_assoc(ar, arvif, info); 3755 + 3756 + /* exclude assoc link as it is done above */ 3757 + links &= ~BIT(ahsta->assoc_link_id); 3758 + } 3759 + 3645 3760 for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) { 3646 3761 arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]); 3647 3762 if (!arvif || !arvif->ar) ··· 3940 3997 band = def.chan->band; 3941 3998 mcast_rate = info->mcast_rate[band]; 3942 3999 3943 - if (mcast_rate > 0) 4000 + if (mcast_rate > 0) { 3944 4001 rateidx = mcast_rate - 1; 3945 - else 3946 - rateidx = ffs(info->basic_rates) - 1; 4002 + } else { 4003 + if (info->basic_rates) 4004 + rateidx = __ffs(info->basic_rates); 4005 + else 4006 + rateidx = 0; 4007 + } 3947 4008 3948 - if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) 4009 + if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5GHZ_CAP) 3949 4010 rateidx += ATH12K_MAC_FIRST_OFDM_RATE_IDX; 3950 4011 3951 4012 bitrate = ath12k_legacy_rates[rateidx].bitrate; ··· 4123 4176 * split the hw request and perform multiple scans 4124 4177 */ 4125 4178 4126 - if (center_freq < ATH12K_MIN_5G_FREQ) 4179 + if (center_freq < ATH12K_MIN_5GHZ_FREQ) 4127 4180 band = NL80211_BAND_2GHZ; 4128 - else if (center_freq < ATH12K_MIN_6G_FREQ) 4181 + else if (center_freq < ATH12K_MIN_6GHZ_FREQ) 4129 4182 band = NL80211_BAND_5GHZ; 4130 4183 else 4131 4184 band = NL80211_BAND_6GHZ; ··· 4155 4208 fallthrough; 4156 4209 case ATH12K_SCAN_STARTING: 4157 4210 cancel_delayed_work(&ar->scan.timeout); 4158 - complete(&ar->scan.completed); 4211 + complete_all(&ar->scan.completed); 4159 4212 wiphy_work_queue(ar->ah->hw->wiphy, &ar->scan.vdev_clean_wk); 4160 4213 break; 4161 4214 } ··· 4337 4390 return 0; 4338 4391 } 4339 4392 4393 + int ath12k_mac_get_fw_stats(struct ath12k *ar, 4394 + struct ath12k_fw_stats_req_params *param) 4395 + { 4396 + struct ath12k_base *ab = ar->ab; 4397 + struct ath12k_hw *ah = ath12k_ar_to_ah(ar); 4398 + unsigned long timeout, time_left; 4399 + int ret; 4400 + 4401 + guard(mutex)(&ah->hw_mutex); 4402 + 4403 + if (ah->state != ATH12K_HW_STATE_ON) 4404 + return -ENETDOWN; 4405 + 4406 + /* FW stats can get split when exceeding the stats data buffer limit. 4407 + * In that case, since there is no end marking for the back-to-back 4408 + * received 'update stats' event, we keep a 3 seconds timeout in case, 4409 + * fw_stats_done is not marked yet 4410 + */ 4411 + timeout = jiffies + msecs_to_jiffies(3 * 1000); 4412 + ath12k_fw_stats_reset(ar); 4413 + 4414 + reinit_completion(&ar->fw_stats_complete); 4415 + 4416 + ret = ath12k_wmi_send_stats_request_cmd(ar, param->stats_id, 4417 + param->vdev_id, param->pdev_id); 4418 + 4419 + if (ret) { 4420 + ath12k_warn(ab, "failed to request fw stats: %d\n", ret); 4421 + return ret; 4422 + } 4423 + 4424 + ath12k_dbg(ab, ATH12K_DBG_WMI, 4425 + "get fw stat pdev id %d vdev id %d stats id 0x%x\n", 4426 + param->pdev_id, param->vdev_id, param->stats_id); 4427 + 4428 + time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1 * HZ); 4429 + 4430 + if (!time_left) { 4431 + ath12k_warn(ab, "time out while waiting for get fw stats\n"); 4432 + return -ETIMEDOUT; 4433 + } 4434 + 4435 + /* Firmware sends WMI_UPDATE_STATS_EVENTID back-to-back 4436 + * when stats data buffer limit is reached. fw_stats_complete 4437 + * is completed once host receives first event from firmware, but 4438 + * still end might not be marked in the TLV. 4439 + * Below loop is to confirm that firmware completed sending all the event 4440 + * and fw_stats_done is marked true when end is marked in the TLV. 4441 + */ 4442 + for (;;) { 4443 + if (time_after(jiffies, timeout)) 4444 + break; 4445 + spin_lock_bh(&ar->data_lock); 4446 + if (ar->fw_stats.fw_stats_done) { 4447 + spin_unlock_bh(&ar->data_lock); 4448 + break; 4449 + } 4450 + spin_unlock_bh(&ar->data_lock); 4451 + } 4452 + return 0; 4453 + } 4454 + 4455 + static int ath12k_mac_op_get_txpower(struct ieee80211_hw *hw, 4456 + struct ieee80211_vif *vif, 4457 + unsigned int link_id, 4458 + int *dbm) 4459 + { 4460 + struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif); 4461 + struct ath12k_fw_stats_req_params params = {}; 4462 + struct ath12k_fw_stats_pdev *pdev; 4463 + struct ath12k_hw *ah = hw->priv; 4464 + struct ath12k_link_vif *arvif; 4465 + struct ath12k_base *ab; 4466 + struct ath12k *ar; 4467 + int ret; 4468 + 4469 + /* Final Tx power is minimum of Target Power, CTL power, Regulatory 4470 + * Power, PSD EIRP Power. We just know the Regulatory power from the 4471 + * regulatory rules obtained. FW knows all these power and sets the min 4472 + * of these. Hence, we request the FW pdev stats in which FW reports 4473 + * the minimum of all vdev's channel Tx power. 4474 + */ 4475 + lockdep_assert_wiphy(hw->wiphy); 4476 + 4477 + arvif = wiphy_dereference(ah->hw->wiphy, ahvif->link[link_id]); 4478 + if (!arvif || !arvif->ar) 4479 + return -EINVAL; 4480 + 4481 + ar = arvif->ar; 4482 + ab = ar->ab; 4483 + if (ah->state != ATH12K_HW_STATE_ON) 4484 + goto err_fallback; 4485 + 4486 + if (test_bit(ATH12K_FLAG_CAC_RUNNING, &ar->dev_flags)) 4487 + return -EAGAIN; 4488 + 4489 + /* Limit the requests to Firmware for fetching the tx power */ 4490 + if (ar->chan_tx_pwr != ATH12K_PDEV_TX_POWER_INVALID && 4491 + time_before(jiffies, 4492 + msecs_to_jiffies(ATH12K_PDEV_TX_POWER_REFRESH_TIME_MSECS) + 4493 + ar->last_tx_power_update)) 4494 + goto send_tx_power; 4495 + 4496 + params.pdev_id = ar->pdev->pdev_id; 4497 + params.vdev_id = arvif->vdev_id; 4498 + params.stats_id = WMI_REQUEST_PDEV_STAT; 4499 + ret = ath12k_mac_get_fw_stats(ar, &params); 4500 + if (ret) { 4501 + ath12k_warn(ab, "failed to request fw pdev stats: %d\n", ret); 4502 + goto err_fallback; 4503 + } 4504 + 4505 + spin_lock_bh(&ar->data_lock); 4506 + pdev = list_first_entry_or_null(&ar->fw_stats.pdevs, 4507 + struct ath12k_fw_stats_pdev, list); 4508 + if (!pdev) { 4509 + spin_unlock_bh(&ar->data_lock); 4510 + goto err_fallback; 4511 + } 4512 + 4513 + /* tx power reported by firmware is in units of 0.5 dBm */ 4514 + ar->chan_tx_pwr = pdev->chan_tx_power / 2; 4515 + spin_unlock_bh(&ar->data_lock); 4516 + ar->last_tx_power_update = jiffies; 4517 + 4518 + send_tx_power: 4519 + *dbm = ar->chan_tx_pwr; 4520 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "txpower fetched from firmware %d dBm\n", 4521 + *dbm); 4522 + return 0; 4523 + 4524 + err_fallback: 4525 + /* We didn't get txpower from FW. Hence, relying on vif->bss_conf.txpower */ 4526 + *dbm = vif->bss_conf.txpower; 4527 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "txpower from firmware NaN, reported %d dBm\n", 4528 + *dbm); 4529 + return 0; 4530 + } 4531 + 4340 4532 static u8 4341 4533 ath12k_mac_find_link_id_by_ar(struct ath12k_vif *ahvif, struct ath12k *ar) 4342 4534 { ··· 4529 4443 return -EINVAL; 4530 4444 4531 4445 /* check if any of the links of ML VIF is already started on 4532 - * radio(ar) correpsondig to given scan frequency and use it, 4446 + * radio(ar) corresponding to given scan frequency and use it, 4533 4447 * if not use scan link (link 15) for scan purpose. 4534 4448 */ 4535 4449 link_id = ath12k_mac_find_link_id_by_ar(ahvif, ar); ··· 4638 4552 4639 4553 ret = ath12k_start_scan(ar, arg); 4640 4554 if (ret) { 4641 - ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); 4555 + if (ret == -EBUSY) 4556 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, 4557 + "scan engine is busy 11d state %d\n", ar->state_11d); 4558 + else 4559 + ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); 4560 + 4642 4561 spin_lock_bh(&ar->data_lock); 4643 4562 ar->scan.state = ATH12K_SCAN_IDLE; 4644 4563 spin_unlock_bh(&ar->data_lock); ··· 4669 4578 kfree(arg->extraie.ptr); 4670 4579 kfree(arg); 4671 4580 } 4581 + 4582 + if (ar->state_11d == ATH12K_11D_PREPARING && 4583 + ahvif->vdev_type == WMI_VDEV_TYPE_STA && 4584 + ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) 4585 + ath12k_mac_11d_scan_start(ar, arvif->vdev_id); 4672 4586 4673 4587 return ret; 4674 4588 } ··· 4715 4619 .macaddr = macaddr, 4716 4620 }; 4717 4621 struct ath12k_vif *ahvif = arvif->ahvif; 4718 - struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif); 4719 4622 4720 4623 lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 4721 4624 ··· 4733 4638 4734 4639 switch (key->cipher) { 4735 4640 case WLAN_CIPHER_SUITE_CCMP: 4641 + case WLAN_CIPHER_SUITE_CCMP_256: 4736 4642 arg.key_cipher = WMI_CIPHER_AES_CCM; 4737 - /* TODO: Re-check if flag is valid */ 4738 4643 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; 4739 4644 break; 4740 4645 case WLAN_CIPHER_SUITE_TKIP: ··· 4742 4647 arg.key_txmic_len = 8; 4743 4648 arg.key_rxmic_len = 8; 4744 4649 break; 4745 - case WLAN_CIPHER_SUITE_CCMP_256: 4746 - arg.key_cipher = WMI_CIPHER_AES_CCM; 4747 - break; 4748 4650 case WLAN_CIPHER_SUITE_GCMP: 4749 4651 case WLAN_CIPHER_SUITE_GCMP_256: 4750 4652 arg.key_cipher = WMI_CIPHER_AES_GCM; 4653 + key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; 4751 4654 break; 4752 4655 default: 4753 4656 ath12k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); ··· 4765 4672 if (!wait_for_completion_timeout(&ar->install_key_done, 1 * HZ)) 4766 4673 return -ETIMEDOUT; 4767 4674 4768 - if (ether_addr_equal(macaddr, vif->addr)) 4675 + if (ether_addr_equal(macaddr, arvif->bssid)) 4769 4676 ahvif->key_cipher = key->cipher; 4770 4677 4771 4678 return ar->install_key_status ? -EINVAL : 0; ··· 5631 5538 ar->max_num_stations); 5632 5539 goto exit; 5633 5540 } 5634 - arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); 5635 - if (!arsta->rx_stats) { 5636 - ret = -ENOMEM; 5637 - goto dec_num_station; 5541 + 5542 + if (ath12k_debugfs_is_extd_rx_stats_enabled(ar) && !arsta->rx_stats) { 5543 + arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); 5544 + if (!arsta->rx_stats) { 5545 + ret = -ENOMEM; 5546 + goto dec_num_station; 5547 + } 5638 5548 } 5639 5549 5640 5550 peer_param.vdev_id = arvif->vdev_id; ··· 5912 5816 * link sta 5913 5817 */ 5914 5818 if (sta->mlo) { 5819 + /* For station mode, arvif->is_sta_assoc_link has been set when 5820 + * vdev starts. Make sure the arvif/arsta pair have same setting 5821 + */ 5822 + if (vif->type == NL80211_IFTYPE_STATION && 5823 + !arsta->arvif->is_sta_assoc_link) { 5824 + ath12k_hw_warn(ah, "failed to verify assoc link setting with link id %u\n", 5825 + link_id); 5826 + ret = -EINVAL; 5827 + goto exit; 5828 + } 5829 + 5915 5830 arsta->is_assoc_link = true; 5916 5831 ahsta->assoc_link_id = link_id; 5917 5832 } ··· 6596 6489 rate_cap_tx_chainmask = ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift; 6597 6490 rate_cap_rx_chainmask = ar->cfg_rx_chainmask >> cap->rx_chain_mask_shift; 6598 6491 6599 - if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { 6492 + if (cap->supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 6600 6493 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; 6601 6494 ht_cap = cap->band[NL80211_BAND_2GHZ].ht_cap_info; 6602 6495 if (ht_cap_info) ··· 6605 6498 rate_cap_rx_chainmask); 6606 6499 } 6607 6500 6608 - if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && 6501 + if (cap->supported_bands & WMI_HOST_WLAN_5GHZ_CAP && 6609 6502 (ar->ab->hw_params->single_pdev_only || 6610 6503 !ar->supports_6ghz)) { 6611 6504 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; ··· 6782 6675 6783 6676 switch (iftype) { 6784 6677 case NL80211_IFTYPE_AP: 6678 + he_cap_elem->mac_cap_info[2] &= 6679 + ~IEEE80211_HE_MAC_CAP2_BCAST_TWT; 6785 6680 he_cap_elem->phy_cap_info[3] &= 6786 6681 ~IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK; 6787 6682 he_cap_elem->phy_cap_info[9] |= ··· 7016 6907 enum nl80211_band band; 7017 6908 int count; 7018 6909 7019 - if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { 6910 + if (cap->supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 7020 6911 band = NL80211_BAND_2GHZ; 7021 6912 count = ath12k_mac_copy_sband_iftype_data(ar, cap, 7022 6913 ar->mac.iftype[band], ··· 7026 6917 count); 7027 6918 } 7028 6919 7029 - if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { 6920 + if (cap->supported_bands & WMI_HOST_WLAN_5GHZ_CAP) { 7030 6921 band = NL80211_BAND_5GHZ; 7031 6922 count = ath12k_mac_copy_sband_iftype_data(ar, cap, 7032 6923 ar->mac.iftype[band], ··· 7036 6927 count); 7037 6928 } 7038 6929 7039 - if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && 6930 + if (cap->supported_bands & WMI_HOST_WLAN_5GHZ_CAP && 7040 6931 ar->supports_6ghz) { 7041 6932 band = NL80211_BAND_6GHZ; 7042 6933 count = ath12k_mac_copy_sband_iftype_data(ar, cap, ··· 7164 7055 { 7165 7056 struct ath12k_base *ab = ar->ab; 7166 7057 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 7058 + struct ath12k_skb_cb *skb_cb = ATH12K_SKB_CB(skb); 7167 7059 struct ieee80211_tx_info *info; 7060 + enum hal_encrypt_type enctype; 7061 + unsigned int mic_len; 7168 7062 dma_addr_t paddr; 7169 7063 int buf_id; 7170 7064 int ret; 7171 7065 7172 7066 lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 7173 7067 7174 - ATH12K_SKB_CB(skb)->ar = ar; 7068 + skb_cb->ar = ar; 7175 7069 spin_lock_bh(&ar->txmgmt_idr_lock); 7176 7070 buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, 7177 7071 ATH12K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC); ··· 7183 7071 return -ENOSPC; 7184 7072 7185 7073 info = IEEE80211_SKB_CB(skb); 7186 - if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { 7074 + if ((skb_cb->flags & ATH12K_SKB_CIPHER_SET) && 7075 + !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { 7187 7076 if ((ieee80211_is_action(hdr->frame_control) || 7188 7077 ieee80211_is_deauth(hdr->frame_control) || 7189 7078 ieee80211_is_disassoc(hdr->frame_control)) && 7190 7079 ieee80211_has_protected(hdr->frame_control)) { 7191 - skb_put(skb, IEEE80211_CCMP_MIC_LEN); 7080 + enctype = ath12k_dp_tx_get_encrypt_type(skb_cb->cipher); 7081 + mic_len = ath12k_dp_rx_crypto_mic_len(ar, enctype); 7082 + skb_put(skb, mic_len); 7192 7083 } 7193 7084 } 7194 7085 ··· 7202 7087 goto err_free_idr; 7203 7088 } 7204 7089 7205 - ATH12K_SKB_CB(skb)->paddr = paddr; 7090 + skb_cb->paddr = paddr; 7206 7091 7207 7092 ret = ath12k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); 7208 7093 if (ret) { ··· 7213 7098 return 0; 7214 7099 7215 7100 err_unmap_buf: 7216 - dma_unmap_single(ab->dev, ATH12K_SKB_CB(skb)->paddr, 7101 + dma_unmap_single(ab->dev, skb_cb->paddr, 7217 7102 skb->len, DMA_TO_DEVICE); 7218 7103 err_free_idr: 7219 7104 spin_lock_bh(&ar->txmgmt_idr_lock); ··· 7472 7357 u8 link_id; 7473 7358 int ret; 7474 7359 7360 + if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { 7361 + ieee80211_free_txskb(hw, skb); 7362 + return; 7363 + } 7364 + 7475 7365 link_id = u32_get_bits(info->control.flags, IEEE80211_TX_CTRL_MLO_LINK); 7476 7366 memset(skb_cb, 0, sizeof(*skb_cb)); 7477 7367 skb_cb->vif = vif; ··· 7533 7413 7534 7414 if (!vif->valid_links || !is_mcast || 7535 7415 test_bit(ATH12K_FLAG_RAW_MODE, &ar->ab->dev_flags)) { 7536 - ret = ath12k_dp_tx(ar, arvif, skb, false, 0); 7416 + ret = ath12k_dp_tx(ar, arvif, skb, false, 0, is_mcast); 7537 7417 if (unlikely(ret)) { 7538 7418 ath12k_warn(ar->ab, "failed to transmit frame %d\n", ret); 7539 7419 ieee80211_free_txskb(ar->ah->hw, skb); ··· 7563 7443 info_flags); 7564 7444 7565 7445 skb_cb = ATH12K_SKB_CB(msdu_copied); 7566 - info = IEEE80211_SKB_CB(msdu_copied); 7567 7446 skb_cb->link_id = link_id; 7568 7447 7569 7448 /* For open mode, skip peer find logic */ 7570 - if (unlikely(ahvif->key_cipher == WMI_CIPHER_NONE)) 7449 + if (unlikely(!ahvif->key_cipher)) 7571 7450 goto skip_peer_find; 7572 7451 7573 7452 spin_lock_bh(&tmp_ar->ab->base_lock); ··· 7585 7466 if (key) { 7586 7467 skb_cb->cipher = key->cipher; 7587 7468 skb_cb->flags |= ATH12K_SKB_CIPHER_SET; 7588 - info->control.hw_key = key; 7589 7469 7590 7470 hdr = (struct ieee80211_hdr *)msdu_copied->data; 7591 7471 if (!ieee80211_has_protected(hdr->frame_control)) ··· 7595 7477 7596 7478 skip_peer_find: 7597 7479 ret = ath12k_dp_tx(tmp_ar, tmp_arvif, 7598 - msdu_copied, true, mcbc_gsn); 7480 + msdu_copied, true, mcbc_gsn, is_mcast); 7599 7481 if (unlikely(ret)) { 7600 7482 if (ret == -ENOMEM) { 7601 7483 /* Drops are expected during heavy multicast ··· 7681 7563 1, pdev->pdev_id); 7682 7564 7683 7565 if (ret) { 7684 - ath12k_err(ab, "failed to enable PMF QOS: (%d\n", ret); 7566 + ath12k_err(ab, "failed to enable PMF QOS: %d\n", ret); 7685 7567 goto err; 7686 7568 } 7687 7569 ··· 7726 7608 7727 7609 /* TODO: Do we need to enable ANI? */ 7728 7610 7729 - ath12k_reg_update_chan_list(ar); 7611 + ath12k_reg_update_chan_list(ar, false); 7730 7612 7731 7613 ar->num_started_vdevs = 0; 7732 7614 ar->num_created_vdevs = 0; 7733 7615 ar->num_peers = 0; 7734 7616 ar->allocated_vdev_map = 0; 7617 + ar->chan_tx_pwr = ATH12K_PDEV_TX_POWER_INVALID; 7735 7618 7736 7619 /* Configure monitor status ring with default rx_filter to get rx status 7737 7620 * such as rssi, rx_duration. ··· 7914 7795 wiphy_work_cancel(ath12k_ar_to_hw(ar)->wiphy, &ar->scan.vdev_clean_wk); 7915 7796 cancel_work_sync(&ar->regd_update_work); 7916 7797 cancel_work_sync(&ar->ab->rfkill_work); 7798 + cancel_work_sync(&ar->ab->update_11d_work); 7799 + ar->state_11d = ATH12K_11D_IDLE; 7800 + complete(&ar->completed_11d_scan); 7917 7801 7918 7802 spin_lock_bh(&ar->data_lock); 7919 7803 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { ··· 8039 7917 return ret; 8040 7918 } 8041 7919 8042 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { 7920 + if (pdev->cap.supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 8043 7921 arg->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; 8044 7922 arg->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; 8045 7923 } 8046 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { 7924 + if (pdev->cap.supported_bands & WMI_HOST_WLAN_5GHZ_CAP) { 8047 7925 arg->chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; 8048 7926 arg->chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; 8049 7927 } 8050 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP && 7928 + if (pdev->cap.supported_bands & WMI_HOST_WLAN_5GHZ_CAP && 8051 7929 ar->supports_6ghz) { 8052 7930 arg->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; 8053 7931 arg->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; ··· 8076 7954 u32 *hecap_phy_ptr = NULL; 8077 7955 u32 hemode; 8078 7956 8079 - if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) 7957 + if (pdev->cap.supported_bands & WMI_HOST_WLAN_2GHZ_CAP) 8080 7958 cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; 8081 7959 else 8082 7960 cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; ··· 8207 8085 ath12k_mac_update_vif_offload(&ahvif->deflink); 8208 8086 } 8209 8087 8088 + static bool ath12k_mac_vif_ap_active_any(struct ath12k_base *ab) 8089 + { 8090 + struct ath12k *ar; 8091 + struct ath12k_pdev *pdev; 8092 + struct ath12k_link_vif *arvif; 8093 + int i; 8094 + 8095 + for (i = 0; i < ab->num_radios; i++) { 8096 + pdev = &ab->pdevs[i]; 8097 + ar = pdev->ar; 8098 + list_for_each_entry(arvif, &ar->arvifs, list) { 8099 + if (arvif->is_up && 8100 + arvif->ahvif->vdev_type == WMI_VDEV_TYPE_AP) 8101 + return true; 8102 + } 8103 + } 8104 + return false; 8105 + } 8106 + 8107 + void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id) 8108 + { 8109 + struct wmi_11d_scan_start_arg arg; 8110 + int ret; 8111 + 8112 + lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 8113 + 8114 + if (ar->regdom_set_by_user) 8115 + goto fin; 8116 + 8117 + if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) 8118 + goto fin; 8119 + 8120 + if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) 8121 + goto fin; 8122 + 8123 + if (ath12k_mac_vif_ap_active_any(ar->ab)) 8124 + goto fin; 8125 + 8126 + arg.vdev_id = vdev_id; 8127 + arg.start_interval_msec = 0; 8128 + arg.scan_period_msec = ATH12K_SCAN_11D_INTERVAL; 8129 + 8130 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, 8131 + "mac start 11d scan for vdev %d\n", vdev_id); 8132 + 8133 + ret = ath12k_wmi_send_11d_scan_start_cmd(ar, &arg); 8134 + if (ret) { 8135 + ath12k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", 8136 + vdev_id, ret); 8137 + } else { 8138 + ar->vdev_id_11d_scan = vdev_id; 8139 + if (ar->state_11d == ATH12K_11D_PREPARING) 8140 + ar->state_11d = ATH12K_11D_RUNNING; 8141 + } 8142 + 8143 + fin: 8144 + if (ar->state_11d == ATH12K_11D_PREPARING) { 8145 + ar->state_11d = ATH12K_11D_IDLE; 8146 + complete(&ar->completed_11d_scan); 8147 + } 8148 + } 8149 + 8150 + void ath12k_mac_11d_scan_stop(struct ath12k *ar) 8151 + { 8152 + int ret; 8153 + u32 vdev_id; 8154 + 8155 + lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); 8156 + 8157 + if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) 8158 + return; 8159 + 8160 + ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac stop 11d for vdev %d\n", 8161 + ar->vdev_id_11d_scan); 8162 + 8163 + if (ar->state_11d == ATH12K_11D_PREPARING) { 8164 + ar->state_11d = ATH12K_11D_IDLE; 8165 + complete(&ar->completed_11d_scan); 8166 + } 8167 + 8168 + if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) { 8169 + vdev_id = ar->vdev_id_11d_scan; 8170 + 8171 + ret = ath12k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); 8172 + if (ret) { 8173 + ath12k_warn(ar->ab, 8174 + "failed to stopt 11d scan vdev %d ret: %d\n", 8175 + vdev_id, ret); 8176 + } else { 8177 + ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; 8178 + ar->state_11d = ATH12K_11D_IDLE; 8179 + complete(&ar->completed_11d_scan); 8180 + } 8181 + } 8182 + } 8183 + 8184 + void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab) 8185 + { 8186 + struct ath12k *ar; 8187 + struct ath12k_pdev *pdev; 8188 + int i; 8189 + 8190 + ath12k_dbg(ab, ATH12K_DBG_MAC, "mac stop soc 11d scan\n"); 8191 + 8192 + for (i = 0; i < ab->num_radios; i++) { 8193 + pdev = &ab->pdevs[i]; 8194 + ar = pdev->ar; 8195 + 8196 + ath12k_mac_11d_scan_stop(ar); 8197 + } 8198 + } 8199 + 8210 8200 int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif) 8211 8201 { 8212 8202 struct ath12k_hw *ah = ar->ah; ··· 8336 8102 u8 link_id; 8337 8103 8338 8104 lockdep_assert_wiphy(hw->wiphy); 8105 + 8106 + /* In NO_VIRTUAL_MONITOR, its necessary to restrict only one monitor 8107 + * interface in each radio 8108 + */ 8109 + if (vif->type == NL80211_IFTYPE_MONITOR && ar->monitor_vdev_created) 8110 + return -EINVAL; 8339 8111 8340 8112 /* If no link is active and scan vdev is requested 8341 8113 * use a default link conf for scan address purpose. ··· 8459 8219 arvif->vdev_id, ret); 8460 8220 goto err_peer_del; 8461 8221 } 8222 + ath12k_mac_11d_scan_stop_all(ar->ab); 8462 8223 break; 8463 8224 case WMI_VDEV_TYPE_STA: 8464 8225 param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; ··· 8498 8257 arvif->vdev_id, ret); 8499 8258 goto err_peer_del; 8500 8259 } 8260 + 8261 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && 8262 + ahvif->vdev_type == WMI_VDEV_TYPE_STA && 8263 + ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) { 8264 + reinit_completion(&ar->completed_11d_scan); 8265 + ar->state_11d = ATH12K_11D_PREPARING; 8266 + } 8267 + break; 8268 + case WMI_VDEV_TYPE_MONITOR: 8269 + ar->monitor_vdev_created = true; 8501 8270 break; 8502 8271 default: 8503 8272 break; ··· 8528 8277 } 8529 8278 8530 8279 ath12k_dp_vdev_tx_attach(ar, arvif); 8531 - if (vif->type != NL80211_IFTYPE_MONITOR && ar->monitor_conf_enabled) 8532 - ath12k_mac_monitor_vdev_create(ar); 8533 8280 8534 8281 return ret; 8535 8282 ··· 8552 8303 } 8553 8304 8554 8305 err_vdev_del: 8306 + if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { 8307 + ar->monitor_vdev_id = -1; 8308 + ar->monitor_vdev_created = false; 8309 + } 8310 + 8555 8311 ath12k_wmi_vdev_delete(ar, arvif->vdev_id); 8556 8312 ar->num_created_vdevs--; 8557 8313 arvif->is_created = false; ··· 8834 8580 if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { 8835 8581 ar->monitor_vdev_id = -1; 8836 8582 ar->monitor_vdev_created = false; 8837 - } else if (ar->monitor_vdev_created && !ar->monitor_started) { 8838 - ret = ath12k_mac_monitor_vdev_delete(ar); 8839 8583 } 8840 8584 8841 8585 ath12k_dbg(ab, ATH12K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", ··· 9064 8812 */ 9065 8813 ar->rx_channel = ctx->def.chan; 9066 8814 spin_unlock_bh(&ar->data_lock); 8815 + ar->chan_tx_pwr = ATH12K_PDEV_TX_POWER_INVALID; 9067 8816 9068 8817 return 0; 9069 8818 } ··· 9093 8840 */ 9094 8841 ar->rx_channel = NULL; 9095 8842 spin_unlock_bh(&ar->data_lock); 8843 + ar->chan_tx_pwr = ATH12K_PDEV_TX_POWER_INVALID; 9096 8844 } 9097 8845 9098 8846 static enum wmi_phy_mode ··· 9185 8931 * link vdevs which are advertised as partners below 9186 8932 */ 9187 8933 ml_arg->link_add = true; 8934 + 8935 + ml_arg->assoc_link = arvif->is_sta_assoc_link; 8936 + 9188 8937 partner_info = ml_arg->partner_info; 9189 8938 9190 8939 links = ahvif->links_map; ··· 9528 9271 arvif = wiphy_dereference(ath12k_ar_to_hw(ar)->wiphy, 9529 9272 ahvif->link[link_id]); 9530 9273 9531 - if (vif->type == NL80211_IFTYPE_MONITOR) 9274 + if (vif->type == NL80211_IFTYPE_MONITOR) { 9532 9275 monitor_vif = true; 9276 + continue; 9277 + } 9533 9278 9534 9279 ath12k_dbg(ab, ATH12K_DBG_MAC, 9535 9280 "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", ··· 9681 9422 struct ath12k_base *ab = ar->ab; 9682 9423 struct ath12k_vif *ahvif = arvif->ahvif; 9683 9424 struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif); 9425 + struct ieee80211_chanctx_conf *chanctx; 9426 + struct ieee80211_bss_conf *link_conf; 9684 9427 int ret; 9685 9428 9686 9429 if (WARN_ON(arvif->is_started)) 9687 9430 return -EBUSY; 9688 9431 9689 - ret = ath12k_mac_vdev_start(arvif, &arvif->chanctx); 9432 + link_conf = ath12k_mac_get_link_bss_conf(arvif); 9433 + if (!link_conf) { 9434 + ath12k_warn(ab, "failed to get link conf for vdev %u\n", arvif->vdev_id); 9435 + return -EINVAL; 9436 + } 9437 + 9438 + chanctx = wiphy_dereference(ath12k_ar_to_hw(arvif->ar)->wiphy, 9439 + link_conf->chanctx_conf); 9440 + ret = ath12k_mac_vdev_start(arvif, chanctx); 9690 9441 if (ret) { 9691 9442 ath12k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n", 9692 9443 arvif->vdev_id, vif->addr, 9693 - arvif->chanctx.def.chan->center_freq, ret); 9444 + chanctx->def.chan->center_freq, ret); 9694 9445 return ret; 9695 9446 } 9696 9447 ··· 9745 9476 9746 9477 ar = ath12k_mac_assign_vif_to_vdev(hw, arvif, ctx); 9747 9478 if (!ar) { 9748 - ath12k_warn(arvif->ar->ab, "failed to assign chanctx for vif %pM link id %u link vif is already started", 9749 - vif->addr, link_id); 9479 + ath12k_hw_warn(ah, "failed to assign chanctx for vif %pM link id %u link vif is already started", 9480 + vif->addr, link_id); 9750 9481 return -EINVAL; 9751 9482 } 9752 9483 ··· 9763 9494 ahvif->vdev_type != WMI_VDEV_TYPE_AP && 9764 9495 ahvif->vdev_type != WMI_VDEV_TYPE_MONITOR && 9765 9496 !ath12k_peer_exist_by_vdev_id(ab, arvif->vdev_id)) { 9766 - memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); 9767 9497 ret = 0; 9768 9498 goto out; 9769 9499 } ··· 9774 9506 9775 9507 if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { 9776 9508 ret = ath12k_mac_monitor_start(ar); 9777 - if (ret) 9509 + if (ret) { 9510 + ath12k_mac_monitor_vdev_delete(ar); 9778 9511 goto out; 9512 + } 9779 9513 9780 9514 arvif->is_started = true; 9781 9515 goto out; ··· 9790 9520 ctx->def.chan->center_freq, ret); 9791 9521 goto out; 9792 9522 } 9793 - 9794 - if (ahvif->vdev_type != WMI_VDEV_TYPE_MONITOR && ar->monitor_vdev_created) 9795 - ath12k_mac_monitor_start(ar); 9796 9523 9797 9524 arvif->is_started = true; 9798 9525 ··· 9853 9586 } 9854 9587 arvif->is_started = false; 9855 9588 9856 - if (ahvif->vdev_type != WMI_VDEV_TYPE_MONITOR && 9857 - ar->num_started_vdevs == 1 && ar->monitor_vdev_created) 9858 - ath12k_mac_monitor_stop(ar); 9589 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && 9590 + ahvif->vdev_type == WMI_VDEV_TYPE_STA && 9591 + ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE && 9592 + ar->state_11d != ATH12K_11D_PREPARING) { 9593 + reinit_completion(&ar->completed_11d_scan); 9594 + ar->state_11d = ATH12K_11D_PREPARING; 9595 + } 9859 9596 } 9860 9597 9861 9598 static int ··· 10421 10150 ath12k_warn(ar->ab, "pdev %d successfully recovered\n", 10422 10151 ar->pdev->pdev_id); 10423 10152 10153 + if (ar->ab->hw_params->current_cc_support && 10154 + ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { 10155 + struct wmi_set_current_country_arg arg = {}; 10156 + 10157 + memcpy(&arg.alpha2, ar->alpha2, 2); 10158 + ath12k_wmi_send_set_current_country_cmd(ar, &arg); 10159 + } 10160 + 10424 10161 if (ab->is_reset) { 10425 10162 recovery_count = atomic_inc_return(&ab->recovery_count); 10426 10163 ··· 10560 10281 return 0; 10561 10282 } 10562 10283 10563 - static int ath12k_mac_get_fw_stats(struct ath12k *ar, u32 pdev_id, 10564 - u32 vdev_id, u32 stats_id) 10565 - { 10566 - struct ath12k_base *ab = ar->ab; 10567 - struct ath12k_hw *ah = ath12k_ar_to_ah(ar); 10568 - unsigned long time_left; 10569 - int ret; 10570 - 10571 - guard(mutex)(&ah->hw_mutex); 10572 - 10573 - if (ah->state != ATH12K_HW_STATE_ON) 10574 - return -ENETDOWN; 10575 - 10576 - reinit_completion(&ar->fw_stats_complete); 10577 - 10578 - ret = ath12k_wmi_send_stats_request_cmd(ar, stats_id, vdev_id, pdev_id); 10579 - 10580 - if (ret) { 10581 - ath12k_warn(ab, "failed to request fw stats: %d\n", ret); 10582 - return ret; 10583 - } 10584 - 10585 - ath12k_dbg(ab, ATH12K_DBG_WMI, 10586 - "get fw stat pdev id %d vdev id %d stats id 0x%x\n", 10587 - pdev_id, vdev_id, stats_id); 10588 - 10589 - time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1 * HZ); 10590 - 10591 - if (!time_left) 10592 - ath12k_warn(ab, "time out while waiting for get fw stats\n"); 10593 - 10594 - return ret; 10595 - } 10596 - 10597 10284 static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw, 10598 10285 struct ieee80211_vif *vif, 10599 10286 struct ieee80211_sta *sta, 10600 10287 struct station_info *sinfo) 10601 10288 { 10602 10289 struct ath12k_sta *ahsta = ath12k_sta_to_ahsta(sta); 10290 + struct ath12k_fw_stats_req_params params = {}; 10603 10291 struct ath12k_link_sta *arsta; 10604 10292 struct ath12k *ar; 10605 10293 s8 signal; ··· 10608 10362 /* TODO: Use real NF instead of default one. */ 10609 10363 signal = arsta->rssi_comb; 10610 10364 10365 + params.pdev_id = ar->pdev->pdev_id; 10366 + params.vdev_id = 0; 10367 + params.stats_id = WMI_REQUEST_VDEV_STAT; 10368 + 10611 10369 if (!signal && 10612 10370 ahsta->ahvif->vdev_type == WMI_VDEV_TYPE_STA && 10613 - !(ath12k_mac_get_fw_stats(ar, ar->pdev->pdev_id, 0, 10614 - WMI_REQUEST_VDEV_STAT))) 10371 + !(ath12k_mac_get_fw_stats(ar, &params))) 10615 10372 signal = arsta->rssi_beacon; 10616 10373 10617 10374 if (signal) { ··· 10674 10425 return -EINVAL; 10675 10426 10676 10427 /* check if any of the links of ML VIF is already started on 10677 - * radio(ar) correpsondig to given scan frequency and use it, 10428 + * radio(ar) corresponding to given scan frequency and use it, 10678 10429 * if not use deflink(link 0) for scan purpose. 10679 10430 */ 10680 10431 ··· 10858 10609 .assign_vif_chanctx = ath12k_mac_op_assign_vif_chanctx, 10859 10610 .unassign_vif_chanctx = ath12k_mac_op_unassign_vif_chanctx, 10860 10611 .switch_vif_chanctx = ath12k_mac_op_switch_vif_chanctx, 10612 + .get_txpower = ath12k_mac_op_get_txpower, 10861 10613 .set_rts_threshold = ath12k_mac_op_set_rts_threshold, 10862 10614 .set_frag_threshold = ath12k_mac_op_set_frag_threshold, 10863 10615 .set_bitrate_mask = ath12k_mac_op_set_bitrate_mask, ··· 10874 10624 .resume = ath12k_wow_op_resume, 10875 10625 .set_wakeup = ath12k_wow_op_set_wakeup, 10876 10626 #endif 10627 + #ifdef CONFIG_ATH12K_DEBUGFS 10628 + .vif_add_debugfs = ath12k_debugfs_op_vif_add, 10629 + #endif 10877 10630 CFG80211_TESTMODE_CMD(ath12k_tm_cmd) 10878 10631 #ifdef CONFIG_ATH12K_DEBUGFS 10879 10632 .link_sta_add_debugfs = ath12k_debugfs_link_sta_op_add, 10880 10633 #endif 10881 10634 }; 10635 + 10636 + void ath12k_mac_update_freq_range(struct ath12k *ar, 10637 + u32 freq_low, u32 freq_high) 10638 + { 10639 + if (!(freq_low && freq_high)) 10640 + return; 10641 + 10642 + ar->freq_range.start_freq = MHZ_TO_KHZ(freq_low); 10643 + ar->freq_range.end_freq = MHZ_TO_KHZ(freq_high); 10644 + } 10882 10645 10883 10646 static void ath12k_mac_update_ch_list(struct ath12k *ar, 10884 10647 struct ieee80211_supported_band *band, ··· 10907 10644 band->channels[i].center_freq > freq_high) 10908 10645 band->channels[i].flags |= IEEE80211_CHAN_DISABLED; 10909 10646 } 10910 - 10911 - ar->freq_range.start_freq = MHZ_TO_KHZ(freq_low); 10912 - ar->freq_range.end_freq = MHZ_TO_KHZ(freq_high); 10913 10647 } 10914 10648 10915 10649 static u32 ath12k_get_phy_id(struct ath12k *ar, u32 band) ··· 10914 10654 struct ath12k_pdev *pdev = ar->pdev; 10915 10655 struct ath12k_pdev_cap *pdev_cap = &pdev->cap; 10916 10656 10917 - if (band == WMI_HOST_WLAN_2G_CAP) 10657 + if (band == WMI_HOST_WLAN_2GHZ_CAP) 10918 10658 return pdev_cap->band[NL80211_BAND_2GHZ].phy_id; 10919 10659 10920 - if (band == WMI_HOST_WLAN_5G_CAP) 10660 + if (band == WMI_HOST_WLAN_5GHZ_CAP) 10921 10661 return pdev_cap->band[NL80211_BAND_5GHZ].phy_id; 10922 10662 10923 10663 ath12k_warn(ar->ab, "unsupported phy cap:%d\n", band); ··· 10931 10671 { 10932 10672 struct ieee80211_supported_band *band; 10933 10673 struct ath12k_wmi_hal_reg_capabilities_ext_arg *reg_cap; 10674 + struct ath12k_base *ab = ar->ab; 10675 + u32 phy_id, freq_low, freq_high; 10934 10676 struct ath12k_hw *ah = ar->ah; 10935 10677 void *channels; 10936 - u32 phy_id; 10937 10678 10938 10679 BUILD_BUG_ON((ARRAY_SIZE(ath12k_2ghz_channels) + 10939 10680 ARRAY_SIZE(ath12k_5ghz_channels) + 10940 10681 ARRAY_SIZE(ath12k_6ghz_channels)) != 10941 10682 ATH12K_NUM_CHANS); 10942 10683 10943 - reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; 10684 + reg_cap = &ab->hal_reg_cap[ar->pdev_idx]; 10944 10685 10945 - if (supported_bands & WMI_HOST_WLAN_2G_CAP) { 10686 + if (supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 10946 10687 channels = kmemdup(ath12k_2ghz_channels, 10947 10688 sizeof(ath12k_2ghz_channels), 10948 10689 GFP_KERNEL); ··· 10958 10697 band->bitrates = ath12k_g_rates; 10959 10698 bands[NL80211_BAND_2GHZ] = band; 10960 10699 10961 - if (ar->ab->hw_params->single_pdev_only) { 10962 - phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_2G_CAP); 10963 - reg_cap = &ar->ab->hal_reg_cap[phy_id]; 10700 + if (ab->hw_params->single_pdev_only) { 10701 + phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_2GHZ_CAP); 10702 + reg_cap = &ab->hal_reg_cap[phy_id]; 10964 10703 } 10704 + 10705 + freq_low = max(reg_cap->low_2ghz_chan, 10706 + ab->reg_freq_2ghz.start_freq); 10707 + freq_high = min(reg_cap->high_2ghz_chan, 10708 + ab->reg_freq_2ghz.end_freq); 10709 + 10965 10710 ath12k_mac_update_ch_list(ar, band, 10966 10711 reg_cap->low_2ghz_chan, 10967 10712 reg_cap->high_2ghz_chan); 10713 + 10714 + ath12k_mac_update_freq_range(ar, freq_low, freq_high); 10968 10715 } 10969 10716 10970 - if (supported_bands & WMI_HOST_WLAN_5G_CAP) { 10971 - if (reg_cap->high_5ghz_chan >= ATH12K_MIN_6G_FREQ) { 10717 + if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP) { 10718 + if (reg_cap->high_5ghz_chan >= ATH12K_MIN_6GHZ_FREQ) { 10972 10719 channels = kmemdup(ath12k_6ghz_channels, 10973 10720 sizeof(ath12k_6ghz_channels), GFP_KERNEL); 10974 10721 if (!channels) { ··· 10992 10723 band->n_bitrates = ath12k_a_rates_size; 10993 10724 band->bitrates = ath12k_a_rates; 10994 10725 bands[NL80211_BAND_6GHZ] = band; 10726 + 10727 + freq_low = max(reg_cap->low_5ghz_chan, 10728 + ab->reg_freq_6ghz.start_freq); 10729 + freq_high = min(reg_cap->high_5ghz_chan, 10730 + ab->reg_freq_6ghz.end_freq); 10731 + 10995 10732 ath12k_mac_update_ch_list(ar, band, 10996 10733 reg_cap->low_5ghz_chan, 10997 10734 reg_cap->high_5ghz_chan); 10735 + 10736 + ath12k_mac_update_freq_range(ar, freq_low, freq_high); 10998 10737 ah->use_6ghz_regd = true; 10999 10738 } 11000 10739 11001 - if (reg_cap->low_5ghz_chan < ATH12K_MIN_6G_FREQ) { 10740 + if (reg_cap->low_5ghz_chan < ATH12K_MIN_6GHZ_FREQ) { 11002 10741 channels = kmemdup(ath12k_5ghz_channels, 11003 10742 sizeof(ath12k_5ghz_channels), 11004 10743 GFP_KERNEL); ··· 11024 10747 band->bitrates = ath12k_a_rates; 11025 10748 bands[NL80211_BAND_5GHZ] = band; 11026 10749 11027 - if (ar->ab->hw_params->single_pdev_only) { 11028 - phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_5G_CAP); 11029 - reg_cap = &ar->ab->hal_reg_cap[phy_id]; 10750 + if (ab->hw_params->single_pdev_only) { 10751 + phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_5GHZ_CAP); 10752 + reg_cap = &ab->hal_reg_cap[phy_id]; 11030 10753 } 10754 + 10755 + freq_low = max(reg_cap->low_5ghz_chan, 10756 + ab->reg_freq_5ghz.start_freq); 10757 + freq_high = min(reg_cap->high_5ghz_chan, 10758 + ab->reg_freq_5ghz.end_freq); 11031 10759 11032 10760 ath12k_mac_update_ch_list(ar, band, 11033 10761 reg_cap->low_5ghz_chan, 11034 10762 reg_cap->high_5ghz_chan); 10763 + 10764 + ath12k_mac_update_freq_range(ar, freq_low, freq_high); 11035 10765 } 11036 10766 } 11037 10767 ··· 11138 10854 comb[0].limits = limits; 11139 10855 comb[0].n_limits = n_limits; 11140 10856 comb[0].max_interfaces = max_interfaces; 11141 - comb[0].num_different_channels = 1; 11142 10857 comb[0].beacon_int_infra_match = true; 11143 10858 comb[0].beacon_int_min_gcd = 100; 11144 - comb[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | 11145 - BIT(NL80211_CHAN_WIDTH_20) | 11146 - BIT(NL80211_CHAN_WIDTH_40) | 11147 - BIT(NL80211_CHAN_WIDTH_80); 10859 + 10860 + if (ar->ab->hw_params->single_pdev_only) { 10861 + comb[0].num_different_channels = 2; 10862 + } else { 10863 + comb[0].num_different_channels = 1; 10864 + comb[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | 10865 + BIT(NL80211_CHAN_WIDTH_20) | 10866 + BIT(NL80211_CHAN_WIDTH_40) | 10867 + BIT(NL80211_CHAN_WIDTH_80); 10868 + } 11148 10869 11149 10870 return 0; 11150 10871 } ··· 11522 11233 ieee80211_hw_set(hw, QUEUE_CONTROL); 11523 11234 ieee80211_hw_set(hw, SUPPORTS_TX_FRAG); 11524 11235 ieee80211_hw_set(hw, REPORTS_LOW_ACK); 11236 + ieee80211_hw_set(hw, NO_VIRTUAL_MONITOR); 11525 11237 11526 11238 if ((ht_cap & WMI_HT_CAP_ENABLED) || is_6ghz) { 11527 11239 ieee80211_hw_set(hw, AMPDU_AGGREGATION); ··· 11651 11361 goto err_unregister_hw; 11652 11362 } 11653 11363 11364 + ath12k_fw_stats_init(ar); 11654 11365 ath12k_debugfs_register(ar); 11655 11366 } 11656 - 11657 - init_completion(&ar->fw_stats_complete); 11658 11367 11659 11368 return 0; 11660 11369 ··· 11699 11410 ar->num_tx_chains = hweight32(pdev->cap.tx_chain_mask); 11700 11411 ar->num_rx_chains = hweight32(pdev->cap.rx_chain_mask); 11701 11412 ar->scan.arvif = NULL; 11413 + ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; 11702 11414 11703 11415 spin_lock_init(&ar->data_lock); 11704 11416 INIT_LIST_HEAD(&ar->arvifs); ··· 11715 11425 init_completion(&ar->scan.completed); 11716 11426 init_completion(&ar->scan.on_channel); 11717 11427 init_completion(&ar->mlo_setup_done); 11428 + init_completion(&ar->completed_11d_scan); 11718 11429 11719 11430 INIT_DELAYED_WORK(&ar->scan.timeout, ath12k_scan_timeout_work); 11720 11431 wiphy_work_init(&ar->scan.vdev_clean_wk, ath12k_scan_vdev_clean_work); ··· 11723 11432 11724 11433 wiphy_work_init(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work); 11725 11434 skb_queue_head_init(&ar->wmi_mgmt_tx_queue); 11435 + 11436 + ar->monitor_vdev_id = -1; 11437 + ar->monitor_vdev_created = false; 11438 + ar->monitor_started = false; 11726 11439 } 11727 11440 11728 11441 static int __ath12k_mac_mlo_setup(struct ath12k *ar) ··· 11881 11586 11882 11587 int ath12k_mac_register(struct ath12k_hw_group *ag) 11883 11588 { 11884 - struct ath12k_base *ab = ag->ab[0]; 11885 11589 struct ath12k_hw *ah; 11886 11590 int i; 11887 11591 int ret; ··· 11892 11598 if (ret) 11893 11599 goto err; 11894 11600 } 11895 - 11896 - set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 11897 11601 11898 11602 return 0; 11899 11603 ··· 11909 11617 11910 11618 void ath12k_mac_unregister(struct ath12k_hw_group *ag) 11911 11619 { 11912 - struct ath12k_base *ab = ag->ab[0]; 11913 11620 struct ath12k_hw *ah; 11914 11621 int i; 11915 - 11916 - clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 11917 11622 11918 11623 for (i = ag->num_hw - 1; i >= 0; i--) { 11919 11624 ah = ath12k_ag_to_ah(ag, i);
+13
drivers/net/wireless/ath/ath12k/mac.h
··· 33 33 #define ATH12K_KEEPALIVE_MAX_IDLE 3895 34 34 #define ATH12K_KEEPALIVE_MAX_UNRESPONSIVE 3900 35 35 36 + #define ATH12K_PDEV_TX_POWER_INVALID ((u32)-1) 37 + #define ATH12K_PDEV_TX_POWER_REFRESH_TIME_MSECS 5000 /* msecs */ 38 + 36 39 /* FIXME: should these be in ieee80211.h? */ 37 40 #define IEEE80211_VHT_MCS_SUPPORT_0_11_MASK GENMASK(23, 16) 38 41 #define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11 BIT(24) ··· 68 65 }; 69 66 70 67 extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default; 68 + 69 + #define ATH12K_SCAN_11D_INTERVAL 600000 70 + #define ATH12K_11D_INVALID_VDEV_ID 0xFFFF 71 + 72 + void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id); 73 + void ath12k_mac_11d_scan_stop(struct ath12k *ar); 74 + void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab); 71 75 72 76 void ath12k_mac_destroy(struct ath12k_hw_group *ag); 73 77 void ath12k_mac_unregister(struct ath12k_hw_group *ag); ··· 125 115 struct ath12k *ath12k_get_ar_by_vif(struct ieee80211_hw *hw, 126 116 struct ieee80211_vif *vif, 127 117 u8 link_id); 118 + int ath12k_mac_get_fw_stats(struct ath12k *ar, struct ath12k_fw_stats_req_params *param); 119 + void ath12k_mac_update_freq_range(struct ath12k *ar, 120 + u32 freq_low, u32 freq_high); 128 121 #endif
+6 -3
drivers/net/wireless/ath/ath12k/mhi.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 2 /* 3 3 * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include <linux/msi.h> ··· 285 285 break; 286 286 } 287 287 288 - if (!(test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags))) 288 + if (!(test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags))) { 289 + set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); 290 + set_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); 289 291 queue_work(ab->workqueue_aux, &ab->reset_work); 292 + } 290 293 break; 291 294 default: 292 295 break; ··· 382 379 mhi_ctrl->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; 383 380 384 381 mhi_ctrl->iova_start = 0; 385 - mhi_ctrl->iova_stop = 0xffffffff; 382 + mhi_ctrl->iova_stop = ab_pci->dma_mask; 386 383 mhi_ctrl->sbl_size = SZ_512K; 387 384 mhi_ctrl->seg_len = SZ_512K; 388 385 mhi_ctrl->fbc_download = true;
+36 -22
drivers/net/wireless/ath/ath12k/pci.c
··· 17 17 #include "debug.h" 18 18 19 19 #define ATH12K_PCI_BAR_NUM 0 20 - #define ATH12K_PCI_DMA_MASK 32 20 + #define ATH12K_PCI_DMA_MASK 36 21 21 22 22 #define ATH12K_PCI_IRQ_CE0_OFFSET 3 23 23 ··· 718 718 cfg->svc_to_ce_map_len = ab->hw_params->svc_to_ce_map_len; 719 719 ab->qmi.service_ins_id = ab->hw_params->qmi_service_ins_id; 720 720 721 - if (test_bit(ATH12K_FW_FEATURE_MULTI_QRTR_ID, ab->fw.fw_features)) { 721 + if (ath12k_fw_feature_supported(ab, ATH12K_FW_FEATURE_MULTI_QRTR_ID)) { 722 722 ab_pci->qmi_instance = 723 723 u32_encode_bits(pci_domain_nr(bus), DOMAIN_NUMBER_MASK) | 724 724 u32_encode_bits(bus->number, BUS_NUMBER_MASK); ··· 877 877 goto disable_device; 878 878 } 879 879 880 - ret = dma_set_mask_and_coherent(&pdev->dev, 881 - DMA_BIT_MASK(ATH12K_PCI_DMA_MASK)); 882 - if (ret) { 883 - ath12k_err(ab, "failed to set pci dma mask to %d: %d\n", 884 - ATH12K_PCI_DMA_MASK, ret); 885 - goto release_region; 886 - } 880 + ab_pci->dma_mask = DMA_BIT_MASK(ATH12K_PCI_DMA_MASK); 881 + dma_set_mask(&pdev->dev, ab_pci->dma_mask); 882 + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 887 883 888 884 pci_set_master(pdev); 889 885 ··· 1468 1472 1469 1473 ath12k_pci_msi_enable(ab_pci); 1470 1474 1471 - if (test_bit(ATH12K_FW_FEATURE_MULTI_QRTR_ID, ab->fw.fw_features)) 1475 + if (ath12k_fw_feature_supported(ab, ATH12K_FW_FEATURE_MULTI_QRTR_ID)) 1472 1476 ath12k_pci_update_qrtr_node_id(ab); 1473 1477 1474 1478 ret = ath12k_mhi_start(ab_pci); ··· 1486 1490 void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend) 1487 1491 { 1488 1492 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); 1493 + 1494 + if (!test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags)) 1495 + return; 1489 1496 1490 1497 /* restore aspm in case firmware bootup fails */ 1491 1498 ath12k_pci_aspm_restore(ab_pci); ··· 1709 1710 err_mhi_unregister: 1710 1711 ath12k_mhi_unregister(ab_pci); 1711 1712 1712 - err_pci_msi_free: 1713 - ath12k_pci_msi_free(ab_pci); 1714 - 1715 1713 err_irq_affinity_cleanup: 1716 1714 ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); 1715 + 1716 + err_pci_msi_free: 1717 + ath12k_pci_msi_free(ab_pci); 1717 1718 1718 1719 err_pci_free_region: 1719 1720 ath12k_pci_free_region(ab_pci); ··· 1757 1758 ath12k_core_free(ab); 1758 1759 } 1759 1760 1761 + static void ath12k_pci_hw_group_power_down(struct ath12k_hw_group *ag) 1762 + { 1763 + struct ath12k_base *ab; 1764 + int i; 1765 + 1766 + if (!ag) 1767 + return; 1768 + 1769 + mutex_lock(&ag->mutex); 1770 + 1771 + for (i = 0; i < ag->num_devices; i++) { 1772 + ab = ag->ab[i]; 1773 + if (!ab) 1774 + continue; 1775 + 1776 + ath12k_pci_power_down(ab, false); 1777 + } 1778 + 1779 + mutex_unlock(&ag->mutex); 1780 + } 1781 + 1760 1782 static void ath12k_pci_shutdown(struct pci_dev *pdev) 1761 1783 { 1762 1784 struct ath12k_base *ab = pci_get_drvdata(pdev); 1763 1785 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); 1764 1786 1765 1787 ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); 1766 - ath12k_pci_power_down(ab, false); 1788 + ath12k_pci_hw_group_power_down(ab->ag); 1767 1789 } 1768 1790 1769 1791 static __maybe_unused int ath12k_pci_pm_suspend(struct device *dev) ··· 1851 1831 .driver.pm = &ath12k_pci_pm_ops, 1852 1832 }; 1853 1833 1854 - static int ath12k_pci_init(void) 1834 + int ath12k_pci_init(void) 1855 1835 { 1856 1836 int ret; 1857 1837 ··· 1864 1844 1865 1845 return 0; 1866 1846 } 1867 - module_init(ath12k_pci_init); 1868 1847 1869 - static void ath12k_pci_exit(void) 1848 + void ath12k_pci_exit(void) 1870 1849 { 1871 1850 pci_unregister_driver(&ath12k_pci_driver); 1872 1851 } 1873 - 1874 - module_exit(ath12k_pci_exit); 1875 - 1876 - MODULE_DESCRIPTION("Driver support for Qualcomm Technologies PCIe 802.11be WLAN devices"); 1877 - MODULE_LICENSE("Dual BSD/GPL");
+4 -1
drivers/net/wireless/ath/ath12k/pci.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 2 /* 3 3 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. 4 - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 #ifndef ATH12K_PCI_H 7 7 #define ATH12K_PCI_H ··· 116 116 unsigned long irq_flags; 117 117 const struct ath12k_pci_ops *pci_ops; 118 118 u32 qmi_instance; 119 + u64 dma_mask; 119 120 }; 120 121 121 122 static inline struct ath12k_pci *ath12k_pci_priv(struct ath12k_base *ab) ··· 146 145 int ath12k_pci_start(struct ath12k_base *ab); 147 146 int ath12k_pci_power_up(struct ath12k_base *ab); 148 147 void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend); 148 + int ath12k_pci_init(void); 149 + void ath12k_pci_exit(void); 149 150 #endif /* ATH12K_PCI_H */
+4 -1
drivers/net/wireless/ath/ath12k/peer.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-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #include "core.h" ··· 382 382 arvif->ast_hash = peer->ast_hash; 383 383 arvif->ast_idx = peer->hw_peer_id; 384 384 } 385 + 386 + if (vif->type == NL80211_IFTYPE_AP) 387 + peer->ucast_ra_only = true; 385 388 386 389 if (sta) { 387 390 ahsta = ath12k_sta_to_ahsta(sta);
+2 -1
drivers/net/wireless/ath/ath12k/peer.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_PEER_H ··· 62 62 63 63 /* for reference to ath12k_link_sta */ 64 64 u8 link_id; 65 + bool ucast_ra_only; 65 66 }; 66 67 67 68 struct ath12k_ml_peer {
+210 -28
drivers/net/wireless/ath/ath12k/qmi.c
··· 11 11 #include "debug.h" 12 12 #include <linux/of.h> 13 13 #include <linux/firmware.h> 14 + #include <linux/of_address.h> 15 + #include <linux/ioport.h> 14 16 15 17 #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 16 18 #define HOST_CSTATE_BIT 0x04 ··· 2170 2168 req.bdf_support_valid = 1; 2171 2169 req.bdf_support = 1; 2172 2170 2173 - req.m3_support_valid = 1; 2174 - req.m3_support = 1; 2175 - req.m3_cache_support_valid = 1; 2176 - req.m3_cache_support = 1; 2171 + if (ab->hw_params->fw.m3_loader == ath12k_m3_fw_loader_driver) { 2172 + req.m3_support_valid = 1; 2173 + req.m3_support = 1; 2174 + req.m3_cache_support_valid = 1; 2175 + req.m3_cache_support = 1; 2176 + } 2177 2177 2178 2178 req.cal_done_valid = 1; 2179 2179 req.cal_done = ab->qmi.cal_done; ··· 2268 2264 goto out; 2269 2265 } 2270 2266 2267 + if (resp.single_chip_mlo_support_valid && resp.single_chip_mlo_support) 2268 + ab->single_chip_mlo_support = true; 2269 + 2271 2270 if (!resp.num_phy_valid) { 2272 2271 ret = -ENODATA; 2273 2272 goto out; ··· 2279 2272 ab->qmi.num_radios = resp.num_phy; 2280 2273 2281 2274 ath12k_dbg(ab, ATH12K_DBG_QMI, 2282 - "phy capability resp valid %d num_phy %d valid %d board_id %d\n", 2275 + "phy capability resp valid %d single_chip_mlo_support %d valid %d num_phy %d valid %d board_id %d\n", 2276 + resp.single_chip_mlo_support_valid, resp.single_chip_mlo_support, 2283 2277 resp.num_phy_valid, resp.num_phy, 2284 2278 resp.board_id_valid, resp.board_id); 2285 2279 ··· 2384 2376 * failure to firmware and firmware then request multiple blocks of 2385 2377 * small chunk size memory. 2386 2378 */ 2387 - if (ab->qmi.target_mem_delayed) { 2379 + if (!test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags) && 2380 + ab->qmi.target_mem_delayed) { 2388 2381 delayed = true; 2389 2382 ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi delays mem_request %d\n", 2390 2383 ab->qmi.mem_seg_count); ··· 2443 2434 return ret; 2444 2435 } 2445 2436 2437 + void ath12k_qmi_reset_mlo_mem(struct ath12k_hw_group *ag) 2438 + { 2439 + struct target_mem_chunk *mlo_chunk; 2440 + int i; 2441 + 2442 + lockdep_assert_held(&ag->mutex); 2443 + 2444 + if (!ag->mlo_mem.init_done || ag->num_started) 2445 + return; 2446 + 2447 + for (i = 0; i < ARRAY_SIZE(ag->mlo_mem.chunk); i++) { 2448 + mlo_chunk = &ag->mlo_mem.chunk[i]; 2449 + 2450 + if (mlo_chunk->v.addr) 2451 + /* TODO: Mode 0 recovery is the default mode hence resetting the 2452 + * whole memory region for now. Once Mode 1 support is added, this 2453 + * needs to be handled properly 2454 + */ 2455 + memset(mlo_chunk->v.addr, 0, mlo_chunk->size); 2456 + } 2457 + } 2458 + 2446 2459 static void ath12k_qmi_free_mlo_mem_chunk(struct ath12k_base *ab, 2447 2460 struct target_mem_chunk *chunk, 2448 2461 int idx) 2449 2462 { 2450 2463 struct ath12k_hw_group *ag = ab->ag; 2451 2464 struct target_mem_chunk *mlo_chunk; 2465 + bool fixed_mem; 2452 2466 2453 2467 lockdep_assert_held(&ag->mutex); 2454 2468 ··· 2483 2451 return; 2484 2452 } 2485 2453 2454 + fixed_mem = test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags); 2486 2455 mlo_chunk = &ag->mlo_mem.chunk[idx]; 2487 - if (mlo_chunk->v.addr) { 2456 + 2457 + if (fixed_mem && mlo_chunk->v.ioaddr) { 2458 + iounmap(mlo_chunk->v.ioaddr); 2459 + mlo_chunk->v.ioaddr = NULL; 2460 + } else if (mlo_chunk->v.addr) { 2488 2461 dma_free_coherent(ab->dev, 2489 2462 mlo_chunk->size, 2490 2463 mlo_chunk->v.addr, ··· 2499 2462 2500 2463 mlo_chunk->paddr = 0; 2501 2464 mlo_chunk->size = 0; 2502 - chunk->v.addr = NULL; 2465 + if (fixed_mem) 2466 + chunk->v.ioaddr = NULL; 2467 + else 2468 + chunk->v.addr = NULL; 2503 2469 chunk->paddr = 0; 2504 2470 chunk->size = 0; 2505 2471 } ··· 2513 2473 int i, mlo_idx; 2514 2474 2515 2475 for (i = 0, mlo_idx = 0; i < ab->qmi.mem_seg_count; i++) { 2516 - if (!ab->qmi.target_mem[i].v.addr) 2517 - continue; 2518 - 2519 2476 if (ab->qmi.target_mem[i].type == MLO_GLOBAL_MEM_REGION_TYPE) { 2520 2477 ath12k_qmi_free_mlo_mem_chunk(ab, 2521 2478 &ab->qmi.target_mem[i], 2522 2479 mlo_idx++); 2523 2480 } else { 2524 - dma_free_coherent(ab->dev, 2525 - ab->qmi.target_mem[i].prev_size, 2526 - ab->qmi.target_mem[i].v.addr, 2527 - ab->qmi.target_mem[i].paddr); 2528 - ab->qmi.target_mem[i].v.addr = NULL; 2481 + if (test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags) && 2482 + ab->qmi.target_mem[i].v.ioaddr) { 2483 + iounmap(ab->qmi.target_mem[i].v.ioaddr); 2484 + ab->qmi.target_mem[i].v.ioaddr = NULL; 2485 + } else { 2486 + if (!ab->qmi.target_mem[i].v.addr) 2487 + continue; 2488 + dma_free_coherent(ab->dev, 2489 + ab->qmi.target_mem[i].prev_size, 2490 + ab->qmi.target_mem[i].v.addr, 2491 + ab->qmi.target_mem[i].paddr); 2492 + ab->qmi.target_mem[i].v.addr = NULL; 2493 + } 2529 2494 } 2530 2495 } 2531 2496 ··· 2680 2635 if (ret == -EAGAIN) 2681 2636 ret = 0; 2682 2637 2638 + return ret; 2639 + } 2640 + 2641 + static int ath12k_qmi_assign_target_mem_chunk(struct ath12k_base *ab) 2642 + { 2643 + struct reserved_mem *rmem; 2644 + size_t avail_rmem_size; 2645 + int i, idx, ret; 2646 + 2647 + for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) { 2648 + switch (ab->qmi.target_mem[i].type) { 2649 + case HOST_DDR_REGION_TYPE: 2650 + rmem = ath12k_core_get_reserved_mem(ab, 0); 2651 + if (!rmem) { 2652 + ret = -ENODEV; 2653 + goto out; 2654 + } 2655 + 2656 + avail_rmem_size = rmem->size; 2657 + if (avail_rmem_size < ab->qmi.target_mem[i].size) { 2658 + ath12k_dbg(ab, ATH12K_DBG_QMI, 2659 + "failed to assign mem type %u req size %u avail size %zu\n", 2660 + ab->qmi.target_mem[i].type, 2661 + ab->qmi.target_mem[i].size, 2662 + avail_rmem_size); 2663 + ret = -EINVAL; 2664 + goto out; 2665 + } 2666 + 2667 + ab->qmi.target_mem[idx].paddr = rmem->base; 2668 + ab->qmi.target_mem[idx].v.ioaddr = 2669 + ioremap(ab->qmi.target_mem[idx].paddr, 2670 + ab->qmi.target_mem[i].size); 2671 + if (!ab->qmi.target_mem[idx].v.ioaddr) { 2672 + ret = -EIO; 2673 + goto out; 2674 + } 2675 + ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; 2676 + ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; 2677 + idx++; 2678 + break; 2679 + case BDF_MEM_REGION_TYPE: 2680 + rmem = ath12k_core_get_reserved_mem(ab, 0); 2681 + if (!rmem) { 2682 + ret = -ENODEV; 2683 + goto out; 2684 + } 2685 + 2686 + avail_rmem_size = rmem->size - ab->hw_params->bdf_addr_offset; 2687 + if (avail_rmem_size < ab->qmi.target_mem[i].size) { 2688 + ath12k_dbg(ab, ATH12K_DBG_QMI, 2689 + "failed to assign mem type %u req size %u avail size %zu\n", 2690 + ab->qmi.target_mem[i].type, 2691 + ab->qmi.target_mem[i].size, 2692 + avail_rmem_size); 2693 + ret = -EINVAL; 2694 + goto out; 2695 + } 2696 + ab->qmi.target_mem[idx].paddr = 2697 + rmem->base + ab->hw_params->bdf_addr_offset; 2698 + ab->qmi.target_mem[idx].v.ioaddr = 2699 + ioremap(ab->qmi.target_mem[idx].paddr, 2700 + ab->qmi.target_mem[i].size); 2701 + if (!ab->qmi.target_mem[idx].v.ioaddr) { 2702 + ret = -EIO; 2703 + goto out; 2704 + } 2705 + ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; 2706 + ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; 2707 + idx++; 2708 + break; 2709 + case CALDB_MEM_REGION_TYPE: 2710 + /* Cold boot calibration is not enabled in Ath12k. Hence, 2711 + * assign paddr = 0. 2712 + * Once cold boot calibration is enabled add support to 2713 + * assign reserved memory from DT. 2714 + */ 2715 + ab->qmi.target_mem[idx].paddr = 0; 2716 + ab->qmi.target_mem[idx].v.ioaddr = NULL; 2717 + ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; 2718 + ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; 2719 + idx++; 2720 + break; 2721 + case M3_DUMP_REGION_TYPE: 2722 + rmem = ath12k_core_get_reserved_mem(ab, 1); 2723 + if (!rmem) { 2724 + ret = -EINVAL; 2725 + goto out; 2726 + } 2727 + 2728 + avail_rmem_size = rmem->size; 2729 + if (avail_rmem_size < ab->qmi.target_mem[i].size) { 2730 + ath12k_dbg(ab, ATH12K_DBG_QMI, 2731 + "failed to assign mem type %u req size %u avail size %zu\n", 2732 + ab->qmi.target_mem[i].type, 2733 + ab->qmi.target_mem[i].size, 2734 + avail_rmem_size); 2735 + ret = -EINVAL; 2736 + goto out; 2737 + } 2738 + 2739 + ab->qmi.target_mem[idx].paddr = rmem->base; 2740 + ab->qmi.target_mem[idx].v.ioaddr = 2741 + ioremap(ab->qmi.target_mem[idx].paddr, 2742 + ab->qmi.target_mem[i].size); 2743 + if (!ab->qmi.target_mem[idx].v.ioaddr) { 2744 + ret = -EIO; 2745 + goto out; 2746 + } 2747 + ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; 2748 + ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; 2749 + idx++; 2750 + break; 2751 + default: 2752 + ath12k_warn(ab, "qmi ignore invalid mem req type %u\n", 2753 + ab->qmi.target_mem[i].type); 2754 + break; 2755 + } 2756 + } 2757 + ab->qmi.mem_seg_count = idx; 2758 + 2759 + return 0; 2760 + out: 2761 + ath12k_qmi_free_target_mem_chunk(ab); 2683 2762 return ret; 2684 2763 } 2685 2764 ··· 3108 2939 { 3109 2940 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 3110 2941 2942 + if (ab->hw_params->fw.m3_loader == ath12k_m3_fw_loader_remoteproc) 2943 + return; 2944 + 3111 2945 if (!m3_mem->vaddr) 3112 2946 return; 3113 2947 ··· 3191 3019 struct qmi_txn txn; 3192 3020 int ret = 0; 3193 3021 3194 - ret = ath12k_qmi_m3_load(ab); 3195 - if (ret) { 3196 - ath12k_err(ab, "failed to load m3 firmware: %d", ret); 3197 - return ret; 3022 + if (ab->hw_params->fw.m3_loader == ath12k_m3_fw_loader_driver) { 3023 + ret = ath12k_qmi_m3_load(ab); 3024 + if (ret) { 3025 + ath12k_err(ab, "failed to load m3 firmware: %d", ret); 3026 + return ret; 3027 + } 3028 + req.addr = m3_mem->paddr; 3029 + req.size = m3_mem->size; 3198 3030 } 3199 - 3200 - req.addr = m3_mem->paddr; 3201 - req.size = m3_mem->size; 3202 3031 3203 3032 ret = qmi_txn_init(&ab->qmi.handle, &txn, 3204 3033 qmi_wlanfw_m3_info_resp_msg_v01_ei, &resp); ··· 3650 3477 msg->mem_seg[i].type, msg->mem_seg[i].size); 3651 3478 } 3652 3479 3653 - ret = ath12k_qmi_alloc_target_mem_chunk(ab); 3654 - if (ret) { 3655 - ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", 3656 - ret); 3657 - return; 3480 + if (test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags)) { 3481 + ret = ath12k_qmi_assign_target_mem_chunk(ab); 3482 + if (ret) { 3483 + ath12k_warn(ab, "failed to assign qmi target memory: %d\n", 3484 + ret); 3485 + return; 3486 + } 3487 + } else { 3488 + ret = ath12k_qmi_alloc_target_mem_chunk(ab); 3489 + if (ret) { 3490 + ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", 3491 + ret); 3492 + return; 3493 + } 3658 3494 } 3659 3495 3660 3496 ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_REQUEST_MEM, NULL);
+4 -1
drivers/net/wireless/ath/ath12k/qmi.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 7 7 #ifndef ATH12K_QMI_H ··· 21 21 #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850 0x1 22 22 23 23 #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274 0x07 24 + #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332 0x2 24 25 #define ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 32 25 26 #define ATH12K_QMI_RESP_LEN_MAX 8192 26 27 #define ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 52 ··· 42 41 #define ATH12K_BOARD_ID_DEFAULT 0xFF 43 42 44 43 struct ath12k_base; 44 + struct ath12k_hw_group; 45 45 46 46 enum ath12k_qmi_file_type { 47 47 ATH12K_QMI_FILE_TYPE_BDF_GOLDEN = 0, ··· 623 621 int ath12k_qmi_init_service(struct ath12k_base *ab); 624 622 void ath12k_qmi_free_resource(struct ath12k_base *ab); 625 623 void ath12k_qmi_trigger_host_cap(struct ath12k_base *ab); 624 + void ath12k_qmi_reset_mlo_mem(struct ath12k_hw_group *ag); 626 625 627 626 #endif
+147 -30
drivers/net/wireless/ath/ath12k/reg.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. 5 5 */ 6 6 #include <linux/rtnetlink.h> 7 7 #include "core.h" 8 8 #include "debug.h" 9 + #include "mac.h" 9 10 10 11 /* World regdom to be used in case default regd from fw is unavailable */ 11 12 #define ATH12K_2GHZ_CH01_11 REG_RULE(2412 - 10, 2462 + 10, 40, 0, 20, 0) ··· 49 48 { 50 49 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 51 50 struct ath12k_wmi_init_country_arg arg; 51 + struct wmi_set_current_country_arg current_arg = {}; 52 52 struct ath12k_hw *ah = ath12k_hw_to_ah(hw); 53 53 struct ath12k *ar = ath12k_ah_to_ar(ah, 0); 54 54 int ret, i; 55 55 56 56 ath12k_dbg(ar->ab, ATH12K_DBG_REG, 57 57 "Regulatory Notification received for %s\n", wiphy_name(wiphy)); 58 + 59 + if (request->initiator == NL80211_REGDOM_SET_BY_DRIVER) { 60 + ath12k_dbg(ar->ab, ATH12K_DBG_REG, 61 + "driver initiated regd update\n"); 62 + if (ah->state != ATH12K_HW_STATE_ON) 63 + return; 64 + 65 + for_each_ar(ah, ar, i) { 66 + ret = ath12k_reg_update_chan_list(ar, true); 67 + if (ret) { 68 + ath12k_warn(ar->ab, 69 + "failed to update chan list for pdev %u, ret %d\n", 70 + i, ret); 71 + break; 72 + } 73 + } 74 + return; 75 + } 58 76 59 77 /* Currently supporting only General User Hints. Cell base user 60 78 * hints to be handled later. ··· 97 77 return; 98 78 } 99 79 100 - /* Set the country code to the firmware and wait for 101 - * the WMI_REG_CHAN_LIST_CC EVENT for updating the 102 - * reg info 103 - */ 104 - arg.flags = ALPHA_IS_SET; 105 - memcpy(&arg.cc_info.alpha2, request->alpha2, 2); 106 - arg.cc_info.alpha2[2] = 0; 107 - 108 80 /* Allow fresh updates to wiphy regd */ 109 81 ah->regd_updated = false; 110 82 111 83 /* Send the reg change request to all the radios */ 112 84 for_each_ar(ah, ar, i) { 113 - ret = ath12k_wmi_send_init_country_cmd(ar, &arg); 114 - if (ret) 115 - ath12k_warn(ar->ab, 116 - "INIT Country code set to fw failed : %d\n", ret); 85 + if (ar->ab->hw_params->current_cc_support) { 86 + memcpy(&current_arg.alpha2, request->alpha2, 2); 87 + memcpy(&ar->alpha2, &current_arg.alpha2, 2); 88 + ret = ath12k_wmi_send_set_current_country_cmd(ar, &current_arg); 89 + if (ret) 90 + ath12k_warn(ar->ab, 91 + "failed set current country code: %d\n", ret); 92 + } else { 93 + arg.flags = ALPHA_IS_SET; 94 + memcpy(&arg.cc_info.alpha2, request->alpha2, 2); 95 + arg.cc_info.alpha2[2] = 0; 96 + 97 + ret = ath12k_wmi_send_init_country_cmd(ar, &arg); 98 + if (ret) 99 + ath12k_warn(ar->ab, 100 + "failed set INIT Country code: %d\n", ret); 101 + } 102 + 103 + wiphy_lock(wiphy); 104 + ath12k_mac_11d_scan_stop(ar); 105 + wiphy_unlock(wiphy); 106 + 107 + ar->regdom_set_by_user = true; 117 108 } 118 109 } 119 110 120 - int ath12k_reg_update_chan_list(struct ath12k *ar) 111 + int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait) 121 112 { 122 113 struct ieee80211_supported_band **bands; 123 114 struct ath12k_wmi_scan_chan_list_arg *arg; ··· 137 106 struct ath12k_wmi_channel_arg *ch; 138 107 enum nl80211_band band; 139 108 int num_channels = 0; 140 - int i, ret; 109 + int i, ret, left; 110 + 111 + if (wait && ar->state_11d != ATH12K_11D_IDLE) { 112 + left = wait_for_completion_timeout(&ar->completed_11d_scan, 113 + ATH12K_SCAN_TIMEOUT_HZ); 114 + if (!left) { 115 + ath12k_dbg(ar->ab, ATH12K_DBG_REG, 116 + "failed to receive 11d scan complete: timed out\n"); 117 + ar->state_11d = ATH12K_11D_IDLE; 118 + } 119 + ath12k_dbg(ar->ab, ATH12K_DBG_REG, 120 + "reg 11d scan wait left time %d\n", left); 121 + } 122 + 123 + if (wait && 124 + (ar->scan.state == ATH12K_SCAN_STARTING || 125 + ar->scan.state == ATH12K_SCAN_RUNNING)) { 126 + left = wait_for_completion_timeout(&ar->scan.completed, 127 + ATH12K_SCAN_TIMEOUT_HZ); 128 + if (!left) 129 + ath12k_dbg(ar->ab, ATH12K_DBG_REG, 130 + "failed to receive hw scan complete: timed out\n"); 131 + 132 + ath12k_dbg(ar->ab, ATH12K_DBG_REG, 133 + "reg hw scan wait left time %d\n", left); 134 + } 135 + 136 + if (ar->ah->state == ATH12K_HW_STATE_RESTARTING) 137 + return 0; 141 138 142 139 bands = hw->wiphy->bands; 143 140 for (band = 0; band < NUM_NL80211_BANDS; band++) { ··· 265 206 266 207 int ath12k_regd_update(struct ath12k *ar, bool init) 267 208 { 209 + u32 phy_id, freq_low = 0, freq_high = 0, supported_bands, band; 210 + struct ath12k_wmi_hal_reg_capabilities_ext_arg *reg_cap; 268 211 struct ath12k_hw *ah = ath12k_ar_to_ah(ar); 269 212 struct ieee80211_hw *hw = ah->hw; 270 213 struct ieee80211_regdomain *regd, *regd_copy = NULL; 271 214 int ret, regd_len, pdev_id; 272 215 struct ath12k_base *ab; 273 - int i; 274 216 275 217 ab = ar->ab; 218 + 219 + supported_bands = ar->pdev->cap.supported_bands; 220 + if (supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 221 + band = NL80211_BAND_2GHZ; 222 + } else if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP && !ar->supports_6ghz) { 223 + band = NL80211_BAND_5GHZ; 224 + } else if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP && ar->supports_6ghz) { 225 + band = NL80211_BAND_6GHZ; 226 + } else { 227 + /* This condition is not expected. 228 + */ 229 + WARN_ON(1); 230 + ret = -EINVAL; 231 + goto err; 232 + } 233 + 234 + reg_cap = &ab->hal_reg_cap[ar->pdev_idx]; 235 + 236 + if (ab->hw_params->single_pdev_only && !ar->supports_6ghz) { 237 + phy_id = ar->pdev->cap.band[band].phy_id; 238 + reg_cap = &ab->hal_reg_cap[phy_id]; 239 + } 240 + 241 + /* Possible that due to reg change, current limits for supported 242 + * frequency changed. Update that 243 + */ 244 + if (supported_bands & WMI_HOST_WLAN_2GHZ_CAP) { 245 + freq_low = max(reg_cap->low_2ghz_chan, ab->reg_freq_2ghz.start_freq); 246 + freq_high = min(reg_cap->high_2ghz_chan, ab->reg_freq_2ghz.end_freq); 247 + } else if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP && !ar->supports_6ghz) { 248 + freq_low = max(reg_cap->low_5ghz_chan, ab->reg_freq_5ghz.start_freq); 249 + freq_high = min(reg_cap->high_5ghz_chan, ab->reg_freq_5ghz.end_freq); 250 + } else if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP && ar->supports_6ghz) { 251 + freq_low = max(reg_cap->low_5ghz_chan, ab->reg_freq_6ghz.start_freq); 252 + freq_high = min(reg_cap->high_5ghz_chan, ab->reg_freq_6ghz.end_freq); 253 + } 254 + 255 + ath12k_mac_update_freq_range(ar, freq_low, freq_high); 256 + 257 + ath12k_dbg(ab, ATH12K_DBG_REG, "pdev %u reg updated freq limits %u->%u MHz\n", 258 + ar->pdev->pdev_id, freq_low, freq_high); 276 259 277 260 /* If one of the radios within ah has already updated the regd for 278 261 * the wiphy, then avoid setting regd again ··· 376 275 goto err; 377 276 } 378 277 379 - rtnl_lock(); 380 - wiphy_lock(hw->wiphy); 381 - ret = regulatory_set_wiphy_regd_sync(hw->wiphy, regd_copy); 382 - wiphy_unlock(hw->wiphy); 383 - rtnl_unlock(); 278 + ret = regulatory_set_wiphy_regd(hw->wiphy, regd_copy); 384 279 385 280 kfree(regd_copy); 386 281 ··· 387 290 goto skip; 388 291 389 292 ah->regd_updated = true; 390 - /* Apply the new regd to all the radios, this is expected to be received only once 391 - * since we check for ah->regd_updated and allow here only once. 392 - */ 393 - for_each_ar(ah, ar, i) { 394 - ab = ar->ab; 395 - ret = ath12k_reg_update_chan_list(ar); 396 - if (ret) 397 - goto err; 398 - } 293 + 399 294 skip: 400 295 return 0; 401 296 err: ··· 700 611 *rule_idx = i; 701 612 } 702 613 614 + static void ath12k_reg_update_freq_range(struct ath12k_reg_freq *reg_freq, 615 + struct ath12k_reg_rule *reg_rule) 616 + { 617 + if (reg_freq->start_freq > reg_rule->start_freq) 618 + reg_freq->start_freq = reg_rule->start_freq; 619 + 620 + if (reg_freq->end_freq < reg_rule->end_freq) 621 + reg_freq->end_freq = reg_rule->end_freq; 622 + } 623 + 703 624 struct ieee80211_regdomain * 704 625 ath12k_reg_build_regd(struct ath12k_base *ab, 705 626 struct ath12k_reg_info *reg_info, bool intersect) ··· 753 654 "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n", 754 655 alpha2, ath12k_reg_get_regdom_str(tmp_regd->dfs_region), 755 656 reg_info->dfs_region, num_rules); 657 + 658 + /* Reset start and end frequency for each band 659 + */ 660 + ab->reg_freq_5ghz.start_freq = INT_MAX; 661 + ab->reg_freq_5ghz.end_freq = 0; 662 + ab->reg_freq_2ghz.start_freq = INT_MAX; 663 + ab->reg_freq_2ghz.end_freq = 0; 664 + ab->reg_freq_6ghz.start_freq = INT_MAX; 665 + ab->reg_freq_6ghz.end_freq = 0; 666 + 756 667 /* Update reg_rules[] below. Firmware is expected to 757 668 * send these rules in order(2G rules first and then 5G) 758 669 */ ··· 773 664 max_bw = min_t(u16, reg_rule->max_bw, 774 665 reg_info->max_bw_2g); 775 666 flags = 0; 667 + ath12k_reg_update_freq_range(&ab->reg_freq_2ghz, reg_rule); 776 668 } else if (reg_info->num_5g_reg_rules && 777 669 (j < reg_info->num_5g_reg_rules)) { 778 670 reg_rule = reg_info->reg_rules_5g_ptr + j++; ··· 787 677 * per other BW rule flags we pass from here 788 678 */ 789 679 flags = NL80211_RRF_AUTO_BW; 680 + ath12k_reg_update_freq_range(&ab->reg_freq_5ghz, reg_rule); 790 681 } else if (reg_info->is_ext_reg_event && 791 682 reg_info->num_6g_reg_rules_ap[WMI_REG_INDOOR_AP] && 792 683 (k < reg_info->num_6g_reg_rules_ap[WMI_REG_INDOOR_AP])) { ··· 795 684 max_bw = min_t(u16, reg_rule->max_bw, 796 685 reg_info->max_bw_6g_ap[WMI_REG_INDOOR_AP]); 797 686 flags = NL80211_RRF_AUTO_BW; 687 + ath12k_reg_update_freq_range(&ab->reg_freq_6ghz, reg_rule); 798 688 } else { 799 689 break; 800 690 } ··· 882 770 void ath12k_reg_init(struct ieee80211_hw *hw) 883 771 { 884 772 hw->wiphy->regulatory_flags = REGULATORY_WIPHY_SELF_MANAGED; 773 + hw->wiphy->flags |= WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER; 885 774 hw->wiphy->reg_notifier = ath12k_reg_notifier; 886 775 } 887 776 ··· 890 777 { 891 778 int i; 892 779 780 + mutex_lock(&ab->core_lock); 893 781 for (i = 0; i < ab->hw_params->max_radios; i++) { 894 782 kfree(ab->default_regd[i]); 895 783 kfree(ab->new_regd[i]); 784 + ab->default_regd[i] = NULL; 785 + ab->new_regd[i] = NULL; 896 786 } 787 + mutex_unlock(&ab->core_lock); 897 788 }
+1 -1
drivers/net/wireless/ath/ath12k/reg.h
··· 99 99 struct ath12k_reg_info *reg_info, 100 100 bool intersect); 101 101 int ath12k_regd_update(struct ath12k *ar, bool init); 102 - int ath12k_reg_update_chan_list(struct ath12k *ar); 102 + int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait); 103 103 104 104 #endif
+2 -2
drivers/net/wireless/ath/ath12k/testmode.c
··· 97 97 u8 const *buf_pos; 98 98 99 99 ath12k_dbg(ab, ATH12K_DBG_TESTMODE, 100 - "testmode event wmi cmd_id %d ftm event msg %pK datalen %d\n", 100 + "testmode event wmi cmd_id %d ftm event msg %p datalen %d\n", 101 101 cmd_id, ftm_msg, length); 102 102 ath12k_dbg_dump(ab, ATH12K_DBG_TESTMODE, NULL, "", ftm_msg, length); 103 103 pdev_id = DP_HW2SW_MACID(le32_to_cpu(ftm_msg->seg_hdr.pdev_id)); ··· 227 227 buf_len = nla_len(tb[ATH_TM_ATTR_DATA]); 228 228 cmd_id = WMI_PDEV_UTF_CMDID; 229 229 ath12k_dbg(ar->ab, ATH12K_DBG_TESTMODE, 230 - "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n", 230 + "testmode cmd wmi cmd_id %d buf %p buf_len %d\n", 231 231 cmd_id, buf, buf_len); 232 232 ath12k_dbg_dump(ar->ab, ATH12K_DBG_TESTMODE, NULL, "", buf, buf_len); 233 233 bufpos = buf;
+282 -47
drivers/net/wireless/ath/ath12k/wmi.c
··· 29 29 30 30 struct wmi_tlv_fw_stats_parse { 31 31 const struct wmi_stats_event *ev; 32 + struct ath12k_fw_stats *stats; 32 33 }; 33 34 34 35 struct ath12k_wmi_dma_ring_caps_parse { ··· 178 177 .min_len = sizeof(struct ath12k_wmi_p2p_noa_info) }, 179 178 [WMI_TAG_P2P_NOA_EVENT] = { 180 179 .min_len = sizeof(struct wmi_p2p_noa_event) }, 180 + [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { 181 + .min_len = sizeof(struct wmi_11d_new_cc_event) }, 181 182 }; 182 183 183 184 __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) ··· 523 520 * band to band for a single radio, need to see how this should be 524 521 * handled. 525 522 */ 526 - if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2G_CAP) { 523 + if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2GHZ_CAP) { 527 524 pdev_cap->tx_chain_mask = le32_to_cpu(mac_caps->tx_chain_mask_2g); 528 525 pdev_cap->rx_chain_mask = le32_to_cpu(mac_caps->rx_chain_mask_2g); 529 - } else if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5G_CAP) { 526 + } else if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5GHZ_CAP) { 530 527 pdev_cap->vht_cap = le32_to_cpu(mac_caps->vht_cap_info_5g); 531 528 pdev_cap->vht_mcs = le32_to_cpu(mac_caps->vht_supp_mcs_5g); 532 529 pdev_cap->he_mcs = le32_to_cpu(mac_caps->he_supp_mcs_5g); ··· 549 546 pdev_cap->rx_chain_mask_shift = 550 547 find_first_bit((unsigned long *)&pdev_cap->rx_chain_mask, 32); 551 548 552 - if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2G_CAP) { 549 + if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2GHZ_CAP) { 553 550 cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; 554 551 cap_band->phy_id = le32_to_cpu(mac_caps->phy_id); 555 552 cap_band->max_bw_supported = le32_to_cpu(mac_caps->max_bw_supported_2g); ··· 569 566 le32_to_cpu(mac_caps->he_ppet2g.ppet16_ppet8_ru3_ru0[i]); 570 567 } 571 568 572 - if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5G_CAP) { 569 + if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5GHZ_CAP) { 573 570 cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; 574 571 cap_band->phy_id = le32_to_cpu(mac_caps->phy_id); 575 572 cap_band->max_bw_supported = ··· 1040 1037 static void ath12k_wmi_put_wmi_channel(struct ath12k_wmi_channel_params *chan, 1041 1038 struct wmi_vdev_start_req_arg *arg) 1042 1039 { 1040 + u32 center_freq1 = arg->band_center_freq1; 1041 + 1043 1042 memset(chan, 0, sizeof(*chan)); 1044 1043 1045 1044 chan->mhz = cpu_to_le32(arg->freq); 1046 - chan->band_center_freq1 = cpu_to_le32(arg->band_center_freq1); 1047 - if (arg->mode == MODE_11AC_VHT80_80) 1045 + chan->band_center_freq1 = cpu_to_le32(center_freq1); 1046 + if (arg->mode == MODE_11BE_EHT320) { 1047 + if (arg->freq > center_freq1) 1048 + chan->band_center_freq1 = cpu_to_le32(center_freq1 + 80); 1049 + else 1050 + chan->band_center_freq1 = cpu_to_le32(center_freq1 - 80); 1051 + 1052 + chan->band_center_freq2 = cpu_to_le32(center_freq1); 1053 + 1054 + } else if (arg->mode == MODE_11BE_EHT160) { 1055 + if (arg->freq > center_freq1) 1056 + chan->band_center_freq1 = cpu_to_le32(center_freq1 + 40); 1057 + else 1058 + chan->band_center_freq1 = cpu_to_le32(center_freq1 - 40); 1059 + 1060 + chan->band_center_freq2 = cpu_to_le32(center_freq1); 1061 + } else if (arg->mode == MODE_11BE_EHT80_80) { 1048 1062 chan->band_center_freq2 = cpu_to_le32(arg->band_center_freq2); 1049 - else 1063 + } else { 1050 1064 chan->band_center_freq2 = 0; 1065 + } 1051 1066 1052 1067 chan->info |= le32_encode_bits(arg->mode, WMI_CHAN_INFO_MODE); 1053 1068 if (arg->passive) ··· 2372 2351 2373 2352 for (i = 0; i < arg->peer_eht_mcs_count; i++) { 2374 2353 eht_mcs = ptr; 2375 - eht_mcs->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_HE_RATE_SET, 2354 + eht_mcs->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_EHT_RATE_SET, 2376 2355 sizeof(*eht_mcs)); 2377 2356 2378 2357 eht_mcs->rx_mcs_set = cpu_to_le32(arg->peer_eht_rx_mcs_set[i]); ··· 2612 2591 cmd->scan_id = cpu_to_le32(arg->scan_id); 2613 2592 cmd->scan_req_id = cpu_to_le32(arg->scan_req_id); 2614 2593 cmd->vdev_id = cpu_to_le32(arg->vdev_id); 2615 - cmd->scan_priority = cpu_to_le32(arg->scan_priority); 2594 + if (ar->state_11d == ATH12K_11D_PREPARING) 2595 + arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; 2596 + else 2597 + arg->scan_priority = WMI_SCAN_PRIORITY_LOW; 2616 2598 cmd->notify_scan_events = cpu_to_le32(arg->notify_scan_events); 2617 2599 2618 2600 ath12k_wmi_copy_scan_event_cntrl_flags(cmd, arg); ··· 3337 3313 return ret; 3338 3314 } 3339 3315 3316 + int ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, 3317 + struct wmi_set_current_country_arg *arg) 3318 + { 3319 + struct ath12k_wmi_pdev *wmi = ar->wmi; 3320 + struct wmi_set_current_country_cmd *cmd; 3321 + struct sk_buff *skb; 3322 + int ret; 3323 + 3324 + skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); 3325 + if (!skb) 3326 + return -ENOMEM; 3327 + 3328 + cmd = (struct wmi_set_current_country_cmd *)skb->data; 3329 + cmd->tlv_header = 3330 + ath12k_wmi_tlv_cmd_hdr(WMI_TAG_SET_CURRENT_COUNTRY_CMD, 3331 + sizeof(*cmd)); 3332 + 3333 + cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id); 3334 + memcpy(&cmd->new_alpha2, &arg->alpha2, sizeof(arg->alpha2)); 3335 + ret = ath12k_wmi_cmd_send(wmi, skb, WMI_SET_CURRENT_COUNTRY_CMDID); 3336 + 3337 + ath12k_dbg(ar->ab, ATH12K_DBG_WMI, 3338 + "set current country pdev id %d alpha2 %c%c\n", 3339 + ar->pdev->pdev_id, 3340 + arg->alpha2[0], 3341 + arg->alpha2[1]); 3342 + 3343 + if (ret) { 3344 + ath12k_warn(ar->ab, 3345 + "failed to send WMI_SET_CURRENT_COUNTRY_CMDID: %d\n", ret); 3346 + dev_kfree_skb(skb); 3347 + } 3348 + 3349 + return ret; 3350 + } 3351 + 3352 + int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, 3353 + struct wmi_11d_scan_start_arg *arg) 3354 + { 3355 + struct ath12k_wmi_pdev *wmi = ar->wmi; 3356 + struct wmi_11d_scan_start_cmd *cmd; 3357 + struct sk_buff *skb; 3358 + int ret; 3359 + 3360 + skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); 3361 + if (!skb) 3362 + return -ENOMEM; 3363 + 3364 + cmd = (struct wmi_11d_scan_start_cmd *)skb->data; 3365 + cmd->tlv_header = 3366 + ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_START_CMD, 3367 + sizeof(*cmd)); 3368 + 3369 + cmd->vdev_id = cpu_to_le32(arg->vdev_id); 3370 + cmd->scan_period_msec = cpu_to_le32(arg->scan_period_msec); 3371 + cmd->start_interval_msec = cpu_to_le32(arg->start_interval_msec); 3372 + ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_START_CMDID); 3373 + 3374 + ath12k_dbg(ar->ab, ATH12K_DBG_WMI, 3375 + "send 11d scan start vdev id %d period %d ms internal %d ms\n", 3376 + arg->vdev_id, arg->scan_period_msec, 3377 + arg->start_interval_msec); 3378 + 3379 + if (ret) { 3380 + ath12k_warn(ar->ab, 3381 + "failed to send WMI_11D_SCAN_START_CMDID: %d\n", ret); 3382 + dev_kfree_skb(skb); 3383 + } 3384 + 3385 + return ret; 3386 + } 3387 + 3388 + int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id) 3389 + { 3390 + struct ath12k_wmi_pdev *wmi = ar->wmi; 3391 + struct wmi_11d_scan_stop_cmd *cmd; 3392 + struct sk_buff *skb; 3393 + int ret; 3394 + 3395 + skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); 3396 + if (!skb) 3397 + return -ENOMEM; 3398 + 3399 + cmd = (struct wmi_11d_scan_stop_cmd *)skb->data; 3400 + cmd->tlv_header = 3401 + ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_STOP_CMD, 3402 + sizeof(*cmd)); 3403 + 3404 + cmd->vdev_id = cpu_to_le32(vdev_id); 3405 + ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_STOP_CMDID); 3406 + 3407 + ath12k_dbg(ar->ab, ATH12K_DBG_WMI, 3408 + "send 11d scan stop vdev id %d\n", 3409 + cmd->vdev_id); 3410 + 3411 + if (ret) { 3412 + ath12k_warn(ar->ab, 3413 + "failed to send WMI_11D_SCAN_STOP_CMDID: %d\n", ret); 3414 + dev_kfree_skb(skb); 3415 + } 3416 + 3417 + return ret; 3418 + } 3419 + 3340 3420 int 3341 3421 ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id) 3342 3422 { ··· 3774 3646 arg[i].pdev_id = pdev->pdev_id; 3775 3647 3776 3648 switch (pdev->cap.supported_bands) { 3777 - case WMI_HOST_WLAN_2G_5G_CAP: 3649 + case WMI_HOST_WLAN_2GHZ_5GHZ_CAP: 3778 3650 arg[i].start_freq = hal_reg_cap->low_2ghz_chan; 3779 3651 arg[i].end_freq = hal_reg_cap->high_5ghz_chan; 3780 3652 break; 3781 - case WMI_HOST_WLAN_2G_CAP: 3653 + case WMI_HOST_WLAN_2GHZ_CAP: 3782 3654 arg[i].start_freq = hal_reg_cap->low_2ghz_chan; 3783 3655 arg[i].end_freq = hal_reg_cap->high_2ghz_chan; 3784 3656 break; 3785 - case WMI_HOST_WLAN_5G_CAP: 3657 + case WMI_HOST_WLAN_5GHZ_CAP: 3786 3658 arg[i].start_freq = hal_reg_cap->low_5ghz_chan; 3787 3659 arg[i].end_freq = hal_reg_cap->high_5ghz_chan; 3788 3660 break; ··· 3793 3665 } 3794 3666 3795 3667 static void 3796 - ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cfg, 3668 + ath12k_wmi_copy_resource_config(struct ath12k_base *ab, 3669 + struct ath12k_wmi_resource_config_params *wmi_cfg, 3797 3670 struct ath12k_wmi_resource_config_arg *tg_cfg) 3798 3671 { 3799 3672 wmi_cfg->num_vdevs = cpu_to_le32(tg_cfg->num_vdevs); ··· 3861 3732 WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION); 3862 3733 wmi_cfg->host_service_flags = cpu_to_le32(tg_cfg->is_reg_cc_ext_event_supported << 3863 3734 WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT); 3735 + if (ab->hw_params->reoq_lut_support) 3736 + wmi_cfg->host_service_flags |= 3737 + cpu_to_le32(1 << WMI_RSRC_CFG_HOST_SVC_FLAG_REO_QREF_SUPPORT_BIT); 3864 3738 wmi_cfg->ema_max_vap_cnt = cpu_to_le32(tg_cfg->ema_max_vap_cnt); 3865 3739 wmi_cfg->ema_max_profile_period = cpu_to_le32(tg_cfg->ema_max_profile_period); 3866 3740 wmi_cfg->flags2 |= cpu_to_le32(WMI_RSRC_CFG_FLAGS2_CALC_NEXT_DTIM_COUNT_SET); ··· 3904 3772 ptr = skb->data + sizeof(*cmd); 3905 3773 cfg = ptr; 3906 3774 3907 - ath12k_wmi_copy_resource_config(cfg, &arg->res_cfg); 3775 + ath12k_wmi_copy_resource_config(ab, cfg, &arg->res_cfg); 3908 3776 3909 3777 cfg->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_RESOURCE_CONFIG, 3910 3778 sizeof(*cfg)); ··· 4831 4699 bands = pdev->cap.supported_bands; 4832 4700 } 4833 4701 4834 - if (bands & WMI_HOST_WLAN_2G_CAP) { 4702 + if (bands & WMI_HOST_WLAN_2GHZ_CAP) { 4835 4703 ath12k_wmi_eht_caps_parse(pdev, NL80211_BAND_2GHZ, 4836 4704 caps->eht_cap_mac_info_2ghz, 4837 4705 caps->eht_cap_phy_info_2ghz, ··· 4840 4708 caps->eht_cap_info_internal); 4841 4709 } 4842 4710 4843 - if (bands & WMI_HOST_WLAN_5G_CAP) { 4711 + if (bands & WMI_HOST_WLAN_5GHZ_CAP) { 4844 4712 ath12k_wmi_eht_caps_parse(pdev, NL80211_BAND_5GHZ, 4845 4713 caps->eht_cap_mac_info_5ghz, 4846 4714 caps->eht_cap_phy_info_5ghz, ··· 5054 4922 for (count = 0; count < num_reg_rules; count++) { 5055 4923 start_freq = le32_get_bits(rule[count].freq_info, REG_RULE_START_FREQ); 5056 4924 5057 - if (start_freq >= ATH12K_MIN_6G_FREQ) 4925 + if (start_freq >= ATH12K_MIN_6GHZ_FREQ) 5058 4926 num_invalid_5ghz_rules++; 5059 4927 } 5060 4928 ··· 5124 4992 for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { 5125 4993 num_6g_reg_rules_ap[i] = reg_info->num_6g_reg_rules_ap[i]; 5126 4994 5127 - if (num_6g_reg_rules_ap[i] > MAX_6G_REG_RULES) { 4995 + if (num_6g_reg_rules_ap[i] > MAX_6GHZ_REG_RULES) { 5128 4996 ath12k_warn(ab, "Num 6G reg rules for AP mode(%d) exceeds max limit (num_6g_reg_rules_ap: %d, max_rules: %d)\n", 5129 - i, num_6g_reg_rules_ap[i], MAX_6G_REG_RULES); 4997 + i, num_6g_reg_rules_ap[i], MAX_6GHZ_REG_RULES); 5130 4998 kfree(tb); 5131 4999 return -EINVAL; 5132 5000 } ··· 5147 5015 reg_info->num_6g_reg_rules_cl[WMI_REG_VLP_AP][i]; 5148 5016 total_reg_rules += num_6g_reg_rules_cl[WMI_REG_VLP_AP][i]; 5149 5017 5150 - if (num_6g_reg_rules_cl[WMI_REG_INDOOR_AP][i] > MAX_6G_REG_RULES || 5151 - num_6g_reg_rules_cl[WMI_REG_STD_POWER_AP][i] > MAX_6G_REG_RULES || 5152 - num_6g_reg_rules_cl[WMI_REG_VLP_AP][i] > MAX_6G_REG_RULES) { 5018 + if (num_6g_reg_rules_cl[WMI_REG_INDOOR_AP][i] > MAX_6GHZ_REG_RULES || 5019 + num_6g_reg_rules_cl[WMI_REG_STD_POWER_AP][i] > MAX_6GHZ_REG_RULES || 5020 + num_6g_reg_rules_cl[WMI_REG_VLP_AP][i] > MAX_6GHZ_REG_RULES) { 5153 5021 ath12k_warn(ab, "Num 6g client reg rules exceeds max limit, for client(type: %d)\n", 5154 5022 i); 5155 5023 kfree(tb); ··· 6065 5933 wake_up(&ab->wmi_ab.tx_credits_wq); 6066 5934 } 6067 5935 5936 + static int ath12k_reg_11d_new_cc_event(struct ath12k_base *ab, struct sk_buff *skb) 5937 + { 5938 + const struct wmi_11d_new_cc_event *ev; 5939 + struct ath12k *ar; 5940 + struct ath12k_pdev *pdev; 5941 + const void **tb; 5942 + int ret, i; 5943 + 5944 + tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); 5945 + if (IS_ERR(tb)) { 5946 + ret = PTR_ERR(tb); 5947 + ath12k_warn(ab, "failed to parse tlv: %d\n", ret); 5948 + return ret; 5949 + } 5950 + 5951 + ev = tb[WMI_TAG_11D_NEW_COUNTRY_EVENT]; 5952 + if (!ev) { 5953 + kfree(tb); 5954 + ath12k_warn(ab, "failed to fetch 11d new cc ev"); 5955 + return -EPROTO; 5956 + } 5957 + 5958 + spin_lock_bh(&ab->base_lock); 5959 + memcpy(&ab->new_alpha2, &ev->new_alpha2, REG_ALPHA2_LEN); 5960 + spin_unlock_bh(&ab->base_lock); 5961 + 5962 + ath12k_dbg(ab, ATH12K_DBG_WMI, "wmi 11d new cc %c%c\n", 5963 + ab->new_alpha2[0], 5964 + ab->new_alpha2[1]); 5965 + 5966 + kfree(tb); 5967 + 5968 + for (i = 0; i < ab->num_radios; i++) { 5969 + pdev = &ab->pdevs[i]; 5970 + ar = pdev->ar; 5971 + ar->state_11d = ATH12K_11D_IDLE; 5972 + complete(&ar->completed_11d_scan); 5973 + } 5974 + 5975 + queue_work(ab->workqueue, &ab->update_11d_work); 5976 + 5977 + return 0; 5978 + } 5979 + 6068 5980 static void ath12k_wmi_htc_tx_complete(struct ath12k_base *ab, 6069 5981 struct sk_buff *skb) 6070 5982 { ··· 6493 6317 if (rx_ev.status & WMI_RX_STATUS_ERR_MIC) 6494 6318 status->flag |= RX_FLAG_MMIC_ERROR; 6495 6319 6496 - if (rx_ev.chan_freq >= ATH12K_MIN_6G_FREQ && 6497 - rx_ev.chan_freq <= ATH12K_MAX_6G_FREQ) { 6320 + if (rx_ev.chan_freq >= ATH12K_MIN_6GHZ_FREQ && 6321 + rx_ev.chan_freq <= ATH12K_MAX_6GHZ_FREQ) { 6498 6322 status->band = NL80211_BAND_6GHZ; 6499 6323 status->freq = rx_ev.chan_freq; 6500 6324 } else if (rx_ev.channel >= 1 && rx_ev.channel <= 14) { 6501 6325 status->band = NL80211_BAND_2GHZ; 6502 - } else if (rx_ev.channel >= 36 && rx_ev.channel <= ATH12K_MAX_5G_CHAN) { 6326 + } else if (rx_ev.channel >= 36 && rx_ev.channel <= ATH12K_MAX_5GHZ_CHAN) { 6503 6327 status->band = NL80211_BAND_5GHZ; 6504 6328 } else { 6505 6329 /* Shouldn't happen unless list of advertised channels to ··· 7392 7216 else 7393 7217 buf[len] = 0; 7394 7218 7395 - ath12k_debugfs_fw_stats_reset(ar); 7219 + ath12k_fw_stats_reset(ar); 7396 7220 } 7397 7221 7398 7222 static void ··· 7511 7335 u16 len) 7512 7336 { 7513 7337 const struct wmi_stats_event *ev = parse->ev; 7514 - struct ath12k_fw_stats stats = {0}; 7338 + struct ath12k_fw_stats *stats = parse->stats; 7515 7339 struct ath12k *ar; 7516 7340 struct ath12k_link_vif *arvif; 7517 7341 struct ieee80211_sta *sta; ··· 7520 7344 int i, ret = 0; 7521 7345 const void *data = ptr; 7522 7346 7523 - INIT_LIST_HEAD(&stats.vdevs); 7524 - INIT_LIST_HEAD(&stats.bcn); 7525 - INIT_LIST_HEAD(&stats.pdevs); 7526 - 7527 7347 if (!ev) { 7528 7348 ath12k_warn(ab, "failed to fetch update stats ev"); 7529 7349 return -EPROTO; 7530 7350 } 7531 7351 7352 + if (!stats) 7353 + return -EINVAL; 7354 + 7532 7355 rcu_read_lock(); 7533 7356 7534 - ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev->pdev_id)); 7357 + stats->pdev_id = le32_to_cpu(ev->pdev_id); 7358 + ar = ath12k_mac_get_ar_by_pdev_id(ab, stats->pdev_id); 7535 7359 if (!ar) { 7536 7360 ath12k_warn(ab, "invalid pdev id %d in update stats event\n", 7537 7361 le32_to_cpu(ev->pdev_id)); ··· 7574 7398 if (!dst) 7575 7399 continue; 7576 7400 ath12k_wmi_pull_vdev_stats(src, dst); 7577 - stats.stats_id = WMI_REQUEST_VDEV_STAT; 7578 - list_add_tail(&dst->list, &stats.vdevs); 7401 + stats->stats_id = WMI_REQUEST_VDEV_STAT; 7402 + list_add_tail(&dst->list, &stats->vdevs); 7579 7403 } 7580 7404 for (i = 0; i < le32_to_cpu(ev->num_bcn_stats); i++) { 7581 7405 const struct ath12k_wmi_bcn_stats_params *src; ··· 7593 7417 if (!dst) 7594 7418 continue; 7595 7419 ath12k_wmi_pull_bcn_stats(src, dst); 7596 - stats.stats_id = WMI_REQUEST_BCN_STAT; 7597 - list_add_tail(&dst->list, &stats.bcn); 7420 + stats->stats_id = WMI_REQUEST_BCN_STAT; 7421 + list_add_tail(&dst->list, &stats->bcn); 7598 7422 } 7599 7423 for (i = 0; i < le32_to_cpu(ev->num_pdev_stats); i++) { 7600 7424 const struct ath12k_wmi_pdev_stats_params *src; ··· 7606 7430 goto exit; 7607 7431 } 7608 7432 7609 - stats.stats_id = WMI_REQUEST_PDEV_STAT; 7433 + stats->stats_id = WMI_REQUEST_PDEV_STAT; 7610 7434 7611 7435 data += sizeof(*src); 7612 7436 len -= sizeof(*src); ··· 7618 7442 ath12k_wmi_pull_pdev_stats_base(&src->base, dst); 7619 7443 ath12k_wmi_pull_pdev_stats_tx(&src->tx, dst); 7620 7444 ath12k_wmi_pull_pdev_stats_rx(&src->rx, dst); 7621 - list_add_tail(&dst->list, &stats.pdevs); 7445 + list_add_tail(&dst->list, &stats->pdevs); 7622 7446 } 7623 7447 7624 - complete(&ar->fw_stats_complete); 7625 - ath12k_debugfs_fw_stats_process(ar, &stats); 7626 7448 exit: 7627 7449 rcu_read_unlock(); 7628 7450 return ret; ··· 7646 7472 return ret; 7647 7473 } 7648 7474 7649 - static void ath12k_update_stats_event(struct ath12k_base *ab, struct sk_buff *skb) 7475 + static int ath12k_wmi_pull_fw_stats(struct ath12k_base *ab, struct sk_buff *skb, 7476 + struct ath12k_fw_stats *stats) 7650 7477 { 7651 - int ret; 7652 7478 struct wmi_tlv_fw_stats_parse parse = {}; 7653 7479 7654 - ret = ath12k_wmi_tlv_iter(ab, skb->data, skb->len, 7655 - ath12k_wmi_tlv_fw_stats_parse, 7656 - &parse); 7657 - if (ret) 7658 - ath12k_warn(ab, "failed to parse fw stats %d\n", ret); 7480 + stats->stats_id = 0; 7481 + parse.stats = stats; 7482 + 7483 + return ath12k_wmi_tlv_iter(ab, skb->data, skb->len, 7484 + ath12k_wmi_tlv_fw_stats_parse, 7485 + &parse); 7486 + } 7487 + 7488 + static void ath12k_update_stats_event(struct ath12k_base *ab, struct sk_buff *skb) 7489 + { 7490 + struct ath12k_fw_stats stats = {}; 7491 + struct ath12k *ar; 7492 + int ret; 7493 + 7494 + INIT_LIST_HEAD(&stats.pdevs); 7495 + INIT_LIST_HEAD(&stats.vdevs); 7496 + INIT_LIST_HEAD(&stats.bcn); 7497 + 7498 + ret = ath12k_wmi_pull_fw_stats(ab, skb, &stats); 7499 + if (ret) { 7500 + ath12k_warn(ab, "failed to pull fw stats: %d\n", ret); 7501 + goto free; 7502 + } 7503 + 7504 + ath12k_dbg(ab, ATH12K_DBG_WMI, "event update stats"); 7505 + 7506 + rcu_read_lock(); 7507 + ar = ath12k_mac_get_ar_by_pdev_id(ab, stats.pdev_id); 7508 + if (!ar) { 7509 + rcu_read_unlock(); 7510 + ath12k_warn(ab, "failed to get ar for pdev_id %d: %d\n", 7511 + stats.pdev_id, ret); 7512 + goto free; 7513 + } 7514 + 7515 + spin_lock_bh(&ar->data_lock); 7516 + 7517 + /* WMI_REQUEST_PDEV_STAT can be requested via .get_txpower mac ops or via 7518 + * debugfs fw stats. Therefore, processing it separately. 7519 + */ 7520 + if (stats.stats_id == WMI_REQUEST_PDEV_STAT) { 7521 + list_splice_tail_init(&stats.pdevs, &ar->fw_stats.pdevs); 7522 + ar->fw_stats.fw_stats_done = true; 7523 + goto complete; 7524 + } 7525 + 7526 + /* WMI_REQUEST_VDEV_STAT and WMI_REQUEST_BCN_STAT are currently requested only 7527 + * via debugfs fw stats. Hence, processing these in debugfs context. 7528 + */ 7529 + ath12k_debugfs_fw_stats_process(ar, &stats); 7530 + 7531 + complete: 7532 + complete(&ar->fw_stats_complete); 7533 + spin_unlock_bh(&ar->data_lock); 7534 + rcu_read_unlock(); 7535 + 7536 + /* Since the stats's pdev, vdev and beacon list are spliced and reinitialised 7537 + * at this point, no need to free the individual list. 7538 + */ 7539 + return; 7540 + 7541 + free: 7542 + ath12k_fw_stats_free(&stats); 7659 7543 } 7660 7544 7661 7545 /* PDEV_CTL_FAILSAFE_CHECK_EVENT is received from FW when the frequency scanned ··· 8871 8639 break; 8872 8640 case WMI_HALPHY_STATS_CTRL_PATH_EVENTID: 8873 8641 ath12k_wmi_process_tpc_stats(ab, skb); 8642 + break; 8643 + case WMI_11D_NEW_COUNTRY_EVENTID: 8644 + ath12k_reg_11d_new_cc_event(ab, skb); 8874 8645 break; 8875 8646 /* add Unsupported events (rare) here */ 8876 8647 case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
+47 -8
drivers/net/wireless/ath/ath12k/wmi.h
··· 216 216 }; 217 217 218 218 enum WMI_HOST_WLAN_BAND { 219 - WMI_HOST_WLAN_2G_CAP = 1, 220 - WMI_HOST_WLAN_5G_CAP = 2, 221 - WMI_HOST_WLAN_2G_5G_CAP = 3, 219 + WMI_HOST_WLAN_2GHZ_CAP = 1, 220 + WMI_HOST_WLAN_5GHZ_CAP = 2, 221 + WMI_HOST_WLAN_2GHZ_5GHZ_CAP = 3, 222 222 }; 223 223 224 224 enum wmi_cmd_group { ··· 2461 2461 } __packed; 2462 2462 2463 2463 #define WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT 4 2464 + #define WMI_RSRC_CFG_HOST_SVC_FLAG_REO_QREF_SUPPORT_BIT 12 2464 2465 #define WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION GENMASK(5, 4) 2465 2466 #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) 2466 2467 #define WMI_RSRC_CFG_FLAGS2_CALC_NEXT_DTIM_COUNT_SET BIT(9) ··· 2691 2690 * 2 - index for 160 MHz, first 3 bytes valid 2692 2691 * 3 - index for 320 MHz, first 3 bytes valid 2693 2692 */ 2694 - #define WMI_MAX_EHT_SUPP_MCS_2G_SIZE 2 2695 - #define WMI_MAX_EHT_SUPP_MCS_5G_SIZE 4 2693 + #define WMI_MAX_EHT_SUPP_MCS_2GHZ_SIZE 2 2694 + #define WMI_MAX_EHT_SUPP_MCS_5GHZ_SIZE 4 2696 2695 2697 2696 #define WMI_EHTCAP_TXRX_MCS_NSS_IDX_80 0 2698 2697 #define WMI_EHTCAP_TXRX_MCS_NSS_IDX_160 1 ··· 2731 2730 struct ath12k_wmi_ppe_threshold_params eht_ppet_2ghz; 2732 2731 struct ath12k_wmi_ppe_threshold_params eht_ppet_5ghz; 2733 2732 __le32 eht_cap_info_internal; 2734 - __le32 eht_supp_mcs_ext_2ghz[WMI_MAX_EHT_SUPP_MCS_2G_SIZE]; 2735 - __le32 eht_supp_mcs_ext_5ghz[WMI_MAX_EHT_SUPP_MCS_5G_SIZE]; 2733 + __le32 eht_supp_mcs_ext_2ghz[WMI_MAX_EHT_SUPP_MCS_2GHZ_SIZE]; 2734 + __le32 eht_supp_mcs_ext_5ghz[WMI_MAX_EHT_SUPP_MCS_5GHZ_SIZE]; 2736 2735 __le32 eml_capability; 2737 2736 __le32 mld_capability; 2738 2737 } __packed; ··· 4027 4026 } cc_info; 4028 4027 } __packed; 4029 4028 4029 + struct wmi_11d_scan_start_arg { 4030 + u32 vdev_id; 4031 + u32 scan_period_msec; 4032 + u32 start_interval_msec; 4033 + }; 4034 + 4035 + struct wmi_11d_scan_start_cmd { 4036 + __le32 tlv_header; 4037 + __le32 vdev_id; 4038 + __le32 scan_period_msec; 4039 + __le32 start_interval_msec; 4040 + } __packed; 4041 + 4042 + struct wmi_11d_scan_stop_cmd { 4043 + __le32 tlv_header; 4044 + __le32 vdev_id; 4045 + } __packed; 4046 + 4047 + struct wmi_11d_new_cc_event { 4048 + __le32 new_alpha2; 4049 + } __packed; 4050 + 4030 4051 struct wmi_delba_send_cmd { 4031 4052 __le32 tlv_header; 4032 4053 __le32 vdev_id; ··· 4131 4108 4132 4109 #define MAX_REG_RULES 10 4133 4110 #define REG_ALPHA2_LEN 2 4134 - #define MAX_6G_REG_RULES 5 4111 + #define MAX_6GHZ_REG_RULES 5 4112 + 4113 + struct wmi_set_current_country_arg { 4114 + u8 alpha2[REG_ALPHA2_LEN]; 4115 + }; 4116 + 4117 + struct wmi_set_current_country_cmd { 4118 + __le32 tlv_header; 4119 + __le32 pdev_id; 4120 + __le32 new_alpha2; 4121 + } __packed; 4135 4122 4136 4123 enum wmi_start_event_param { 4137 4124 WMI_VDEV_START_RESP_EVENT = 0, ··· 6023 5990 u32 vdev_id, u32 bcn_ctrl_op); 6024 5991 int ath12k_wmi_send_init_country_cmd(struct ath12k *ar, 6025 5992 struct ath12k_wmi_init_country_arg *arg); 5993 + int 5994 + ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, 5995 + struct wmi_set_current_country_arg *arg); 6026 5996 int ath12k_wmi_peer_rx_reorder_queue_setup(struct ath12k *ar, 6027 5997 int vdev_id, const u8 *addr, 6028 5998 dma_addr_t paddr, u8 tid, 6029 5999 u8 ba_window_size_valid, 6030 6000 u32 ba_window_size); 6001 + int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, 6002 + struct wmi_11d_scan_start_arg *arg); 6003 + int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id); 6031 6004 int 6032 6005 ath12k_wmi_rx_reord_queue_remove(struct ath12k *ar, 6033 6006 struct ath12k_wmi_rx_reorder_queue_remove_arg *arg);
+1 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 15 15 #include "fwcmd.h" 16 16 #include "version.h" 17 17 18 - static const u8 otus_magic[4] = { OTUS_MAGIC }; 18 + static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC }; 19 19 20 20 static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4], 21 21 const unsigned int len, const u8 compatible_revision)
+1 -1
drivers/net/wireless/ath/wcn36xx/testmode.c
··· 56 56 msg = buf; 57 57 58 58 wcn36xx_dbg(WCN36XX_DBG_TESTMODE, 59 - "testmode cmd wmi msg_id 0x%04X msg_len %d buf %pK buf_len %d\n", 59 + "testmode cmd wmi msg_id 0x%04X msg_len %d buf %p buf_len %d\n", 60 60 msg->msg_id, msg->msg_body_length, 61 61 buf, buf_len); 62 62