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

Merge tag 'wireless-next-2023-10-26' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Kalle Valo says:

====================
wireless-next patches for v6.7

The third, and most likely the last, features pull request for v6.7.
Fixes all over and only few small new features.

Major changes:

iwlwifi
- more Multi-Link Operation (MLO) work

ath12k
- QCN9274: mesh support

ath11k
- firmware-2.bin container file format support

* tag 'wireless-next-2023-10-26' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (155 commits)
wifi: ray_cs: Remove unnecessary (void*) conversions
Revert "wifi: ath11k: call ath11k_mac_fils_discovery() without condition"
wifi: ath12k: Introduce and use ath12k_sta_to_arsta()
wifi: ath12k: fix htt mlo-offset event locking
wifi: ath12k: fix dfs-radar and temperature event locking
wifi: ath11k: fix gtk offload status event locking
wifi: ath11k: fix htt pktlog locking
wifi: ath11k: fix dfs radar event locking
wifi: ath11k: fix temperature event locking
wifi: ath12k: rename the sc naming convention to ab
wifi: ath12k: rename the wmi_sc naming convention to wmi_ab
wifi: ath11k: add firmware-2.bin support
wifi: ath11k: qmi: refactor ath11k_qmi_m3_load()
wifi: rtw89: cleanup firmware elements parsing
wifi: rt2x00: rework MT7620 PA/LNA RF calibration
wifi: rt2x00: rework MT7620 channel config function
wifi: rt2x00: improve MT7620 register initialization
MAINTAINERS: wifi: rt2x00: drop Helmut Schaa
wifi: wlcore: main: replace deprecated strncpy with strscpy
wifi: wlcore: boot: replace deprecated strncpy with strscpy
...
====================

Link: https://lore.kernel.org/r/20231026090411.B2426C433CB@smtp.kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3557 -1723
+1 -1
Documentation/driver-api/80211/mac80211.rst
··· 120 120 ieee80211_rx 121 121 ieee80211_rx_ni 122 122 ieee80211_rx_irqsafe 123 - ieee80211_tx_status 123 + ieee80211_tx_status_skb 124 124 ieee80211_tx_status_ni 125 125 ieee80211_tx_status_irqsafe 126 126 ieee80211_rts_get
-1
MAINTAINERS
··· 17943 17943 17944 17944 RALINK RT2X00 WIRELESS LAN DRIVER 17945 17945 M: Stanislaw Gruszka <stf_xl@wp.pl> 17946 - M: Helmut Schaa <helmut.schaa@googlemail.com> 17947 17946 L: linux-wireless@vger.kernel.org 17948 17947 S: Maintained 17949 17948 F: drivers/net/wireless/ralink/rt2x00/
+2 -1
drivers/net/wireless/ath/ath11k/Makefile
··· 17 17 peer.o \ 18 18 dbring.o \ 19 19 hw.o \ 20 - pcic.o 20 + pcic.o \ 21 + fw.o 21 22 22 23 ath11k-$(CONFIG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o 23 24 ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
+2 -8
drivers/net/wireless/ath/ath11k/ahb.c
··· 6 6 7 7 #include <linux/module.h> 8 8 #include <linux/platform_device.h> 9 + #include <linux/property.h> 9 10 #include <linux/of_device.h> 10 11 #include <linux/of.h> 11 12 #include <linux/dma-mapping.h> ··· 1085 1084 static int ath11k_ahb_probe(struct platform_device *pdev) 1086 1085 { 1087 1086 struct ath11k_base *ab; 1088 - const struct of_device_id *of_id; 1089 1087 const struct ath11k_hif_ops *hif_ops; 1090 1088 const struct ath11k_pci_ops *pci_ops; 1091 1089 enum ath11k_hw_rev hw_rev; 1092 1090 int ret; 1093 1091 1094 - of_id = of_match_device(ath11k_ahb_of_match, &pdev->dev); 1095 - if (!of_id) { 1096 - dev_err(&pdev->dev, "failed to find matching device tree id\n"); 1097 - return -EINVAL; 1098 - } 1099 - 1100 - hw_rev = (uintptr_t)of_id->data; 1092 + hw_rev = (uintptr_t)device_get_match_data(&pdev->dev); 1101 1093 1102 1094 switch (hw_rev) { 1103 1095 case ATH11K_HW_IPQ8074:
+12 -3
drivers/net/wireless/ath/ath11k/core.c
··· 16 16 #include "debug.h" 17 17 #include "hif.h" 18 18 #include "wow.h" 19 + #include "fw.h" 19 20 20 21 unsigned int ath11k_debug_mask; 21 22 EXPORT_SYMBOL(ath11k_debug_mask); ··· 1318 1317 { 1319 1318 char *boardname = NULL, *fallback_boardname = NULL, *chip_id_boardname = NULL; 1320 1319 char *filename, filepath[100]; 1320 + int bd_api; 1321 1321 int ret = 0; 1322 1322 1323 1323 filename = ATH11K_BOARD_API2_FILE; ··· 1334 1332 goto exit; 1335 1333 } 1336 1334 1337 - ab->bd_api = 2; 1335 + bd_api = 2; 1338 1336 ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname, 1339 1337 ATH11K_BD_IE_BOARD, 1340 1338 ATH11K_BD_IE_BOARD_NAME, ··· 1383 1381 if (!ret) 1384 1382 goto exit; 1385 1383 1386 - ab->bd_api = 1; 1384 + bd_api = 1; 1387 1385 ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE); 1388 1386 if (ret) { 1389 1387 ath11k_core_create_firmware_path(ab, filename, ··· 1407 1405 kfree(chip_id_boardname); 1408 1406 1409 1407 if (!ret) 1410 - ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); 1408 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", bd_api); 1411 1409 1412 1410 return ret; 1413 1411 } ··· 2073 2071 return ret; 2074 2072 } 2075 2073 2074 + ret = ath11k_fw_pre_init(ab); 2075 + if (ret) { 2076 + ath11k_err(ab, "failed to pre init firmware: %d", ret); 2077 + return ret; 2078 + } 2079 + 2076 2080 return 0; 2077 2081 } 2078 2082 EXPORT_SYMBOL(ath11k_core_pre_init); ··· 2109 2101 ath11k_hif_power_down(ab); 2110 2102 ath11k_mac_destroy(ab); 2111 2103 ath11k_core_soc_destroy(ab); 2104 + ath11k_fw_destroy(ab); 2112 2105 } 2113 2106 EXPORT_SYMBOL(ath11k_core_deinit); 2114 2107
+20 -1
drivers/net/wireless/ath/ath11k/core.h
··· 15 15 #include <linux/ctype.h> 16 16 #include <linux/rhashtable.h> 17 17 #include <linux/average.h> 18 + #include <linux/firmware.h> 19 + 18 20 #include "qmi.h" 19 21 #include "htc.h" 20 22 #include "wmi.h" ··· 31 29 #include "dbring.h" 32 30 #include "spectral.h" 33 31 #include "wow.h" 32 + #include "fw.h" 34 33 35 34 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) 36 35 ··· 909 906 struct ath11k_targ_cap target_caps; 910 907 u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; 911 908 bool pdevs_macaddr_valid; 912 - int bd_api; 913 909 914 910 struct ath11k_hw_params hw_params; 915 911 ··· 983 981 984 982 const struct ath11k_pci_ops *ops; 985 983 } pci; 984 + 985 + struct { 986 + u32 api_version; 987 + 988 + const struct firmware *fw; 989 + const u8 *amss_data; 990 + size_t amss_len; 991 + const u8 *m3_data; 992 + size_t m3_len; 993 + 994 + DECLARE_BITMAP(fw_features, ATH11K_FW_FEATURE_COUNT); 995 + } fw; 986 996 987 997 #ifdef CONFIG_NL80211_TESTMODE 988 998 struct { ··· 1235 1221 static inline struct ath11k_vif *ath11k_vif_to_arvif(struct ieee80211_vif *vif) 1236 1222 { 1237 1223 return (struct ath11k_vif *)vif->drv_priv; 1224 + } 1225 + 1226 + static inline struct ath11k_sta *ath11k_sta_to_arsta(struct ieee80211_sta *sta) 1227 + { 1228 + return (struct ath11k_sta *)sta->drv_priv; 1238 1229 } 1239 1230 1240 1231 static inline struct ath11k *ath11k_ab_to_ar(struct ath11k_base *ab,
+4 -4
drivers/net/wireless/ath/ath11k/debugfs.c
··· 1459 1459 struct ieee80211_sta *sta) 1460 1460 { 1461 1461 struct ath11k *ar = data; 1462 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 1462 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 1463 1463 1464 1464 spin_lock_bh(&ar->data_lock); 1465 1465 arsta->ps_total_duration = 0; ··· 1510 1510 struct ieee80211_sta *sta) 1511 1511 { 1512 1512 struct ath11k *ar = data; 1513 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 1513 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 1514 1514 1515 1515 spin_lock_bh(&ar->data_lock); 1516 1516 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; ··· 1591 1591 int ath11k_debugfs_register(struct ath11k *ar) 1592 1592 { 1593 1593 struct ath11k_base *ab = ar->ab; 1594 - char pdev_name[5]; 1594 + char pdev_name[10]; 1595 1595 char buf[100] = {0}; 1596 1596 1597 - snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx); 1597 + snprintf(pdev_name, sizeof(pdev_name), "%s%u", "mac", ar->pdev_idx); 1598 1598 1599 1599 ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc); 1600 1600 if (IS_ERR(ar->debug.debugfs_pdev))
+15 -15
drivers/net/wireless/ath/ath11k/debugfs_sta.c
··· 136 136 size_t count, loff_t *ppos) 137 137 { 138 138 struct ieee80211_sta *sta = file->private_data; 139 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 139 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 140 140 struct ath11k *ar = arsta->arvif->ar; 141 141 struct ath11k_htt_data_stats *stats; 142 142 static const char *str_name[ATH11K_STATS_TYPE_MAX] = {"succ", "fail", ··· 243 243 size_t count, loff_t *ppos) 244 244 { 245 245 struct ieee80211_sta *sta = file->private_data; 246 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 246 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 247 247 struct ath11k *ar = arsta->arvif->ar; 248 248 struct ath11k_rx_peer_stats *rx_stats = arsta->rx_stats; 249 249 int len = 0, i, retval = 0; ··· 340 340 ath11k_dbg_sta_open_htt_peer_stats(struct inode *inode, struct file *file) 341 341 { 342 342 struct ieee80211_sta *sta = inode->i_private; 343 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 343 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 344 344 struct ath11k *ar = arsta->arvif->ar; 345 345 struct debug_htt_stats_req *stats_req; 346 346 int type = ar->debug.htt_stats.type; ··· 376 376 ath11k_dbg_sta_release_htt_peer_stats(struct inode *inode, struct file *file) 377 377 { 378 378 struct ieee80211_sta *sta = inode->i_private; 379 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 379 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 380 380 struct ath11k *ar = arsta->arvif->ar; 381 381 382 382 mutex_lock(&ar->conf_mutex); ··· 413 413 size_t count, loff_t *ppos) 414 414 { 415 415 struct ieee80211_sta *sta = file->private_data; 416 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 416 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 417 417 struct ath11k *ar = arsta->arvif->ar; 418 418 int ret, enable; 419 419 ··· 453 453 size_t count, loff_t *ppos) 454 454 { 455 455 struct ieee80211_sta *sta = file->private_data; 456 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 456 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 457 457 struct ath11k *ar = arsta->arvif->ar; 458 458 char buf[32] = {0}; 459 459 int len; ··· 480 480 size_t count, loff_t *ppos) 481 481 { 482 482 struct ieee80211_sta *sta = file->private_data; 483 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 483 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 484 484 struct ath11k *ar = arsta->arvif->ar; 485 485 u32 tid, initiator, reason; 486 486 int ret; ··· 531 531 size_t count, loff_t *ppos) 532 532 { 533 533 struct ieee80211_sta *sta = file->private_data; 534 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 534 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 535 535 struct ath11k *ar = arsta->arvif->ar; 536 536 u32 tid, status; 537 537 int ret; ··· 581 581 size_t count, loff_t *ppos) 582 582 { 583 583 struct ieee80211_sta *sta = file->private_data; 584 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 584 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 585 585 struct ath11k *ar = arsta->arvif->ar; 586 586 u32 tid, buf_size; 587 587 int ret; ··· 632 632 size_t count, loff_t *ppos) 633 633 { 634 634 struct ieee80211_sta *sta = file->private_data; 635 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 635 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 636 636 struct ath11k *ar = arsta->arvif->ar; 637 637 char buf[64]; 638 638 int len = 0; ··· 652 652 size_t count, loff_t *ppos) 653 653 { 654 654 struct ieee80211_sta *sta = file->private_data; 655 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 655 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 656 656 struct ath11k *ar = arsta->arvif->ar; 657 657 u32 aggr_mode; 658 658 int ret; ··· 697 697 size_t count, loff_t *ppos) 698 698 { 699 699 struct ieee80211_sta *sta = file->private_data; 700 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 700 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 701 701 struct ath11k *ar = arsta->arvif->ar; 702 702 struct htt_ext_stats_cfg_params cfg_params = { 0 }; 703 703 int ret; ··· 756 756 size_t count, loff_t *ppos) 757 757 { 758 758 struct ieee80211_sta *sta = file->private_data; 759 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 759 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 760 760 struct ath11k *ar = arsta->arvif->ar; 761 761 char buf[20]; 762 762 int len; ··· 783 783 loff_t *ppos) 784 784 { 785 785 struct ieee80211_sta *sta = file->private_data; 786 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 786 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 787 787 struct ath11k *ar = arsta->arvif->ar; 788 788 u64 time_since_station_in_power_save; 789 789 char buf[20]; ··· 817 817 size_t count, loff_t *ppos) 818 818 { 819 819 struct ieee80211_sta *sta = file->private_data; 820 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 820 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 821 821 struct ath11k *ar = arsta->arvif->ar; 822 822 char buf[20]; 823 823 u64 power_save_duration;
+11 -5
drivers/net/wireless/ath/ath11k/dp_rx.c
··· 1099 1099 struct ieee80211_ampdu_params *params) 1100 1100 { 1101 1101 struct ath11k_base *ab = ar->ab; 1102 - struct ath11k_sta *arsta = (void *)params->sta->drv_priv; 1102 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta); 1103 1103 int vdev_id = arsta->arvif->vdev_id; 1104 1104 int ret; 1105 1105 ··· 1117 1117 { 1118 1118 struct ath11k_base *ab = ar->ab; 1119 1119 struct ath11k_peer *peer; 1120 - struct ath11k_sta *arsta = (void *)params->sta->drv_priv; 1120 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta); 1121 1121 int vdev_id = arsta->arvif->vdev_id; 1122 1122 dma_addr_t paddr; 1123 1123 bool active; ··· 1456 1456 } 1457 1457 1458 1458 sta = peer->sta; 1459 - arsta = (struct ath11k_sta *)sta->drv_priv; 1459 + arsta = ath11k_sta_to_arsta(sta); 1460 1460 1461 1461 memset(&arsta->txrate, 0, sizeof(arsta->txrate)); 1462 1462 ··· 1618 1618 u8 pdev_id; 1619 1619 1620 1620 pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_INFO_PDEV_ID, data->hdr); 1621 + 1622 + rcu_read_lock(); 1623 + 1621 1624 ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id); 1622 1625 if (!ar) { 1623 1626 ath11k_warn(ab, "invalid pdev id %d on htt pktlog\n", pdev_id); 1624 - return; 1627 + goto out; 1625 1628 } 1626 1629 1627 1630 trace_ath11k_htt_pktlog(ar, data->payload, hdr->size, 1628 1631 ar->ab->pktlog_defs_checksum); 1632 + 1633 + out: 1634 + rcu_read_unlock(); 1629 1635 } 1630 1636 1631 1637 static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab, ··· 5248 5242 goto next_skb; 5249 5243 } 5250 5244 5251 - arsta = (struct ath11k_sta *)peer->sta->drv_priv; 5245 + arsta = ath11k_sta_to_arsta(peer->sta); 5252 5246 ath11k_dp_rx_update_peer_stats(arsta, ppdu_info); 5253 5247 5254 5248 if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr))
+2 -2
drivers/net/wireless/ath/ath11k/dp_tx.c
··· 467 467 } 468 468 469 469 sta = peer->sta; 470 - arsta = (struct ath11k_sta *)sta->drv_priv; 470 + arsta = ath11k_sta_to_arsta(sta); 471 471 472 472 memset(&arsta->txrate, 0, sizeof(arsta->txrate)); 473 473 pkt_type = FIELD_GET(HAL_TX_RATE_STATS_INFO0_PKT_TYPE, ··· 627 627 ieee80211_free_txskb(ar->hw, msdu); 628 628 return; 629 629 } 630 - arsta = (struct ath11k_sta *)peer->sta->drv_priv; 630 + arsta = ath11k_sta_to_arsta(peer->sta); 631 631 status.sta = peer->sta; 632 632 status.skb = msdu; 633 633 status.info = info;
+168
drivers/net/wireless/ath/ath11k/fw.c
··· 1 + // SPDX-License-Identifier: BSD-3-Clause-Clear 2 + /* 3 + * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. 4 + */ 5 + 6 + #include "core.h" 7 + 8 + #include "debug.h" 9 + 10 + static int ath11k_fw_request_firmware_api_n(struct ath11k_base *ab, 11 + const char *name) 12 + { 13 + size_t magic_len, len, ie_len; 14 + int ie_id, i, index, bit, ret; 15 + struct ath11k_fw_ie *hdr; 16 + const u8 *data; 17 + __le32 *timestamp; 18 + 19 + ab->fw.fw = ath11k_core_firmware_request(ab, name); 20 + if (IS_ERR(ab->fw.fw)) { 21 + ret = PTR_ERR(ab->fw.fw); 22 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "failed to load %s: %d\n", name, ret); 23 + ab->fw.fw = NULL; 24 + return ret; 25 + } 26 + 27 + data = ab->fw.fw->data; 28 + len = ab->fw.fw->size; 29 + 30 + /* magic also includes the null byte, check that as well */ 31 + magic_len = strlen(ATH11K_FIRMWARE_MAGIC) + 1; 32 + 33 + if (len < magic_len) { 34 + ath11k_err(ab, "firmware image too small to contain magic: %zu\n", 35 + len); 36 + ret = -EINVAL; 37 + goto err; 38 + } 39 + 40 + if (memcmp(data, ATH11K_FIRMWARE_MAGIC, magic_len) != 0) { 41 + ath11k_err(ab, "Invalid firmware magic\n"); 42 + ret = -EINVAL; 43 + goto err; 44 + } 45 + 46 + /* jump over the padding */ 47 + magic_len = ALIGN(magic_len, 4); 48 + 49 + /* make sure there's space for padding */ 50 + if (magic_len > len) { 51 + ath11k_err(ab, "No space for padding after magic\n"); 52 + ret = -EINVAL; 53 + goto err; 54 + } 55 + 56 + len -= magic_len; 57 + data += magic_len; 58 + 59 + /* loop elements */ 60 + while (len > sizeof(struct ath11k_fw_ie)) { 61 + hdr = (struct ath11k_fw_ie *)data; 62 + 63 + ie_id = le32_to_cpu(hdr->id); 64 + ie_len = le32_to_cpu(hdr->len); 65 + 66 + len -= sizeof(*hdr); 67 + data += sizeof(*hdr); 68 + 69 + if (len < ie_len) { 70 + ath11k_err(ab, "Invalid length for FW IE %d (%zu < %zu)\n", 71 + ie_id, len, ie_len); 72 + ret = -EINVAL; 73 + goto err; 74 + } 75 + 76 + switch (ie_id) { 77 + case ATH11K_FW_IE_TIMESTAMP: 78 + if (ie_len != sizeof(u32)) 79 + break; 80 + 81 + timestamp = (__le32 *)data; 82 + 83 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "found fw timestamp %d\n", 84 + le32_to_cpup(timestamp)); 85 + break; 86 + case ATH11K_FW_IE_FEATURES: 87 + ath11k_dbg(ab, ATH11K_DBG_BOOT, 88 + "found firmware features ie (%zd B)\n", 89 + ie_len); 90 + 91 + for (i = 0; i < ATH11K_FW_FEATURE_COUNT; i++) { 92 + index = i / 8; 93 + bit = i % 8; 94 + 95 + if (index == ie_len) 96 + break; 97 + 98 + if (data[index] & (1 << bit)) 99 + __set_bit(i, ab->fw.fw_features); 100 + } 101 + 102 + ath11k_dbg_dump(ab, ATH11K_DBG_BOOT, "features", "", 103 + ab->fw.fw_features, 104 + sizeof(ab->fw.fw_features)); 105 + break; 106 + case ATH11K_FW_IE_AMSS_IMAGE: 107 + ath11k_dbg(ab, ATH11K_DBG_BOOT, 108 + "found fw image ie (%zd B)\n", 109 + ie_len); 110 + 111 + ab->fw.amss_data = data; 112 + ab->fw.amss_len = ie_len; 113 + break; 114 + case ATH11K_FW_IE_M3_IMAGE: 115 + ath11k_dbg(ab, ATH11K_DBG_BOOT, 116 + "found m3 image ie (%zd B)\n", 117 + ie_len); 118 + 119 + ab->fw.m3_data = data; 120 + ab->fw.m3_len = ie_len; 121 + break; 122 + default: 123 + ath11k_warn(ab, "Unknown FW IE: %u\n", ie_id); 124 + break; 125 + } 126 + 127 + /* jump over the padding */ 128 + ie_len = ALIGN(ie_len, 4); 129 + 130 + /* make sure there's space for padding */ 131 + if (ie_len > len) 132 + break; 133 + 134 + len -= ie_len; 135 + data += ie_len; 136 + }; 137 + 138 + return 0; 139 + 140 + err: 141 + release_firmware(ab->fw.fw); 142 + ab->fw.fw = NULL; 143 + return ret; 144 + } 145 + 146 + int ath11k_fw_pre_init(struct ath11k_base *ab) 147 + { 148 + int ret; 149 + 150 + ret = ath11k_fw_request_firmware_api_n(ab, ATH11K_FW_API2_FILE); 151 + if (ret == 0) { 152 + ab->fw.api_version = 2; 153 + goto out; 154 + } 155 + 156 + ab->fw.api_version = 1; 157 + 158 + out: 159 + ath11k_dbg(ab, ATH11K_DBG_BOOT, "using fw api %d\n", 160 + ab->fw.api_version); 161 + 162 + return 0; 163 + } 164 + 165 + void ath11k_fw_destroy(struct ath11k_base *ab) 166 + { 167 + release_firmware(ab->fw.fw); 168 + }
+27
drivers/net/wireless/ath/ath11k/fw.h
··· 1 + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 + /* 3 + * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. 4 + */ 5 + 6 + #ifndef ATH11K_FW_H 7 + #define ATH11K_FW_H 8 + 9 + #define ATH11K_FW_API2_FILE "firmware-2.bin" 10 + #define ATH11K_FIRMWARE_MAGIC "QCOM-ATH11K-FW" 11 + 12 + enum ath11k_fw_ie_type { 13 + ATH11K_FW_IE_TIMESTAMP = 0, 14 + ATH11K_FW_IE_FEATURES = 1, 15 + ATH11K_FW_IE_AMSS_IMAGE = 2, 16 + ATH11K_FW_IE_M3_IMAGE = 3, 17 + }; 18 + 19 + enum ath11k_fw_features { 20 + /* keep last */ 21 + ATH11K_FW_FEATURE_COUNT, 22 + }; 23 + 24 + int ath11k_fw_pre_init(struct ath11k_base *ab); 25 + void ath11k_fw_destroy(struct ath11k_base *ab); 26 + 27 + #endif /* ATH11K_FW_H */
+27 -27
drivers/net/wireless/ath/ath11k/hif.h
··· 9 9 #include "core.h" 10 10 11 11 struct ath11k_hif_ops { 12 - u32 (*read32)(struct ath11k_base *sc, u32 address); 13 - void (*write32)(struct ath11k_base *sc, u32 address, u32 data); 12 + u32 (*read32)(struct ath11k_base *ab, u32 address); 13 + void (*write32)(struct ath11k_base *ab, u32 address, u32 data); 14 14 int (*read)(struct ath11k_base *ab, void *buf, u32 start, u32 end); 15 - void (*irq_enable)(struct ath11k_base *sc); 16 - void (*irq_disable)(struct ath11k_base *sc); 17 - int (*start)(struct ath11k_base *sc); 18 - void (*stop)(struct ath11k_base *sc); 19 - int (*power_up)(struct ath11k_base *sc); 20 - void (*power_down)(struct ath11k_base *sc); 15 + void (*irq_enable)(struct ath11k_base *ab); 16 + void (*irq_disable)(struct ath11k_base *ab); 17 + int (*start)(struct ath11k_base *ab); 18 + void (*stop)(struct ath11k_base *ab); 19 + int (*power_up)(struct ath11k_base *ab); 20 + void (*power_down)(struct ath11k_base *ab); 21 21 int (*suspend)(struct ath11k_base *ab); 22 22 int (*resume)(struct ath11k_base *ab); 23 - int (*map_service_to_pipe)(struct ath11k_base *sc, u16 service_id, 23 + int (*map_service_to_pipe)(struct ath11k_base *ab, u16 service_id, 24 24 u8 *ul_pipe, u8 *dl_pipe); 25 25 int (*get_user_msi_vector)(struct ath11k_base *ab, char *user_name, 26 26 int *num_vectors, u32 *user_base_data, ··· 44 44 ab->hif.ops->ce_irq_disable(ab); 45 45 } 46 46 47 - static inline int ath11k_hif_start(struct ath11k_base *sc) 47 + static inline int ath11k_hif_start(struct ath11k_base *ab) 48 48 { 49 - return sc->hif.ops->start(sc); 49 + return ab->hif.ops->start(ab); 50 50 } 51 51 52 - static inline void ath11k_hif_stop(struct ath11k_base *sc) 52 + static inline void ath11k_hif_stop(struct ath11k_base *ab) 53 53 { 54 - sc->hif.ops->stop(sc); 54 + ab->hif.ops->stop(ab); 55 55 } 56 56 57 - static inline void ath11k_hif_irq_enable(struct ath11k_base *sc) 57 + static inline void ath11k_hif_irq_enable(struct ath11k_base *ab) 58 58 { 59 - sc->hif.ops->irq_enable(sc); 59 + ab->hif.ops->irq_enable(ab); 60 60 } 61 61 62 - static inline void ath11k_hif_irq_disable(struct ath11k_base *sc) 62 + static inline void ath11k_hif_irq_disable(struct ath11k_base *ab) 63 63 { 64 - sc->hif.ops->irq_disable(sc); 64 + ab->hif.ops->irq_disable(ab); 65 65 } 66 66 67 - static inline int ath11k_hif_power_up(struct ath11k_base *sc) 67 + static inline int ath11k_hif_power_up(struct ath11k_base *ab) 68 68 { 69 - return sc->hif.ops->power_up(sc); 69 + return ab->hif.ops->power_up(ab); 70 70 } 71 71 72 - static inline void ath11k_hif_power_down(struct ath11k_base *sc) 72 + static inline void ath11k_hif_power_down(struct ath11k_base *ab) 73 73 { 74 - sc->hif.ops->power_down(sc); 74 + ab->hif.ops->power_down(ab); 75 75 } 76 76 77 77 static inline int ath11k_hif_suspend(struct ath11k_base *ab) ··· 90 90 return 0; 91 91 } 92 92 93 - static inline u32 ath11k_hif_read32(struct ath11k_base *sc, u32 address) 93 + static inline u32 ath11k_hif_read32(struct ath11k_base *ab, u32 address) 94 94 { 95 - return sc->hif.ops->read32(sc, address); 95 + return ab->hif.ops->read32(ab, address); 96 96 } 97 97 98 - static inline void ath11k_hif_write32(struct ath11k_base *sc, u32 address, u32 data) 98 + static inline void ath11k_hif_write32(struct ath11k_base *ab, u32 address, u32 data) 99 99 { 100 - sc->hif.ops->write32(sc, address, data); 100 + ab->hif.ops->write32(ab, address, data); 101 101 } 102 102 103 103 static inline int ath11k_hif_read(struct ath11k_base *ab, void *buf, ··· 109 109 return ab->hif.ops->read(ab, buf, start, end); 110 110 } 111 111 112 - static inline int ath11k_hif_map_service_to_pipe(struct ath11k_base *sc, u16 service_id, 112 + static inline int ath11k_hif_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, 113 113 u8 *ul_pipe, u8 *dl_pipe) 114 114 { 115 - return sc->hif.ops->map_service_to_pipe(sc, service_id, ul_pipe, dl_pipe); 115 + return ab->hif.ops->map_service_to_pipe(ab, service_id, ul_pipe, dl_pipe); 116 116 } 117 117 118 118 static inline int ath11k_get_user_msi_vector(struct ath11k_base *ab, char *user_name,
-12
drivers/net/wireless/ath/ath11k/htc.h
··· 156 156 }; 157 157 } __packed __aligned(4); 158 158 159 - /* note: the trailer offset is dynamic depending 160 - * on payload length. this is only a struct layout draft 161 - */ 162 - struct ath11k_htc_frame { 163 - struct ath11k_htc_hdr hdr; 164 - union { 165 - struct ath11k_htc_msg msg; 166 - u8 payload[0]; 167 - }; 168 - struct ath11k_htc_record trailer[0]; 169 - } __packed __aligned(4); 170 - 171 159 enum ath11k_htc_svc_gid { 172 160 ATH11K_HTC_SVC_GRP_RSVD = 0, 173 161 ATH11K_HTC_SVC_GRP_WMI = 1,
+9 -9
drivers/net/wireless/ath/ath11k/mac.c
··· 2832 2832 2833 2833 lockdep_assert_held(&ar->conf_mutex); 2834 2834 2835 - arsta = (struct ath11k_sta *)sta->drv_priv; 2835 + arsta = ath11k_sta_to_arsta(sta); 2836 2836 2837 2837 memset(arg, 0, sizeof(*arg)); 2838 2838 ··· 4315 4315 ath11k_warn(ab, "peer %pM disappeared!\n", peer_addr); 4316 4316 4317 4317 if (sta) { 4318 - arsta = (struct ath11k_sta *)sta->drv_priv; 4318 + arsta = ath11k_sta_to_arsta(sta); 4319 4319 4320 4320 switch (key->cipher) { 4321 4321 case WLAN_CIPHER_SUITE_TKIP: ··· 4906 4906 { 4907 4907 struct ath11k_base *ab = ar->ab; 4908 4908 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 4909 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 4909 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 4910 4910 struct peer_create_params peer_param; 4911 4911 int ret; 4912 4912 ··· 5030 5030 { 5031 5031 struct ath11k *ar = hw->priv; 5032 5032 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 5033 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 5033 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 5034 5034 struct ath11k_peer *peer; 5035 5035 int ret = 0; 5036 5036 ··· 5196 5196 struct ieee80211_sta *sta, bool enabled) 5197 5197 { 5198 5198 struct ath11k *ar = hw->priv; 5199 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 5199 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 5200 5200 5201 5201 if (enabled && !arsta->use_4addr_set) { 5202 5202 ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk); ··· 5210 5210 u32 changed) 5211 5211 { 5212 5212 struct ath11k *ar = hw->priv; 5213 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 5213 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 5214 5214 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 5215 5215 struct ath11k_peer *peer; 5216 5216 u32 bw, smps; ··· 6203 6203 } 6204 6204 6205 6205 if (control->sta) 6206 - arsta = (struct ath11k_sta *)control->sta->drv_priv; 6206 + arsta = ath11k_sta_to_arsta(control->sta); 6207 6207 6208 6208 ret = ath11k_dp_tx(ar, arvif, arsta, skb); 6209 6209 if (unlikely(ret)) { ··· 8235 8235 struct ieee80211_sta *sta) 8236 8236 { 8237 8237 struct ath11k_vif *arvif = data; 8238 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 8238 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 8239 8239 struct ath11k *ar = arvif->ar; 8240 8240 8241 8241 spin_lock_bh(&ar->data_lock); ··· 8639 8639 struct ieee80211_sta *sta, 8640 8640 struct station_info *sinfo) 8641 8641 { 8642 - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; 8642 + struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 8643 8643 struct ath11k *ar = arsta->arvif->ar; 8644 8644 s8 signal; 8645 8645 bool db2dbm = test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT,
+13 -5
drivers/net/wireless/ath/ath11k/mhi.c
··· 6 6 7 7 #include <linux/msi.h> 8 8 #include <linux/pci.h> 9 + #include <linux/firmware.h> 9 10 #include <linux/of.h> 10 11 #include <linux/of_address.h> 11 12 #include <linux/ioport.h> ··· 391 390 if (!mhi_ctrl) 392 391 return -ENOMEM; 393 392 394 - ath11k_core_create_firmware_path(ab, ATH11K_AMSS_FILE, 395 - ab_pci->amss_path, 396 - sizeof(ab_pci->amss_path)); 397 - 398 393 ab_pci->mhi_ctrl = mhi_ctrl; 399 394 mhi_ctrl->cntrl_dev = ab->dev; 400 - mhi_ctrl->fw_image = ab_pci->amss_path; 401 395 mhi_ctrl->regs = ab->mem; 402 396 mhi_ctrl->reg_len = ab->mem_len; 397 + 398 + if (ab->fw.amss_data && ab->fw.amss_len > 0) { 399 + /* use MHI firmware file from firmware-N.bin */ 400 + mhi_ctrl->fw_data = ab->fw.amss_data; 401 + mhi_ctrl->fw_sz = ab->fw.amss_len; 402 + } else { 403 + /* use the old separate mhi.bin MHI firmware file */ 404 + ath11k_core_create_firmware_path(ab, ATH11K_AMSS_FILE, 405 + ab_pci->amss_path, 406 + sizeof(ab_pci->amss_path)); 407 + mhi_ctrl->fw_image = ab_pci->amss_path; 408 + } 403 409 404 410 ret = ath11k_mhi_get_msi(ab_pci); 405 411 if (ret) {
+3 -3
drivers/net/wireless/ath/ath11k/pcic.c
··· 422 422 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); 423 423 } 424 424 425 - static void __ath11k_pcic_ext_irq_disable(struct ath11k_base *sc) 425 + static void __ath11k_pcic_ext_irq_disable(struct ath11k_base *ab) 426 426 { 427 427 int i; 428 428 429 - clear_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &sc->dev_flags); 429 + clear_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); 430 430 431 431 for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { 432 - struct ath11k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; 432 + struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 433 433 434 434 ath11k_pcic_ext_grp_disable(irq_grp); 435 435
+1 -1
drivers/net/wireless/ath/ath11k/peer.c
··· 446 446 peer->sec_type_grp = HAL_ENCRYPT_TYPE_OPEN; 447 447 448 448 if (sta) { 449 - arsta = (struct ath11k_sta *)sta->drv_priv; 449 + arsta = ath11k_sta_to_arsta(sta); 450 450 arsta->tcl_metadata |= FIELD_PREP(HTT_TCL_META_DATA_TYPE, 0) | 451 451 FIELD_PREP(HTT_TCL_META_DATA_PEER_ID, 452 452 peer->peer_id);
+36 -18
drivers/net/wireless/ath/ath11k/qmi.c
··· 2502 2502 static int ath11k_qmi_m3_load(struct ath11k_base *ab) 2503 2503 { 2504 2504 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 2505 - const struct firmware *fw; 2505 + const struct firmware *fw = NULL; 2506 + const void *m3_data; 2506 2507 char path[100]; 2508 + size_t m3_len; 2507 2509 int ret; 2508 2510 2509 - fw = ath11k_core_firmware_request(ab, ATH11K_M3_FILE); 2510 - if (IS_ERR(fw)) { 2511 - ret = PTR_ERR(fw); 2512 - ath11k_core_create_firmware_path(ab, ATH11K_M3_FILE, 2513 - path, sizeof(path)); 2514 - ath11k_err(ab, "failed to load %s: %d\n", path, ret); 2515 - return ret; 2511 + if (m3_mem->vaddr) 2512 + /* m3 firmware buffer is already available in the DMA buffer */ 2513 + return 0; 2514 + 2515 + if (ab->fw.m3_data && ab->fw.m3_len > 0) { 2516 + /* firmware-N.bin had a m3 firmware file so use that */ 2517 + m3_data = ab->fw.m3_data; 2518 + m3_len = ab->fw.m3_len; 2519 + } else { 2520 + /* No m3 file in firmware-N.bin so try to request old 2521 + * separate m3.bin. 2522 + */ 2523 + fw = ath11k_core_firmware_request(ab, ATH11K_M3_FILE); 2524 + if (IS_ERR(fw)) { 2525 + ret = PTR_ERR(fw); 2526 + ath11k_core_create_firmware_path(ab, ATH11K_M3_FILE, 2527 + path, sizeof(path)); 2528 + ath11k_err(ab, "failed to load %s: %d\n", path, ret); 2529 + return ret; 2530 + } 2531 + 2532 + m3_data = fw->data; 2533 + m3_len = fw->size; 2516 2534 } 2517 2535 2518 - if (m3_mem->vaddr || m3_mem->size) 2519 - goto skip_m3_alloc; 2520 - 2521 2536 m3_mem->vaddr = dma_alloc_coherent(ab->dev, 2522 - fw->size, &m3_mem->paddr, 2537 + m3_len, &m3_mem->paddr, 2523 2538 GFP_KERNEL); 2524 2539 if (!m3_mem->vaddr) { 2525 2540 ath11k_err(ab, "failed to allocate memory for M3 with size %zu\n", 2526 2541 fw->size); 2527 - release_firmware(fw); 2528 - return -ENOMEM; 2542 + ret = -ENOMEM; 2543 + goto out; 2529 2544 } 2530 2545 2531 - skip_m3_alloc: 2532 - memcpy(m3_mem->vaddr, fw->data, fw->size); 2533 - m3_mem->size = fw->size; 2546 + memcpy(m3_mem->vaddr, m3_data, m3_len); 2547 + m3_mem->size = m3_len; 2548 + 2549 + ret = 0; 2550 + 2551 + out: 2534 2552 release_firmware(fw); 2535 2553 2536 - return 0; 2554 + return ret; 2537 2555 } 2538 2556 2539 2557 static void ath11k_qmi_m3_free(struct ath11k_base *ab)
+11
drivers/net/wireless/ath/ath11k/reg.c
··· 352 352 return flags; 353 353 } 354 354 355 + static u32 ath11k_map_fw_phy_flags(u32 phy_flags) 356 + { 357 + u32 flags = 0; 358 + 359 + if (phy_flags & ATH11K_REG_PHY_BITMAP_NO11AX) 360 + flags |= NL80211_RRF_NO_HE; 361 + 362 + return flags; 363 + } 364 + 355 365 static bool 356 366 ath11k_reg_can_intersect(struct ieee80211_reg_rule *rule1, 357 367 struct ieee80211_reg_rule *rule2) ··· 695 685 } 696 686 697 687 flags |= ath11k_map_fw_reg_flags(reg_rule->flags); 688 + flags |= ath11k_map_fw_phy_flags(reg_info->phybitmap); 698 689 699 690 ath11k_reg_update_rule(tmp_regd->reg_rules + i, 700 691 reg_rule->start_freq,
+3
drivers/net/wireless/ath/ath11k/reg.h
··· 24 24 ATH11K_DFS_REG_UNDEF, 25 25 }; 26 26 27 + /* Phy bitmaps */ 28 + #define ATH11K_REG_PHY_BITMAP_NO11AX BIT(5) 29 + 27 30 /* ATH11K Regulatory API's */ 28 31 void ath11k_reg_init(struct ath11k *ar); 29 32 void ath11k_reg_free(struct ath11k_base *ab);
+11 -11
drivers/net/wireless/ath/ath11k/thermal.c
··· 125 125 126 126 int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state) 127 127 { 128 - struct ath11k_base *sc = ar->ab; 128 + struct ath11k_base *ab = ar->ab; 129 129 struct thermal_mitigation_params param; 130 130 int ret = 0; 131 131 ··· 147 147 148 148 ret = ath11k_wmi_send_thermal_mitigation_param_cmd(ar, &param); 149 149 if (ret) { 150 - ath11k_warn(sc, "failed to send thermal mitigation duty cycle %u ret %d\n", 150 + ath11k_warn(ab, "failed to send thermal mitigation duty cycle %u ret %d\n", 151 151 throttle_state, ret); 152 152 } 153 153 154 154 return ret; 155 155 } 156 156 157 - int ath11k_thermal_register(struct ath11k_base *sc) 157 + int ath11k_thermal_register(struct ath11k_base *ab) 158 158 { 159 159 struct thermal_cooling_device *cdev; 160 160 struct device *hwmon_dev; ··· 162 162 struct ath11k_pdev *pdev; 163 163 int i, ret; 164 164 165 - for (i = 0; i < sc->num_radios; i++) { 166 - pdev = &sc->pdevs[i]; 165 + for (i = 0; i < ab->num_radios; i++) { 166 + pdev = &ab->pdevs[i]; 167 167 ar = pdev->ar; 168 168 if (!ar) 169 169 continue; ··· 172 172 &ath11k_thermal_ops); 173 173 174 174 if (IS_ERR(cdev)) { 175 - ath11k_err(sc, "failed to setup thermal device result: %ld\n", 175 + ath11k_err(ab, "failed to setup thermal device result: %ld\n", 176 176 PTR_ERR(cdev)); 177 177 ret = -EINVAL; 178 178 goto err_thermal_destroy; ··· 183 183 ret = sysfs_create_link(&ar->hw->wiphy->dev.kobj, &cdev->device.kobj, 184 184 "cooling_device"); 185 185 if (ret) { 186 - ath11k_err(sc, "failed to create cooling device symlink\n"); 186 + ath11k_err(ab, "failed to create cooling device symlink\n"); 187 187 goto err_thermal_destroy; 188 188 } 189 189 ··· 204 204 return 0; 205 205 206 206 err_thermal_destroy: 207 - ath11k_thermal_unregister(sc); 207 + ath11k_thermal_unregister(ab); 208 208 return ret; 209 209 } 210 210 211 - void ath11k_thermal_unregister(struct ath11k_base *sc) 211 + void ath11k_thermal_unregister(struct ath11k_base *ab) 212 212 { 213 213 struct ath11k *ar; 214 214 struct ath11k_pdev *pdev; 215 215 int i; 216 216 217 - for (i = 0; i < sc->num_radios; i++) { 218 - pdev = &sc->pdevs[i]; 217 + for (i = 0; i < ab->num_radios; i++) { 218 + pdev = &ab->pdevs[i]; 219 219 ar = pdev->ar; 220 220 if (!ar) 221 221 continue;
+4 -4
drivers/net/wireless/ath/ath11k/thermal.h
··· 26 26 }; 27 27 28 28 #if IS_REACHABLE(CONFIG_THERMAL) 29 - int ath11k_thermal_register(struct ath11k_base *sc); 30 - void ath11k_thermal_unregister(struct ath11k_base *sc); 29 + int ath11k_thermal_register(struct ath11k_base *ab); 30 + void ath11k_thermal_unregister(struct ath11k_base *ab); 31 31 int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state); 32 32 void ath11k_thermal_event_temperature(struct ath11k *ar, int temperature); 33 33 #else 34 - static inline int ath11k_thermal_register(struct ath11k_base *sc) 34 + static inline int ath11k_thermal_register(struct ath11k_base *ab) 35 35 { 36 36 return 0; 37 37 } 38 38 39 - static inline void ath11k_thermal_unregister(struct ath11k_base *sc) 39 + static inline void ath11k_thermal_unregister(struct ath11k_base *ab) 40 40 { 41 41 } 42 42
+37 -25
drivers/net/wireless/ath/ath11k/wmi.c
··· 292 292 int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, 293 293 u32 cmd_id) 294 294 { 295 - struct ath11k_wmi_base *wmi_sc = wmi->wmi_ab; 295 + struct ath11k_wmi_base *wmi_ab = wmi->wmi_ab; 296 296 int ret = -EOPNOTSUPP; 297 - struct ath11k_base *ab = wmi_sc->ab; 297 + struct ath11k_base *ab = wmi_ab->ab; 298 298 299 299 might_sleep(); 300 300 301 301 if (ab->hw_params.credit_flow) { 302 - wait_event_timeout(wmi_sc->tx_credits_wq, ({ 302 + wait_event_timeout(wmi_ab->tx_credits_wq, ({ 303 303 ret = ath11k_wmi_cmd_send_nowait(wmi, skb, cmd_id); 304 304 305 305 if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH, 306 - &wmi_sc->ab->dev_flags)) 306 + &wmi_ab->ab->dev_flags)) 307 307 ret = -ESHUTDOWN; 308 308 309 309 (ret != -EAGAIN); ··· 313 313 ret = ath11k_wmi_cmd_send_nowait(wmi, skb, cmd_id); 314 314 315 315 if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH, 316 - &wmi_sc->ab->dev_flags)) 316 + &wmi_ab->ab->dev_flags)) 317 317 ret = -ESHUTDOWN; 318 318 319 319 (ret != -ENOBUFS); ··· 321 321 } 322 322 323 323 if (ret == -EAGAIN) 324 - ath11k_warn(wmi_sc->ab, "wmi command %d timeout\n", cmd_id); 324 + ath11k_warn(wmi_ab->ab, "wmi command %d timeout\n", cmd_id); 325 325 326 326 if (ret == -ENOBUFS) 327 - ath11k_warn(wmi_sc->ab, "ce desc not available for wmi command %d\n", 327 + ath11k_warn(wmi_ab->ab, "ce desc not available for wmi command %d\n", 328 328 cmd_id); 329 329 330 330 return ret; ··· 611 611 return 0; 612 612 } 613 613 614 - struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len) 614 + struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_ab, u32 len) 615 615 { 616 616 struct sk_buff *skb; 617 - struct ath11k_base *ab = wmi_sc->ab; 617 + struct ath11k_base *ab = wmi_ab->ab; 618 618 u32 round_len = roundup(len, 4); 619 619 620 620 skb = ath11k_htc_alloc_skb(ab, WMI_SKB_HEADROOM + round_len); ··· 4291 4291 4292 4292 int ath11k_wmi_cmd_init(struct ath11k_base *ab) 4293 4293 { 4294 - struct ath11k_wmi_base *wmi_sc = &ab->wmi_ab; 4294 + struct ath11k_wmi_base *wmi_ab = &ab->wmi_ab; 4295 4295 struct wmi_init_cmd_param init_param; 4296 4296 struct target_resource_config config; 4297 4297 ··· 4304 4304 ab->wmi_ab.svc_map)) 4305 4305 config.is_reg_cc_ext_event_supported = 1; 4306 4306 4307 - memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config)); 4307 + memcpy(&wmi_ab->wlan_resource_config, &config, sizeof(config)); 4308 4308 4309 - init_param.res_cfg = &wmi_sc->wlan_resource_config; 4310 - init_param.num_mem_chunks = wmi_sc->num_mem_chunks; 4311 - init_param.hw_mode_id = wmi_sc->preferred_hw_mode; 4312 - init_param.mem_chunks = wmi_sc->mem_chunks; 4309 + init_param.res_cfg = &wmi_ab->wlan_resource_config; 4310 + init_param.num_mem_chunks = wmi_ab->num_mem_chunks; 4311 + init_param.hw_mode_id = wmi_ab->preferred_hw_mode; 4312 + init_param.mem_chunks = wmi_ab->mem_chunks; 4313 4313 4314 4314 if (ab->hw_params.single_pdev_only) 4315 4315 init_param.hw_mode_id = WMI_HOST_HW_MODE_MAX; ··· 4317 4317 init_param.num_band_to_mac = ab->num_radios; 4318 4318 ath11k_fill_band_to_mac_param(ab, init_param.band_to_mac); 4319 4319 4320 - return ath11k_init_cmd_send(&wmi_sc->wmi[0], &init_param); 4320 + return ath11k_init_cmd_send(&wmi_ab->wmi[0], &init_param); 4321 4321 } 4322 4322 4323 4323 int ath11k_wmi_vdev_spectral_conf(struct ath11k *ar, ··· 5440 5440 } 5441 5441 5442 5442 ath11k_dbg(ab, ATH11K_DBG_WMI, 5443 - "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", 5443 + "cc_ext %s dfs %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d phy_bitmap 0x%x", 5444 5444 reg_info->alpha2, reg_info->dfs_region, 5445 5445 reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, 5446 - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); 5446 + reg_info->min_bw_5ghz, reg_info->max_bw_5ghz, 5447 + reg_info->phybitmap); 5447 5448 5448 5449 ath11k_dbg(ab, ATH11K_DBG_WMI, 5449 5450 "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", ··· 6453 6452 goto exit; 6454 6453 } 6455 6454 6456 - arsta = (struct ath11k_sta *)sta->drv_priv; 6455 + arsta = ath11k_sta_to_arsta(sta); 6457 6456 6458 6457 BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) > 6459 6458 ARRAY_SIZE(stats_rssi->rssi_avg_beacon)); ··· 6541 6540 arvif->bssid, 6542 6541 NULL); 6543 6542 if (sta) { 6544 - arsta = (struct ath11k_sta *)sta->drv_priv; 6543 + arsta = ath11k_sta_to_arsta(sta); 6545 6544 arsta->rssi_beacon = src->beacon_snr; 6546 6545 ath11k_dbg(ab, ATH11K_DBG_WMI, 6547 6546 "stats vdev id %d snr %d\n", ··· 7468 7467 goto exit; 7469 7468 } 7470 7469 7471 - arsta = (struct ath11k_sta *)sta->drv_priv; 7470 + arsta = ath11k_sta_to_arsta(sta); 7472 7471 7473 7472 spin_lock_bh(&ar->data_lock); 7474 7473 ··· 8336 8335 ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, 8337 8336 ev->freq_offset, ev->sidx); 8338 8337 8338 + rcu_read_lock(); 8339 + 8339 8340 ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); 8340 8341 8341 8342 if (!ar) { ··· 8355 8352 ieee80211_radar_detected(ar->hw); 8356 8353 8357 8354 exit: 8355 + rcu_read_unlock(); 8356 + 8358 8357 kfree(tb); 8359 8358 } 8360 8359 ··· 8386 8381 ath11k_dbg(ab, ATH11K_DBG_WMI, "event pdev temperature ev temp %d pdev_id %d\n", 8387 8382 ev->temp, ev->pdev_id); 8388 8383 8384 + rcu_read_lock(); 8385 + 8389 8386 ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); 8390 8387 if (!ar) { 8391 8388 ath11k_warn(ab, "invalid pdev id in pdev temperature ev %d", ev->pdev_id); 8392 - kfree(tb); 8393 - return; 8389 + goto exit; 8394 8390 } 8395 8391 8396 8392 ath11k_thermal_event_temperature(ar, ev->temp); 8393 + 8394 + exit: 8395 + rcu_read_unlock(); 8397 8396 8398 8397 kfree(tb); 8399 8398 } ··· 8618 8609 return; 8619 8610 } 8620 8611 8612 + rcu_read_lock(); 8613 + 8621 8614 arvif = ath11k_mac_get_arvif_by_vdev_id(ab, ev->vdev_id); 8622 8615 if (!arvif) { 8623 8616 ath11k_warn(ab, "failed to get arvif for vdev_id:%d\n", 8624 8617 ev->vdev_id); 8625 - kfree(tb); 8626 - return; 8618 + goto exit; 8627 8619 } 8628 8620 8629 8621 ath11k_dbg(ab, ATH11K_DBG_WMI, "event gtk offload refresh_cnt %d\n", ··· 8641 8631 8642 8632 ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid, 8643 8633 (void *)&replay_ctr_be, GFP_ATOMIC); 8634 + exit: 8635 + rcu_read_unlock(); 8644 8636 8645 8637 kfree(tb); 8646 8638 }
+5 -3
drivers/net/wireless/ath/ath12k/core.c
··· 360 360 int ath12k_core_fetch_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd) 361 361 { 362 362 char boardname[BOARD_NAME_SIZE]; 363 + int bd_api; 363 364 int ret; 364 365 365 366 ret = ath12k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); ··· 369 368 return ret; 370 369 } 371 370 372 - ab->bd_api = 2; 371 + bd_api = 2; 373 372 ret = ath12k_core_fetch_board_data_api_n(ab, bd, boardname); 374 373 if (!ret) 375 374 goto success; 376 375 377 - ab->bd_api = 1; 376 + bd_api = 1; 378 377 ret = ath12k_core_fetch_board_data_api_1(ab, bd, ATH12K_DEFAULT_BOARD_FILE); 379 378 if (ret) { 380 379 ath12k_err(ab, "failed to fetch board-2.bin or board.bin from %s\n", ··· 383 382 } 384 383 385 384 success: 386 - ath12k_dbg(ab, ATH12K_DBG_BOOT, "using board api %d\n", ab->bd_api); 385 + ath12k_dbg(ab, ATH12K_DBG_BOOT, "using board api %d\n", bd_api); 387 386 return 0; 388 387 } 389 388 ··· 961 960 ATH12K_RECOVER_START_TIMEOUT_HZ); 962 961 963 962 ath12k_hif_power_down(ab); 963 + ath12k_qmi_free_resource(ab); 964 964 ath12k_hif_power_up(ab); 965 965 966 966 ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n");
+5 -1
drivers/net/wireless/ath/ath12k/core.h
··· 737 737 struct ath12k_wmi_target_cap_arg target_caps; 738 738 u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; 739 739 bool pdevs_macaddr_valid; 740 - int bd_api; 741 740 742 741 const struct ath12k_hw_params *hw_params; 743 742 ··· 850 851 static inline struct ath12k_vif *ath12k_vif_to_arvif(struct ieee80211_vif *vif) 851 852 { 852 853 return (struct ath12k_vif *)vif->drv_priv; 854 + } 855 + 856 + static inline struct ath12k_sta *ath12k_sta_to_arsta(struct ieee80211_sta *sta) 857 + { 858 + return (struct ath12k_sta *)sta->drv_priv; 853 859 } 854 860 855 861 static inline struct ath12k *ath12k_ab_to_ar(struct ath12k_base *ab,
+2 -2
drivers/net/wireless/ath/ath12k/dp_mon.c
··· 2374 2374 return; 2375 2375 } 2376 2376 2377 - arsta = (struct ath12k_sta *)peer->sta->drv_priv; 2377 + arsta = ath12k_sta_to_arsta(peer->sta); 2378 2378 rx_stats = arsta->rx_stats; 2379 2379 2380 2380 if (!rx_stats) ··· 2550 2550 } 2551 2551 2552 2552 if (ppdu_info->reception_type == HAL_RX_RECEPTION_TYPE_SU) { 2553 - arsta = (struct ath12k_sta *)peer->sta->drv_priv; 2553 + arsta = ath12k_sta_to_arsta(peer->sta); 2554 2554 ath12k_dp_mon_rx_update_peer_su_stats(ar, arsta, 2555 2555 ppdu_info); 2556 2556 } else if ((ppdu_info->fc_valid) &&
+8 -5
drivers/net/wireless/ath/ath12k/dp_rx.c
··· 1054 1054 struct ieee80211_ampdu_params *params) 1055 1055 { 1056 1056 struct ath12k_base *ab = ar->ab; 1057 - struct ath12k_sta *arsta = (void *)params->sta->drv_priv; 1057 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(params->sta); 1058 1058 int vdev_id = arsta->arvif->vdev_id; 1059 1059 int ret; 1060 1060 ··· 1072 1072 { 1073 1073 struct ath12k_base *ab = ar->ab; 1074 1074 struct ath12k_peer *peer; 1075 - struct ath12k_sta *arsta = (void *)params->sta->drv_priv; 1075 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(params->sta); 1076 1076 int vdev_id = arsta->arvif->vdev_id; 1077 1077 bool active; 1078 1078 int ret; ··· 1410 1410 } 1411 1411 1412 1412 sta = peer->sta; 1413 - arsta = (struct ath12k_sta *)sta->drv_priv; 1413 + arsta = ath12k_sta_to_arsta(sta); 1414 1414 1415 1415 memset(&arsta->txrate, 0, sizeof(arsta->txrate)); 1416 1416 ··· 1658 1658 msg = (struct ath12k_htt_mlo_offset_msg *)skb->data; 1659 1659 pdev_id = u32_get_bits(__le32_to_cpu(msg->info), 1660 1660 HTT_T2H_MLO_OFFSET_INFO_PDEV_ID); 1661 - ar = ath12k_mac_get_ar_by_pdev_id(ab, pdev_id); 1662 1661 1662 + rcu_read_lock(); 1663 + ar = ath12k_mac_get_ar_by_pdev_id(ab, pdev_id); 1663 1664 if (!ar) { 1664 1665 ath12k_warn(ab, "invalid pdev id %d on htt mlo offset\n", pdev_id); 1665 - return; 1666 + goto exit; 1666 1667 } 1667 1668 1668 1669 spin_lock_bh(&ar->data_lock); ··· 1679 1678 pdev->timestamp.mlo_comp_timer = __le32_to_cpu(msg->mlo_comp_timer); 1680 1679 1681 1680 spin_unlock_bh(&ar->data_lock); 1681 + exit: 1682 + rcu_read_unlock(); 1682 1683 } 1683 1684 1684 1685 void ath12k_dp_htt_htc_t2h_msg_handler(struct ath12k_base *ab,
+2 -2
drivers/net/wireless/ath/ath12k/dp_tx.c
··· 401 401 } 402 402 } 403 403 404 - ieee80211_tx_status(ar->hw, msdu); 404 + ieee80211_tx_status_skb(ar->hw, msdu); 405 405 } 406 406 407 407 static void ··· 498 498 * Might end up reporting it out-of-band from HTT stats. 499 499 */ 500 500 501 - ieee80211_tx_status(ar->hw, msdu); 501 + ieee80211_tx_status_skb(ar->hw, msdu); 502 502 503 503 exit: 504 504 rcu_read_unlock();
-2
drivers/net/wireless/ath/ath12k/hal_rx.c
··· 713 713 { 714 714 struct hal_rx_reo_queue_ext *ext_desc; 715 715 716 - memset(qdesc, 0, sizeof(*qdesc)); 717 - 718 716 ath12k_hal_reo_set_desc_hdr(&qdesc->desc_hdr, HAL_DESC_REO_OWNED, 719 717 HAL_DESC_REO_QUEUE_DESC, 720 718 REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_0);
+9 -9
drivers/net/wireless/ath/ath12k/hif.h
··· 10 10 #include "core.h" 11 11 12 12 struct ath12k_hif_ops { 13 - u32 (*read32)(struct ath12k_base *sc, u32 address); 14 - void (*write32)(struct ath12k_base *sc, u32 address, u32 data); 15 - void (*irq_enable)(struct ath12k_base *sc); 16 - void (*irq_disable)(struct ath12k_base *sc); 17 - int (*start)(struct ath12k_base *sc); 18 - void (*stop)(struct ath12k_base *sc); 19 - int (*power_up)(struct ath12k_base *sc); 20 - void (*power_down)(struct ath12k_base *sc); 13 + u32 (*read32)(struct ath12k_base *ab, u32 address); 14 + void (*write32)(struct ath12k_base *ab, u32 address, u32 data); 15 + void (*irq_enable)(struct ath12k_base *ab); 16 + void (*irq_disable)(struct ath12k_base *ab); 17 + int (*start)(struct ath12k_base *ab); 18 + void (*stop)(struct ath12k_base *ab); 19 + int (*power_up)(struct ath12k_base *ab); 20 + void (*power_down)(struct ath12k_base *ab); 21 21 int (*suspend)(struct ath12k_base *ab); 22 22 int (*resume)(struct ath12k_base *ab); 23 - int (*map_service_to_pipe)(struct ath12k_base *sc, u16 service_id, 23 + int (*map_service_to_pipe)(struct ath12k_base *ab, u16 service_id, 24 24 u8 *ul_pipe, u8 *dl_pipe); 25 25 int (*get_user_msi_vector)(struct ath12k_base *ab, char *user_name, 26 26 int *num_vectors, u32 *user_base_data,
+10 -2
drivers/net/wireless/ath/ath12k/hw.c
··· 886 886 .vdev_start_delay = false, 887 887 888 888 .interface_modes = BIT(NL80211_IFTYPE_STATION) | 889 - BIT(NL80211_IFTYPE_AP), 889 + BIT(NL80211_IFTYPE_AP) | 890 + BIT(NL80211_IFTYPE_MESH_POINT), 890 891 .supports_monitor = false, 891 892 892 893 .idle_ps = false, ··· 912 911 .rfkill_pin = 0, 913 912 .rfkill_cfg = 0, 914 913 .rfkill_on_level = 0, 914 + 915 + .rddm_size = 0, 915 916 }, 916 917 { 917 918 .name = "wcn7850 hw2.0", ··· 975 972 .rfkill_pin = 48, 976 973 .rfkill_cfg = 0, 977 974 .rfkill_on_level = 1, 975 + 976 + .rddm_size = 0x780000, 978 977 }, 979 978 { 980 979 .name = "qcn9274 hw2.0", ··· 1011 1006 .vdev_start_delay = false, 1012 1007 1013 1008 .interface_modes = BIT(NL80211_IFTYPE_STATION) | 1014 - BIT(NL80211_IFTYPE_AP), 1009 + BIT(NL80211_IFTYPE_AP) | 1010 + BIT(NL80211_IFTYPE_MESH_POINT), 1015 1011 .supports_monitor = false, 1016 1012 1017 1013 .idle_ps = false, ··· 1037 1031 .rfkill_pin = 0, 1038 1032 .rfkill_cfg = 0, 1039 1033 .rfkill_on_level = 0, 1034 + 1035 + .rddm_size = 0, 1040 1036 }, 1041 1037 }; 1042 1038
+2
drivers/net/wireless/ath/ath12k/hw.h
··· 190 190 u32 rfkill_pin; 191 191 u32 rfkill_cfg; 192 192 u32 rfkill_on_level; 193 + 194 + u32 rddm_size; 193 195 }; 194 196 195 197 struct ath12k_hw_ops {
+73 -28
drivers/net/wireless/ath/ath12k/mac.c
··· 523 523 struct ieee80211_vif *vif) 524 524 { 525 525 struct ath12k_vif_iter *arvif_iter = data; 526 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 526 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 527 527 528 528 if (arvif->vdev_id == arvif_iter->vdev_id) 529 529 arvif_iter->arvif = arvif; ··· 1208 1208 struct ieee80211_sta *sta, 1209 1209 struct ath12k_wmi_peer_assoc_arg *arg) 1210 1210 { 1211 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1211 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1212 1212 u32 aid; 1213 1213 1214 1214 lockdep_assert_held(&ar->conf_mutex); ··· 1236 1236 struct ieee80211_bss_conf *info = &vif->bss_conf; 1237 1237 struct cfg80211_chan_def def; 1238 1238 struct cfg80211_bss *bss; 1239 - struct ath12k_vif *arvif = (struct ath12k_vif *)vif->drv_priv; 1239 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1240 1240 const u8 *rsnie = NULL; 1241 1241 const u8 *wpaie = NULL; 1242 1242 ··· 1294 1294 struct ieee80211_sta *sta, 1295 1295 struct ath12k_wmi_peer_assoc_arg *arg) 1296 1296 { 1297 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1297 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1298 1298 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; 1299 1299 struct cfg80211_chan_def def; 1300 1300 const struct ieee80211_supported_band *sband; ··· 1357 1357 struct ath12k_wmi_peer_assoc_arg *arg) 1358 1358 { 1359 1359 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; 1360 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1360 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1361 1361 struct cfg80211_chan_def def; 1362 1362 enum nl80211_band band; 1363 1363 const u8 *ht_mcs_mask; ··· 1518 1518 struct ath12k_wmi_peer_assoc_arg *arg) 1519 1519 { 1520 1520 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; 1521 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1521 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1522 1522 struct cfg80211_chan_def def; 1523 1523 enum nl80211_band band; 1524 1524 const u16 *vht_mcs_mask; ··· 1793 1793 struct ieee80211_sta *sta, 1794 1794 struct ath12k_wmi_peer_assoc_arg *arg) 1795 1795 { 1796 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1796 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1797 1797 1798 1798 switch (arvif->vdev_type) { 1799 1799 case WMI_VDEV_TYPE_AP: ··· 1991 1991 struct ieee80211_sta *sta, 1992 1992 struct ath12k_wmi_peer_assoc_arg *arg) 1993 1993 { 1994 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 1994 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 1995 1995 struct cfg80211_chan_def def; 1996 1996 enum nl80211_band band; 1997 1997 const u8 *ht_mcs_mask; ··· 2140 2140 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; 2141 2141 const struct ieee80211_eht_mcs_nss_supp_20mhz_only *bw_20; 2142 2142 const struct ieee80211_eht_mcs_nss_supp_bw *bw; 2143 - struct ath12k_vif *arvif = (struct ath12k_vif *)vif->drv_priv; 2143 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 2144 2144 u32 *rx_mcs, *tx_mcs; 2145 2145 2146 2146 if (!sta->deflink.he_cap.has_he || !eht_cap->has_eht) ··· 2266 2266 struct ieee80211_bss_conf *bss_conf) 2267 2267 { 2268 2268 struct ath12k *ar = hw->priv; 2269 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 2269 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 2270 2270 struct ath12k_wmi_peer_assoc_arg peer_arg; 2271 2271 struct ieee80211_sta *ap_sta; 2272 2272 struct ath12k_peer *peer; ··· 2360 2360 struct ieee80211_vif *vif) 2361 2361 { 2362 2362 struct ath12k *ar = hw->priv; 2363 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 2363 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 2364 2364 int ret; 2365 2365 2366 2366 lockdep_assert_held(&ar->conf_mutex); ··· 2407 2407 struct ieee80211_vif *vif, 2408 2408 struct cfg80211_chan_def *def) 2409 2409 { 2410 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 2410 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 2411 2411 const struct ieee80211_supported_band *sband; 2412 2412 u8 basic_rate_idx; 2413 2413 int hw_rate_code; ··· 3247 3247 ath12k_warn(ab, "peer %pM disappeared!\n", peer_addr); 3248 3248 3249 3249 if (sta) { 3250 - arsta = (struct ath12k_sta *)sta->drv_priv; 3250 + arsta = ath12k_sta_to_arsta(sta); 3251 3251 3252 3252 switch (key->cipher) { 3253 3253 case WLAN_CIPHER_SUITE_TKIP: ··· 3420 3420 struct ieee80211_vif *vif, 3421 3421 struct ieee80211_sta *sta) 3422 3422 { 3423 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 3423 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 3424 3424 int ret; 3425 3425 3426 3426 lockdep_assert_held(&ar->conf_mutex); ··· 3637 3637 { 3638 3638 struct ath12k_base *ab = ar->ab; 3639 3639 struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 3640 - struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv; 3640 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); 3641 3641 struct ath12k_wmi_peer_create_arg peer_param; 3642 3642 int ret; 3643 3643 ··· 3744 3744 { 3745 3745 struct ath12k *ar = hw->priv; 3746 3746 struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 3747 - struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv; 3747 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); 3748 3748 struct ath12k_peer *peer; 3749 3749 int ret = 0; 3750 3750 ··· 3856 3856 struct ieee80211_sta *sta) 3857 3857 { 3858 3858 struct ath12k *ar = hw->priv; 3859 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 3859 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 3860 3860 int ret; 3861 3861 s16 txpwr; 3862 3862 ··· 3892 3892 u32 changed) 3893 3893 { 3894 3894 struct ath12k *ar = hw->priv; 3895 - struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv; 3896 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 3895 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); 3896 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 3897 3897 struct ath12k_peer *peer; 3898 3898 u32 bw, smps; 3899 3899 ··· 4019 4019 const struct ieee80211_tx_queue_params *params) 4020 4020 { 4021 4021 struct ath12k *ar = hw->priv; 4022 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 4022 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 4023 4023 struct wmi_wmm_params_arg *p = NULL; 4024 4024 int ret; 4025 4025 ··· 4554 4554 } 4555 4555 } 4556 4556 4557 + static void 4558 + ath12k_mac_filter_eht_cap_mesh(struct ieee80211_eht_cap_elem_fixed 4559 + *eht_cap_elem) 4560 + { 4561 + u8 m; 4562 + 4563 + m = IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS; 4564 + eht_cap_elem->mac_cap_info[0] &= ~m; 4565 + 4566 + m = IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO; 4567 + eht_cap_elem->phy_cap_info[0] &= ~m; 4568 + 4569 + m = IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK | 4570 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK | 4571 + IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK | 4572 + IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK; 4573 + eht_cap_elem->phy_cap_info[3] &= ~m; 4574 + 4575 + m = IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO | 4576 + IEEE80211_EHT_PHY_CAP4_PSR_SR_SUPP | 4577 + IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP | 4578 + IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI; 4579 + eht_cap_elem->phy_cap_info[4] &= ~m; 4580 + 4581 + m = IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK | 4582 + IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP | 4583 + IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP | 4584 + IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK; 4585 + eht_cap_elem->phy_cap_info[5] &= ~m; 4586 + 4587 + m = IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK; 4588 + eht_cap_elem->phy_cap_info[6] &= ~m; 4589 + 4590 + m = IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ | 4591 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ | 4592 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ | 4593 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ | 4594 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ | 4595 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ; 4596 + eht_cap_elem->phy_cap_info[7] &= ~m; 4597 + } 4598 + 4557 4599 static void ath12k_mac_copy_eht_cap(struct ath12k *ar, 4558 4600 struct ath12k_band_cap *band_cap, 4559 4601 struct ieee80211_he_cap_elem *he_cap_elem, ··· 4633 4591 ~(IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ | 4634 4592 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ | 4635 4593 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ); 4594 + break; 4595 + case NL80211_IFTYPE_MESH_POINT: 4596 + ath12k_mac_filter_eht_cap_mesh(eht_cap_elem); 4636 4597 break; 4637 4598 default: 4638 4599 break; ··· 6168 6123 lockdep_assert_held(&ar->conf_mutex); 6169 6124 6170 6125 for (i = 0; i < n_vifs; i++) { 6171 - arvif = (void *)vifs[i].vif->drv_priv; 6126 + arvif = ath12k_vif_to_arvif(vifs[i].vif); 6172 6127 6173 6128 if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR) 6174 6129 monitor_vif = true; ··· 6202 6157 /* TODO: Update ar->rx_channel */ 6203 6158 6204 6159 for (i = 0; i < n_vifs; i++) { 6205 - arvif = (void *)vifs[i].vif->drv_priv; 6160 + arvif = ath12k_vif_to_arvif(vifs[i].vif); 6206 6161 6207 6162 if (WARN_ON(!arvif->is_started)) 6208 6163 continue; ··· 6316 6271 { 6317 6272 struct ath12k *ar = hw->priv; 6318 6273 struct ath12k_base *ab = ar->ab; 6319 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 6274 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 6320 6275 int ret; 6321 6276 6322 6277 if (WARN_ON(arvif->is_started)) ··· 6352 6307 { 6353 6308 struct ath12k *ar = hw->priv; 6354 6309 struct ath12k_base *ab = ar->ab; 6355 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 6310 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 6356 6311 int ret; 6357 6312 struct ath12k_wmi_peer_create_arg param; 6358 6313 ··· 6431 6386 { 6432 6387 struct ath12k *ar = hw->priv; 6433 6388 struct ath12k_base *ab = ar->ab; 6434 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 6389 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 6435 6390 int ret; 6436 6391 6437 6392 mutex_lock(&ar->conf_mutex); ··· 6762 6717 struct ieee80211_sta *sta) 6763 6718 { 6764 6719 struct ath12k_vif *arvif = data; 6765 - struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv; 6720 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); 6766 6721 struct ath12k *ar = arvif->ar; 6767 6722 6768 6723 spin_lock_bh(&ar->data_lock); ··· 6794 6749 struct ieee80211_vif *vif, 6795 6750 const struct cfg80211_bitrate_mask *mask) 6796 6751 { 6797 - struct ath12k_vif *arvif = (void *)vif->drv_priv; 6752 + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); 6798 6753 struct cfg80211_chan_def def; 6799 6754 struct ath12k *ar = arvif->ar; 6800 6755 enum nl80211_band band; ··· 7051 7006 struct ieee80211_sta *sta, 7052 7007 struct station_info *sinfo) 7053 7008 { 7054 - struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv; 7009 + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); 7055 7010 7056 7011 sinfo->rx_duration = arsta->rx_duration; 7057 7012 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION);
+1
drivers/net/wireless/ath/ath12k/mhi.c
··· 366 366 mhi_ctrl->fw_image = ab_pci->amss_path; 367 367 mhi_ctrl->regs = ab->mem; 368 368 mhi_ctrl->reg_len = ab->mem_len; 369 + mhi_ctrl->rddm_size = ab->hw_params->rddm_size; 369 370 370 371 ret = ath12k_mhi_get_msi(ab_pci); 371 372 if (ret) {
+2 -2
drivers/net/wireless/ath/ath12k/pci.c
··· 424 424 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); 425 425 } 426 426 427 - static void __ath12k_pci_ext_irq_disable(struct ath12k_base *sc) 427 + static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab) 428 428 { 429 429 int i; 430 430 431 431 for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { 432 - struct ath12k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; 432 + struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 433 433 434 434 ath12k_pci_ext_grp_disable(irq_grp); 435 435
+7
drivers/net/wireless/ath/ath12k/qmi.c
··· 2540 2540 dma_free_coherent(ab->dev, m3_mem->size, 2541 2541 m3_mem->vaddr, m3_mem->paddr); 2542 2542 m3_mem->vaddr = NULL; 2543 + m3_mem->size = 0; 2543 2544 } 2544 2545 2545 2546 static int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab) ··· 3093 3092 destroy_workqueue(ab->qmi.event_wq); 3094 3093 ath12k_qmi_m3_free(ab); 3095 3094 ath12k_qmi_free_target_mem_chunk(ab); 3095 + } 3096 + 3097 + void ath12k_qmi_free_resource(struct ath12k_base *ab) 3098 + { 3099 + ath12k_qmi_free_target_mem_chunk(ab); 3100 + ath12k_qmi_m3_free(ab); 3096 3101 }
+1
drivers/net/wireless/ath/ath12k/qmi.h
··· 564 564 void ath12k_qmi_firmware_stop(struct ath12k_base *ab); 565 565 void ath12k_qmi_deinit_service(struct ath12k_base *ab); 566 566 int ath12k_qmi_init_service(struct ath12k_base *ab); 567 + void ath12k_qmi_free_resource(struct ath12k_base *ab); 567 568 568 569 #endif
+14
drivers/net/wireless/ath/ath12k/reg.c
··· 314 314 return flags; 315 315 } 316 316 317 + static u32 ath12k_map_fw_phy_flags(u32 phy_flags) 318 + { 319 + u32 flags = 0; 320 + 321 + if (phy_flags & ATH12K_REG_PHY_BITMAP_NO11AX) 322 + flags |= NL80211_RRF_NO_HE; 323 + 324 + if (phy_flags & ATH12K_REG_PHY_BITMAP_NO11BE) 325 + flags |= NL80211_RRF_NO_EHT; 326 + 327 + return flags; 328 + } 329 + 317 330 static bool 318 331 ath12k_reg_can_intersect(struct ieee80211_reg_rule *rule1, 319 332 struct ieee80211_reg_rule *rule2) ··· 651 638 } 652 639 653 640 flags |= ath12k_map_fw_reg_flags(reg_rule->flags); 641 + flags |= ath12k_map_fw_phy_flags(reg_info->phybitmap); 654 642 655 643 ath12k_reg_update_rule(tmp_regd->reg_rules + i, 656 644 reg_rule->start_freq,
+6
drivers/net/wireless/ath/ath12k/reg.h
··· 83 83 [WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; 84 84 }; 85 85 86 + /* Phy bitmaps */ 87 + enum ath12k_reg_phy_bitmap { 88 + ATH12K_REG_PHY_BITMAP_NO11AX = BIT(5), 89 + ATH12K_REG_PHY_BITMAP_NO11BE = BIT(6), 90 + }; 91 + 86 92 void ath12k_reg_init(struct ath12k *ar); 87 93 void ath12k_reg_free(struct ath12k_base *ab); 88 94 void ath12k_regd_update_work(struct work_struct *work);
+24 -14
drivers/net/wireless/ath/ath12k/wmi.c
··· 408 408 int ath12k_wmi_cmd_send(struct ath12k_wmi_pdev *wmi, struct sk_buff *skb, 409 409 u32 cmd_id) 410 410 { 411 - struct ath12k_wmi_base *wmi_sc = wmi->wmi_ab; 411 + struct ath12k_wmi_base *wmi_ab = wmi->wmi_ab; 412 412 int ret = -EOPNOTSUPP; 413 413 414 414 might_sleep(); 415 415 416 - wait_event_timeout(wmi_sc->tx_credits_wq, ({ 416 + wait_event_timeout(wmi_ab->tx_credits_wq, ({ 417 417 ret = ath12k_wmi_cmd_send_nowait(wmi, skb, cmd_id); 418 418 419 - if (ret && test_bit(ATH12K_FLAG_CRASH_FLUSH, &wmi_sc->ab->dev_flags)) 419 + if (ret && test_bit(ATH12K_FLAG_CRASH_FLUSH, &wmi_ab->ab->dev_flags)) 420 420 ret = -ESHUTDOWN; 421 421 422 422 (ret != -EAGAIN); 423 423 }), WMI_SEND_TIMEOUT_HZ); 424 424 425 425 if (ret == -EAGAIN) 426 - ath12k_warn(wmi_sc->ab, "wmi command %d timeout\n", cmd_id); 426 + ath12k_warn(wmi_ab->ab, "wmi command %d timeout\n", cmd_id); 427 427 428 428 return ret; 429 429 } ··· 727 727 return 0; 728 728 } 729 729 730 - struct sk_buff *ath12k_wmi_alloc_skb(struct ath12k_wmi_base *wmi_sc, u32 len) 730 + struct sk_buff *ath12k_wmi_alloc_skb(struct ath12k_wmi_base *wmi_ab, u32 len) 731 731 { 732 732 struct sk_buff *skb; 733 - struct ath12k_base *ab = wmi_sc->ab; 733 + struct ath12k_base *ab = wmi_ab->ab; 734 734 u32 round_len = roundup(len, 4); 735 735 736 736 skb = ath12k_htc_alloc_skb(ab, WMI_SKB_HEADROOM + round_len); ··· 3471 3471 3472 3472 int ath12k_wmi_cmd_init(struct ath12k_base *ab) 3473 3473 { 3474 - struct ath12k_wmi_base *wmi_sc = &ab->wmi_ab; 3474 + struct ath12k_wmi_base *wmi_ab = &ab->wmi_ab; 3475 3475 struct ath12k_wmi_init_cmd_arg arg = {}; 3476 3476 3477 3477 if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT, ··· 3480 3480 3481 3481 ab->hw_params->wmi_init(ab, &arg.res_cfg); 3482 3482 3483 - arg.num_mem_chunks = wmi_sc->num_mem_chunks; 3484 - arg.hw_mode_id = wmi_sc->preferred_hw_mode; 3485 - arg.mem_chunks = wmi_sc->mem_chunks; 3483 + arg.num_mem_chunks = wmi_ab->num_mem_chunks; 3484 + arg.hw_mode_id = wmi_ab->preferred_hw_mode; 3485 + arg.mem_chunks = wmi_ab->mem_chunks; 3486 3486 3487 3487 if (ab->hw_params->single_pdev_only) 3488 3488 arg.hw_mode_id = WMI_HOST_HW_MODE_MAX; ··· 3490 3490 arg.num_band_to_mac = ab->num_radios; 3491 3491 ath12k_fill_band_to_mac_param(ab, arg.band_to_mac); 3492 3492 3493 - return ath12k_init_cmd_send(&wmi_sc->wmi[0], &arg); 3493 + return ath12k_init_cmd_send(&wmi_ab->wmi[0], &arg); 3494 3494 } 3495 3495 3496 3496 int ath12k_wmi_vdev_spectral_conf(struct ath12k *ar, ··· 4611 4611 } 4612 4612 4613 4613 ath12k_dbg(ab, ATH12K_DBG_WMI, 4614 - "%s:cc_ext %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", 4614 + "%s:cc_ext %s dfs %d BW: min_2g %d max_2g %d min_5g %d max_5g %d phy_bitmap 0x%x", 4615 4615 __func__, reg_info->alpha2, reg_info->dfs_region, 4616 4616 reg_info->min_bw_2g, reg_info->max_bw_2g, 4617 - reg_info->min_bw_5g, reg_info->max_bw_5g); 4617 + reg_info->min_bw_5g, reg_info->max_bw_5g, 4618 + reg_info->phybitmap); 4618 4619 4619 4620 ath12k_dbg(ab, ATH12K_DBG_WMI, 4620 4621 "num_2g_reg_rules %d num_5g_reg_rules %d", ··· 6515 6514 ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, 6516 6515 ev->freq_offset, ev->sidx); 6517 6516 6517 + rcu_read_lock(); 6518 + 6518 6519 ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev->pdev_id)); 6519 6520 6520 6521 if (!ar) { ··· 6534 6531 ieee80211_radar_detected(ar->hw); 6535 6532 6536 6533 exit: 6534 + rcu_read_unlock(); 6535 + 6537 6536 kfree(tb); 6538 6537 } 6539 6538 ··· 6554 6549 ath12k_dbg(ab, ATH12K_DBG_WMI, 6555 6550 "pdev temperature ev temp %d pdev_id %d\n", ev.temp, ev.pdev_id); 6556 6551 6552 + rcu_read_lock(); 6553 + 6557 6554 ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev.pdev_id)); 6558 6555 if (!ar) { 6559 6556 ath12k_warn(ab, "invalid pdev id in pdev temperature ev %d", ev.pdev_id); 6560 - return; 6557 + goto exit; 6561 6558 } 6559 + 6560 + exit: 6561 + rcu_read_unlock(); 6562 6562 } 6563 6563 6564 6564 static void ath12k_fils_discovery_event(struct ath12k_base *ab,
+1 -1
drivers/net/wireless/ath/ath5k/base.c
··· 1770 1770 ah->stats.antenna_tx[0]++; /* invalid */ 1771 1771 1772 1772 trace_ath5k_tx_complete(ah, skb, txq, ts); 1773 - ieee80211_tx_status(ah->hw, skb); 1773 + ieee80211_tx_status_skb(ah->hw, skb); 1774 1774 } 1775 1775 1776 1776 static void
+1 -2
drivers/net/wireless/ath/ath5k/led.c
··· 131 131 int err; 132 132 133 133 led->ah = ah; 134 - strncpy(led->name, name, sizeof(led->name)); 135 - led->name[sizeof(led->name)-1] = 0; 134 + strscpy(led->name, name, sizeof(led->name)); 136 135 led->led_dev.name = led->name; 137 136 led->led_dev.default_trigger = trigger; 138 137 led->led_dev.brightness_set = ath5k_led_brightness_set;
+1 -1
drivers/net/wireless/ath/ath6kl/init.c
··· 1677 1677 1678 1678 /* add "..." to the end of string */ 1679 1679 trunc_len = strlen(trunc) + 1; 1680 - strncpy(buf + buf_len - trunc_len, trunc, trunc_len); 1680 + memcpy(buf + buf_len - trunc_len, trunc, trunc_len); 1681 1681 1682 1682 return; 1683 1683 }
+1 -1
drivers/net/wireless/ath/ath9k/hif_usb.h
··· 126 126 struct usb_anchor reg_in_submitted; 127 127 struct usb_anchor mgmt_submitted; 128 128 struct sk_buff *remain_skb; 129 - char fw_name[32]; 129 + char fw_name[64]; 130 130 int fw_minor_index; 131 131 int rx_remain_len; 132 132 int rx_pkt_len;
+1 -1
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
··· 523 523 } 524 524 525 525 /* Send status to mac80211 */ 526 - ieee80211_tx_status(priv->hw, skb); 526 + ieee80211_tx_status_skb(priv->hw, skb); 527 527 } 528 528 529 529 static inline void ath9k_htc_tx_drainq(struct ath9k_htc_priv *priv,
+1 -1
drivers/net/wireless/ath/ath9k/xmit.c
··· 94 94 95 95 if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | 96 96 IEEE80211_TX_STATUS_EOSP)) { 97 - ieee80211_tx_status(hw, skb); 97 + ieee80211_tx_status_skb(hw, skb); 98 98 return; 99 99 } 100 100
+2 -2
drivers/net/wireless/broadcom/b43/dma.c
··· 1531 1531 ring->nr_failed_tx_packets++; 1532 1532 ring->nr_total_packet_tries += status->frame_count; 1533 1533 #endif /* DEBUG */ 1534 - ieee80211_tx_status(dev->wl->hw, meta->skb); 1534 + ieee80211_tx_status_skb(dev->wl->hw, meta->skb); 1535 1535 1536 - /* skb will be freed by ieee80211_tx_status(). 1536 + /* skb will be freed by ieee80211_tx_status_skb(). 1537 1537 * Poison our pointer. */ 1538 1538 meta->skb = B43_DMA_PTR_POISON; 1539 1539 } else {
+1 -1
drivers/net/wireless/broadcom/b43/pio.c
··· 582 582 q->buffer_used -= total_len; 583 583 q->free_packet_slots += 1; 584 584 585 - ieee80211_tx_status(dev->wl->hw, pack->skb); 585 + ieee80211_tx_status_skb(dev->wl->hw, pack->skb); 586 586 pack->skb = NULL; 587 587 list_add(&pack->list, &q->packets_list); 588 588
+3 -3
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
··· 19 19 20 20 #define BRCMF_FW_MAX_NVRAM_SIZE 64000 21 21 #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */ 22 - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */ 22 + #define BRCMF_FW_NVRAM_PCIEDEV_LEN 20 /* pcie/1/4/ + \0 */ 23 23 #define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff" 24 24 #define BRCMF_FW_MACADDR_FMT "macaddr=%pM" 25 25 #define BRCMF_FW_MACADDR_LEN (7 + ETH_ALEN * 3) ··· 238 238 u16 bus_nr) 239 239 { 240 240 /* Device path with a leading '=' key-value separator */ 241 - char pci_path[] = "=pci/?/?"; 241 + char pci_path[20]; 242 242 size_t pci_len; 243 - char pcie_path[] = "=pcie/?/?"; 243 + char pcie_path[20]; 244 244 size_t pcie_len; 245 245 246 246 u32 i, j;
+2 -18
drivers/net/wireless/intel/ipw2x00/ipw2100.c
··· 317 317 struct ipw2100_fw *fw); 318 318 static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 319 319 size_t max); 320 - static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 321 - size_t max); 322 320 static void ipw2100_release_firmware(struct ipw2100_priv *priv, 323 321 struct ipw2100_fw *fw); 324 322 static int ipw2100_ucode_download(struct ipw2100_priv *priv, ··· 5892 5894 struct ethtool_drvinfo *info) 5893 5895 { 5894 5896 struct ipw2100_priv *priv = libipw_priv(dev); 5895 - char fw_ver[64], ucode_ver[64]; 5897 + char fw_ver[64]; 5896 5898 5897 5899 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); 5898 5900 strscpy(info->version, DRV_VERSION, sizeof(info->version)); 5899 5901 5900 5902 ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); 5901 - ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); 5902 5903 5903 - snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", 5904 - fw_ver, priv->eeprom_version, ucode_ver); 5905 - 5904 + strscpy(info->fw_version, fw_ver, sizeof(info->fw_version)); 5906 5905 strscpy(info->bus_info, pci_name(priv->pci_dev), 5907 5906 sizeof(info->bus_info)); 5908 5907 } ··· 8399 8404 buf[i] = ver[i]; 8400 8405 buf[i] = '\0'; 8401 8406 return tmp; 8402 - } 8403 - 8404 - static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 8405 - size_t max) 8406 - { 8407 - u32 ver; 8408 - u32 len = sizeof(ver); 8409 - /* microcode version is a 32 bit integer */ 8410 - if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) 8411 - return -EIO; 8412 - return snprintf(buf, max, "%08X", ver); 8413 8407 } 8414 8408 8415 8409 /*
+9 -14
drivers/net/wireless/intel/ipw2x00/ipw2200.c
··· 9656 9656 mutex_lock(&priv->mutex); 9657 9657 switch (priv->ieee->mode) { 9658 9658 case IEEE_A: 9659 - strncpy(extra, "802.11a (1)", MAX_WX_STRING); 9659 + strscpy_pad(extra, "802.11a (1)", MAX_WX_STRING); 9660 9660 break; 9661 9661 case IEEE_B: 9662 - strncpy(extra, "802.11b (2)", MAX_WX_STRING); 9662 + strscpy_pad(extra, "802.11b (2)", MAX_WX_STRING); 9663 9663 break; 9664 9664 case IEEE_A | IEEE_B: 9665 - strncpy(extra, "802.11ab (3)", MAX_WX_STRING); 9665 + strscpy_pad(extra, "802.11ab (3)", MAX_WX_STRING); 9666 9666 break; 9667 9667 case IEEE_G: 9668 - strncpy(extra, "802.11g (4)", MAX_WX_STRING); 9668 + strscpy_pad(extra, "802.11g (4)", MAX_WX_STRING); 9669 9669 break; 9670 9670 case IEEE_A | IEEE_G: 9671 - strncpy(extra, "802.11ag (5)", MAX_WX_STRING); 9671 + strscpy_pad(extra, "802.11ag (5)", MAX_WX_STRING); 9672 9672 break; 9673 9673 case IEEE_B | IEEE_G: 9674 - strncpy(extra, "802.11bg (6)", MAX_WX_STRING); 9674 + strscpy_pad(extra, "802.11bg (6)", MAX_WX_STRING); 9675 9675 break; 9676 9676 case IEEE_A | IEEE_B | IEEE_G: 9677 - strncpy(extra, "802.11abg (7)", MAX_WX_STRING); 9677 + strscpy_pad(extra, "802.11abg (7)", MAX_WX_STRING); 9678 9678 break; 9679 9679 default: 9680 - strncpy(extra, "unknown", MAX_WX_STRING); 9680 + strscpy_pad(extra, "unknown", MAX_WX_STRING); 9681 9681 break; 9682 9682 } 9683 - extra[MAX_WX_STRING - 1] = '\0'; 9684 9683 9685 9684 IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); 9686 9685 ··· 10377 10378 { 10378 10379 struct ipw_priv *p = libipw_priv(dev); 10379 10380 char vers[64]; 10380 - char date[32]; 10381 10381 u32 len; 10382 10382 10383 10383 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); ··· 10384 10386 10385 10387 len = sizeof(vers); 10386 10388 ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len); 10387 - len = sizeof(date); 10388 - ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); 10389 10389 10390 - snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", 10391 - vers, date); 10390 + strscpy(info->fw_version, vers, sizeof(info->fw_version)); 10392 10391 strscpy(info->bus_info, pci_name(p->pci_dev), 10393 10392 sizeof(info->bus_info)); 10394 10393 }
+1 -1
drivers/net/wireless/intel/iwlwifi/cfg/ax210.c
··· 10 10 #include "fw/api/txq.h" 11 11 12 12 /* Highest firmware API version supported */ 13 - #define IWL_AX210_UCODE_API_MAX 83 13 + #define IWL_AX210_UCODE_API_MAX 86 14 14 15 15 /* Lowest firmware API version supported */ 16 16 #define IWL_AX210_UCODE_API_MIN 59
+3 -3
drivers/net/wireless/intel/iwlwifi/cfg/bz.c
··· 10 10 #include "fw/api/txq.h" 11 11 12 12 /* Highest firmware API version supported */ 13 - #define IWL_BZ_UCODE_API_MAX 83 13 + #define IWL_BZ_UCODE_API_MAX 86 14 14 15 15 /* Lowest firmware API version supported */ 16 16 #define IWL_BZ_UCODE_API_MIN 80 ··· 158 158 .fw_name_mac = "bz", 159 159 .uhb_supported = true, 160 160 IWL_DEVICE_BZ, 161 - .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, 161 + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, 162 162 .num_rbds = IWL_NUM_RBDS_BZ_EHT, 163 163 }; 164 164 ··· 166 166 .fw_name_mac = "gl", 167 167 .uhb_supported = true, 168 168 IWL_DEVICE_BZ, 169 - .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, 169 + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, 170 170 .num_rbds = IWL_NUM_RBDS_BZ_EHT, 171 171 }; 172 172
+2 -2
drivers/net/wireless/intel/iwlwifi/cfg/sc.c
··· 10 10 #include "fw/api/txq.h" 11 11 12 12 /* Highest firmware API version supported */ 13 - #define IWL_SC_UCODE_API_MAX 83 13 + #define IWL_SC_UCODE_API_MAX 86 14 14 15 15 /* Lowest firmware API version supported */ 16 16 #define IWL_SC_UCODE_API_MIN 82 ··· 151 151 .fw_name_mac = "sc", 152 152 .uhb_supported = true, 153 153 IWL_DEVICE_SC, 154 - .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, 154 + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, 155 155 .num_rbds = IWL_NUM_RBDS_SC_EHT, 156 156 }; 157 157
+1 -1
drivers/net/wireless/intel/iwlwifi/dvm/main.c
··· 1464 1464 1465 1465 snprintf(priv->hw->wiphy->fw_version, 1466 1466 sizeof(priv->hw->wiphy->fw_version), 1467 - "%s", fw->fw_version); 1467 + "%.31s", fw->fw_version); 1468 1468 1469 1469 priv->new_scan_threshold_behaviour = 1470 1470 !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
+5 -4
drivers/net/wireless/intel/iwlwifi/dvm/tx.c
··· 3 3 * 4 4 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 5 5 * Copyright (C) 2019 Intel Corporation 6 + * Copyright (C) 2023 Intel Corporation 6 7 *****************************************************************************/ 7 8 8 9 #include <linux/kernel.h> ··· 1170 1169 iwlagn_check_ratid_empty(priv, sta_id, tid); 1171 1170 } 1172 1171 1173 - iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); 1172 + iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs, false); 1174 1173 1175 1174 freed = 0; 1176 1175 ··· 1248 1247 1249 1248 while (!skb_queue_empty(&skbs)) { 1250 1249 skb = __skb_dequeue(&skbs); 1251 - ieee80211_tx_status(priv->hw, skb); 1250 + ieee80211_tx_status_skb(priv->hw, skb); 1252 1251 } 1253 1252 } 1254 1253 ··· 1316 1315 * block-ack window (we assume that they've been successfully 1317 1316 * transmitted ... if not, it's too late anyway). */ 1318 1317 iwl_trans_reclaim(priv->trans, scd_flow, ba_resp_scd_ssn, 1319 - &reclaimed_skbs); 1318 + &reclaimed_skbs, false); 1320 1319 1321 1320 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " 1322 1321 "sta_id = %d\n", ··· 1385 1384 1386 1385 while (!skb_queue_empty(&reclaimed_skbs)) { 1387 1386 skb = __skb_dequeue(&reclaimed_skbs); 1388 - ieee80211_tx_status(priv->hw, skb); 1387 + ieee80211_tx_status_skb(priv->hw, skb); 1389 1388 } 1390 1389 }
+17 -7
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
··· 1015 1015 __le32 config_bitmap = 0; 1016 1016 1017 1017 /* 1018 - ** Evaluate func 'DSM_FUNC_ENABLE_INDONESIA_5G2' 1018 + * Evaluate func 'DSM_FUNC_ENABLE_INDONESIA_5G2'. 1019 + * Setting config_bitmap Indonesia bit is valid only for HR/JF. 1019 1020 */ 1020 - ret = iwl_acpi_get_dsm_u8(fwrt->dev, 0, 1021 - DSM_FUNC_ENABLE_INDONESIA_5G2, 1022 - &iwl_guid, &value); 1021 + switch (CSR_HW_RFID_TYPE(fwrt->trans->hw_rf_id)) { 1022 + case IWL_CFG_RF_TYPE_HR1: 1023 + case IWL_CFG_RF_TYPE_HR2: 1024 + case IWL_CFG_RF_TYPE_JF1: 1025 + case IWL_CFG_RF_TYPE_JF2: 1026 + ret = iwl_acpi_get_dsm_u8(fwrt->dev, 0, 1027 + DSM_FUNC_ENABLE_INDONESIA_5G2, 1028 + &iwl_guid, &value); 1023 1029 1024 - if (!ret && value == DSM_VALUE_INDONESIA_ENABLE) 1025 - config_bitmap |= 1026 - cpu_to_le32(LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK); 1030 + if (!ret && value == DSM_VALUE_INDONESIA_ENABLE) 1031 + config_bitmap |= 1032 + cpu_to_le32(LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK); 1033 + break; 1034 + default: 1035 + break; 1036 + } 1027 1037 1028 1038 /* 1029 1039 ** Evaluate func 'DSM_FUNC_DISABLE_SRD'
+2 -1
drivers/net/wireless/intel/iwlwifi/fw/acpi.h
··· 138 138 DSM_FUNC_11AX_ENABLEMENT = 6, 139 139 DSM_FUNC_ENABLE_UNII4_CHAN = 7, 140 140 DSM_FUNC_ACTIVATE_CHANNEL = 8, 141 - DSM_FUNC_FORCE_DISABLE_CHANNELS = 9 141 + DSM_FUNC_FORCE_DISABLE_CHANNELS = 9, 142 + DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10, 142 143 }; 143 144 144 145 enum iwl_dsm_values_srd {
+30
drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
··· 30 30 * @REGULATORY_AND_NVM_GROUP: regulatory/NVM group, uses command IDs from 31 31 * &enum iwl_regulatory_and_nvm_subcmd_ids 32 32 * @DEBUG_GROUP: Debug group, uses command IDs from &enum iwl_debug_cmds 33 + * @STATISTICS_GROUP: Statistics group, uses command IDs from 34 + * &enum iwl_statistics_subcmd_ids 33 35 */ 34 36 enum iwl_mvm_command_groups { 35 37 LEGACY_GROUP = 0x0, ··· 46 44 PROT_OFFLOAD_GROUP = 0xb, 47 45 REGULATORY_AND_NVM_GROUP = 0xc, 48 46 DEBUG_GROUP = 0xf, 47 + STATISTICS_GROUP = 0x10, 49 48 }; 50 49 51 50 /** ··· 620 617 SYSTEM_FEATURES_CONTROL_CMD = 0xd, 621 618 622 619 /** 620 + * @SYSTEM_STATISTICS_CMD: &struct iwl_system_statistics_cmd 621 + */ 622 + SYSTEM_STATISTICS_CMD = 0xf, 623 + 624 + /** 625 + * @SYSTEM_STATISTICS_END_NOTIF: &struct iwl_system_statistics_end_notif 626 + */ 627 + SYSTEM_STATISTICS_END_NOTIF = 0xfd, 628 + 629 + /** 623 630 * @RFI_DEACTIVATE_NOTIF: &struct iwl_rfi_deactivate_notif 624 631 */ 625 632 RFI_DEACTIVATE_NOTIF = 0xff, 633 + }; 634 + 635 + /** 636 + * enum iwl_statistics_subcmd_ids - Statistics group command IDs 637 + */ 638 + enum iwl_statistics_subcmd_ids { 639 + /** 640 + * @STATISTICS_OPER_NOTIF: Notification about operational 641 + * statistics &struct iwl_system_statistics_notif_oper 642 + */ 643 + STATISTICS_OPER_NOTIF = 0x0, 644 + 645 + /** 646 + * @STATISTICS_OPER_PART1_NOTIF: Notification about operational part1 647 + * statistics &struct iwl_system_statistics_part1_notif_oper 648 + */ 649 + STATISTICS_OPER_PART1_NOTIF = 0x1, 626 650 }; 627 651 628 652 #endif /* __iwl_fw_api_commands_h__ */
+36 -1
drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2018-2022 Intel Corporation 3 + * Copyright (C) 2018-2023 Intel Corporation 4 4 */ 5 5 #ifndef __iwl_fw_dbg_tlv_h__ 6 6 #define __iwl_fw_dbg_tlv_h__ ··· 41 41 __le32 domain; 42 42 /* followed by the data */ 43 43 } __packed; /* FW_TLV_DEBUG_HEADER_S_VER_1 */ 44 + 45 + /** 46 + * struct iwl_fw_ini_addr_size - Base address and size that defines 47 + * a chunk of memory 48 + * 49 + * @addr: the base address (fixed size - 4 bytes) 50 + * @size: the size to read 51 + */ 52 + struct iwl_fw_ini_addr_size { 53 + __le32 addr; 54 + __le32 size; 55 + } __packed; /* FW_TLV_DEBUG_ADDR_SIZE_VER_1 */ 56 + 57 + /** 58 + * struct iwl_fw_ini_region_dev_addr_range - Configuration to read 59 + * device address range 60 + * 61 + * @offset: offset to add to the base address of each chunk 62 + * The addrs[] array will be treated as an array of &iwl_fw_ini_addr_size - 63 + * an array of (addr, size) pairs. 64 + */ 65 + struct iwl_fw_ini_region_dev_addr_range { 66 + __le32 offset; 67 + } __packed; /* FW_TLV_DEBUG_DEVICE_ADDR_RANGE_API_S_VER_1 */ 44 68 45 69 /** 46 70 * struct iwl_fw_ini_region_dev_addr - Configuration to read device addresses ··· 159 135 * &IWL_FW_INI_REGION_PAGING, &IWL_FW_INI_REGION_CSR, 160 136 * &IWL_FW_INI_REGION_DRAM_IMR and &IWL_FW_INI_REGION_PCI_IOSF_CONFIG 161 137 * &IWL_FW_INI_REGION_DBGI_SRAM, &FW_TLV_DEBUG_REGION_TYPE_DBGI_SRAM, 138 + * &IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP, 139 + * @dev_addr_range: device address range configuration. Used by 140 + * &IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE and 141 + * &IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE 162 142 * @fifos: fifos configuration. Used by &IWL_FW_INI_REGION_TXF and 163 143 * &IWL_FW_INI_REGION_RXF 164 144 * @err_table: error table configuration. Used by ··· 185 157 u8 name[IWL_FW_INI_MAX_NAME]; 186 158 union { 187 159 struct iwl_fw_ini_region_dev_addr dev_addr; 160 + struct iwl_fw_ini_region_dev_addr_range dev_addr_range; 188 161 struct iwl_fw_ini_region_fifos fifos; 189 162 struct iwl_fw_ini_region_err_table err_table; 190 163 struct iwl_fw_ini_region_internal_buffer internal_buffer; ··· 391 362 * @IWL_FW_INI_REGION_PCI_IOSF_CONFIG: PCI/IOSF config 392 363 * @IWL_FW_INI_REGION_SPECIAL_DEVICE_MEMORY: special device memory 393 364 * @IWL_FW_INI_REGION_DBGI_SRAM: periphery registers of DBGI SRAM 365 + * @IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE: a range of periphery registers of MAC 366 + * @IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE: a range of periphery registers of PHY 367 + * @IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP: periphery registers of SNPS DPHYIP 394 368 * @IWL_FW_INI_REGION_NUM: number of region types 395 369 */ 396 370 enum iwl_fw_ini_region_type { ··· 416 384 IWL_FW_INI_REGION_PCI_IOSF_CONFIG, 417 385 IWL_FW_INI_REGION_SPECIAL_DEVICE_MEMORY, 418 386 IWL_FW_INI_REGION_DBGI_SRAM, 387 + IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE, 388 + IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE, 389 + IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP, 419 390 IWL_FW_INI_REGION_NUM 420 391 }; /* FW_TLV_DEBUG_REGION_TYPE_API_E */ 421 392
+9 -1
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2012-2014, 2018-2019, 2021-2022 Intel Corporation 3 + * Copyright (C) 2012-2014, 2018-2019, 2021-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 57 57 * @STA_DISABLE_TX_CMD: &struct iwl_mvm_sta_disable_tx_cmd 58 58 */ 59 59 STA_DISABLE_TX_CMD = 0xD, 60 + /** 61 + * @ROC_CMD: &struct iwl_roc_req 62 + */ 63 + ROC_CMD = 0xE, 64 + /** 65 + * @ROC_NOTIF: &struct iwl_roc_notif 66 + */ 67 + ROC_NOTIF = 0xF8, 60 68 /** 61 69 * @SESSION_PROTECTION_NOTIF: &struct iwl_mvm_session_prot_notif 62 70 */
+60 -2
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
··· 21 21 * &struct iwl_lari_config_change_cmd_v2, 22 22 * &struct iwl_lari_config_change_cmd_v3, 23 23 * &struct iwl_lari_config_change_cmd_v4, 24 - * &struct iwl_lari_config_change_cmd_v5 or 25 - * &struct iwl_lari_config_change_cmd_v6 24 + * &struct iwl_lari_config_change_cmd_v5, 25 + * &struct iwl_lari_config_change_cmd_v6 or 26 + * &struct iwl_lari_config_change_cmd_v7 26 27 */ 27 28 LARI_CONFIG_CHANGE = 0x1, 28 29 ··· 43 42 * @SAR_OFFSET_MAPPING_TABLE_CMD: &struct iwl_sar_offset_mapping_cmd 44 43 */ 45 44 SAR_OFFSET_MAPPING_TABLE_CMD = 0x4, 45 + 46 + /** 47 + * @UATS_TABLE_CMD: &struct iwl_uats_table_cmd 48 + */ 49 + UATS_TABLE_CMD = 0x5, 46 50 47 51 /** 48 52 * @PNVM_INIT_COMPLETE_NTFY: &struct iwl_pnvm_init_complete_ntfy ··· 609 603 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_6 */ 610 604 611 605 /** 606 + * struct iwl_lari_config_change_cmd_v7 - change LARI configuration 607 + * This structure is used also for lari cmd version 8. 608 + * @config_bitmap: Bitmap of the config commands. Each bit will trigger a 609 + * different predefined FW config operation. 610 + * @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets. 611 + * @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits 612 + * per country, one to indicate whether to override and the other to 613 + * indicate the value to use. 614 + * @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits 615 + * per country, one to indicate whether to override and the other to 616 + * indicate allow/disallow unii4 channels. 617 + * @chan_state_active_bitmap: Bitmap to enable different bands per country 618 + * or region. 619 + * Each bit represents a country or region, and a band to activate 620 + * according to the BIOS definitions. 621 + * For LARI cmd version 7 - bits 0:3 are supported. 622 + * For LARI cmd version 8 - bits 0:4 are supported. 623 + * @force_disable_channels_bitmap: Bitmap of disabled bands/channels. 624 + * Each bit represents a set of channels in a specific band that should be 625 + * disabled 626 + * @edt_bitmap: Bitmap of energy detection threshold table. 627 + * Disable/enable the EDT optimization method for different band. 628 + */ 629 + struct iwl_lari_config_change_cmd_v7 { 630 + __le32 config_bitmap; 631 + __le32 oem_uhb_allow_bitmap; 632 + __le32 oem_11ax_allow_bitmap; 633 + __le32 oem_unii4_allow_bitmap; 634 + __le32 chan_state_active_bitmap; 635 + __le32 force_disable_channels_bitmap; 636 + __le32 edt_bitmap; 637 + } __packed; 638 + /* LARI_CHANGE_CONF_CMD_S_VER_7 */ 639 + /* LARI_CHANGE_CONF_CMD_S_VER_8 */ 640 + 641 + /* Activate UNII-1 (5.2GHz) for World Wide */ 642 + #define ACTIVATE_5G2_IN_WW_MASK BIT(4) 643 + 644 + /** 612 645 * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete 613 646 * @status: PNVM image loading status 614 647 */ 615 648 struct iwl_pnvm_init_complete_ntfy { 616 649 __le32 status; 617 650 } __packed; /* PNVM_INIT_COMPLETE_NTFY_S_VER_1 */ 651 + 652 + #define UATS_TABLE_ROW_SIZE 26 653 + #define UATS_TABLE_COL_SIZE 13 654 + 655 + /** 656 + * struct iwl_uats_table_cmd - struct for UATS_TABLE_CMD 657 + * @offset_map: mapping a mcc to UHB AP type support (UATS) allowed 658 + * @reserved: reserved 659 + */ 660 + struct iwl_uats_table_cmd { 661 + u8 offset_map[UATS_TABLE_ROW_SIZE][UATS_TABLE_COL_SIZE]; 662 + __le16 reserved; 663 + } __packed; /* UATS_TABLE_CMD_S_VER_1 */ 618 664 619 665 #endif /* __iwl_fw_api_nvm_reg_h__ */
+2 -2
drivers/net/wireless/intel/iwlwifi/fw/api/phy-ctxt.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2012-2014, 2018, 2020-2022 Intel Corporation 3 + * Copyright (C) 2012-2014, 2018, 2020-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 25 25 * For legacy set bit means upper channel, otherwise lower. 26 26 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq 27 27 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0. 28 - * center_freq 29 28 * For EHT - bit-3 is used for extended distance 29 + * center_freq 30 30 * | 31 31 * 40Mhz |____|____| 32 32 * 80Mhz |____|____|____|____|
+139 -14
drivers/net/wireless/intel/iwlwifi/fw/api/stats.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2012-2014, 2018, 2020 - 2021 Intel Corporation 3 + * Copyright (C) 2012-2014, 2018, 2020 - 2021, 2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ 7 7 #ifndef __iwl_fw_api_stats_h__ 8 8 #define __iwl_fw_api_stats_h__ 9 9 #include "mac.h" 10 + #include "mac-cfg.h" 10 11 11 12 struct mvm_statistics_dbg { 12 13 __le32 burst_check; ··· 413 412 #define MAX_BCAST_FILTER_NUM 8 414 413 415 414 /** 415 + * enum iwl_statistics_notify_type_id - type_id used in system statistics 416 + * command 417 + * @IWL_STATS_NTFY_TYPE_ID_OPER: request legacy statistics 418 + * @IWL_STATS_NTFY_TYPE_ID_OPER_PART1: request operational part1 statistics 419 + * @IWL_STATS_NTFY_TYPE_ID_OPER_PART2: request operational part2 statistics 420 + * @IWL_STATS_NTFY_TYPE_ID_OPER_PART3: request operational part3 statistics 421 + * @IWL_STATS_NTFY_TYPE_ID_OPER_PART4: request operational part4 statistics 422 + */ 423 + enum iwl_statistics_notify_type_id { 424 + IWL_STATS_NTFY_TYPE_ID_OPER = BIT(0), 425 + IWL_STATS_NTFY_TYPE_ID_OPER_PART1 = BIT(1), 426 + IWL_STATS_NTFY_TYPE_ID_OPER_PART2 = BIT(2), 427 + IWL_STATS_NTFY_TYPE_ID_OPER_PART3 = BIT(3), 428 + IWL_STATS_NTFY_TYPE_ID_OPER_PART4 = BIT(4), 429 + }; 430 + 431 + /** 432 + * enum iwl_statistics_cfg_flags - cfg_mask used in system statistics command 433 + * @IWL_STATS_CFG_FLG_DISABLE_NTFY_MSK: 0 for enable, 1 for disable 434 + * @IWL_STATS_CFG_FLG_ON_DEMAND_NTFY_MSK: 0 for periodic, 1 for on-demand 435 + * @IWL_STATS_CFG_FLG_RESET_MSK: 0 for reset statistics after 436 + * sending the notification, 1 for do not reset statistics after sending 437 + * the notification 438 + */ 439 + enum iwl_statistics_cfg_flags { 440 + IWL_STATS_CFG_FLG_DISABLE_NTFY_MSK = BIT(0), 441 + IWL_STATS_CFG_FLG_ON_DEMAND_NTFY_MSK = BIT(1), 442 + IWL_STATS_CFG_FLG_RESET_MSK = BIT(2), 443 + }; 444 + 445 + /** 446 + * struct iwl_system_statistics_cmd - system statistics command 447 + * @cfg_mask: configuration mask, &enum iwl_statistics_cfg_flags 448 + * @config_time_sec: time in sec for periodic notification 449 + * @type_id_mask: type_id masks, &enum iwl_statistics_notify_type_id 450 + */ 451 + struct iwl_system_statistics_cmd { 452 + __le32 cfg_mask; 453 + __le32 config_time_sec; 454 + __le32 type_id_mask; 455 + } __packed; /* STATISTICS_FW_CMD_API_S_VER_1 */ 456 + 457 + /** 416 458 * enum iwl_fw_statistics_type 417 459 * 418 460 * @FW_STATISTICS_OPERATIONAL: operational statistics ··· 491 447 }; /* STATISTICS_NTFY_HDR_API_S_VER_1 */ 492 448 493 449 /** 494 - * struct iwl_statistics_ntfy_per_mac 450 + * struct iwl_stats_ntfy_per_link 451 + * 452 + * @beacon_filter_average_energy: Average energy [-dBm] of the 2 453 + * antennas. 454 + * @air_time: air time 455 + * @beacon_counter: all beacons (both filtered and not filtered) 456 + * @beacon_average_energy: Average energy [-dBm] of all beacons 457 + * (both filtered and not filtered) 458 + * @beacon_rssi_a: beacon RSSI on antenna A 459 + * @beacon_rssi_b: beacon RSSI on antenna B 460 + * @rx_bytes: RX byte count 461 + */ 462 + struct iwl_stats_ntfy_per_link { 463 + __le32 beacon_filter_average_energy; 464 + __le32 air_time; 465 + __le32 beacon_counter; 466 + __le32 beacon_average_energy; 467 + __le32 beacon_rssi_a; 468 + __le32 beacon_rssi_b; 469 + __le32 rx_bytes; 470 + } __packed; /* STATISTICS_NTFY_PER_LINK_API_S_VER_1 */ 471 + 472 + /** 473 + * struct iwl_stats_ntfy_part1_per_link 474 + * 475 + * @rx_time: rx time 476 + * @tx_time: tx time 477 + * @rx_action: action frames handled by FW 478 + * @tx_action: action frames generated and transmitted by FW 479 + * @cca_defers: cca defer count 480 + * @beacon_filtered: filtered out beacons 481 + */ 482 + struct iwl_stats_ntfy_part1_per_link { 483 + __le64 rx_time; 484 + __le64 tx_time; 485 + __le32 rx_action; 486 + __le32 tx_action; 487 + __le32 cca_defers; 488 + __le32 beacon_filtered; 489 + } __packed; /* STATISTICS_FW_NTFY_OPERATIONAL_PART1_PER_LINK_API_S_VER_1 */ 490 + 491 + /** 492 + * struct iwl_stats_ntfy_per_mac 495 493 * 496 494 * @beacon_filter_average_energy: Average energy [-dBm] of the 2 497 495 * antennas. ··· 545 459 * @beacon_rssi_b: beacon RSSI on antenna B 546 460 * @rx_bytes: RX byte count 547 461 */ 548 - struct iwl_statistics_ntfy_per_mac { 462 + struct iwl_stats_ntfy_per_mac { 549 463 __le32 beacon_filter_average_energy; 550 464 __le32 air_time; 551 465 __le32 beacon_counter; ··· 556 470 } __packed; /* STATISTICS_NTFY_PER_MAC_API_S_VER_1 */ 557 471 558 472 #define IWL_STATS_MAX_BW_INDEX 5 559 - /** struct iwl_statistics_ntfy_per_phy 473 + /** struct iwl_stats_ntfy_per_phy 560 474 * @channel_load: channel load 561 475 * @channel_load_by_us: device contribution to MCLM 562 476 * @channel_load_not_by_us: other devices' contribution to MCLM ··· 571 485 * per channel BW. note BACK counted as 1 572 486 * @last_tx_ch_width_indx: last txed frame channel width index 573 487 */ 574 - struct iwl_statistics_ntfy_per_phy { 488 + struct iwl_stats_ntfy_per_phy { 575 489 __le32 channel_load; 576 490 __le32 channel_load_by_us; 577 491 __le32 channel_load_not_by_us; ··· 585 499 } __packed; /* STATISTICS_NTFY_PER_PHY_API_S_VER_1 */ 586 500 587 501 /** 588 - * struct iwl_statistics_ntfy_per_sta 502 + * struct iwl_stats_ntfy_per_sta 589 503 * 590 504 * @average_energy: in fact it is minus the energy.. 591 505 */ 592 - struct iwl_statistics_ntfy_per_sta { 506 + struct iwl_stats_ntfy_per_sta { 593 507 __le32 average_energy; 594 508 } __packed; /* STATISTICS_NTFY_PER_STA_API_S_VER_1 */ 595 509 596 - #define IWL_STATS_MAX_PHY_OPERTINAL 3 510 + #define IWL_STATS_MAX_PHY_OPERATIONAL 3 511 + #define IWL_STATS_MAX_FW_LINKS (IWL_MVM_FW_MAX_LINK_ID + 1) 512 + 513 + /** 514 + * struct iwl_system_statistics_notif_oper 515 + * 516 + * @time_stamp: time when the notification is sent from firmware 517 + * @per_link: per link statistics, &struct iwl_stats_ntfy_per_link 518 + * @per_phy: per phy statistics, &struct iwl_stats_ntfy_per_phy 519 + * @per_sta: per sta statistics, &struct iwl_stats_ntfy_per_sta 520 + */ 521 + struct iwl_system_statistics_notif_oper { 522 + __le32 time_stamp; 523 + struct iwl_stats_ntfy_per_link per_link[IWL_STATS_MAX_FW_LINKS]; 524 + struct iwl_stats_ntfy_per_phy per_phy[IWL_STATS_MAX_PHY_OPERATIONAL]; 525 + struct iwl_stats_ntfy_per_sta per_sta[IWL_MVM_STATION_COUNT_MAX]; 526 + } __packed; /* STATISTICS_FW_NTFY_OPERATIONAL_API_S_VER_3 */ 527 + 528 + /** 529 + * struct iwl_system_statistics_part1_notif_oper 530 + * 531 + * @time_stamp: time when the notification is sent from firmware 532 + * @per_link: per link statistics &struct iwl_stats_ntfy_part1_per_link 533 + * @per_phy_crc_error_stats: per phy crc error statistics 534 + */ 535 + struct iwl_system_statistics_part1_notif_oper { 536 + __le32 time_stamp; 537 + struct iwl_stats_ntfy_part1_per_link per_link[IWL_STATS_MAX_FW_LINKS]; 538 + __le32 per_phy_crc_error_stats[IWL_STATS_MAX_PHY_OPERATIONAL]; 539 + } __packed; /* STATISTICS_FW_NTFY_OPERATIONAL_PART1_API_S_VER_4 */ 540 + 541 + /** 542 + * struct iwl_system_statistics_end_notif 543 + * 544 + * @time_stamp: time when the notification is sent from firmware 545 + */ 546 + struct iwl_system_statistics_end_notif { 547 + __le32 time_stamp; 548 + } __packed; /* STATISTICS_FW_NTFY_END_API_S_VER_1 */ 549 + 597 550 /** 598 551 * struct iwl_statistics_operational_ntfy 599 552 * 600 553 * @hdr: general statistics header 601 554 * @flags: bitmap of possible notification structures 602 - * @per_mac_stats: per mac statistics, &struct iwl_statistics_ntfy_per_mac 603 - * @per_phy_stats: per phy statistics, &struct iwl_statistics_ntfy_per_phy 604 - * @per_sta_stats: per sta statistics, &struct iwl_statistics_ntfy_per_sta 555 + * @per_mac: per mac statistics, &struct iwl_stats_ntfy_per_mac 556 + * @per_phy: per phy statistics, &struct iwl_stats_ntfy_per_phy 557 + * @per_sta: per sta statistics, &struct iwl_stats_ntfy_per_sta 605 558 * @rx_time: rx time 606 559 * @tx_time: usec the radio is transmitting. 607 560 * @on_time_rf: The total time in usec the RF is awake. ··· 649 524 struct iwl_statistics_operational_ntfy { 650 525 struct iwl_statistics_ntfy_hdr hdr; 651 526 __le32 flags; 652 - struct iwl_statistics_ntfy_per_mac per_mac_stats[MAC_INDEX_AUX]; 653 - struct iwl_statistics_ntfy_per_phy per_phy_stats[IWL_STATS_MAX_PHY_OPERTINAL]; 654 - struct iwl_statistics_ntfy_per_sta per_sta_stats[IWL_MVM_STATION_COUNT_MAX]; 527 + struct iwl_stats_ntfy_per_mac per_mac[MAC_INDEX_AUX]; 528 + struct iwl_stats_ntfy_per_phy per_phy[IWL_STATS_MAX_PHY_OPERATIONAL]; 529 + struct iwl_stats_ntfy_per_sta per_sta[IWL_MVM_STATION_COUNT_MAX]; 655 530 __le64 rx_time; 656 531 __le64 tx_time; 657 532 __le64 on_time_rf;
+71 -7
drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2012-2014, 2018-2020, 2022 Intel Corporation 3 + * Copyright (C) 2012-2014, 2018-2020, 2022-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 335 335 __le32 status; 336 336 } __packed; /* HOT_SPOT_RSP_API_S_VER_1 */ 337 337 338 + /* 339 + * Activity types for the ROC command 340 + * @ROC_ACTIVITY_HOTSPOT: ROC for hs20 activity 341 + * @ROC_ACTIVITY_P2P_DISC: ROC for p2p discoverability activity 342 + * @ROC_ACTIVITY_P2P_TXRX: ROC for p2p action frames activity 343 + */ 344 + enum iwl_roc_activity { 345 + ROC_ACTIVITY_HOTSPOT, 346 + ROC_ACTIVITY_P2P_DISC, 347 + ROC_ACTIVITY_P2P_TXRX, 348 + ROC_NUM_ACTIVITIES 349 + }; /* ROC_ACTIVITY_API_E_VER_1 */ 350 + 351 + /* 352 + * ROC command 353 + * 354 + * Command requests the firmware to remain on a channel for a certain duration. 355 + * 356 + * ( MAC_CONF_GROUP 0x3, ROC_CMD 0xE ) 357 + * 358 + * @action: action to perform, see &enum iwl_ctxt_action 359 + * @activity: type of activity, see &enum iwl_roc_activity 360 + * @sta_id: station id, resumed during "Remain On Channel" activity. 361 + * @channel_info: &struct iwl_fw_channel_info 362 + * @node_addr: node MAC address for Rx filtering 363 + * @reserved: align to a dword 364 + * @max_delay: max delay the ROC can start in TU 365 + * @duration: remain on channel duration in TU 366 + */ 367 + struct iwl_roc_req { 368 + __le32 action; 369 + __le32 activity; 370 + __le32 sta_id; 371 + struct iwl_fw_channel_info channel_info; 372 + u8 node_addr[ETH_ALEN]; 373 + __le16 reserved; 374 + __le32 max_delay; 375 + __le32 duration; 376 + } __packed; /* ROC_CMD_API_S_VER_3 */ 377 + 378 + /* 379 + * ROC notification 380 + * 381 + * Notification when ROC startes and when ROC ended. 382 + * 383 + * ( MAC_CONF_GROUP 0x3, ROC_NOTIF 0xf8 ) 384 + * 385 + * @status: true if ROC succeeded to start 386 + * @start_end: true if ROC started, false if ROC ended 387 + * @activity: notification to which activity - &enum iwl_roc_activity 388 + */ 389 + struct iwl_roc_notif { 390 + __le32 success; 391 + __le32 started; 392 + __le32 activity; 393 + } __packed; /* ROC_NOTIF_API_S_VER_1 */ 394 + 338 395 /** 339 396 * enum iwl_mvm_session_prot_conf_id - session protection's configurations 340 397 * @SESSION_PROTECT_CONF_ASSOC: Start a session protection for association. ··· 432 375 433 376 /** 434 377 * struct iwl_mvm_session_prot_cmd - configure a session protection 435 - * @id_and_color: the id and color of the mac for which this session protection 436 - * is sent 378 + * @id_and_color: the id and color of the link (or mac, for command version 1) 379 + * for which this session protection is sent 437 380 * @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE, 438 381 * see &enum iwl_ctxt_action 439 382 * @conf_id: see &enum iwl_mvm_session_prot_conf_id ··· 454 397 __le32 duration_tu; 455 398 __le32 repetition_count; 456 399 __le32 interval; 457 - } __packed; /* SESSION_PROTECTION_CMD_API_S_VER_1 */ 400 + } __packed; 401 + /* SESSION_PROTECTION_CMD_API_S_VER_1 and 402 + * SESSION_PROTECTION_CMD_API_S_VER_2 403 + */ 458 404 459 405 /** 460 406 * struct iwl_mvm_session_prot_notif - session protection started / ended 461 - * @mac_id: the mac id for which the session protection started / ended 407 + * @mac_link_id: the mac id (or link id, for notif ver > 2) for which the 408 + * session protection started / ended 462 409 * @status: 1 means success, 0 means failure 463 410 * @start: 1 means the session protection started, 0 means it ended 464 411 * @conf_id: see &enum iwl_mvm_session_prot_conf_id ··· 471 410 * and end even the firmware could not schedule it. 472 411 */ 473 412 struct iwl_mvm_session_prot_notif { 474 - __le32 mac_id; 413 + __le32 mac_link_id; 475 414 __le32 status; 476 415 __le32 start; 477 416 __le32 conf_id; 478 - } __packed; /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 */ 417 + } __packed; 418 + /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 and 419 + * SESSION_PROTECTION_NOTIFICATION_API_S_VER_3 420 + */ 479 421 480 422 #endif /* __iwl_fw_api_time_event_h__ */
+160 -18
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
··· 1021 1021 struct iwl_fwrt_dump_data *dump_data; 1022 1022 }; 1023 1023 1024 - static int 1025 - iwl_dump_ini_prph_mac_iter(struct iwl_fw_runtime *fwrt, 1026 - struct iwl_dump_ini_region_data *reg_data, 1027 - void *range_ptr, u32 range_len, int idx) 1024 + static int iwl_dump_ini_prph_mac_iter_common(struct iwl_fw_runtime *fwrt, 1025 + void *range_ptr, u32 addr, 1026 + __le32 size) 1028 1027 { 1029 - struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1030 1028 struct iwl_fw_ini_error_dump_range *range = range_ptr; 1031 1029 __le32 *val = range->data; 1032 1030 u32 prph_val; 1033 - u32 addr = le32_to_cpu(reg->addrs[idx]) + 1034 - le32_to_cpu(reg->dev_addr.offset); 1035 1031 int i; 1036 1032 1037 1033 range->internal_base_addr = cpu_to_le32(addr); 1038 - range->range_data_size = reg->dev_addr.size; 1039 - for (i = 0; i < le32_to_cpu(reg->dev_addr.size); i += 4) { 1034 + range->range_data_size = size; 1035 + for (i = 0; i < le32_to_cpu(size); i += 4) { 1040 1036 prph_val = iwl_read_prph(fwrt->trans, addr + i); 1041 1037 if (iwl_trans_is_hw_error_value(prph_val)) 1042 1038 return -EBUSY; ··· 1043 1047 } 1044 1048 1045 1049 static int 1046 - iwl_dump_ini_prph_phy_iter(struct iwl_fw_runtime *fwrt, 1050 + iwl_dump_ini_prph_mac_iter(struct iwl_fw_runtime *fwrt, 1047 1051 struct iwl_dump_ini_region_data *reg_data, 1048 1052 void *range_ptr, u32 range_len, int idx) 1049 1053 { 1050 1054 struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1055 + u32 addr = le32_to_cpu(reg->addrs[idx]) + 1056 + le32_to_cpu(reg->dev_addr.offset); 1057 + 1058 + return iwl_dump_ini_prph_mac_iter_common(fwrt, range_ptr, addr, 1059 + reg->dev_addr.size); 1060 + } 1061 + 1062 + static int 1063 + iwl_dump_ini_prph_mac_block_iter(struct iwl_fw_runtime *fwrt, 1064 + struct iwl_dump_ini_region_data *reg_data, 1065 + void *range_ptr, u32 range_len, int idx) 1066 + { 1067 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1068 + struct iwl_fw_ini_addr_size *pairs = (void *)reg->addrs; 1069 + u32 addr = le32_to_cpu(reg->dev_addr_range.offset) + 1070 + le32_to_cpu(pairs[idx].addr); 1071 + 1072 + return iwl_dump_ini_prph_mac_iter_common(fwrt, range_ptr, addr, 1073 + pairs[idx].size); 1074 + } 1075 + 1076 + static int iwl_dump_ini_prph_phy_iter_common(struct iwl_fw_runtime *fwrt, 1077 + void *range_ptr, u32 addr, 1078 + __le32 size, __le32 offset) 1079 + { 1051 1080 struct iwl_fw_ini_error_dump_range *range = range_ptr; 1052 1081 __le32 *val = range->data; 1053 1082 u32 indirect_wr_addr = WMAL_INDRCT_RD_CMD1; 1054 1083 u32 indirect_rd_addr = WMAL_MRSPF_1; 1055 1084 u32 prph_val; 1056 - u32 addr = le32_to_cpu(reg->addrs[idx]); 1057 1085 u32 dphy_state; 1058 1086 u32 dphy_addr; 1059 1087 int i; 1060 1088 1061 1089 range->internal_base_addr = cpu_to_le32(addr); 1062 - range->range_data_size = reg->dev_addr.size; 1090 + range->range_data_size = size; 1063 1091 1064 1092 if (fwrt->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210) 1065 1093 indirect_wr_addr = WMAL_INDRCT_CMD1; 1066 1094 1067 - indirect_wr_addr += le32_to_cpu(reg->dev_addr.offset); 1068 - indirect_rd_addr += le32_to_cpu(reg->dev_addr.offset); 1095 + indirect_wr_addr += le32_to_cpu(offset); 1096 + indirect_rd_addr += le32_to_cpu(offset); 1069 1097 1070 1098 if (!iwl_trans_grab_nic_access(fwrt->trans)) 1071 1099 return -EBUSY; 1072 1100 1073 - dphy_addr = (reg->dev_addr.offset) ? WFPM_LMAC2_PS_CTL_RW : 1074 - WFPM_LMAC1_PS_CTL_RW; 1101 + dphy_addr = (offset) ? WFPM_LMAC2_PS_CTL_RW : WFPM_LMAC1_PS_CTL_RW; 1075 1102 dphy_state = iwl_read_umac_prph_no_grab(fwrt->trans, dphy_addr); 1076 1103 1077 - for (i = 0; i < le32_to_cpu(reg->dev_addr.size); i += 4) { 1104 + for (i = 0; i < le32_to_cpu(size); i += 4) { 1078 1105 if (dphy_state == HBUS_TIMEOUT || 1079 1106 (dphy_state & WFPM_PS_CTL_RW_PHYRF_PD_FSM_CURSTATE_MSK) != 1080 1107 WFPM_PHYRF_STATE_ON) { ··· 1114 1095 1115 1096 iwl_trans_release_nic_access(fwrt->trans); 1116 1097 return sizeof(*range) + le32_to_cpu(range->range_data_size); 1098 + } 1099 + 1100 + static int 1101 + iwl_dump_ini_prph_phy_iter(struct iwl_fw_runtime *fwrt, 1102 + struct iwl_dump_ini_region_data *reg_data, 1103 + void *range_ptr, u32 range_len, int idx) 1104 + { 1105 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1106 + u32 addr = le32_to_cpu(reg->addrs[idx]); 1107 + 1108 + return iwl_dump_ini_prph_phy_iter_common(fwrt, range_ptr, addr, 1109 + reg->dev_addr.size, 1110 + reg->dev_addr.offset); 1111 + } 1112 + 1113 + static int 1114 + iwl_dump_ini_prph_phy_block_iter(struct iwl_fw_runtime *fwrt, 1115 + struct iwl_dump_ini_region_data *reg_data, 1116 + void *range_ptr, u32 range_len, int idx) 1117 + { 1118 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1119 + struct iwl_fw_ini_addr_size *pairs = (void *)reg->addrs; 1120 + u32 addr = le32_to_cpu(pairs[idx].addr); 1121 + 1122 + return iwl_dump_ini_prph_phy_iter_common(fwrt, range_ptr, addr, 1123 + pairs[idx].size, 1124 + reg->dev_addr_range.offset); 1117 1125 } 1118 1126 1119 1127 static int iwl_dump_ini_csr_iter(struct iwl_fw_runtime *fwrt, ··· 1413 1367 out: 1414 1368 iwl_trans_release_nic_access(fwrt->trans); 1415 1369 1370 + return sizeof(*range) + le32_to_cpu(range->range_data_size); 1371 + } 1372 + 1373 + static int 1374 + iwl_dump_ini_prph_snps_dphyip_iter(struct iwl_fw_runtime *fwrt, 1375 + struct iwl_dump_ini_region_data *reg_data, 1376 + void *range_ptr, u32 range_len, int idx) 1377 + { 1378 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1379 + struct iwl_fw_ini_error_dump_range *range = range_ptr; 1380 + __le32 *val = range->data; 1381 + __le32 offset = reg->dev_addr.offset; 1382 + u32 indirect_rd_wr_addr = DPHYIP_INDIRECT; 1383 + u32 addr = le32_to_cpu(reg->addrs[idx]); 1384 + u32 dphy_state, dphy_addr, prph_val; 1385 + int i; 1386 + 1387 + range->internal_base_addr = cpu_to_le32(addr); 1388 + range->range_data_size = reg->dev_addr.size; 1389 + 1390 + if (!iwl_trans_grab_nic_access(fwrt->trans)) 1391 + return -EBUSY; 1392 + 1393 + indirect_rd_wr_addr += le32_to_cpu(offset); 1394 + 1395 + dphy_addr = offset ? WFPM_LMAC2_PS_CTL_RW : WFPM_LMAC1_PS_CTL_RW; 1396 + dphy_state = iwl_read_umac_prph_no_grab(fwrt->trans, dphy_addr); 1397 + 1398 + for (i = 0; i < le32_to_cpu(reg->dev_addr.size); i += 4) { 1399 + if (dphy_state == HBUS_TIMEOUT || 1400 + (dphy_state & WFPM_PS_CTL_RW_PHYRF_PD_FSM_CURSTATE_MSK) != 1401 + WFPM_PHYRF_STATE_ON) { 1402 + *val++ = cpu_to_le32(WFPM_DPHY_OFF); 1403 + continue; 1404 + } 1405 + 1406 + iwl_write_prph_no_grab(fwrt->trans, indirect_rd_wr_addr, 1407 + addr + i); 1408 + /* wait a bit for value to be ready in register */ 1409 + udelay(1); 1410 + prph_val = iwl_read_prph_no_grab(fwrt->trans, 1411 + indirect_rd_wr_addr); 1412 + *val++ = cpu_to_le32((prph_val & DPHYIP_INDIRECT_RD_MSK) >> 1413 + DPHYIP_INDIRECT_RD_SHIFT); 1414 + } 1415 + 1416 + iwl_trans_release_nic_access(fwrt->trans); 1416 1417 return sizeof(*range) + le32_to_cpu(range->range_data_size); 1417 1418 } 1418 1419 ··· 1874 1781 return iwl_tlv_array_len(reg_data->reg_tlv, reg, addrs); 1875 1782 } 1876 1783 1784 + static u32 1785 + iwl_dump_ini_mem_block_ranges(struct iwl_fw_runtime *fwrt, 1786 + struct iwl_dump_ini_region_data *reg_data) 1787 + { 1788 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1789 + size_t size = sizeof(struct iwl_fw_ini_addr_size); 1790 + 1791 + return iwl_tlv_array_len_with_size(reg_data->reg_tlv, reg, size); 1792 + } 1793 + 1877 1794 static u32 iwl_dump_ini_paging_ranges(struct iwl_fw_runtime *fwrt, 1878 1795 struct iwl_dump_ini_region_data *reg_data) 1879 1796 { ··· 1967 1864 1968 1865 return sizeof(struct iwl_fw_ini_error_dump) + ranges * 1969 1866 (size + sizeof(struct iwl_fw_ini_error_dump_range)); 1867 + } 1868 + 1869 + static u32 1870 + iwl_dump_ini_mem_block_get_size(struct iwl_fw_runtime *fwrt, 1871 + struct iwl_dump_ini_region_data *reg_data) 1872 + { 1873 + struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data; 1874 + struct iwl_fw_ini_addr_size *pairs = (void *)reg->addrs; 1875 + u32 ranges = iwl_dump_ini_mem_block_ranges(fwrt, reg_data); 1876 + u32 size = sizeof(struct iwl_fw_ini_error_dump); 1877 + int range; 1878 + 1879 + if (!ranges) 1880 + return 0; 1881 + 1882 + for (range = 0; range < ranges; range++) 1883 + size += le32_to_cpu(pairs[range].size); 1884 + 1885 + return size + ranges * sizeof(struct iwl_fw_ini_error_dump_range); 1970 1886 } 1971 1887 1972 1888 static u32 ··· 2535 2413 .fill_mem_hdr = iwl_dump_ini_mem_fill_header, 2536 2414 .fill_range = iwl_dump_ini_prph_phy_iter, 2537 2415 }, 2416 + [IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE] = { 2417 + .get_num_of_ranges = iwl_dump_ini_mem_block_ranges, 2418 + .get_size = iwl_dump_ini_mem_block_get_size, 2419 + .fill_mem_hdr = iwl_dump_ini_mem_fill_header, 2420 + .fill_range = iwl_dump_ini_prph_mac_block_iter, 2421 + }, 2422 + [IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE] = { 2423 + .get_num_of_ranges = iwl_dump_ini_mem_block_ranges, 2424 + .get_size = iwl_dump_ini_mem_block_get_size, 2425 + .fill_mem_hdr = iwl_dump_ini_mem_fill_header, 2426 + .fill_range = iwl_dump_ini_prph_phy_block_iter, 2427 + }, 2538 2428 [IWL_FW_INI_REGION_PERIPHERY_AUX] = {}, 2539 2429 [IWL_FW_INI_REGION_PAGING] = { 2540 2430 .fill_mem_hdr = iwl_dump_ini_mem_fill_header, ··· 2583 2449 .get_size = iwl_dump_ini_mon_dbgi_get_size, 2584 2450 .fill_mem_hdr = iwl_dump_ini_mon_dbgi_fill_header, 2585 2451 .fill_range = iwl_dump_ini_dbgi_sram_iter, 2452 + }, 2453 + [IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP] = { 2454 + .get_num_of_ranges = iwl_dump_ini_mem_ranges, 2455 + .get_size = iwl_dump_ini_mem_get_size, 2456 + .fill_mem_hdr = iwl_dump_ini_mem_fill_header, 2457 + .fill_range = iwl_dump_ini_prph_snps_dphyip_iter, 2586 2458 }, 2587 2459 }; 2588 2460 ··· 2632 2492 if (reg_type >= ARRAY_SIZE(iwl_dump_ini_region_ops)) 2633 2493 continue; 2634 2494 2635 - if (reg_type == IWL_FW_INI_REGION_PERIPHERY_PHY && 2495 + if ((reg_type == IWL_FW_INI_REGION_PERIPHERY_PHY || 2496 + reg_type == IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE || 2497 + reg_type == IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP) && 2636 2498 tp_id != IWL_FW_INI_TIME_POINT_FW_ASSERT) { 2637 2499 IWL_WARN(fwrt, 2638 2500 "WRT: trying to collect phy prph at time point: %d, skipping\n",
+5 -1
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
··· 141 141 142 142 event_cfg.enabled_severities = cpu_to_le32(enabled_severities); 143 143 144 - ret = iwl_trans_send_cmd(fwrt->trans, &hcmd); 144 + if (fwrt->ops && fwrt->ops->send_hcmd) 145 + ret = fwrt->ops->send_hcmd(fwrt->ops_ctx, &hcmd); 146 + else 147 + ret = -EPERM; 148 + 145 149 IWL_INFO(fwrt, 146 150 "sent host event cfg with enabled_severities: %u, ret: %d\n", 147 151 enabled_severities, ret);
+2
drivers/net/wireless/intel/iwlwifi/fw/file.h
··· 975 975 _iwl_tlv_array_len((_tlv_ptr), sizeof(*(_struct_ptr)), \ 976 976 sizeof(_struct_ptr->_memb[0])) 977 977 978 + #define iwl_tlv_array_len_with_size(_tlv_ptr, _struct_ptr, _size) \ 979 + _iwl_tlv_array_len((_tlv_ptr), sizeof(*(_struct_ptr)), _size) 978 980 #endif /* __iwl_fw_file_h__ */
+2 -2
drivers/net/wireless/intel/iwlwifi/fw/img.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2021 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016 Intel Deutschland GmbH 6 6 */ ··· 198 198 struct iwl_fw { 199 199 u32 ucode_ver; 200 200 201 - char fw_version[64]; 201 + char fw_version[128]; 202 202 203 203 /* ucode images */ 204 204 struct fw_img img[IWL_UCODE_TYPE_MAX];
+4
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
··· 98 98 * @cur_fw_img: current firmware image, must be maintained by 99 99 * the driver by calling &iwl_fw_set_current_image() 100 100 * @dump: debug dump data 101 + * @uats_enabled: VLP or AFC AP is enabled 102 + * @uats_table: AP type table 101 103 */ 102 104 struct iwl_fw_runtime { 103 105 struct iwl_trans *trans; ··· 173 171 struct iwl_sar_offset_mapping_cmd sgom_table; 174 172 bool sgom_enabled; 175 173 u8 reduced_power_flags; 174 + bool uats_enabled; 175 + struct iwl_uats_table_cmd uats_table; 176 176 #endif 177 177 }; 178 178
+50
drivers/net/wireless/intel/iwlwifi/fw/uefi.c
··· 388 388 kfree(data); 389 389 } 390 390 IWL_EXPORT_SYMBOL(iwl_uefi_get_sgom_table); 391 + 392 + static int iwl_uefi_uats_parse(struct uefi_cnv_wlan_uats_data *uats_data, 393 + struct iwl_fw_runtime *fwrt) 394 + { 395 + if (uats_data->revision != 1) 396 + return -EINVAL; 397 + 398 + memcpy(fwrt->uats_table.offset_map, uats_data->offset_map, 399 + sizeof(fwrt->uats_table.offset_map)); 400 + return 0; 401 + } 402 + 403 + int iwl_uefi_get_uats_table(struct iwl_trans *trans, 404 + struct iwl_fw_runtime *fwrt) 405 + { 406 + struct uefi_cnv_wlan_uats_data *data; 407 + unsigned long package_size; 408 + int ret; 409 + 410 + data = iwl_uefi_get_variable(IWL_UEFI_UATS_NAME, &IWL_EFI_VAR_GUID, 411 + &package_size); 412 + if (IS_ERR(data)) { 413 + IWL_DEBUG_FW(trans, 414 + "UATS UEFI variable not found 0x%lx\n", 415 + PTR_ERR(data)); 416 + return -EINVAL; 417 + } 418 + 419 + if (package_size < sizeof(*data)) { 420 + IWL_DEBUG_FW(trans, 421 + "Invalid UATS table UEFI variable len (%lu)\n", 422 + package_size); 423 + kfree(data); 424 + return -EINVAL; 425 + } 426 + 427 + IWL_DEBUG_FW(trans, "Read UATS from UEFI with size %lu\n", 428 + package_size); 429 + 430 + ret = iwl_uefi_uats_parse(data, fwrt); 431 + if (ret < 0) { 432 + IWL_DEBUG_FW(trans, "Cannot read UATS table. rev is invalid\n"); 433 + kfree(data); 434 + return ret; 435 + } 436 + 437 + kfree(data); 438 + return 0; 439 + } 440 + IWL_EXPORT_SYMBOL(iwl_uefi_get_uats_table); 391 441 #endif /* CONFIG_ACPI */
+17
drivers/net/wireless/intel/iwlwifi/fw/uefi.h
··· 9 9 #define IWL_UEFI_REDUCED_POWER_NAME L"UefiCnvWlanReducedPower" 10 10 #define IWL_UEFI_SGOM_NAME L"UefiCnvWlanSarGeoOffsetMapping" 11 11 #define IWL_UEFI_STEP_NAME L"UefiCnvCommonSTEP" 12 + #define IWL_UEFI_UATS_NAME L"CnvUefiWlanUATS" 12 13 13 14 #define IWL_SGOM_MAP_SIZE 339 15 + #define IWL_UATS_MAP_SIZE 339 14 16 15 17 struct pnvm_sku_package { 16 18 u8 rev; ··· 25 23 struct uefi_cnv_wlan_sgom_data { 26 24 u8 revision; 27 25 u8 offset_map[IWL_SGOM_MAP_SIZE - 1]; 26 + } __packed; 27 + 28 + struct uefi_cnv_wlan_uats_data { 29 + u8 revision; 30 + u8 offset_map[IWL_UATS_MAP_SIZE - 1]; 28 31 } __packed; 29 32 30 33 struct uefi_cnv_common_step_data { ··· 89 82 90 83 #if defined(CONFIG_EFI) && defined(CONFIG_ACPI) 91 84 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt); 85 + int iwl_uefi_get_uats_table(struct iwl_trans *trans, 86 + struct iwl_fw_runtime *fwrt); 92 87 #else 93 88 static inline 94 89 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt) 95 90 { 96 91 } 92 + 93 + static inline 94 + int iwl_uefi_get_uats_table(struct iwl_trans *trans, 95 + struct iwl_fw_runtime *fwrt) 96 + { 97 + return 0; 98 + } 99 + 97 100 #endif 98 101 #endif /* __iwl_fw_uefi__ */
+1 -4
drivers/net/wireless/intel/iwlwifi/iwl-config.h
··· 86 86 #define IWL_DEFAULT_MAX_TX_POWER 22 87 87 #define IWL_TX_CSUM_NETIF_FLAGS (NETIF_F_IPV6_CSUM | NETIF_F_IP_CSUM |\ 88 88 NETIF_F_TSO | NETIF_F_TSO6) 89 - #define IWL_TX_CSUM_NETIF_FLAGS_BZ (NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6) 90 - #define IWL_CSUM_NETIF_FLAGS_MASK (IWL_TX_CSUM_NETIF_FLAGS | \ 91 - IWL_TX_CSUM_NETIF_FLAGS_BZ | \ 92 - NETIF_F_RXCSUM) 89 + #define IWL_CSUM_NETIF_FLAGS_MASK (IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM) 93 90 94 91 /* Antenna presence definitions */ 95 92 #define ANT_NONE 0x0
+2 -1
drivers/net/wireless/intel/iwlwifi/iwl-csr.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2022 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016 Intel Deutschland GmbH 6 6 */ ··· 313 313 SILICON_C_STEP, 314 314 SILICON_D_STEP, 315 315 SILICON_E_STEP, 316 + SILICON_TC_STEP = 0xe, 316 317 SILICON_Z_STEP = 0xf, 317 318 }; 318 319
+7 -1
drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h
··· 3 3 * 4 4 * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 5 5 * Copyright(C) 2016 Intel Deutschland GmbH 6 - * Copyright(c) 2018 Intel Corporation 6 + * Copyright(c) 2018, 2023 Intel Corporation 7 7 *****************************************************************************/ 8 8 9 9 #ifndef __IWLWIFI_DEVICE_TRACE 10 10 #include <linux/skbuff.h> 11 11 #include <linux/ieee80211.h> 12 12 #include <net/cfg80211.h> 13 + #include <net/mac80211.h> 13 14 #include "iwl-trans.h" 14 15 #if !defined(__IWLWIFI_DEVICE_TRACE) 15 16 static inline bool iwl_trace_data(struct sk_buff *skb) 16 17 { 18 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 17 19 struct ieee80211_hdr *hdr = (void *)skb->data; 18 20 __le16 fc = hdr->frame_control; 19 21 int offs = 24; /* start with normal header length */ 20 22 21 23 if (!ieee80211_is_data(fc)) 24 + return false; 25 + 26 + /* If upper layers wanted TX status it's an important frame */ 27 + if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) 22 28 return false; 23 29 24 30 /* Try to determine if the frame is EAPOL. This might have false
+27 -12
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2021 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 162 162 { 163 163 if (step == SILICON_Z_STEP) 164 164 return 'z'; 165 + if (step == SILICON_TC_STEP) 166 + return 'a'; 165 167 return 'a' + step; 166 168 } 167 169 ··· 179 177 return "unconfigured"; 180 178 181 179 mac_step = iwl_drv_get_step(trans->hw_rev_step); 180 + 181 + rf_step = iwl_drv_get_step(CSR_HW_RFID_STEP(trans->hw_rf_id)); 182 182 183 183 switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) { 184 184 case IWL_CFG_RF_TYPE_HR1: ··· 200 196 rf = "fm"; 201 197 break; 202 198 case IWL_CFG_RF_TYPE_WH: 203 - rf = "wh"; 199 + if (SILICON_Z_STEP == 200 + CSR_HW_RFID_STEP(trans->hw_rf_id)) { 201 + rf = "whtc"; 202 + rf_step = 'a'; 203 + } else { 204 + rf = "wh"; 205 + } 204 206 break; 205 207 default: 206 208 return "unknown-rf"; 207 209 } 208 210 209 211 cdb = CSR_HW_RFID_IS_CDB(trans->hw_rf_id) ? "4" : ""; 210 - 211 - rf_step = iwl_drv_get_step(CSR_HW_RFID_STEP(trans->hw_rf_id)); 212 212 213 213 scnprintf(buf, FW_NAME_PRE_BUFSIZE, 214 214 "iwlwifi-%s-%c0-%s%s-%c0", ··· 1311 1303 case IWL_UCODE_TLV_CURRENT_PC: 1312 1304 if (tlv_len < sizeof(struct iwl_pc_data)) 1313 1305 goto invalid_tlv_len; 1314 - drv->trans->dbg.num_pc = 1315 - tlv_len / sizeof(struct iwl_pc_data); 1316 1306 drv->trans->dbg.pc_data = 1317 1307 kmemdup(tlv_data, tlv_len, GFP_KERNEL); 1308 + if (!drv->trans->dbg.pc_data) 1309 + return -ENOMEM; 1310 + drv->trans->dbg.num_pc = 1311 + tlv_len / sizeof(struct iwl_pc_data); 1318 1312 break; 1319 1313 default: 1320 1314 IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type); ··· 1425 1415 struct iwl_op_mode *op_mode = NULL; 1426 1416 int retry, max_retry = !!iwlwifi_mod_params.fw_restart * IWL_MAX_INIT_RETRY; 1427 1417 1418 + /* also protects start/stop from racing against each other */ 1419 + lockdep_assert_held(&iwlwifi_opmode_table_mtx); 1420 + 1428 1421 for (retry = 0; retry <= max_retry; retry++) { 1429 1422 1430 1423 #ifdef CONFIG_IWLWIFI_DEBUGFS ··· 1442 1429 if (op_mode) 1443 1430 return op_mode; 1444 1431 1432 + if (test_bit(STATUS_TRANS_DEAD, &drv->trans->status)) 1433 + break; 1434 + 1445 1435 IWL_ERR(drv, "retry init count %d\n", retry); 1446 1436 1447 1437 #ifdef CONFIG_IWLWIFI_DEBUGFS ··· 1458 1442 1459 1443 static void _iwl_op_mode_stop(struct iwl_drv *drv) 1460 1444 { 1445 + /* also protects start/stop from racing against each other */ 1446 + lockdep_assert_held(&iwlwifi_opmode_table_mtx); 1447 + 1461 1448 /* op_mode can be NULL if its start failed */ 1462 1449 if (drv->op_mode) { 1463 1450 iwl_op_mode_stop(drv->op_mode); ··· 1744 1725 } 1745 1726 mutex_unlock(&iwlwifi_opmode_table_mtx); 1746 1727 1747 - /* 1748 - * Complete the firmware request last so that 1749 - * a driver unbind (stop) doesn't run while we 1750 - * are doing the start() above. 1751 - */ 1752 1728 complete(&drv->request_firmware_complete); 1753 1729 1754 1730 /* ··· 1848 1834 { 1849 1835 wait_for_completion(&drv->request_firmware_complete); 1850 1836 1837 + mutex_lock(&iwlwifi_opmode_table_mtx); 1838 + 1851 1839 _iwl_op_mode_stop(drv); 1852 1840 1853 1841 iwl_dealloc_ucode(drv); 1854 1842 1855 - mutex_lock(&iwlwifi_opmode_table_mtx); 1856 1843 /* 1857 1844 * List is empty (this item wasn't added) 1858 1845 * when firmware loading failed -- in that
+2 -1
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
··· 671 671 IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | 672 672 IEEE80211_EHT_MAC_CAP0_OM_CONTROL | 673 673 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 | 674 - IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2, 674 + IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 | 675 + IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC, 675 676 .phy_cap_info[0] = 676 677 IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ | 677 678 IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
+11 -8
drivers/net/wireless/intel/iwlwifi/iwl-prph.h
··· 348 348 #define RFIC_REG_RD 0xAD0470 349 349 #define WFPM_CTRL_REG 0xA03030 350 350 #define WFPM_OTP_CFG1_ADDR 0x00a03098 351 - #define WFPM_OTP_CFG1_IS_JACKET_BIT BIT(4) 352 - #define WFPM_OTP_CFG1_IS_CDB_BIT BIT(5) 351 + #define WFPM_OTP_CFG1_IS_JACKET_BIT BIT(5) 352 + #define WFPM_OTP_CFG1_IS_CDB_BIT BIT(4) 353 353 #define WFPM_OTP_BZ_BNJ_JACKET_BIT 5 354 354 #define WFPM_OTP_BZ_BNJ_CDB_BIT 4 355 355 #define WFPM_OTP_CFG1_IS_JACKET(_val) (((_val) & 0x00000020) >> WFPM_OTP_BZ_BNJ_JACKET_BIT) ··· 365 365 #define DBGI_SRAM_FIFO_POINTERS_WR_PTR_MSK 0x00000FFF 366 366 367 367 enum { 368 - ENABLE_WFPM = BIT(31), 369 368 WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK = 0x80000000, 370 369 }; 371 370 ··· 382 383 #define PREG_PRPH_WPROT_22000 0xA04D00 383 384 384 385 #define SB_MODIFY_CFG_FLAG 0xA03088 385 - #define SB_CFG_RESIDES_IN_OTP_MASK 0x10 386 + #define SB_CFG_RESIDES_IN_ROM 0x80 386 387 #define SB_CPU_1_STATUS 0xA01E30 387 388 #define SB_CPU_2_STATUS 0xA01E34 388 389 #define UMAG_SB_CPU_1_STATUS 0xA038C0 ··· 423 424 * reserved: bits 12-18 424 425 * slave_exist: bit 19 425 426 * dash: bits 20-23 426 - * step: bits 24-26 427 - * flavor: bits 27-31 427 + * step: bits 24-27 428 + * flavor: bits 28-31 428 429 */ 429 430 #define REG_CRF_ID_TYPE(val) (((val) & 0x00000FFF) >> 0) 430 431 #define REG_CRF_ID_SLAVE(val) (((val) & 0x00080000) >> 19) 431 432 #define REG_CRF_ID_DASH(val) (((val) & 0x00F00000) >> 20) 432 - #define REG_CRF_ID_STEP(val) (((val) & 0x07000000) >> 24) 433 - #define REG_CRF_ID_FLAVOR(val) (((val) & 0xF8000000) >> 27) 433 + #define REG_CRF_ID_STEP(val) (((val) & 0x0F000000) >> 24) 434 + #define REG_CRF_ID_FLAVOR(val) (((val) & 0xF0000000) >> 28) 434 435 435 436 #define UREG_CHICK (0xA05C00) 436 437 #define UREG_CHICK_MSI_ENABLE BIT(24) ··· 515 516 516 517 #define WFPM_LMAC2_PD_NOTIFICATION 0xA033CC 517 518 #define WFPM_LMAC2_PD_RE_READ BIT(31) 519 + 520 + #define DPHYIP_INDIRECT 0xA2D800 521 + #define DPHYIP_INDIRECT_RD_MSK 0xFF000000 522 + #define DPHYIP_INDIRECT_RD_SHIFT 24 518 523 519 524 #endif /* __iwl_prph_h__ */
+5 -4
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
··· 279 279 #define IWL_MGMT_TID 15 280 280 #define IWL_FRAME_LIMIT 64 281 281 #define IWL_MAX_RX_HW_QUEUES 16 282 - #define IWL_9000_MAX_RX_HW_QUEUES 6 282 + #define IWL_9000_MAX_RX_HW_QUEUES 1 283 283 284 284 /** 285 285 * enum iwl_wowlan_status - WoWLAN image/device status ··· 589 589 int (*tx)(struct iwl_trans *trans, struct sk_buff *skb, 590 590 struct iwl_device_tx_cmd *dev_cmd, int queue); 591 591 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, 592 - struct sk_buff_head *skbs); 592 + struct sk_buff_head *skbs, bool is_flush); 593 593 594 594 void (*set_q_ptrs)(struct iwl_trans *trans, int queue, int ptr); 595 595 ··· 1274 1274 } 1275 1275 1276 1276 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, 1277 - int ssn, struct sk_buff_head *skbs) 1277 + int ssn, struct sk_buff_head *skbs, 1278 + bool is_flush) 1278 1279 { 1279 1280 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { 1280 1281 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 1281 1282 return; 1282 1283 } 1283 1284 1284 - trans->ops->reclaim(trans, queue, ssn, skbs); 1285 + trans->ops->reclaim(trans, queue, ssn, skbs, is_flush); 1285 1286 } 1286 1287 1287 1288 static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue,
+2 -2
drivers/net/wireless/intel/iwlwifi/mei/iwl-mei.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (C) 2021 - 2022 Intel Corporation 3 + * Copyright (C) 2021-2023 Intel Corporation 4 4 */ 5 5 6 6 #ifndef __iwl_mei_h__ ··· 493 493 494 494 static inline int iwl_mei_register(void *priv, 495 495 const struct iwl_mei_ops *ops) 496 - { return 0; } 496 + { return -EOPNOTSUPP; } 497 497 498 498 static inline void iwl_mei_start_unregister(void) 499 499 {}
+1
drivers/net/wireless/intel/iwlwifi/mvm/constants.h
··· 119 119 #define IWL_MVM_DISABLE_AP_FILS false 120 120 #define IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT 3000 /* in seconds */ 121 121 #define IWL_MVM_6GHZ_PASSIVE_SCAN_ASSOC_TIMEOUT 60 /* in seconds */ 122 + #define IWL_MVM_AUTO_EML_ENABLE true 122 123 123 124 #endif /* __MVM_CONSTANTS_H */
+11 -1
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 818 818 if (ret) 819 819 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); 820 820 821 - if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm)) 821 + if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm, false)) 822 822 IWL_ERR(mvm, "Failed to initialize D3 LAR information\n"); 823 823 824 824 return 0; ··· 2031 2031 if (IS_ERR(key_config)) 2032 2032 return false; 2033 2033 ieee80211_set_key_rx_seq(key_config, 0, &seq); 2034 + 2035 + if (key_config->keyidx == 4 || key_config->keyidx == 5) { 2036 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 2037 + int link_id = vif->active_links ? __ffs(vif->active_links) : 0; 2038 + struct iwl_mvm_vif_link_info *mvm_link = 2039 + mvmvif->link[link_id]; 2040 + 2041 + mvm_link->igtk = key_config; 2042 + } 2043 + 2034 2044 return true; 2035 2045 } 2036 2046
+60 -16
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
··· 699 699 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); 700 700 MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff); 701 701 702 - 703 - void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 702 + void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 704 703 { 704 + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 705 705 struct dentry *dbgfs_dir = vif->debugfs_dir; 706 706 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 707 - char buf[100]; 708 - 709 - /* 710 - * Check if debugfs directory already exist before creating it. 711 - * This may happen when, for example, resetting hw or suspend-resume 712 - */ 713 - if (!dbgfs_dir || mvmvif->dbgfs_dir) 714 - return; 715 707 716 708 mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); 717 709 if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) { ··· 729 737 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && 730 738 mvmvif == mvm->bf_allowed_vif) 731 739 MVM_DEBUGFS_ADD_FILE_VIF(bf_params, mvmvif->dbgfs_dir, 0600); 740 + } 741 + 742 + void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 743 + { 744 + struct dentry *dbgfs_dir = vif->debugfs_dir; 745 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 746 + char buf[100]; 747 + 748 + /* this will happen in monitor mode */ 749 + if (!dbgfs_dir) 750 + return; 732 751 733 752 /* 734 753 * Create symlink for convenience pointing to interface specific ··· 748 745 * find 749 746 * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ 750 747 */ 751 - snprintf(buf, 100, "../../../%pd3/%pd", 752 - dbgfs_dir, 753 - mvmvif->dbgfs_dir); 748 + snprintf(buf, 100, "../../../%pd3/iwlmvm", dbgfs_dir); 754 749 755 750 mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, 756 751 mvm->debugfs_dir, buf); 757 752 } 758 753 759 - void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 754 + void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 760 755 { 761 756 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 762 757 763 758 debugfs_remove(mvmvif->dbgfs_slink); 764 759 mvmvif->dbgfs_slink = NULL; 760 + } 765 761 766 - debugfs_remove_recursive(mvmvif->dbgfs_dir); 767 - mvmvif->dbgfs_dir = NULL; 762 + #define MVM_DEBUGFS_WRITE_LINK_FILE_OPS(name, bufsz) \ 763 + _MVM_DEBUGFS_WRITE_FILE_OPS(link_##name, bufsz, \ 764 + struct ieee80211_bss_conf) 765 + #define MVM_DEBUGFS_READ_WRITE_LINK_FILE_OPS(name, bufsz) \ 766 + _MVM_DEBUGFS_READ_WRITE_FILE_OPS(link_##name, bufsz, \ 767 + struct ieee80211_bss_conf) 768 + #define MVM_DEBUGFS_ADD_LINK_FILE(name, parent, mode) \ 769 + debugfs_create_file(#name, mode, parent, link_conf, \ 770 + &iwl_dbgfs_link_##name##_ops) 771 + 772 + static void iwl_mvm_debugfs_add_link_files(struct ieee80211_vif *vif, 773 + struct ieee80211_bss_conf *link_conf, 774 + struct dentry *mvm_dir) 775 + { 776 + /* Add per-link files here*/ 777 + } 778 + 779 + void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw, 780 + struct ieee80211_vif *vif, 781 + struct ieee80211_bss_conf *link_conf, 782 + struct dentry *dir) 783 + { 784 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 785 + struct iwl_mvm *mvm = mvmvif->mvm; 786 + unsigned int link_id = link_conf->link_id; 787 + struct iwl_mvm_vif_link_info *link_info = mvmvif->link[link_id]; 788 + struct dentry *mvm_dir; 789 + 790 + if (WARN_ON(!link_info) || !dir) 791 + return; 792 + 793 + if (dir == vif->debugfs_dir) { 794 + WARN_ON(!mvmvif->dbgfs_dir); 795 + mvm_dir = mvmvif->dbgfs_dir; 796 + } else { 797 + mvm_dir = debugfs_create_dir("iwlmvm", dir); 798 + if (IS_ERR_OR_NULL(mvm_dir)) { 799 + IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n", 800 + dir); 801 + return; 802 + } 803 + } 804 + 805 + iwl_mvm_debugfs_add_link_files(vif, link_conf, mvm_dir); 768 806 }
+147 -1
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
··· 50 50 size_t count, loff_t *ppos) 51 51 { 52 52 int ret; 53 + bool force; 53 54 54 - if (!iwl_mvm_is_ctdp_supported(mvm)) 55 + if (!kstrtobool(buf, &force)) 56 + IWL_DEBUG_INFO(mvm, 57 + "force start is %d [0=disabled, 1=enabled]\n", 58 + force); 59 + 60 + /* we allow skipping cap support check and force stop ctdp 61 + * statistics collection and with guerantee that it is 62 + * safe to use. 63 + */ 64 + if (!force && !iwl_mvm_is_ctdp_supported(mvm)) 55 65 return -EOPNOTSUPP; 56 66 57 67 if (!iwl_mvm_firmware_running(mvm) || ··· 70 60 71 61 mutex_lock(&mvm->mutex); 72 62 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_STOP, 0); 63 + mutex_unlock(&mvm->mutex); 64 + 65 + return ret ?: count; 66 + } 67 + 68 + static ssize_t iwl_dbgfs_start_ctdp_write(struct iwl_mvm *mvm, 69 + char *buf, size_t count, 70 + loff_t *ppos) 71 + { 72 + int ret; 73 + bool force; 74 + 75 + if (!kstrtobool(buf, &force)) 76 + IWL_DEBUG_INFO(mvm, 77 + "force start is %d [0=disabled, 1=enabled]\n", 78 + force); 79 + 80 + /* we allow skipping cap support check and force enable ctdp 81 + * for statistics collection and with guerantee that it is 82 + * safe to use. 83 + */ 84 + if (!force && !iwl_mvm_is_ctdp_supported(mvm)) 85 + return -EOPNOTSUPP; 86 + 87 + if (!iwl_mvm_firmware_running(mvm) || 88 + mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) 89 + return -EIO; 90 + 91 + mutex_lock(&mvm->mutex); 92 + ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, 0); 73 93 mutex_unlock(&mvm->mutex); 74 94 75 95 return ret ?: count; ··· 1005 965 char *buf; 1006 966 int ret; 1007 967 size_t bufsz; 968 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 969 + WIDE_ID(SYSTEM_GROUP, 970 + SYSTEM_STATISTICS_CMD), 971 + IWL_FW_CMD_VER_UNKNOWN); 972 + 973 + if (cmd_ver != IWL_FW_CMD_VER_UNKNOWN) 974 + return -EOPNOTSUPP; 1008 975 1009 976 if (iwl_mvm_has_new_rx_stats_api(mvm)) 1010 977 bufsz = ((sizeof(struct mvm_statistics_rx) / ··· 1190 1143 return ret; 1191 1144 } 1192 1145 #undef PRINT_STAT_LE32 1146 + 1147 + static ssize_t iwl_dbgfs_fw_system_stats_read(struct file *file, 1148 + char __user *user_buf, 1149 + size_t count, loff_t *ppos) 1150 + { 1151 + char *buff, *pos, *endpos; 1152 + int ret; 1153 + size_t bufsz; 1154 + int i; 1155 + struct iwl_mvm_vif *mvmvif; 1156 + struct ieee80211_vif *vif; 1157 + struct iwl_mvm *mvm = file->private_data; 1158 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 1159 + WIDE_ID(SYSTEM_GROUP, 1160 + SYSTEM_STATISTICS_CMD), 1161 + IWL_FW_CMD_VER_UNKNOWN); 1162 + 1163 + /* in case of a wrong cmd version, allocate buffer only for error msg */ 1164 + bufsz = (cmd_ver == 1) ? 4096 : 64; 1165 + 1166 + buff = kzalloc(bufsz, GFP_KERNEL); 1167 + if (!buff) 1168 + return -ENOMEM; 1169 + 1170 + pos = buff; 1171 + endpos = pos + bufsz; 1172 + 1173 + if (cmd_ver != 1) { 1174 + pos += scnprintf(pos, endpos - pos, 1175 + "System stats not supported:%d\n", cmd_ver); 1176 + goto send_out; 1177 + } 1178 + 1179 + mutex_lock(&mvm->mutex); 1180 + if (iwl_mvm_firmware_running(mvm)) 1181 + iwl_mvm_request_statistics(mvm, false); 1182 + 1183 + for (i = 0; i < NUM_MAC_INDEX_DRIVER; i++) { 1184 + vif = iwl_mvm_rcu_dereference_vif_id(mvm, i, false); 1185 + if (!vif) 1186 + continue; 1187 + 1188 + if (vif->type == NL80211_IFTYPE_STATION) 1189 + break; 1190 + } 1191 + 1192 + if (i == NUM_MAC_INDEX_DRIVER || !vif) { 1193 + pos += scnprintf(pos, endpos - pos, "vif is NULL\n"); 1194 + goto release_send_out; 1195 + } 1196 + 1197 + mvmvif = iwl_mvm_vif_from_mac80211(vif); 1198 + if (!mvmvif) { 1199 + pos += scnprintf(pos, endpos - pos, "mvmvif is NULL\n"); 1200 + goto release_send_out; 1201 + } 1202 + 1203 + for_each_mvm_vif_valid_link(mvmvif, i) { 1204 + struct iwl_mvm_vif_link_info *link_info = mvmvif->link[i]; 1205 + 1206 + pos += scnprintf(pos, endpos - pos, 1207 + "link_id %d", i); 1208 + pos += scnprintf(pos, endpos - pos, 1209 + " num_beacons %d", 1210 + link_info->beacon_stats.num_beacons); 1211 + pos += scnprintf(pos, endpos - pos, 1212 + " accu_num_beacons %d", 1213 + link_info->beacon_stats.accu_num_beacons); 1214 + pos += scnprintf(pos, endpos - pos, 1215 + " avg_signal %d\n", 1216 + link_info->beacon_stats.avg_signal); 1217 + } 1218 + 1219 + pos += scnprintf(pos, endpos - pos, 1220 + "radio_stats.rx_time %lld\n", 1221 + mvm->radio_stats.rx_time); 1222 + pos += scnprintf(pos, endpos - pos, 1223 + "radio_stats.tx_time %lld\n", 1224 + mvm->radio_stats.tx_time); 1225 + pos += scnprintf(pos, endpos - pos, 1226 + "accu_radio_stats.rx_time %lld\n", 1227 + mvm->accu_radio_stats.rx_time); 1228 + pos += scnprintf(pos, endpos - pos, 1229 + "accu_radio_stats.tx_time %lld\n", 1230 + mvm->accu_radio_stats.tx_time); 1231 + 1232 + release_send_out: 1233 + mutex_unlock(&mvm->mutex); 1234 + 1235 + send_out: 1236 + ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff); 1237 + kfree(buff); 1238 + 1239 + return ret; 1240 + } 1193 1241 1194 1242 static ssize_t iwl_dbgfs_frame_stats_read(struct iwl_mvm *mvm, 1195 1243 char __user *user_buf, size_t count, ··· 2140 1998 /* Device wide debugfs entries */ 2141 1999 MVM_DEBUGFS_READ_FILE_OPS(ctdp_budget); 2142 2000 MVM_DEBUGFS_WRITE_FILE_OPS(stop_ctdp, 8); 2001 + MVM_DEBUGFS_WRITE_FILE_OPS(start_ctdp, 8); 2143 2002 MVM_DEBUGFS_WRITE_FILE_OPS(force_ctkill, 8); 2144 2003 MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16); 2145 2004 MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8); ··· 2155 2012 MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off, 64); 2156 2013 MVM_DEBUGFS_READ_FILE_OPS(fw_rx_stats); 2157 2014 MVM_DEBUGFS_READ_FILE_OPS(drv_rx_stats); 2015 + MVM_DEBUGFS_READ_FILE_OPS(fw_system_stats); 2158 2016 MVM_DEBUGFS_READ_FILE_OPS(fw_ver); 2159 2017 MVM_DEBUGFS_READ_FILE_OPS(phy_integration_ver); 2160 2018 MVM_DEBUGFS_READ_FILE_OPS(tas_get_status); ··· 2354 2210 MVM_DEBUGFS_ADD_FILE(nic_temp, mvm->debugfs_dir, 0400); 2355 2211 MVM_DEBUGFS_ADD_FILE(ctdp_budget, mvm->debugfs_dir, 0400); 2356 2212 MVM_DEBUGFS_ADD_FILE(stop_ctdp, mvm->debugfs_dir, 0200); 2213 + MVM_DEBUGFS_ADD_FILE(start_ctdp, mvm->debugfs_dir, 0200); 2357 2214 MVM_DEBUGFS_ADD_FILE(force_ctkill, mvm->debugfs_dir, 0200); 2358 2215 MVM_DEBUGFS_ADD_FILE(stations, mvm->debugfs_dir, 0400); 2359 2216 MVM_DEBUGFS_ADD_FILE(bt_notif, mvm->debugfs_dir, 0400); ··· 2363 2218 MVM_DEBUGFS_ADD_FILE(fw_ver, mvm->debugfs_dir, 0400); 2364 2219 MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, 0400); 2365 2220 MVM_DEBUGFS_ADD_FILE(drv_rx_stats, mvm->debugfs_dir, 0400); 2221 + MVM_DEBUGFS_ADD_FILE(fw_system_stats, mvm->debugfs_dir, 0400); 2366 2222 MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, 0200); 2367 2223 MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, 0200); 2368 2224 MVM_DEBUGFS_ADD_FILE(bt_tx_prio, mvm->debugfs_dir, 0200);
+1
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 + * Copyright (C) 2023 Intel Corporation 3 4 * Copyright (C) 2012-2014 Intel Corporation 4 5 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH 5 6 */
+7 -2
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 3 * Copyright (C) 2015-2017 Intel Deutschland GmbH 4 - * Copyright (C) 2018-2022 Intel Corporation 4 + * Copyright (C) 2018-2023 Intel Corporation 5 5 */ 6 6 #include <net/cfg80211.h> 7 7 #include <linux/etherdevice.h> ··· 302 302 struct iwl_mvm_pasn_sta *sta) 303 303 { 304 304 list_del(&sta->list); 305 - iwl_mvm_rm_sta_id(mvm, vif, sta->int_sta.sta_id); 305 + 306 + if (iwl_mvm_has_mld_api(mvm->fw)) 307 + iwl_mvm_mld_rm_sta_id(mvm, sta->int_sta.sta_id); 308 + else 309 + iwl_mvm_rm_sta_id(mvm, vif, sta->int_sta.sta_id); 310 + 306 311 iwl_mvm_dealloc_int_sta(mvm, &sta->int_sta); 307 312 kfree(sta); 308 313 }
+91 -26
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 15 15 #include "iwl-prph.h" 16 16 #include "fw/acpi.h" 17 17 #include "fw/pnvm.h" 18 + #include "fw/uefi.h" 18 19 19 20 #include "mvm.h" 20 21 #include "fw/dbg.h" ··· 24 23 #include "iwl-nvm-parse.h" 25 24 #include "time-sync.h" 26 25 27 - #define MVM_UCODE_ALIVE_TIMEOUT (HZ) 26 + #define MVM_UCODE_ALIVE_TIMEOUT (2 * HZ) 28 27 #define MVM_UCODE_CALIB_TIMEOUT (2 * HZ) 29 28 30 29 #define IWL_TAS_US_MCC 0x5553 31 30 #define IWL_TAS_CANADA_MCC 0x4341 31 + 32 + #define IWL_UATS_VLP_AP_SUPPORTED BIT(29) 33 + #define IWL_UATS_AFC_AP_SUPPORTED BIT(30) 32 34 33 35 struct iwl_mvm_alive_data { 34 36 bool valid; ··· 491 487 } 492 488 493 489 #if defined(CONFIG_ACPI) && defined(CONFIG_EFI) 490 + static void iwl_mvm_uats_init(struct iwl_mvm *mvm) 491 + { 492 + u8 cmd_ver; 493 + int ret; 494 + struct iwl_host_cmd cmd = { 495 + .id = WIDE_ID(REGULATORY_AND_NVM_GROUP, 496 + UATS_TABLE_CMD), 497 + .flags = 0, 498 + .data[0] = &mvm->fwrt.uats_table, 499 + .len[0] = sizeof(mvm->fwrt.uats_table), 500 + .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 501 + }; 502 + 503 + if (!(mvm->trans->trans_cfg->device_family >= 504 + IWL_DEVICE_FAMILY_AX210)) { 505 + IWL_DEBUG_RADIO(mvm, "UATS feature is not supported\n"); 506 + return; 507 + } 508 + 509 + if (!mvm->fwrt.uats_enabled) { 510 + IWL_DEBUG_RADIO(mvm, "UATS feature is disabled\n"); 511 + return; 512 + } 513 + 514 + cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, 515 + IWL_FW_CMD_VER_UNKNOWN); 516 + if (cmd_ver != 1) { 517 + IWL_DEBUG_RADIO(mvm, 518 + "UATS_TABLE_CMD ver %d not supported\n", 519 + cmd_ver); 520 + return; 521 + } 522 + 523 + ret = iwl_uefi_get_uats_table(mvm->trans, &mvm->fwrt); 524 + if (ret < 0) { 525 + IWL_ERR(mvm, "failed to read UATS table (%d)\n", ret); 526 + return; 527 + } 528 + 529 + ret = iwl_mvm_send_cmd(mvm, &cmd); 530 + if (ret < 0) 531 + IWL_ERR(mvm, "failed to send UATS_TABLE_CMD (%d)\n", ret); 532 + else 533 + IWL_DEBUG_RADIO(mvm, "UATS_TABLE_CMD sent to FW\n"); 534 + } 535 + 494 536 static int iwl_mvm_sgom_init(struct iwl_mvm *mvm) 495 537 { 496 538 u8 cmd_ver; ··· 575 525 static int iwl_mvm_sgom_init(struct iwl_mvm *mvm) 576 526 { 577 527 return 0; 528 + } 529 + 530 + static void iwl_mvm_uats_init(struct iwl_mvm *mvm) 531 + { 578 532 } 579 533 #endif 580 534 ··· 650 596 if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) { 651 597 sb_cfg = iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG); 652 598 /* if needed, we'll reset this on our way out later */ 653 - mvm->pldr_sync = !(sb_cfg & SB_CFG_RESIDES_IN_OTP_MASK); 599 + mvm->pldr_sync = sb_cfg == SB_CFG_RESIDES_IN_ROM; 654 600 if (mvm->pldr_sync && iwl_mei_pldr_req()) 655 601 return -EBUSY; 656 602 } ··· 1155 1101 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 1156 1102 }, 1157 1103 }, 1104 + { .ident = "GOOGLE-HP", 1105 + .matches = { 1106 + DMI_MATCH(DMI_SYS_VENDOR, "Google"), 1107 + DMI_MATCH(DMI_BOARD_VENDOR, "HP"), 1108 + }, 1109 + }, 1158 1110 { .ident = "MSI", 1159 1111 .matches = { 1160 1112 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."), ··· 1286 1226 { 1287 1227 int ret; 1288 1228 u32 value; 1289 - struct iwl_lari_config_change_cmd_v6 cmd = {}; 1229 + struct iwl_lari_config_change_cmd_v7 cmd = {}; 1230 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 1231 + WIDE_ID(REGULATORY_AND_NVM_GROUP, 1232 + LARI_CONFIG_CHANGE), 1); 1290 1233 1291 1234 cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt); 1292 1235 ··· 1307 1244 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, 1308 1245 DSM_FUNC_ACTIVATE_CHANNEL, 1309 1246 &iwl_guid, &value); 1310 - if (!ret) 1247 + if (!ret) { 1248 + if (cmd_ver < 8) 1249 + value &= ~ACTIVATE_5G2_IN_WW_MASK; 1311 1250 cmd.chan_state_active_bitmap = cpu_to_le32(value); 1251 + } 1312 1252 1313 1253 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, 1314 1254 DSM_FUNC_ENABLE_6E, ··· 1325 1259 if (!ret) 1326 1260 cmd.force_disable_channels_bitmap = cpu_to_le32(value); 1327 1261 1262 + ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, 1263 + DSM_FUNC_ENERGY_DETECTION_THRESHOLD, 1264 + &iwl_guid, &value); 1265 + if (!ret) 1266 + cmd.edt_bitmap = cpu_to_le32(value); 1267 + 1328 1268 if (cmd.config_bitmap || 1329 1269 cmd.oem_uhb_allow_bitmap || 1330 1270 cmd.oem_11ax_allow_bitmap || 1331 1271 cmd.oem_unii4_allow_bitmap || 1332 1272 cmd.chan_state_active_bitmap || 1333 - cmd.force_disable_channels_bitmap) { 1273 + cmd.force_disable_channels_bitmap || 1274 + cmd.edt_bitmap) { 1334 1275 size_t cmd_size; 1335 - u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 1336 - WIDE_ID(REGULATORY_AND_NVM_GROUP, 1337 - LARI_CONFIG_CHANGE), 1338 - 1); 1276 + 1339 1277 switch (cmd_ver) { 1278 + case 8: 1279 + case 7: 1280 + cmd_size = sizeof(struct iwl_lari_config_change_cmd_v7); 1281 + break; 1340 1282 case 6: 1341 1283 cmd_size = sizeof(struct iwl_lari_config_change_cmd_v6); 1342 1284 break; ··· 1378 1304 "sending LARI_CONFIG_CHANGE, oem_uhb_allow_bitmap=0x%x, force_disable_channels_bitmap=0x%x\n", 1379 1305 le32_to_cpu(cmd.oem_uhb_allow_bitmap), 1380 1306 le32_to_cpu(cmd.force_disable_channels_bitmap)); 1307 + IWL_DEBUG_RADIO(mvm, 1308 + "sending LARI_CONFIG_CHANGE, edt_bitmap=0x%x\n", 1309 + le32_to_cpu(cmd.edt_bitmap)); 1381 1310 ret = iwl_mvm_send_cmd_pdu(mvm, 1382 1311 WIDE_ID(REGULATORY_AND_NVM_GROUP, 1383 1312 LARI_CONFIG_CHANGE), ··· 1390 1313 "Failed to send LARI_CONFIG_CHANGE (%d)\n", 1391 1314 ret); 1392 1315 } 1316 + 1317 + if (le32_to_cpu(cmd.oem_uhb_allow_bitmap) & IWL_UATS_VLP_AP_SUPPORTED || 1318 + le32_to_cpu(cmd.oem_uhb_allow_bitmap) & IWL_UATS_AFC_AP_SUPPORTED) 1319 + mvm->fwrt.uats_enabled = TRUE; 1393 1320 } 1394 1321 1395 1322 void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm) ··· 1597 1516 int iwl_mvm_up(struct iwl_mvm *mvm) 1598 1517 { 1599 1518 int ret, i; 1600 - struct ieee80211_channel *chan; 1601 - struct cfg80211_chan_def chandef; 1602 1519 struct ieee80211_supported_band *sband = NULL; 1603 1520 1604 1521 lockdep_assert_held(&mvm->mutex); ··· 1721 1642 goto error; 1722 1643 } 1723 1644 1724 - chan = &sband->channels[0]; 1725 - 1726 - cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); 1727 - for (i = 0; i < NUM_PHY_CTX; i++) { 1728 - /* 1729 - * The channel used here isn't relevant as it's 1730 - * going to be overwritten in the other flows. 1731 - * For now use the first channel we have. 1732 - */ 1733 - ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i], 1734 - &chandef, 1, 1); 1735 - if (ret) 1736 - goto error; 1737 - } 1738 - 1739 1645 if (iwl_mvm_is_tt_in_fw(mvm)) { 1740 1646 /* in order to give the responsibility of ct-kill and 1741 1647 * TX backoff to FW we need to send empty temperature reporting ··· 1803 1739 1804 1740 iwl_mvm_tas_init(mvm); 1805 1741 iwl_mvm_leds_sync(mvm); 1742 + iwl_mvm_uats_init(mvm); 1806 1743 1807 1744 if (iwl_rfi_supported(mvm)) { 1808 1745 if (iwl_mvm_eval_dsm_rfi(mvm) == DSM_VALUE_RFI_ENABLE)
+15 -15
drivers/net/wireless/intel/iwlwifi/mvm/link.c
··· 53 53 unsigned int link_id = link_conf->link_id; 54 54 struct iwl_mvm_vif_link_info *link_info = mvmvif->link[link_id]; 55 55 struct iwl_link_config_cmd cmd = {}; 56 - struct iwl_mvm_phy_ctxt *phyctxt; 57 56 58 57 if (WARN_ON_ONCE(!link_info)) 59 58 return -EINVAL; ··· 60 61 if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) { 61 62 link_info->fw_link_id = iwl_mvm_get_free_fw_link_id(mvm, 62 63 mvmvif); 63 - if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) 64 + if (link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf)) 64 65 return -EINVAL; 65 66 66 67 rcu_assign_pointer(mvm->link_id_to_link_conf[link_info->fw_link_id], ··· 76 77 cmd.link_id = cpu_to_le32(link_info->fw_link_id); 77 78 cmd.mac_id = cpu_to_le32(mvmvif->id); 78 79 cmd.spec_link_id = link_conf->link_id; 79 - /* P2P-Device already has a valid PHY context during add */ 80 - phyctxt = link_info->phy_ctxt; 81 - if (phyctxt) 82 - cmd.phy_id = cpu_to_le32(phyctxt->id); 83 - else 84 - cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID); 80 + WARN_ON_ONCE(link_info->phy_ctxt); 81 + cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID); 85 82 86 83 memcpy(cmd.local_link_addr, link_conf->addr, ETH_ALEN); 87 84 ··· 189 194 flags_mask |= LINK_FLG_MU_EDCA_CW; 190 195 } 191 196 192 - if (link_conf->eht_puncturing && !iwlwifi_mod_params.disable_11be) 193 - cmd.puncture_mask = cpu_to_le16(link_conf->eht_puncturing); 194 - else 195 - /* This flag can be set only if the MAC has eht support */ 196 - changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS; 197 + if (changes & LINK_CONTEXT_MODIFY_EHT_PARAMS) { 198 + if (iwlwifi_mod_params.disable_11be || 199 + !link_conf->eht_support) 200 + changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS; 201 + else 202 + cmd.puncture_mask = 203 + cpu_to_le16(link_conf->eht_puncturing); 204 + } 197 205 198 206 cmd.bss_color = link_conf->he_bss_color.color; 199 207 ··· 242 244 struct iwl_link_config_cmd cmd = {}; 243 245 int ret; 244 246 247 + /* mac80211 thought we have the link, but it was never configured */ 245 248 if (WARN_ON(!link_info || 246 - link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID)) 247 - return -EINVAL; 249 + link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf))) 250 + return 0; 248 251 249 252 RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id], 250 253 NULL); ··· 253 254 iwl_mvm_release_fw_link_id(mvm, link_info->fw_link_id); 254 255 link_info->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; 255 256 cmd.spec_link_id = link_conf->link_id; 257 + cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID); 256 258 257 259 ret = iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_REMOVE); 258 260
+4 -4
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
··· 286 286 INIT_LIST_HEAD(&mvmvif->time_event_data.list); 287 287 mvmvif->time_event_data.id = TE_MAX; 288 288 289 + mvmvif->deflink.bcast_sta.sta_id = IWL_MVM_INVALID_STA; 290 + mvmvif->deflink.mcast_sta.sta_id = IWL_MVM_INVALID_STA; 291 + mvmvif->deflink.ap_sta_id = IWL_MVM_INVALID_STA; 292 + 289 293 /* No need to allocate data queues to P2P Device MAC and NAN.*/ 290 294 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) 291 295 return 0; ··· 303 299 */ 304 300 mvmvif->deflink.cab_queue = IWL_MVM_DQA_GCAST_QUEUE; 305 301 } 306 - 307 - mvmvif->deflink.bcast_sta.sta_id = IWL_MVM_INVALID_STA; 308 - mvmvif->deflink.mcast_sta.sta_id = IWL_MVM_INVALID_STA; 309 - mvmvif->deflink.ap_sta_id = IWL_MVM_INVALID_STA; 310 302 311 303 for (i = 0; i < NUM_IWL_MVM_SMPS_REQ; i++) 312 304 mvmvif->deflink.smps_requests[i] = IEEE80211_SMPS_AUTOMATIC;
+267 -226
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 186 186 MCC_SOURCE_OLD_FW, changed); 187 187 } 188 188 189 - int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm) 189 + int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync) 190 190 { 191 191 enum iwl_mcc_source used_src; 192 192 struct ieee80211_regdomain *regd; ··· 213 213 if (IS_ERR_OR_NULL(regd)) 214 214 return -EIO; 215 215 216 - /* update cfg80211 if the regdomain was changed */ 217 - if (changed) 216 + /* update cfg80211 if the regdomain was changed or the caller explicitly 217 + * asked to update regdomain 218 + */ 219 + if (changed || force_regd_sync) 218 220 ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd); 219 221 else 220 222 ret = 0; ··· 378 376 ieee80211_hw_set(hw, HAS_RATE_CONTROL); 379 377 } 380 378 381 - if (iwl_mvm_has_new_rx_api(mvm)) 379 + /* We want to use the mac80211's reorder buffer for 9000 */ 380 + if (iwl_mvm_has_new_rx_api(mvm) && 381 + mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_9000) 382 382 ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER); 383 383 384 384 if (fw_has_capa(&mvm->fw->ucode_capa, ··· 1539 1535 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 1540 1536 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1541 1537 int ret; 1538 + int i; 1542 1539 1543 1540 mutex_lock(&mvm->mutex); 1544 1541 ··· 1556 1551 1557 1552 /* make sure that beacon statistics don't go backwards with FW reset */ 1558 1553 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 1559 - mvmvif->deflink.beacon_stats.accu_num_beacons += 1560 - mvmvif->deflink.beacon_stats.num_beacons; 1554 + for_each_mvm_vif_valid_link(mvmvif, i) 1555 + mvmvif->link[i]->beacon_stats.accu_num_beacons += 1556 + mvmvif->link[i]->beacon_stats.num_beacons; 1561 1557 1562 1558 /* Allocate resources for the MAC context, and add it to the fw */ 1563 1559 ret = iwl_mvm_mac_ctxt_init(mvm, vif); ··· 1586 1580 */ 1587 1581 if (vif->type == NL80211_IFTYPE_AP || 1588 1582 vif->type == NL80211_IFTYPE_ADHOC) { 1589 - iwl_mvm_vif_dbgfs_register(mvm, vif); 1583 + iwl_mvm_vif_dbgfs_add_link(mvm, vif); 1590 1584 ret = 0; 1591 1585 goto out; 1592 1586 } ··· 1613 1607 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 1614 1608 } 1615 1609 1616 - /* 1617 - * P2P_DEVICE interface does not have a channel context assigned to it, 1618 - * so a dedicated PHY context is allocated to it and the corresponding 1619 - * MAC context is bound to it at this stage. 1620 - */ 1621 - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 1622 - 1623 - mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); 1624 - if (!mvmvif->deflink.phy_ctxt) { 1625 - ret = -ENOSPC; 1626 - goto out_free_bf; 1627 - } 1628 - 1629 - iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); 1630 - ret = iwl_mvm_binding_add_vif(mvm, vif); 1631 - if (ret) 1632 - goto out_unref_phy; 1633 - 1634 - ret = iwl_mvm_add_p2p_bcast_sta(mvm, vif); 1635 - if (ret) 1636 - goto out_unbind; 1637 - 1638 - /* Save a pointer to p2p device vif, so it can later be used to 1639 - * update the p2p device MAC when a GO is started/stopped */ 1610 + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) 1640 1611 mvm->p2p_device_vif = vif; 1641 - } 1642 1612 1643 1613 iwl_mvm_tcm_add_vif(mvm, vif); 1644 1614 INIT_DELAYED_WORK(&mvmvif->csa_work, ··· 1626 1644 iwl_mvm_chandef_get_primary_80(&vif->bss_conf.chandef); 1627 1645 } 1628 1646 1629 - iwl_mvm_vif_dbgfs_register(mvm, vif); 1647 + iwl_mvm_vif_dbgfs_add_link(mvm, vif); 1630 1648 1631 1649 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 1632 1650 vif->type == NL80211_IFTYPE_STATION && !vif->p2p && ··· 1643 1661 1644 1662 goto out_unlock; 1645 1663 1646 - out_unbind: 1647 - iwl_mvm_binding_remove_vif(mvm, vif); 1648 - out_unref_phy: 1649 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 1650 - out_free_bf: 1651 - if (mvm->bf_allowed_vif == mvmvif) { 1652 - mvm->bf_allowed_vif = NULL; 1653 - vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | 1654 - IEEE80211_VIF_SUPPORTS_CQM_RSSI); 1655 - } 1656 1664 out_remove_mac: 1657 1665 mvmvif->deflink.phy_ctxt = NULL; 1658 1666 iwl_mvm_mac_ctxt_remove(mvm, vif); ··· 1704 1732 if (vif->bss_conf.ftm_responder) 1705 1733 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); 1706 1734 1707 - iwl_mvm_vif_dbgfs_clean(mvm, vif); 1735 + iwl_mvm_vif_dbgfs_rm_link(mvm, vif); 1708 1736 1709 1737 /* 1710 1738 * For AP/GO interface, the tear down of the resources allocated to the ··· 1734 1762 if (iwl_mvm_mac_remove_interface_common(hw, vif)) 1735 1763 goto out; 1736 1764 1765 + /* Before the interface removal, mac80211 would cancel the ROC, and the 1766 + * ROC worker would be scheduled if needed. The worker would be flushed 1767 + * in iwl_mvm_prepare_mac_removal() and thus at this point there is no 1768 + * binding etc. so nothing needs to be done here. 1769 + */ 1737 1770 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 1771 + if (mvmvif->deflink.phy_ctxt) { 1772 + iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 1773 + mvmvif->deflink.phy_ctxt = NULL; 1774 + } 1738 1775 mvm->p2p_device_vif = NULL; 1739 - iwl_mvm_rm_p2p_bcast_sta(mvm, vif); 1740 - iwl_mvm_binding_remove_vif(mvm, vif); 1741 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 1742 - mvmvif->deflink.phy_ctxt = NULL; 1743 1776 } 1744 1777 1745 1778 iwl_mvm_mac_ctxt_remove(mvm, vif); ··· 2468 2491 } 2469 2492 2470 2493 void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 2471 - u32 duration_override) 2494 + u32 duration_override, unsigned int link_id) 2472 2495 { 2473 2496 u32 duration = IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS; 2474 2497 u32 min_duration = IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS; ··· 2488 2511 if (fw_has_capa(&mvm->fw->ucode_capa, 2489 2512 IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) 2490 2513 iwl_mvm_schedule_session_protection(mvm, vif, 900, 2491 - min_duration, false); 2514 + min_duration, false, 2515 + link_id); 2492 2516 else 2493 2517 iwl_mvm_protect_session(mvm, vif, duration, 2494 2518 min_duration, 500, false); ··· 2583 2605 { 2584 2606 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 2585 2607 int ret; 2608 + int i; 2586 2609 2587 2610 /* 2588 2611 * Re-calculate the tsf id, as the leader-follower relations depend ··· 2630 2651 if (vif->cfg.assoc) { 2631 2652 /* clear statistics to get clean beacon counter */ 2632 2653 iwl_mvm_request_statistics(mvm, true); 2633 - memset(&mvmvif->deflink.beacon_stats, 0, 2634 - sizeof(mvmvif->deflink.beacon_stats)); 2654 + for_each_mvm_vif_valid_link(mvmvif, i) 2655 + memset(&mvmvif->link[i]->beacon_stats, 0, 2656 + sizeof(mvmvif->link[i]->beacon_stats)); 2635 2657 2636 2658 /* add quota for this interface */ 2637 2659 ret = iwl_mvm_update_quotas(mvm, true, NULL); ··· 2679 2699 * time could be small without us having heard 2680 2700 * a beacon yet. 2681 2701 */ 2682 - iwl_mvm_protect_assoc(mvm, vif, 0); 2702 + iwl_mvm_protect_assoc(mvm, vif, 0, 0); 2683 2703 } 2684 2704 2685 2705 iwl_mvm_sf_update(mvm, vif, false); ··· 3046 3066 struct ieee80211_bss_conf *bss_conf, 3047 3067 u64 changes) 3048 3068 { 3049 - static const struct iwl_mvm_bss_info_changed_ops callbacks = { 3050 - .bss_info_changed_sta = iwl_mvm_bss_info_changed_station, 3051 - .bss_info_changed_ap_ibss = iwl_mvm_bss_info_changed_ap_ibss, 3052 - }; 3053 - 3054 - iwl_mvm_bss_info_changed_common(hw, vif, bss_conf, &callbacks, 3055 - changes); 3056 - } 3057 - 3058 - void 3059 - iwl_mvm_bss_info_changed_common(struct ieee80211_hw *hw, 3060 - struct ieee80211_vif *vif, 3061 - struct ieee80211_bss_conf *bss_conf, 3062 - const struct iwl_mvm_bss_info_changed_ops *callbacks, 3063 - u64 changes) 3064 - { 3065 3069 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 3066 3070 3067 3071 mutex_lock(&mvm->mutex); ··· 3055 3091 3056 3092 switch (vif->type) { 3057 3093 case NL80211_IFTYPE_STATION: 3058 - callbacks->bss_info_changed_sta(mvm, vif, bss_conf, changes); 3094 + iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); 3059 3095 break; 3060 3096 case NL80211_IFTYPE_AP: 3061 3097 case NL80211_IFTYPE_ADHOC: 3062 - callbacks->bss_info_changed_ap_ibss(mvm, vif, bss_conf, 3063 - changes); 3098 + iwl_mvm_bss_info_changed_ap_ibss(mvm, vif, bss_conf, changes); 3064 3099 break; 3065 3100 case NL80211_IFTYPE_MONITOR: 3066 3101 if (changes & BSS_CHANGED_MU_GROUPS) ··· 3766 3803 3767 3804 callbacks->mac_ctxt_changed(mvm, vif, false); 3768 3805 iwl_mvm_mei_host_associated(mvm, vif, mvm_sta); 3806 + 3807 + /* when client is authorized (AP station marked as such), 3808 + * try to enable more links 3809 + */ 3810 + if (vif->type == NL80211_IFTYPE_STATION && 3811 + !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 3812 + iwl_mvm_mld_select_links(mvm, vif, false); 3769 3813 } 3770 3814 3771 3815 mvm_sta->authorized = true; 3772 3816 3773 3817 iwl_mvm_rs_rate_init_all_links(mvm, vif, sta); 3818 + 3819 + /* MFP is set by default before the station is authorized. 3820 + * Clear it here in case it's not used. 3821 + */ 3822 + if (!sta->mfp) 3823 + return callbacks->update_sta(mvm, vif, sta); 3774 3824 3775 3825 return 0; 3776 3826 } ··· 4018 4042 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 4019 4043 4020 4044 mutex_lock(&mvm->mutex); 4021 - iwl_mvm_protect_assoc(mvm, vif, info->duration); 4045 + iwl_mvm_protect_assoc(mvm, vif, info->duration, info->link_id); 4022 4046 mutex_unlock(&mvm->mutex); 4023 4047 } 4024 4048 ··· 4155 4179 * GTK on AP interface is a TX-only key, return 0; 4156 4180 * on IBSS they're per-station and because we're lazy 4157 4181 * we don't support them for RX, so do the same. 4158 - * CMAC/GMAC in AP/IBSS modes must be done in software. 4182 + * CMAC/GMAC in AP/IBSS modes must be done in software 4183 + * on older NICs. 4159 4184 * 4160 4185 * Except, of course, beacon protection - it must be 4161 - * offloaded since we just set a beacon template. 4186 + * offloaded since we just set a beacon template, and 4187 + * then we must also offload the IGTK (not just BIGTK) 4188 + * for firmware reasons. 4189 + * 4190 + * So just check for beacon protection - if we don't 4191 + * have it we cannot get here with keyidx >= 6, and 4192 + * if we do have it we need to send the key to FW in 4193 + * all cases (CMAC/GMAC). 4162 4194 */ 4163 - if (keyidx < 6 && 4195 + if (!wiphy_ext_feature_isset(hw->wiphy, 4196 + NL80211_EXT_FEATURE_BEACON_PROTECTION) && 4164 4197 (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || 4165 4198 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || 4166 4199 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256)) { ··· 4398 4413 #define AUX_ROC_MAX_DELAY MSEC_TO_TU(600) 4399 4414 #define AUX_ROC_SAFETY_BUFFER MSEC_TO_TU(20) 4400 4415 #define AUX_ROC_MIN_SAFETY_BUFFER MSEC_TO_TU(10) 4416 + 4417 + static void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif, 4418 + u32 duration_ms, 4419 + u32 *duration_tu, 4420 + u32 *delay) 4421 + { 4422 + u32 dtim_interval = vif->bss_conf.dtim_period * 4423 + vif->bss_conf.beacon_int; 4424 + 4425 + *delay = AUX_ROC_MIN_DELAY; 4426 + *duration_tu = MSEC_TO_TU(duration_ms); 4427 + 4428 + /* 4429 + * If we are associated we want the delay time to be at least one 4430 + * dtim interval so that the FW can wait until after the DTIM and 4431 + * then start the time event, this will potentially allow us to 4432 + * remain off-channel for the max duration. 4433 + * Since we want to use almost a whole dtim interval we would also 4434 + * like the delay to be for 2-3 dtim intervals, in case there are 4435 + * other time events with higher priority. 4436 + */ 4437 + if (vif->cfg.assoc) { 4438 + *delay = min_t(u32, dtim_interval * 3, AUX_ROC_MAX_DELAY); 4439 + /* We cannot remain off-channel longer than the DTIM interval */ 4440 + if (dtim_interval <= *duration_tu) { 4441 + *duration_tu = dtim_interval - AUX_ROC_SAFETY_BUFFER; 4442 + if (*duration_tu <= AUX_ROC_MIN_DURATION) 4443 + *duration_tu = dtim_interval - 4444 + AUX_ROC_MIN_SAFETY_BUFFER; 4445 + } 4446 + } 4447 + } 4448 + 4401 4449 static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, 4402 4450 struct ieee80211_channel *channel, 4403 4451 struct ieee80211_vif *vif, ··· 4441 4423 struct iwl_mvm_time_event_data *te_data = &mvmvif->hs_time_event_data; 4442 4424 static const u16 time_event_response[] = { HOT_SPOT_CMD }; 4443 4425 struct iwl_notification_wait wait_time_event; 4444 - u32 dtim_interval = vif->bss_conf.dtim_period * 4445 - vif->bss_conf.beacon_int; 4446 4426 u32 req_dur, delay; 4447 4427 struct iwl_hs20_roc_req aux_roc_req = { 4448 4428 .action = cpu_to_le32(FW_CTXT_ACTION_ADD), ··· 4461 4445 /* Set the time and duration */ 4462 4446 tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm)); 4463 4447 4464 - delay = AUX_ROC_MIN_DELAY; 4465 - req_dur = MSEC_TO_TU(duration); 4466 - 4467 - /* 4468 - * If we are associated we want the delay time to be at least one 4469 - * dtim interval so that the FW can wait until after the DTIM and 4470 - * then start the time event, this will potentially allow us to 4471 - * remain off-channel for the max duration. 4472 - * Since we want to use almost a whole dtim interval we would also 4473 - * like the delay to be for 2-3 dtim intervals, in case there are 4474 - * other time events with higher priority. 4475 - */ 4476 - if (vif->cfg.assoc) { 4477 - delay = min_t(u32, dtim_interval * 3, AUX_ROC_MAX_DELAY); 4478 - /* We cannot remain off-channel longer than the DTIM interval */ 4479 - if (dtim_interval <= req_dur) { 4480 - req_dur = dtim_interval - AUX_ROC_SAFETY_BUFFER; 4481 - if (req_dur <= AUX_ROC_MIN_DURATION) 4482 - req_dur = dtim_interval - 4483 - AUX_ROC_MIN_SAFETY_BUFFER; 4484 - } 4485 - } 4486 - 4448 + iwl_mvm_roc_duration_and_delay(vif, duration, &req_dur, &delay); 4487 4449 tail->duration = cpu_to_le32(req_dur); 4488 4450 tail->apply_time_max_delay = cpu_to_le32(delay); 4489 4451 ··· 4469 4475 "ROC: Requesting to remain on channel %u for %ums\n", 4470 4476 channel->hw_value, req_dur); 4471 4477 IWL_DEBUG_TE(mvm, 4472 - "\t(requested = %ums, max_delay = %ums, dtim_interval = %ums)\n", 4473 - duration, delay, dtim_interval); 4478 + "\t(requested = %ums, max_delay = %ums)\n", 4479 + duration, delay); 4474 4480 4475 4481 /* Set the node address */ 4476 4482 memcpy(tail->node_addr, vif->addr, ETH_ALEN); ··· 4528 4534 return res; 4529 4535 } 4530 4536 4537 + static int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm, 4538 + struct ieee80211_channel *channel, 4539 + struct ieee80211_vif *vif, 4540 + int duration, u32 activity) 4541 + { 4542 + int res; 4543 + u32 duration_tu, delay; 4544 + struct iwl_roc_req roc_req = { 4545 + .action = cpu_to_le32(FW_CTXT_ACTION_ADD), 4546 + .activity = cpu_to_le32(activity), 4547 + .sta_id = cpu_to_le32(mvm->aux_sta.sta_id), 4548 + }; 4549 + 4550 + lockdep_assert_held(&mvm->mutex); 4551 + 4552 + /* Set the channel info data */ 4553 + iwl_mvm_set_chan_info(mvm, &roc_req.channel_info, 4554 + channel->hw_value, 4555 + iwl_mvm_phy_band_from_nl80211(channel->band), 4556 + IWL_PHY_CHANNEL_MODE20, 0); 4557 + 4558 + iwl_mvm_roc_duration_and_delay(vif, duration, &duration_tu, 4559 + &delay); 4560 + roc_req.duration = cpu_to_le32(duration_tu); 4561 + roc_req.max_delay = cpu_to_le32(delay); 4562 + 4563 + IWL_DEBUG_TE(mvm, 4564 + "\t(requested = %ums, max_delay = %ums)\n", 4565 + duration, delay); 4566 + IWL_DEBUG_TE(mvm, 4567 + "Requesting to remain on channel %u for %utu\n", 4568 + channel->hw_value, duration_tu); 4569 + 4570 + /* Set the node address */ 4571 + memcpy(roc_req.node_addr, vif->addr, ETH_ALEN); 4572 + 4573 + res = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 4574 + 0, sizeof(roc_req), &roc_req); 4575 + 4576 + return res; 4577 + } 4578 + 4531 4579 static int iwl_mvm_add_aux_sta_for_hs20(struct iwl_mvm *mvm, u32 lmac_id) 4532 4580 { 4533 4581 int ret = 0; ··· 4590 4554 return ret; 4591 4555 } 4592 4556 4593 - static int iwl_mvm_roc_switch_binding(struct iwl_mvm *mvm, 4594 - struct ieee80211_vif *vif, 4595 - struct iwl_mvm_phy_ctxt *new_phy_ctxt) 4557 + static int iwl_mvm_roc_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 4596 4558 { 4597 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 4598 - int ret = 0; 4559 + int ret; 4599 4560 4600 4561 lockdep_assert_held(&mvm->mutex); 4601 4562 4602 - /* Unbind the P2P_DEVICE from the current PHY context, 4603 - * and if the PHY context is not used remove it. 4604 - */ 4605 - ret = iwl_mvm_binding_remove_vif(mvm, vif); 4606 - if (WARN(ret, "Failed unbinding P2P_DEVICE\n")) 4563 + ret = iwl_mvm_binding_add_vif(mvm, vif); 4564 + if (WARN(ret, "Failed binding P2P_DEVICE\n")) 4607 4565 return ret; 4608 4566 4609 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 4610 - 4611 - /* Bind the P2P_DEVICE to the current PHY Context */ 4612 - mvmvif->deflink.phy_ctxt = new_phy_ctxt; 4613 - 4614 - ret = iwl_mvm_binding_add_vif(mvm, vif); 4615 - WARN(ret, "Failed binding P2P_DEVICE\n"); 4616 - return ret; 4567 + /* The station and queue allocation must be done only after the binding 4568 + * is done, as otherwise the FW might incorrectly configure its state. 4569 + */ 4570 + return iwl_mvm_add_p2p_bcast_sta(mvm, vif); 4617 4571 } 4618 4572 4619 4573 static int iwl_mvm_roc(struct ieee80211_hw *hw, ··· 4614 4588 { 4615 4589 static const struct iwl_mvm_roc_ops ops = { 4616 4590 .add_aux_sta_for_hs20 = iwl_mvm_add_aux_sta_for_hs20, 4617 - .switch_phy_ctxt = iwl_mvm_roc_switch_binding, 4591 + .link = iwl_mvm_roc_link, 4618 4592 }; 4619 4593 4620 4594 return iwl_mvm_roc_common(hw, vif, channel, duration, type, &ops); 4595 + } 4596 + 4597 + static int iwl_mvm_roc_station(struct iwl_mvm *mvm, 4598 + struct ieee80211_channel *channel, 4599 + struct ieee80211_vif *vif, 4600 + int duration) 4601 + { 4602 + int ret; 4603 + u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, ROC_CMD); 4604 + u8 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 4605 + IWL_FW_CMD_VER_UNKNOWN); 4606 + 4607 + if (fw_ver == IWL_FW_CMD_VER_UNKNOWN) { 4608 + ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, vif, duration); 4609 + } else if (fw_ver == 3) { 4610 + ret = iwl_mvm_roc_add_cmd(mvm, channel, vif, duration, 4611 + ROC_ACTIVITY_HOTSPOT); 4612 + } else { 4613 + ret = -EOPNOTSUPP; 4614 + IWL_ERR(mvm, "ROC command version %d mismatch!\n", fw_ver); 4615 + } 4616 + 4617 + return ret; 4618 + } 4619 + 4620 + static int iwl_mvm_p2p_find_phy_ctxt(struct iwl_mvm *mvm, 4621 + struct ieee80211_vif *vif, 4622 + struct ieee80211_channel *channel) 4623 + { 4624 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 4625 + struct cfg80211_chan_def chandef; 4626 + int i; 4627 + 4628 + lockdep_assert_held(&mvm->mutex); 4629 + 4630 + if (mvmvif->deflink.phy_ctxt && 4631 + channel == mvmvif->deflink.phy_ctxt->channel) 4632 + return 0; 4633 + 4634 + /* Try using a PHY context that is already in use */ 4635 + for (i = 0; i < NUM_PHY_CTX; i++) { 4636 + struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[i]; 4637 + 4638 + if (!phy_ctxt->ref || mvmvif->deflink.phy_ctxt == phy_ctxt) 4639 + continue; 4640 + 4641 + if (channel == phy_ctxt->channel) { 4642 + if (mvmvif->deflink.phy_ctxt) 4643 + iwl_mvm_phy_ctxt_unref(mvm, 4644 + mvmvif->deflink.phy_ctxt); 4645 + 4646 + mvmvif->deflink.phy_ctxt = phy_ctxt; 4647 + iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); 4648 + return 0; 4649 + } 4650 + } 4651 + 4652 + /* We already have a phy_ctxt, but it's not on the right channel */ 4653 + if (mvmvif->deflink.phy_ctxt) 4654 + iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 4655 + 4656 + mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); 4657 + if (!mvmvif->deflink.phy_ctxt) 4658 + return -ENOSPC; 4659 + 4660 + cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT); 4661 + 4662 + return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, 4663 + &chandef, 1, 1); 4621 4664 } 4622 4665 4623 4666 /* Execute the common part for MLD and non-MLD modes */ ··· 4696 4601 const struct iwl_mvm_roc_ops *ops) 4697 4602 { 4698 4603 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 4699 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 4700 - struct cfg80211_chan_def chandef; 4701 - struct iwl_mvm_phy_ctxt *phy_ctxt; 4702 - bool band_change_removal; 4703 - int ret, i; 4704 4604 u32 lmac_id; 4605 + int ret; 4705 4606 4706 4607 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, 4707 4608 duration, type); ··· 4717 4626 /* Use aux roc framework (HS20) */ 4718 4627 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id); 4719 4628 if (!ret) 4720 - ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, 4721 - vif, duration); 4629 + ret = iwl_mvm_roc_station(mvm, channel, vif, duration); 4722 4630 goto out_unlock; 4723 4631 case NL80211_IFTYPE_P2P_DEVICE: 4724 4632 /* handle below */ 4725 4633 break; 4726 4634 default: 4727 - IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); 4635 + IWL_ERR(mvm, "ROC: Invalid vif type=%u\n", vif->type); 4728 4636 ret = -EINVAL; 4729 4637 goto out_unlock; 4730 4638 } 4731 4639 4732 - for (i = 0; i < NUM_PHY_CTX; i++) { 4733 - phy_ctxt = &mvm->phy_ctxts[i]; 4734 - if (phy_ctxt->ref == 0 || mvmvif->deflink.phy_ctxt == phy_ctxt) 4735 - continue; 4736 4640 4737 - if (phy_ctxt->ref && channel == phy_ctxt->channel) { 4738 - ret = ops->switch_phy_ctxt(mvm, vif, phy_ctxt); 4739 - if (ret) 4740 - goto out_unlock; 4641 + ret = iwl_mvm_p2p_find_phy_ctxt(mvm, vif, channel); 4642 + if (ret) 4643 + goto out_unlock; 4741 4644 4742 - iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); 4743 - goto schedule_time_event; 4744 - } 4745 - } 4645 + ret = ops->link(mvm, vif); 4646 + if (ret) 4647 + goto out_unlock; 4746 4648 4747 - /* Need to update the PHY context only if the ROC channel changed */ 4748 - if (channel == mvmvif->deflink.phy_ctxt->channel) 4749 - goto schedule_time_event; 4750 - 4751 - cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT); 4752 - 4753 - /* 4754 - * Check if the remain-on-channel is on a different band and that 4755 - * requires context removal, see iwl_mvm_phy_ctxt_changed(). If 4756 - * so, we'll need to release and then re-configure here, since we 4757 - * must not remove a PHY context that's part of a binding. 4758 - */ 4759 - band_change_removal = 4760 - fw_has_capa(&mvm->fw->ucode_capa, 4761 - IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT) && 4762 - mvmvif->deflink.phy_ctxt->channel->band != chandef.chan->band; 4763 - 4764 - if (mvmvif->deflink.phy_ctxt->ref == 1 && !band_change_removal) { 4765 - /* 4766 - * Change the PHY context configuration as it is currently 4767 - * referenced only by the P2P Device MAC (and we can modify it) 4768 - */ 4769 - ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->deflink.phy_ctxt, 4770 - &chandef, 1, 1); 4771 - if (ret) 4772 - goto out_unlock; 4773 - } else { 4774 - /* 4775 - * The PHY context is shared with other MACs (or we're trying to 4776 - * switch bands), so remove the P2P Device from the binding, 4777 - * allocate an new PHY context and create a new binding. 4778 - */ 4779 - phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); 4780 - if (!phy_ctxt) { 4781 - ret = -ENOSPC; 4782 - goto out_unlock; 4783 - } 4784 - 4785 - ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chandef, 4786 - 1, 1); 4787 - if (ret) { 4788 - IWL_ERR(mvm, "Failed to change PHY context\n"); 4789 - goto out_unlock; 4790 - } 4791 - 4792 - ret = ops->switch_phy_ctxt(mvm, vif, phy_ctxt); 4793 - if (ret) 4794 - goto out_unlock; 4795 - 4796 - iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); 4797 - } 4798 - 4799 - schedule_time_event: 4800 - /* Schedule the time events */ 4801 4649 ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type); 4802 - 4803 4650 out_unlock: 4804 4651 mutex_unlock(&mvm->mutex); 4805 4652 IWL_DEBUG_MAC80211(mvm, "leave\n"); ··· 4809 4780 goto out; 4810 4781 } 4811 4782 4812 - ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, 4813 - ctx->rx_chains_static, 4814 - ctx->rx_chains_dynamic); 4783 + ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, 4784 + ctx->rx_chains_static, 4785 + ctx->rx_chains_dynamic); 4815 4786 if (ret) { 4816 4787 IWL_ERR(mvm, "Failed to add PHY context\n"); 4817 4788 goto out; 4818 4789 } 4819 4790 4820 - iwl_mvm_phy_ctxt_ref(mvm, phy_ctxt); 4821 4791 *phy_ctxt_id = phy_ctxt->id; 4822 4792 out: 4823 4793 return ret; ··· 5281 5253 return mvm->ibss_manager; 5282 5254 } 5283 5255 5284 - int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 5285 - bool set) 5256 + static int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 5257 + bool set) 5286 5258 { 5287 5259 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 5288 5260 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); ··· 5683 5655 } 5684 5656 5685 5657 if (drop) { 5686 - if (iwl_mvm_flush_sta(mvm, mvmsta, false)) 5658 + if (iwl_mvm_flush_sta(mvm, mvmsta->deflink.sta_id, 5659 + mvmsta->tfd_queue_msk)) 5687 5660 IWL_ERR(mvm, "flush request fail\n"); 5688 5661 } else { 5689 5662 if (iwl_mvm_has_new_tx_api(mvm)) ··· 5706 5677 void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 5707 5678 struct ieee80211_sta *sta) 5708 5679 { 5680 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 5709 5681 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 5710 - int i; 5682 + struct iwl_mvm_link_sta *mvm_link_sta; 5683 + struct ieee80211_link_sta *link_sta; 5684 + int link_id; 5711 5685 5712 5686 mutex_lock(&mvm->mutex); 5713 - for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { 5714 - struct iwl_mvm_sta *mvmsta; 5715 - struct ieee80211_sta *tmp; 5716 - 5717 - tmp = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], 5718 - lockdep_is_held(&mvm->mutex)); 5719 - if (tmp != sta) 5687 + for_each_sta_active_link(vif, sta, link_sta, link_id) { 5688 + mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_id], 5689 + lockdep_is_held(&mvm->mutex)); 5690 + if (!mvm_link_sta) 5720 5691 continue; 5721 5692 5722 - mvmsta = iwl_mvm_sta_from_mac80211(sta); 5723 - 5724 - if (iwl_mvm_flush_sta(mvm, mvmsta, false)) 5693 + if (iwl_mvm_flush_sta(mvm, mvm_link_sta->sta_id, 5694 + mvmsta->tfd_queue_msk)) 5725 5695 IWL_ERR(mvm, "flush request fail\n"); 5726 5696 } 5727 5697 mutex_unlock(&mvm->mutex); ··· 5730 5702 struct survey_info *survey) 5731 5703 { 5732 5704 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 5733 - int ret; 5705 + int ret = 0; 5706 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 5707 + WIDE_ID(SYSTEM_GROUP, 5708 + SYSTEM_STATISTICS_CMD), 5709 + IWL_FW_CMD_VER_UNKNOWN); 5734 5710 5735 5711 memset(survey, 0, sizeof(*survey)); 5736 5712 ··· 5754 5722 goto out; 5755 5723 } 5756 5724 5757 - survey->filled = SURVEY_INFO_TIME | 5758 - SURVEY_INFO_TIME_RX | 5759 - SURVEY_INFO_TIME_TX | 5760 - SURVEY_INFO_TIME_SCAN; 5761 - survey->time = mvm->accu_radio_stats.on_time_rf + 5762 - mvm->radio_stats.on_time_rf; 5763 - do_div(survey->time, USEC_PER_MSEC); 5725 + survey->filled = SURVEY_INFO_TIME_RX | 5726 + SURVEY_INFO_TIME_TX; 5764 5727 5765 5728 survey->time_rx = mvm->accu_radio_stats.rx_time + 5766 5729 mvm->radio_stats.rx_time; ··· 5765 5738 mvm->radio_stats.tx_time; 5766 5739 do_div(survey->time_tx, USEC_PER_MSEC); 5767 5740 5741 + /* the new fw api doesn't support the following fields */ 5742 + if (cmd_ver != IWL_FW_CMD_VER_UNKNOWN) 5743 + goto out; 5744 + 5745 + survey->filled |= SURVEY_INFO_TIME | 5746 + SURVEY_INFO_TIME_SCAN; 5747 + survey->time = mvm->accu_radio_stats.on_time_rf + 5748 + mvm->radio_stats.on_time_rf; 5749 + do_div(survey->time, USEC_PER_MSEC); 5750 + 5768 5751 survey->time_scan = mvm->accu_radio_stats.on_time_scan + 5769 5752 mvm->radio_stats.on_time_scan; 5770 5753 do_div(survey->time_scan, USEC_PER_MSEC); 5771 5754 5772 - ret = 0; 5773 5755 out: 5774 5756 mutex_unlock(&mvm->mutex); 5775 5757 return ret; ··· 5927 5891 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 5928 5892 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 5929 5893 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 5894 + int i; 5930 5895 5931 5896 if (mvmsta->deflink.avg_energy) { 5932 5897 sinfo->signal_avg = -(s8)mvmsta->deflink.avg_energy; ··· 5956 5919 if (iwl_mvm_request_statistics(mvm, false)) 5957 5920 goto unlock; 5958 5921 5959 - sinfo->rx_beacon = mvmvif->deflink.beacon_stats.num_beacons + 5960 - mvmvif->deflink.beacon_stats.accu_num_beacons; 5922 + sinfo->rx_beacon = 0; 5923 + for_each_mvm_vif_valid_link(mvmvif, i) 5924 + sinfo->rx_beacon += mvmvif->link[i]->beacon_stats.num_beacons + 5925 + mvmvif->link[i]->beacon_stats.accu_num_beacons; 5926 + 5961 5927 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); 5962 5928 if (mvmvif->deflink.beacon_stats.avg_signal) { 5963 5929 /* firmware only reports a value after RXing a few beacons */ ··· 6349 6309 6350 6310 .can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate, 6351 6311 #ifdef CONFIG_IWLWIFI_DEBUGFS 6312 + .vif_add_debugfs = iwl_mvm_vif_add_debugfs, 6352 6313 .link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs, 6353 6314 #endif 6354 6315 .set_hw_timestamp = iwl_mvm_set_hw_timestamp,
+13 -3
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
··· 24 24 return 0; 25 25 } 26 26 27 - /* AP group keys are per link and should be on the mcast STA */ 27 + /* AP group keys are per link and should be on the mcast/bcast STA */ 28 28 if (vif->type == NL80211_IFTYPE_AP && 29 - !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) 29 + !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { 30 + /* IGTK/BIGTK to bcast STA */ 31 + if (keyconf->keyidx >= 4) 32 + return BIT(link_info->bcast_sta.sta_id); 33 + /* GTK for data to mcast STA */ 30 34 return BIT(link_info->mcast_sta.sta_id); 35 + } 31 36 32 37 /* for client mode use the AP STA also for group keys */ 33 38 if (!sta && vif->type == NL80211_IFTYPE_STATION) ··· 96 91 if (!sta && vif->type == NL80211_IFTYPE_STATION) 97 92 sta = mvmvif->ap_sta; 98 93 99 - if (!IS_ERR_OR_NULL(sta) && sta->mfp) 94 + /* Set the MFP flag also for an AP interface where the key is an IGTK 95 + * key as in such a case the station would always be NULL 96 + */ 97 + if ((!IS_ERR_OR_NULL(sta) && sta->mfp) || 98 + (vif->type == NL80211_IFTYPE_AP && 99 + (keyconf->keyidx == 4 || keyconf->keyidx == 5))) 100 100 flags |= IWL_SEC_KEY_FLAG_MFP; 101 101 102 102 return flags;
+182 -80
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
··· 10 10 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 11 11 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 12 12 int ret; 13 + int i; 13 14 14 15 mutex_lock(&mvm->mutex); 15 16 ··· 23 22 24 23 /* make sure that beacon statistics don't go backwards with FW reset */ 25 24 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 26 - mvmvif->deflink.beacon_stats.accu_num_beacons += 27 - mvmvif->deflink.beacon_stats.num_beacons; 25 + for_each_mvm_vif_valid_link(mvmvif, i) 26 + mvmvif->link[i]->beacon_stats.accu_num_beacons += 27 + mvmvif->link[i]->beacon_stats.num_beacons; 28 28 29 29 /* Allocate resources for the MAC context, and add it to the fw */ 30 30 ret = iwl_mvm_mac_ctxt_init(mvm, vif); ··· 58 56 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 59 57 } 60 58 61 - /* 62 - * P2P_DEVICE interface does not have a channel context assigned to it, 63 - * so a dedicated PHY context is allocated to it and the corresponding 64 - * MAC context is bound to it at this stage. 59 + ret = iwl_mvm_add_link(mvm, vif, &vif->bss_conf); 60 + if (ret) 61 + goto out_free_bf; 62 + 63 + /* Save a pointer to p2p device vif, so it can later be used to 64 + * update the p2p device MAC when a GO is started/stopped 65 65 */ 66 - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 67 - mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); 68 - if (!mvmvif->deflink.phy_ctxt) { 69 - ret = -ENOSPC; 70 - goto out_free_bf; 71 - } 72 - 73 - iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); 74 - ret = iwl_mvm_add_link(mvm, vif, &vif->bss_conf); 75 - if (ret) 76 - goto out_unref_phy; 77 - 78 - ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 79 - LINK_CONTEXT_MODIFY_ACTIVE | 80 - LINK_CONTEXT_MODIFY_RATES_INFO, 81 - true); 82 - if (ret) 83 - goto out_remove_link; 84 - 85 - ret = iwl_mvm_mld_add_bcast_sta(mvm, vif, &vif->bss_conf); 86 - if (ret) 87 - goto out_remove_link; 88 - 89 - /* Save a pointer to p2p device vif, so it can later be used to 90 - * update the p2p device MAC when a GO is started/stopped 91 - */ 66 + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) 92 67 mvm->p2p_device_vif = vif; 93 - } else { 94 - ret = iwl_mvm_add_link(mvm, vif, &vif->bss_conf); 95 - if (ret) 96 - goto out_free_bf; 97 - } 98 68 99 69 ret = iwl_mvm_power_update_mac(mvm); 100 70 if (ret) ··· 81 107 ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS); 82 108 } 83 109 84 - iwl_mvm_vif_dbgfs_register(mvm, vif); 110 + iwl_mvm_vif_dbgfs_add_link(mvm, vif); 85 111 86 112 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 87 113 vif->type == NL80211_IFTYPE_STATION && !vif->p2p && ··· 93 119 94 120 goto out_unlock; 95 121 96 - out_remove_link: 97 - iwl_mvm_disable_link(mvm, vif, &vif->bss_conf); 98 - out_unref_phy: 99 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 100 122 out_free_bf: 101 123 if (mvm->bf_allowed_vif == mvmvif) { 102 124 mvm->bf_allowed_vif = NULL; ··· 100 130 IEEE80211_VIF_SUPPORTS_CQM_RSSI); 101 131 } 102 132 out_remove_mac: 103 - mvmvif->deflink.phy_ctxt = NULL; 104 133 mvmvif->link[0] = NULL; 105 134 iwl_mvm_mld_mac_ctxt_remove(mvm, vif); 106 135 out_unlock: ··· 137 168 if (vif->bss_conf.ftm_responder) 138 169 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); 139 170 140 - iwl_mvm_vif_dbgfs_clean(mvm, vif); 171 + iwl_mvm_vif_dbgfs_rm_link(mvm, vif); 141 172 142 173 /* For AP/GO interface, the tear down of the resources allocated to the 143 174 * interface is be handled as part of the stop_ap flow. ··· 154 185 155 186 iwl_mvm_power_update_mac(mvm); 156 187 188 + /* Before the interface removal, mac80211 would cancel the ROC, and the 189 + * ROC worker would be scheduled if needed. The worker would be flushed 190 + * in iwl_mvm_prepare_mac_removal() and thus at this point the link is 191 + * not active. So need only to remove the link. 192 + */ 157 193 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 194 + if (mvmvif->deflink.phy_ctxt) { 195 + iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 196 + mvmvif->deflink.phy_ctxt = NULL; 197 + } 158 198 mvm->p2p_device_vif = NULL; 159 - 160 - /* P2P device uses only one link */ 161 - iwl_mvm_mld_rm_bcast_sta(mvm, vif, &vif->bss_conf); 162 - iwl_mvm_disable_link(mvm, vif, &vif->bss_conf); 163 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 164 - mvmvif->deflink.phy_ctxt = NULL; 199 + iwl_mvm_remove_link(mvm, vif, &vif->bss_conf); 165 200 } else { 166 201 iwl_mvm_disable_link(mvm, vif, &vif->bss_conf); 167 202 } ··· 213 240 214 241 mvmvif->esr_active = true; 215 242 216 - /* Disable SMPS overrideing by user */ 217 - vif->driver_flags |= IEEE80211_VIF_DISABLE_SMPS_OVERRIDE; 243 + /* Indicate to mac80211 that EML is enabled */ 244 + vif->driver_flags |= IEEE80211_VIF_EML_ACTIVE; 218 245 219 246 iwl_mvm_update_smps_on_active_links(mvm, vif, IWL_MVM_SMPS_REQ_FW, 220 247 IEEE80211_SMPS_OFF); ··· 372 399 373 400 mvmvif->esr_active = false; 374 401 375 - vif->driver_flags &= ~IEEE80211_VIF_DISABLE_SMPS_OVERRIDE; 402 + vif->driver_flags &= ~IEEE80211_VIF_EML_ACTIVE; 376 403 377 404 iwl_mvm_update_smps_on_active_links(mvm, vif, IWL_MVM_SMPS_REQ_FW, 378 405 IEEE80211_SMPS_AUTOMATIC); ··· 462 489 struct ieee80211_bss_conf *link_conf, 463 490 struct ieee80211_chanctx_conf *ctx) 464 491 { 492 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 465 493 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 466 494 467 495 mutex_lock(&mvm->mutex); 468 496 __iwl_mvm_mld_unassign_vif_chanctx(mvm, vif, link_conf, ctx, false); 497 + /* in the non-MLD case, remove/re-add the link to clean up FW state */ 498 + if (!ieee80211_vif_is_mld(vif) && !mvmvif->ap_sta && 499 + !WARN_ON_ONCE(vif->cfg.assoc)) { 500 + iwl_mvm_remove_link(mvm, vif, link_conf); 501 + iwl_mvm_add_link(mvm, vif, link_conf); 502 + } 469 503 mutex_unlock(&mvm->mutex); 470 504 } 471 505 ··· 603 623 &callbacks); 604 624 } 605 625 626 + struct iwl_mvm_link_sel_data { 627 + u8 link_id; 628 + enum nl80211_band band; 629 + bool active; 630 + }; 631 + 632 + static bool iwl_mvm_mld_valid_link_pair(struct iwl_mvm_link_sel_data *a, 633 + struct iwl_mvm_link_sel_data *b) 634 + { 635 + return a->band != b->band; 636 + } 637 + 638 + void iwl_mvm_mld_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 639 + bool valid_links_changed) 640 + { 641 + struct iwl_mvm_link_sel_data data[IEEE80211_MLD_MAX_NUM_LINKS]; 642 + unsigned long usable_links = ieee80211_vif_usable_links(vif); 643 + u32 max_active_links = iwl_mvm_max_active_links(mvm, vif); 644 + u16 new_active_links; 645 + u8 link_id, n_data = 0, i, j; 646 + 647 + if (!IWL_MVM_AUTO_EML_ENABLE) 648 + return; 649 + 650 + if (!ieee80211_vif_is_mld(vif) || usable_links == 1) 651 + return; 652 + 653 + /* The logic below is a simple version that doesn't suit more than 2 654 + * links 655 + */ 656 + WARN_ON_ONCE(max_active_links > 2); 657 + 658 + /* if only a single active link is supported, assume that the one 659 + * selected by higher layer for connection establishment is the best. 660 + */ 661 + if (max_active_links == 1 && !valid_links_changed) 662 + return; 663 + 664 + /* If we are already using the maximal number of active links, don't do 665 + * any change. This can later be optimized to pick a 'better' link pair. 666 + */ 667 + if (hweight16(vif->active_links) == max_active_links) 668 + return; 669 + 670 + rcu_read_lock(); 671 + 672 + for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { 673 + struct ieee80211_bss_conf *link_conf = 674 + rcu_dereference(vif->link_conf[link_id]); 675 + 676 + if (WARN_ON_ONCE(!link_conf)) 677 + continue; 678 + 679 + data[n_data].link_id = link_id; 680 + data[n_data].band = link_conf->chandef.chan->band; 681 + data[n_data].active = vif->active_links & BIT(link_id); 682 + n_data++; 683 + } 684 + 685 + rcu_read_unlock(); 686 + 687 + /* this is expected to be the current active link */ 688 + if (n_data == 1) 689 + return; 690 + 691 + new_active_links = 0; 692 + 693 + /* Assume that after association only a single link is active, thus, 694 + * select only the 2nd link 695 + */ 696 + if (!valid_links_changed) { 697 + for (i = 0; i < n_data; i++) { 698 + if (data[i].active) 699 + break; 700 + } 701 + 702 + if (WARN_ON_ONCE(i == n_data)) 703 + return; 704 + 705 + for (j = 0; j < n_data; j++) { 706 + if (i == j) 707 + continue; 708 + 709 + if (iwl_mvm_mld_valid_link_pair(&data[i], &data[j])) 710 + break; 711 + } 712 + 713 + if (j != n_data) 714 + new_active_links = BIT(data[i].link_id) | 715 + BIT(data[j].link_id); 716 + } else { 717 + /* Try to find a valid link pair for EMLSR operation. If a pair 718 + * is not found continue using the current active link. 719 + */ 720 + for (i = 0; i < n_data; i++) { 721 + for (j = 0; j < n_data; j++) { 722 + if (i == j) 723 + continue; 724 + 725 + if (iwl_mvm_mld_valid_link_pair(&data[i], 726 + &data[j])) 727 + break; 728 + } 729 + 730 + /* found a valid pair for EMLSR, use it */ 731 + if (j != n_data) { 732 + new_active_links = BIT(data[i].link_id) | 733 + BIT(data[j].link_id); 734 + break; 735 + } 736 + } 737 + } 738 + 739 + if (WARN_ON(!new_active_links)) 740 + return; 741 + 742 + if (vif->active_links != new_active_links) 743 + ieee80211_set_active_links_async(vif, new_active_links); 744 + } 745 + 606 746 static void 607 747 iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm, 608 748 struct ieee80211_vif *vif, ··· 753 653 } 754 654 755 655 /* Update EHT Puncturing info */ 756 - if (changes & BSS_CHANGED_EHT_PUNCTURING && vif->cfg.assoc && has_eht) 656 + if (changes & BSS_CHANGED_EHT_PUNCTURING && vif->cfg.assoc) 757 657 link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS; 758 658 759 659 if (link_changes) { ··· 766 666 ret = iwl_mvm_mld_mac_ctxt_changed(mvm, vif, false); 767 667 if (ret) 768 668 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); 669 + 670 + if (changes & BSS_CHANGED_MLD_VALID_LINKS) 671 + iwl_mvm_mld_select_links(mvm, vif, true); 769 672 770 673 memcpy(mvmvif->link[link_conf->link_id]->bssid, link_conf->bssid, 771 674 ETH_ALEN); ··· 860 757 861 758 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 862 759 protect) { 760 + /* We are in assoc so only one link is active- 761 + * The association link 762 + */ 763 + unsigned int link_id = 764 + ffs(vif->active_links) - 1; 765 + 863 766 /* If we're not restarting and still haven't 864 767 * heard a beacon (dtim period unknown) then 865 768 * make sure we still have enough minimum time ··· 875 766 * time could be small without us having heard 876 767 * a beacon yet. 877 768 */ 878 - iwl_mvm_protect_assoc(mvm, vif, 0); 769 + iwl_mvm_protect_assoc(mvm, vif, 0, link_id); 879 770 } 880 771 881 772 iwl_mvm_sf_update(mvm, vif, false); ··· 1077 968 return 0; 1078 969 } 1079 970 1080 - static int iwl_mvm_link_switch_phy_ctx(struct iwl_mvm *mvm, 1081 - struct ieee80211_vif *vif, 1082 - struct iwl_mvm_phy_ctxt *new_phy_ctxt) 971 + static int iwl_mvm_mld_roc_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1083 972 { 1084 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1085 - int ret = 0; 973 + int ret; 1086 974 1087 975 lockdep_assert_held(&mvm->mutex); 1088 976 1089 - /* Inorder to change the phy_ctx of a link, the link needs to be 1090 - * inactive. Therefore, first deactivate the link, then change its 1091 - * phy_ctx, and then activate it again. 1092 - */ 1093 - ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 1094 - LINK_CONTEXT_MODIFY_ACTIVE, false); 1095 - if (WARN(ret, "Failed to deactivate link\n")) 1096 - return ret; 1097 - 1098 - iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); 1099 - 1100 - mvmvif->deflink.phy_ctxt = new_phy_ctxt; 1101 - 977 + /* The PHY context ID might have changed so need to set it */ 1102 978 ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 0, false); 1103 - if (WARN(ret, "Failed to deactivate link\n")) 979 + if (WARN(ret, "Failed to set PHY context ID\n")) 1104 980 return ret; 1105 981 1106 982 ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 1107 - LINK_CONTEXT_MODIFY_ACTIVE, true); 1108 - WARN(ret, "Failed binding P2P_DEVICE\n"); 1109 - return ret; 983 + LINK_CONTEXT_MODIFY_ACTIVE | 984 + LINK_CONTEXT_MODIFY_RATES_INFO, 985 + true); 986 + 987 + if (WARN(ret, "Failed linking P2P_DEVICE\n")) 988 + return ret; 989 + 990 + /* The station and queue allocation must be done only after the linking 991 + * is done, as otherwise the FW might incorrectly configure its state. 992 + */ 993 + return iwl_mvm_mld_add_bcast_sta(mvm, vif, &vif->bss_conf); 1110 994 } 1111 995 1112 996 static int iwl_mvm_mld_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ··· 1108 1006 { 1109 1007 static const struct iwl_mvm_roc_ops ops = { 1110 1008 .add_aux_sta_for_hs20 = iwl_mvm_mld_add_aux_sta, 1111 - .switch_phy_ctxt = iwl_mvm_link_switch_phy_ctx, 1009 + .link = iwl_mvm_mld_roc_link, 1112 1010 }; 1113 1011 1114 1012 return iwl_mvm_roc_common(hw, vif, channel, duration, type, &ops); ··· 1275 1173 1276 1174 .tx_last_beacon = iwl_mvm_tx_last_beacon, 1277 1175 1278 - .set_tim = iwl_mvm_set_tim, 1279 - 1280 1176 .channel_switch = iwl_mvm_channel_switch, 1281 1177 .pre_channel_switch = iwl_mvm_pre_channel_switch, 1282 1178 .post_channel_switch = iwl_mvm_post_channel_switch, ··· 1309 1209 .abort_pmsr = iwl_mvm_abort_pmsr, 1310 1210 1311 1211 #ifdef CONFIG_IWLWIFI_DEBUGFS 1212 + .vif_add_debugfs = iwl_mvm_vif_add_debugfs, 1213 + .link_add_debugfs = iwl_mvm_link_add_debugfs, 1312 1214 .link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs, 1313 1215 #endif 1314 1216 .set_hw_timestamp = iwl_mvm_set_hw_timestamp,
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
··· 347 347 return -EINVAL; 348 348 349 349 if (flush) 350 - iwl_mvm_flush_sta(mvm, int_sta, true); 350 + iwl_mvm_flush_sta(mvm, int_sta->sta_id, int_sta->tfd_queue_msk); 351 351 352 352 iwl_mvm_mld_disable_txq(mvm, BIT(int_sta->sta_id), queuptr, tid); 353 353
+39 -74
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 121 121 * if the te is in the time event list or not (when id == TE_MAX) 122 122 */ 123 123 u32 id; 124 + u8 link_id; 124 125 }; 125 126 126 127 /* Power management */ ··· 647 646 * @queue: queue of this reorder buffer 648 647 * @last_amsdu: track last ASMDU SN for duplication detection 649 648 * @last_sub_index: track ASMDU sub frame index for duplication detection 650 - * @reorder_timer: timer for frames are in the reorder buffer. For AMSDU 651 - * it is the time of last received sub-frame 652 - * @removed: prevent timer re-arming 653 649 * @valid: reordering is valid for this queue 654 650 * @lock: protect reorder buffer internal state 655 651 * @mvm: mvm pointer, needed for frame timer context 656 - * @consec_oldsn_drops: consecutive drops due to old SN 657 - * @consec_oldsn_ampdu_gp2: A-MPDU GP2 timestamp to track 658 - * when to apply old SN consecutive drop workaround 659 - * @consec_oldsn_prev_drop: track whether or not an MPDU 660 - * that was single/part of the previous A-MPDU was 661 - * dropped due to old SN 662 652 */ 663 653 struct iwl_mvm_reorder_buffer { 664 654 u16 head_sn; ··· 658 666 int queue; 659 667 u16 last_amsdu; 660 668 u8 last_sub_index; 661 - struct timer_list reorder_timer; 662 - bool removed; 663 669 bool valid; 664 670 spinlock_t lock; 665 671 struct iwl_mvm *mvm; 666 - unsigned int consec_oldsn_drops; 667 - u32 consec_oldsn_ampdu_gp2; 668 - unsigned int consec_oldsn_prev_drop:1; 669 672 } ____cacheline_aligned_in_smp; 670 673 671 674 /** 672 - * struct _iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno 675 + * struct iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno 673 676 * @frames: list of skbs stored 674 - * @reorder_time: time the packet was stored in the reorder buffer 675 677 */ 676 - struct _iwl_mvm_reorder_buf_entry { 677 - struct sk_buff_head frames; 678 - unsigned long reorder_time; 679 - }; 680 - 681 - /* make this indirection to get the aligned thing */ 682 678 struct iwl_mvm_reorder_buf_entry { 683 - struct _iwl_mvm_reorder_buf_entry e; 679 + struct sk_buff_head frames; 684 680 } 685 681 #ifndef __CHECKER__ 686 682 /* sparse doesn't like this construct: "bad integer constant expression" */ 687 - __aligned(roundup_pow_of_two(sizeof(struct _iwl_mvm_reorder_buf_entry))) 683 + __aligned(roundup_pow_of_two(sizeof(struct sk_buff_head))) 688 684 #endif 689 685 ; 690 686 ··· 1194 1214 struct iwl_time_sync_data time_sync; 1195 1215 1196 1216 struct iwl_mei_scan_filter mei_scan_filter; 1217 + 1218 + bool statistics_clear; 1197 1219 }; 1198 1220 1199 1221 /* Extract MVM priv from op_mode and _hw */ ··· 1656 1674 static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; } 1657 1675 #endif 1658 1676 int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk); 1659 - int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal); 1677 + int iwl_mvm_flush_sta(struct iwl_mvm *mvm, u32 sta_id, u32 tfd_queue_mask); 1660 1678 int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, u16 tids); 1661 1679 1662 1680 /* Utils to extract sta related data */ ··· 1687 1705 } 1688 1706 1689 1707 /* Statistics */ 1708 + void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, 1709 + struct iwl_rx_cmd_buffer *rxb); 1710 + void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm, 1711 + struct iwl_rx_cmd_buffer *rxb); 1712 + static inline void 1713 + iwl_mvm_handle_rx_system_end_stats_notif(struct iwl_mvm *mvm, 1714 + struct iwl_rx_cmd_buffer *rxb) 1715 + { 1716 + } 1717 + 1690 1718 void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, 1691 1719 struct iwl_rx_packet *pkt); 1692 1720 void iwl_mvm_rx_statistics(struct iwl_mvm *mvm, ··· 1913 1921 struct ieee80211_vif *vif); 1914 1922 1915 1923 /* BSS Info */ 1916 - /** 1917 - * struct iwl_mvm_bss_info_changed_ops - callbacks for the bss_info_changed() 1918 - * 1919 - * Since the only difference between both MLD and 1920 - * non-MLD versions of bss_info_changed() is these function calls, 1921 - * each version will send its specific function calls to 1922 - * %iwl_mvm_bss_info_changed_common(). 1923 - * 1924 - * @bss_info_changed_sta: pointer to the function that handles changes 1925 - * in bss_info in sta mode 1926 - * @bss_info_changed_ap_ibss: pointer to the function that handles changes 1927 - * in bss_info in ap and ibss modes 1928 - */ 1929 - struct iwl_mvm_bss_info_changed_ops { 1930 - void (*bss_info_changed_sta)(struct iwl_mvm *mvm, 1931 - struct ieee80211_vif *vif, 1932 - struct ieee80211_bss_conf *bss_conf, 1933 - u64 changes); 1934 - void (*bss_info_changed_ap_ibss)(struct iwl_mvm *mvm, 1935 - struct ieee80211_vif *vif, 1936 - struct ieee80211_bss_conf *bss_conf, 1937 - u64 changes); 1938 - }; 1939 - 1940 - void 1941 - iwl_mvm_bss_info_changed_common(struct ieee80211_hw *hw, 1942 - struct ieee80211_vif *vif, 1943 - struct ieee80211_bss_conf *bss_conf, 1944 - const struct iwl_mvm_bss_info_changed_ops *callbacks, 1945 - u64 changes); 1946 - void 1947 - iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm, 1948 - struct ieee80211_vif *vif, 1949 - struct ieee80211_bss_conf *link_conf, 1950 - u64 changes); 1924 + void iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm, 1925 + struct ieee80211_vif *vif, 1926 + struct ieee80211_bss_conf *link_conf, 1927 + u64 changes); 1951 1928 void iwl_mvm_bss_info_changed_station_assoc(struct iwl_mvm *mvm, 1952 1929 struct ieee80211_vif *vif, 1953 1930 u64 changes); ··· 1932 1971 * 1933 1972 * @add_aux_sta_for_hs20: pointer to the function that adds an aux sta 1934 1973 * for Hot Spot 2.0 1935 - * @switch_phy_ctxt: pointer to the function that switches a vif from one 1936 - * phy_ctx to another 1974 + * @link: For a P2P Device interface, pointer to a function that links the 1975 + * MAC/Link to the PHY context 1937 1976 */ 1938 1977 struct iwl_mvm_roc_ops { 1939 1978 int (*add_aux_sta_for_hs20)(struct iwl_mvm *mvm, u32 lmac_id); 1940 - int (*switch_phy_ctxt)(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1941 - struct iwl_mvm_phy_ctxt *new_phy_ctxt); 1979 + int (*link)(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 1942 1980 }; 1943 1981 1944 1982 int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ··· 1948 1988 struct ieee80211_vif *vif); 1949 1989 /*Session Protection */ 1950 1990 void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1951 - u32 duration_override); 1991 + u32 duration_override, unsigned int link_id); 1952 1992 1953 1993 /* Quota management */ 1954 1994 static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm) ··· 2008 2048 /* MVM debugfs */ 2009 2049 #ifdef CONFIG_IWLWIFI_DEBUGFS 2010 2050 void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm); 2011 - void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 2012 - void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 2051 + void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2052 + void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 2053 + void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 2013 2054 #else 2014 2055 static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) 2015 2056 { 2016 2057 } 2017 2058 static inline void 2018 - iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 2059 + iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 2019 2060 { 2020 2061 } 2021 2062 static inline void 2022 - iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 2063 + iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 2023 2064 { 2024 2065 } 2025 2066 #endif /* CONFIG_IWLWIFI_DEBUGFS */ ··· 2253 2292 bool *changed); 2254 2293 struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm, 2255 2294 bool *changed); 2256 - int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm); 2295 + int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync); 2257 2296 void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm); 2258 2297 2259 2298 /* smart fifo */ ··· 2306 2345 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 2307 2346 bool sta_added); 2308 2347 void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw, 2309 - struct ieee80211_vif *vif); 2348 + struct ieee80211_vif *vif, 2349 + unsigned int link_id); 2310 2350 int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw, 2311 2351 struct ieee80211_vif *vif, 2312 2352 struct ieee80211_sta *sta, u8 oper_class, ··· 2326 2364 enum iwl_mvm_rxq_notif_type type, 2327 2365 bool sync, 2328 2366 const void *data, u32 size); 2329 - void iwl_mvm_reorder_timer_expired(struct timer_list *t); 2330 2367 struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); 2331 2368 struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid); 2332 2369 bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm); ··· 2365 2404 struct ieee80211_vif *vif, 2366 2405 struct ieee80211_link_sta *link_sta, 2367 2406 struct dentry *dir); 2407 + void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw, 2408 + struct ieee80211_vif *vif, 2409 + struct ieee80211_bss_conf *link_conf, 2410 + struct dentry *dir); 2368 2411 #endif 2369 2412 2370 2413 /* new MLD related APIs */ ··· 2678 2713 void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, 2679 2714 struct ieee80211_chanctx_conf *ctx, u32 changed); 2680 2715 int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw); 2681 - int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 2682 - bool set); 2683 2716 void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2684 2717 struct ieee80211_channel_switch *chsw); 2685 2718 int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, ··· 2721 2758 int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 2722 2759 bool iwl_mvm_enable_fils(struct iwl_mvm *mvm, 2723 2760 struct ieee80211_chanctx_conf *ctx); 2761 + void iwl_mvm_mld_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 2762 + bool valid_links_changed); 2724 2763 #endif /* __IWL_MVM_H__ */
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
··· 573 573 * try to replay the last set MCC to FW. If it doesn't exist, 574 574 * queue an update to cfg80211 to retrieve the default alpha2 from FW. 575 575 */ 576 - retval = iwl_mvm_init_fw_regd(mvm); 576 + retval = iwl_mvm_init_fw_regd(mvm, true); 577 577 if (retval != -ENOENT) 578 578 return retval; 579 579
+30 -4
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 322 322 RX_HANDLER_NO_SIZE(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, 323 323 RX_HANDLER_ASYNC_LOCKED), 324 324 325 + RX_HANDLER_GRP(STATISTICS_GROUP, STATISTICS_OPER_NOTIF, 326 + iwl_mvm_handle_rx_system_oper_stats, 327 + RX_HANDLER_ASYNC_LOCKED, 328 + struct iwl_system_statistics_notif_oper), 329 + RX_HANDLER_GRP(STATISTICS_GROUP, STATISTICS_OPER_PART1_NOTIF, 330 + iwl_mvm_handle_rx_system_oper_part1_stats, 331 + RX_HANDLER_ASYNC_LOCKED, 332 + struct iwl_system_statistics_part1_notif_oper), 333 + RX_HANDLER_GRP(SYSTEM_GROUP, SYSTEM_STATISTICS_END_NOTIF, 334 + iwl_mvm_handle_rx_system_end_stats_notif, 335 + RX_HANDLER_ASYNC_LOCKED, 336 + struct iwl_system_statistics_end_notif), 337 + 325 338 RX_HANDLER(BA_WINDOW_STATUS_NOTIFICATION_ID, 326 339 iwl_mvm_window_status_notif, RX_HANDLER_SYNC, 327 340 struct iwl_ba_window_status_notif), ··· 439 426 WNM_80211V_TIMING_MEASUREMENT_CONFIRM_NOTIFICATION, 440 427 iwl_mvm_time_sync_msmt_confirm_event, RX_HANDLER_SYNC, 441 428 struct iwl_time_msmt_cfm_notify), 429 + RX_HANDLER_GRP(MAC_CONF_GROUP, ROC_NOTIF, 430 + iwl_mvm_rx_roc_notif, RX_HANDLER_SYNC, 431 + struct iwl_roc_notif), 442 432 }; 443 433 #undef RX_HANDLER 444 434 #undef RX_HANDLER_GRP ··· 551 535 HCMD_NAME(RFI_GET_FREQ_TABLE_CMD), 552 536 HCMD_NAME(SYSTEM_FEATURES_CONTROL_CMD), 553 537 HCMD_NAME(RFI_DEACTIVATE_NOTIF), 538 + HCMD_NAME(SYSTEM_STATISTICS_CMD), 539 + HCMD_NAME(SYSTEM_STATISTICS_END_NOTIF), 554 540 }; 555 541 556 542 /* Please keep this array *SORTED* by hex value. ··· 567 549 HCMD_NAME(AUX_STA_CMD), 568 550 HCMD_NAME(STA_REMOVE_CMD), 569 551 HCMD_NAME(STA_DISABLE_TX_CMD), 552 + HCMD_NAME(ROC_CMD), 553 + HCMD_NAME(ROC_NOTIF), 570 554 HCMD_NAME(SESSION_PROTECTION_NOTIF), 571 555 HCMD_NAME(CHANNEL_SWITCH_START_NOTIF), 572 556 }; ··· 604 584 HCMD_NAME(STA_PM_NOTIF), 605 585 HCMD_NAME(MU_GROUP_MGMT_NOTIF), 606 586 HCMD_NAME(RX_QUEUES_NOTIFICATION), 587 + }; 588 + 589 + /* Please keep this array *SORTED* by hex value. 590 + * Access is done through binary search 591 + */ 592 + static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = { 593 + HCMD_NAME(STATISTICS_OPER_NOTIF), 594 + HCMD_NAME(STATISTICS_OPER_PART1_NOTIF), 607 595 }; 608 596 609 597 /* Please keep this array *SORTED* by hex value. ··· 668 640 [PROT_OFFLOAD_GROUP] = HCMD_ARR(iwl_mvm_prot_offload_names), 669 641 [REGULATORY_AND_NVM_GROUP] = 670 642 HCMD_ARR(iwl_mvm_regulatory_and_nvm_names), 643 + [STATISTICS_GROUP] = HCMD_ARR(iwl_mvm_statistics_names), 671 644 }; 672 645 673 646 /* this forward declaration can avoid to export the function */ ··· 1333 1304 1334 1305 snprintf(mvm->hw->wiphy->fw_version, 1335 1306 sizeof(mvm->hw->wiphy->fw_version), 1336 - "%s", fw->fw_version); 1307 + "%.31s", fw->fw_version); 1337 1308 1338 1309 trans_cfg.fw_reset_handshake = fw_has_capa(&mvm->fw->ucode_capa, 1339 1310 IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE); ··· 1978 1949 static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, bool sync) 1979 1950 { 1980 1951 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); 1981 - 1982 - if (mvm->pldr_sync) 1983 - return; 1984 1952 1985 1953 if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && 1986 1954 !test_and_clear_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE,
+31 -37
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
··· 192 192 iwl_mvm_phy_ctxt_set_rxchain(mvm, ctxt, &cmd.rlc.rx_chain_info, 193 193 chains_static, chains_dynamic); 194 194 195 + IWL_DEBUG_FW(mvm, "Send RLC command: phy=%d, rx_chain_info=0x%x\n", 196 + ctxt->id, cmd.rlc.rx_chain_info); 197 + 195 198 return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(RLC_CONFIG_CMD, 196 199 DATA_PATH_GROUP, 2), 197 200 0, sizeof(cmd), &cmd); ··· 268 265 struct cfg80211_chan_def *chandef, 269 266 u8 chains_static, u8 chains_dynamic) 270 267 { 268 + int ret; 269 + 271 270 WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 272 271 ctxt->ref); 273 272 lockdep_assert_held(&mvm->mutex); ··· 278 273 ctxt->width = chandef->width; 279 274 ctxt->center_freq1 = chandef->center_freq1; 280 275 281 - return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, 282 - chains_static, chains_dynamic, 283 - FW_CTXT_ACTION_ADD); 276 + ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, 277 + chains_static, chains_dynamic, 278 + FW_CTXT_ACTION_ADD); 279 + 280 + if (ret) 281 + return ret; 282 + 283 + ctxt->ref++; 284 + 285 + return 0; 284 286 } 285 287 286 288 /* ··· 297 285 void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) 298 286 { 299 287 lockdep_assert_held(&mvm->mutex); 288 + 289 + /* If we were taking the first ref, we should have 290 + * called iwl_mvm_phy_ctxt_add. 291 + */ 292 + WARN_ON(!ctxt->ref); 300 293 ctxt->ref++; 301 294 } 302 295 ··· 318 301 319 302 lockdep_assert_held(&mvm->mutex); 320 303 321 - if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP, RLC_CONFIG_CMD), 0) >= 2 && 304 + if (WARN_ON_ONCE(!ctxt->ref)) 305 + return -EINVAL; 306 + 307 + if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP, 308 + RLC_CONFIG_CMD), 0) >= 2 && 322 309 ctxt->channel == chandef->chan && 323 310 ctxt->width == chandef->width && 324 311 ctxt->center_freq1 == chandef->center_freq1) ··· 356 335 357 336 void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) 358 337 { 338 + struct cfg80211_chan_def chandef; 359 339 lockdep_assert_held(&mvm->mutex); 360 340 361 341 if (WARN_ON_ONCE(!ctxt)) ··· 364 342 365 343 ctxt->ref--; 366 344 367 - /* 368 - * Move unused phy's to a default channel. When the phy is moved the, 369 - * fw will cleanup immediate quiet bit if it was previously set, 370 - * otherwise we might not be able to reuse this phy. 371 - */ 372 - if (ctxt->ref == 0) { 373 - struct ieee80211_channel *chan = NULL; 374 - struct cfg80211_chan_def chandef; 375 - struct ieee80211_supported_band *sband; 376 - enum nl80211_band band; 377 - int channel; 345 + if (ctxt->ref) 346 + return; 378 347 379 - for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) { 380 - sband = mvm->hw->wiphy->bands[band]; 348 + cfg80211_chandef_create(&chandef, ctxt->channel, NL80211_CHAN_NO_HT); 381 349 382 - if (!sband) 383 - continue; 384 - 385 - for (channel = 0; channel < sband->n_channels; channel++) 386 - if (!(sband->channels[channel].flags & 387 - IEEE80211_CHAN_DISABLED)) { 388 - chan = &sband->channels[channel]; 389 - break; 390 - } 391 - 392 - if (chan) 393 - break; 394 - } 395 - 396 - if (WARN_ON(!chan)) 397 - return; 398 - 399 - cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); 400 - iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1); 401 - } 350 + iwl_mvm_phy_ctxt_apply(mvm, ctxt, &chandef, 1, 1, 351 + FW_CTXT_ACTION_REMOVE); 402 352 } 403 353 404 354 static void iwl_mvm_binding_iterator(void *_data, u8 *mac,
+150 -7
drivers/net/wireless/intel/iwlwifi/mvm/rx.c
··· 553 553 struct iwl_mvm_stat_data_all_macs { 554 554 struct iwl_mvm *mvm; 555 555 __le32 flags; 556 - struct iwl_statistics_ntfy_per_mac *per_mac_stats; 556 + struct iwl_stats_ntfy_per_mac *per_mac; 557 557 }; 558 558 559 559 static void iwl_mvm_update_vif_sig(struct ieee80211_vif *vif, int sig) ··· 658 658 struct ieee80211_vif *vif) 659 659 { 660 660 struct iwl_mvm_stat_data_all_macs *data = _data; 661 - struct iwl_statistics_ntfy_per_mac *mac_stats; 661 + struct iwl_stats_ntfy_per_mac *mac_stats; 662 662 int sig; 663 663 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 664 664 u16 vif_id = mvmvif->id; ··· 669 669 if (vif->type != NL80211_IFTYPE_STATION) 670 670 return; 671 671 672 - mac_stats = &data->per_mac_stats[vif_id]; 672 + mac_stats = &data->per_mac[vif_id]; 673 673 674 674 mvmvif->deflink.beacon_stats.num_beacons = 675 675 le32_to_cpu(mac_stats->beacon_counter); ··· 759 759 struct iwl_mvm_stat_data_all_macs data = { 760 760 .mvm = mvm, 761 761 .flags = stats->flags, 762 - .per_mac_stats = stats->per_mac_stats, 762 + .per_mac = stats->per_mac, 763 763 }; 764 764 765 765 ieee80211_iterate_active_interfaces(mvm->hw, ··· 829 829 } 830 830 831 831 static void 832 + iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, 833 + struct iwl_stats_ntfy_per_link *per_link) 834 + { 835 + u32 air_time[MAC_INDEX_AUX] = {}; 836 + u32 rx_bytes[MAC_INDEX_AUX] = {}; 837 + int fw_link_id; 838 + 839 + for (fw_link_id = 0; fw_link_id < ARRAY_SIZE(mvm->link_id_to_link_conf); 840 + fw_link_id++) { 841 + struct iwl_stats_ntfy_per_link *link_stats; 842 + struct ieee80211_bss_conf *bss_conf; 843 + struct iwl_mvm_vif *mvmvif; 844 + int link_id; 845 + int sig; 846 + 847 + bss_conf = iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, fw_link_id, 848 + false); 849 + if (!bss_conf) 850 + continue; 851 + 852 + if (bss_conf->vif->type != NL80211_IFTYPE_STATION) 853 + continue; 854 + 855 + link_id = bss_conf->link_id; 856 + if (link_id >= ARRAY_SIZE(mvmvif->link)) 857 + continue; 858 + 859 + mvmvif = iwl_mvm_vif_from_mac80211(bss_conf->vif); 860 + if (!mvmvif || !mvmvif->link[link_id]) 861 + continue; 862 + 863 + link_stats = &per_link[fw_link_id]; 864 + 865 + mvmvif->link[link_id]->beacon_stats.num_beacons = 866 + le32_to_cpu(link_stats->beacon_counter); 867 + 868 + /* we basically just use the u8 to store 8 bits and then treat 869 + * it as a s8 whenever we take it out to a different type. 870 + */ 871 + mvmvif->link[link_id]->beacon_stats.avg_signal = 872 + -le32_to_cpu(link_stats->beacon_average_energy); 873 + 874 + /* make sure that beacon statistics don't go backwards with TCM 875 + * request to clear statistics 876 + */ 877 + if (mvm->statistics_clear) 878 + mvmvif->link[link_id]->beacon_stats.accu_num_beacons += 879 + mvmvif->link[link_id]->beacon_stats.num_beacons; 880 + 881 + sig = -le32_to_cpu(link_stats->beacon_filter_average_energy); 882 + iwl_mvm_update_vif_sig(bss_conf->vif, sig); 883 + 884 + if (WARN_ONCE(mvmvif->id >= MAC_INDEX_AUX, 885 + "invalid mvmvif id: %d", mvmvif->id)) 886 + continue; 887 + 888 + air_time[mvmvif->id] += 889 + le32_to_cpu(per_link[fw_link_id].air_time); 890 + rx_bytes[mvmvif->id] += 891 + le32_to_cpu(per_link[fw_link_id].rx_bytes); 892 + } 893 + 894 + /* Don't update in case the statistics are not cleared, since 895 + * we will end up counting twice the same airtime, once in TCM 896 + * request and once in statistics notification. 897 + */ 898 + if (mvm->statistics_clear) { 899 + __le32 air_time_le[MAC_INDEX_AUX]; 900 + __le32 rx_bytes_le[MAC_INDEX_AUX]; 901 + int vif_id; 902 + 903 + for (vif_id = 0; vif_id < ARRAY_SIZE(air_time_le); vif_id++) { 904 + air_time_le[vif_id] = cpu_to_le32(air_time[vif_id]); 905 + rx_bytes_le[vif_id] = cpu_to_le32(rx_bytes[vif_id]); 906 + } 907 + 908 + iwl_mvm_update_tcm_from_stats(mvm, air_time_le, rx_bytes_le); 909 + } 910 + } 911 + 912 + void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, 913 + struct iwl_rx_cmd_buffer *rxb) 914 + { 915 + u8 average_energy[IWL_MVM_STATION_COUNT_MAX]; 916 + struct iwl_rx_packet *pkt = rxb_addr(rxb); 917 + struct iwl_system_statistics_notif_oper *stats; 918 + int i; 919 + u32 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, STATISTICS_GROUP, 920 + STATISTICS_OPER_NOTIF, 0); 921 + 922 + if (notif_ver != 3) { 923 + IWL_FW_CHECK_FAILED(mvm, 924 + "Oper stats notif ver %d is not supported\n", 925 + notif_ver); 926 + return; 927 + } 928 + 929 + stats = (void *)&pkt->data; 930 + iwl_mvm_stat_iterator_all_links(mvm, stats->per_link); 931 + 932 + for (i = 0; i < ARRAY_SIZE(average_energy); i++) 933 + average_energy[i] = 934 + le32_to_cpu(stats->per_sta[i].average_energy); 935 + 936 + ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter, 937 + average_energy); 938 + } 939 + 940 + void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm, 941 + struct iwl_rx_cmd_buffer *rxb) 942 + { 943 + struct iwl_rx_packet *pkt = rxb_addr(rxb); 944 + struct iwl_system_statistics_part1_notif_oper *part1_stats; 945 + int i; 946 + u32 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, STATISTICS_GROUP, 947 + STATISTICS_OPER_PART1_NOTIF, 0); 948 + 949 + if (notif_ver != 4) { 950 + IWL_FW_CHECK_FAILED(mvm, 951 + "Part1 stats notif ver %d is not supported\n", 952 + notif_ver); 953 + return; 954 + } 955 + 956 + part1_stats = (void *)&pkt->data; 957 + mvm->radio_stats.rx_time = 0; 958 + mvm->radio_stats.tx_time = 0; 959 + for (i = 0; i < ARRAY_SIZE(part1_stats->per_link); i++) { 960 + mvm->radio_stats.rx_time += 961 + le64_to_cpu(part1_stats->per_link[i].rx_time); 962 + mvm->radio_stats.tx_time += 963 + le64_to_cpu(part1_stats->per_link[i].tx_time); 964 + } 965 + } 966 + 967 + static void 832 968 iwl_mvm_handle_rx_statistics_tlv(struct iwl_mvm *mvm, 833 969 struct iwl_rx_packet *pkt) 834 970 { ··· 1023 887 1024 888 for (i = 0; i < ARRAY_SIZE(average_energy); i++) 1025 889 average_energy[i] = 1026 - le32_to_cpu(stats->per_sta_stats[i].average_energy); 890 + le32_to_cpu(stats->per_sta[i].average_energy); 1027 891 1028 892 for (i = 0; i < ARRAY_SIZE(air_time); i++) { 1029 - air_time[i] = stats->per_mac_stats[i].air_time; 1030 - rx_bytes[i] = stats->per_mac_stats[i].rx_bytes; 893 + air_time[i] = stats->per_mac[i].air_time; 894 + rx_bytes[i] = stats->per_mac[i].rx_bytes; 1031 895 } 1032 896 } 1033 897 ··· 1053 917 __le32 *bytes, *air_time, flags; 1054 918 int expected_size; 1055 919 u8 *energy; 920 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 921 + WIDE_ID(SYSTEM_GROUP, 922 + SYSTEM_STATISTICS_CMD), 923 + IWL_FW_CMD_VER_UNKNOWN); 924 + 925 + if (cmd_ver != IWL_FW_CMD_VER_UNKNOWN) 926 + return; 1056 927 1057 928 /* From ver 14 and up we use TLV statistics format */ 1058 929 if (iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
+28 -296
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 550 550 return false; 551 551 } 552 552 553 - /* 554 - * Returns true if sn2 - buffer_size < sn1 < sn2. 555 - * To be used only in order to compare reorder buffer head with NSSN. 556 - * We fully trust NSSN unless it is behind us due to reorder timeout. 557 - * Reorder timeout can only bring us up to buffer_size SNs ahead of NSSN. 558 - */ 559 - static bool iwl_mvm_is_sn_less(u16 sn1, u16 sn2, u16 buffer_size) 560 - { 561 - return ieee80211_sn_less(sn1, sn2) && 562 - !ieee80211_sn_less(sn1, sn2 - buffer_size); 563 - } 564 - 565 - static void iwl_mvm_sync_nssn(struct iwl_mvm *mvm, u8 baid, u16 nssn) 566 - { 567 - if (IWL_MVM_USE_NSSN_SYNC) { 568 - struct iwl_mvm_nssn_sync_data notif = { 569 - .baid = baid, 570 - .nssn = nssn, 571 - }; 572 - 573 - iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_NSSN_SYNC, false, 574 - &notif, sizeof(notif)); 575 - } 576 - } 577 - 578 - #define RX_REORDER_BUF_TIMEOUT_MQ (HZ / 10) 579 - 580 - enum iwl_mvm_release_flags { 581 - IWL_MVM_RELEASE_SEND_RSS_SYNC = BIT(0), 582 - IWL_MVM_RELEASE_FROM_RSS_SYNC = BIT(1), 583 - }; 584 - 585 553 static void iwl_mvm_release_frames(struct iwl_mvm *mvm, 586 554 struct ieee80211_sta *sta, 587 555 struct napi_struct *napi, 588 556 struct iwl_mvm_baid_data *baid_data, 589 557 struct iwl_mvm_reorder_buffer *reorder_buf, 590 - u16 nssn, u32 flags) 558 + u16 nssn) 591 559 { 592 560 struct iwl_mvm_reorder_buf_entry *entries = 593 561 &baid_data->entries[reorder_buf->queue * ··· 564 596 565 597 lockdep_assert_held(&reorder_buf->lock); 566 598 567 - /* 568 - * We keep the NSSN not too far behind, if we are sync'ing it and it 569 - * is more than 2048 ahead of us, it must be behind us. Discard it. 570 - * This can happen if the queue that hit the 0 / 2048 seqno was lagging 571 - * behind and this queue already processed packets. The next if 572 - * would have caught cases where this queue would have processed less 573 - * than 64 packets, but it may have processed more than 64 packets. 574 - */ 575 - if ((flags & IWL_MVM_RELEASE_FROM_RSS_SYNC) && 576 - ieee80211_sn_less(nssn, ssn)) 577 - goto set_timer; 578 - 579 - /* ignore nssn smaller than head sn - this can happen due to timeout */ 580 - if (iwl_mvm_is_sn_less(nssn, ssn, reorder_buf->buf_size)) 581 - goto set_timer; 582 - 583 - while (iwl_mvm_is_sn_less(ssn, nssn, reorder_buf->buf_size)) { 599 + while (ieee80211_sn_less(ssn, nssn)) { 584 600 int index = ssn % reorder_buf->buf_size; 585 - struct sk_buff_head *skb_list = &entries[index].e.frames; 601 + struct sk_buff_head *skb_list = &entries[index].frames; 586 602 struct sk_buff *skb; 587 603 588 604 ssn = ieee80211_sn_inc(ssn); 589 - if ((flags & IWL_MVM_RELEASE_SEND_RSS_SYNC) && 590 - (ssn == 2048 || ssn == 0)) 591 - iwl_mvm_sync_nssn(mvm, baid_data->baid, ssn); 592 605 593 606 /* 594 607 * Empty the list. Will have more than one frame for A-MSDU. ··· 584 635 } 585 636 } 586 637 reorder_buf->head_sn = nssn; 587 - 588 - set_timer: 589 - if (reorder_buf->num_stored && !reorder_buf->removed) { 590 - u16 index = reorder_buf->head_sn % reorder_buf->buf_size; 591 - 592 - while (skb_queue_empty(&entries[index].e.frames)) 593 - index = (index + 1) % reorder_buf->buf_size; 594 - /* modify timer to match next frame's expiration time */ 595 - mod_timer(&reorder_buf->reorder_timer, 596 - entries[index].e.reorder_time + 1 + 597 - RX_REORDER_BUF_TIMEOUT_MQ); 598 - } else { 599 - del_timer(&reorder_buf->reorder_timer); 600 - } 601 - } 602 - 603 - void iwl_mvm_reorder_timer_expired(struct timer_list *t) 604 - { 605 - struct iwl_mvm_reorder_buffer *buf = from_timer(buf, t, reorder_timer); 606 - struct iwl_mvm_baid_data *baid_data = 607 - iwl_mvm_baid_data_from_reorder_buf(buf); 608 - struct iwl_mvm_reorder_buf_entry *entries = 609 - &baid_data->entries[buf->queue * baid_data->entries_per_queue]; 610 - int i; 611 - u16 sn = 0, index = 0; 612 - bool expired = false; 613 - bool cont = false; 614 - 615 - spin_lock(&buf->lock); 616 - 617 - if (!buf->num_stored || buf->removed) { 618 - spin_unlock(&buf->lock); 619 - return; 620 - } 621 - 622 - for (i = 0; i < buf->buf_size ; i++) { 623 - index = (buf->head_sn + i) % buf->buf_size; 624 - 625 - if (skb_queue_empty(&entries[index].e.frames)) { 626 - /* 627 - * If there is a hole and the next frame didn't expire 628 - * we want to break and not advance SN 629 - */ 630 - cont = false; 631 - continue; 632 - } 633 - if (!cont && 634 - !time_after(jiffies, entries[index].e.reorder_time + 635 - RX_REORDER_BUF_TIMEOUT_MQ)) 636 - break; 637 - 638 - expired = true; 639 - /* continue until next hole after this expired frames */ 640 - cont = true; 641 - sn = ieee80211_sn_add(buf->head_sn, i + 1); 642 - } 643 - 644 - if (expired) { 645 - struct ieee80211_sta *sta; 646 - struct iwl_mvm_sta *mvmsta; 647 - u8 sta_id = ffs(baid_data->sta_mask) - 1; 648 - 649 - rcu_read_lock(); 650 - sta = rcu_dereference(buf->mvm->fw_id_to_mac_id[sta_id]); 651 - if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { 652 - rcu_read_unlock(); 653 - goto out; 654 - } 655 - 656 - mvmsta = iwl_mvm_sta_from_mac80211(sta); 657 - 658 - /* SN is set to the last expired frame + 1 */ 659 - IWL_DEBUG_HT(buf->mvm, 660 - "Releasing expired frames for sta %u, sn %d\n", 661 - sta_id, sn); 662 - iwl_mvm_event_frame_timeout_callback(buf->mvm, mvmsta->vif, 663 - sta, baid_data->tid); 664 - iwl_mvm_release_frames(buf->mvm, sta, NULL, baid_data, 665 - buf, sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); 666 - rcu_read_unlock(); 667 - } else { 668 - /* 669 - * If no frame expired and there are stored frames, index is now 670 - * pointing to the first unexpired frame - modify timer 671 - * accordingly to this frame. 672 - */ 673 - mod_timer(&buf->reorder_timer, 674 - entries[index].e.reorder_time + 675 - 1 + RX_REORDER_BUF_TIMEOUT_MQ); 676 - } 677 - 678 - out: 679 - spin_unlock(&buf->lock); 680 638 } 681 639 682 640 static void iwl_mvm_del_ba(struct iwl_mvm *mvm, int queue, ··· 616 760 spin_lock_bh(&reorder_buf->lock); 617 761 iwl_mvm_release_frames(mvm, sta, NULL, ba_data, reorder_buf, 618 762 ieee80211_sn_add(reorder_buf->head_sn, 619 - reorder_buf->buf_size), 620 - 0); 763 + reorder_buf->buf_size)); 621 764 spin_unlock_bh(&reorder_buf->lock); 622 - del_timer_sync(&reorder_buf->reorder_timer); 623 765 624 766 out: 625 767 rcu_read_unlock(); ··· 625 771 626 772 static void iwl_mvm_release_frames_from_notif(struct iwl_mvm *mvm, 627 773 struct napi_struct *napi, 628 - u8 baid, u16 nssn, int queue, 629 - u32 flags) 774 + u8 baid, u16 nssn, int queue) 630 775 { 631 776 struct ieee80211_sta *sta; 632 777 struct iwl_mvm_reorder_buffer *reorder_buf; ··· 643 790 644 791 ba_data = rcu_dereference(mvm->baid_map[baid]); 645 792 if (!ba_data) { 646 - WARN(!(flags & IWL_MVM_RELEASE_FROM_RSS_SYNC), 647 - "BAID %d not found in map\n", baid); 793 + WARN(true, "BAID %d not found in map\n", baid); 648 794 goto out; 649 795 } 650 796 ··· 657 805 658 806 spin_lock_bh(&reorder_buf->lock); 659 807 iwl_mvm_release_frames(mvm, sta, napi, ba_data, 660 - reorder_buf, nssn, flags); 808 + reorder_buf, nssn); 661 809 spin_unlock_bh(&reorder_buf->lock); 662 810 663 811 out: 664 812 rcu_read_unlock(); 665 - } 666 - 667 - static void iwl_mvm_nssn_sync(struct iwl_mvm *mvm, 668 - struct napi_struct *napi, int queue, 669 - const struct iwl_mvm_nssn_sync_data *data) 670 - { 671 - iwl_mvm_release_frames_from_notif(mvm, napi, data->baid, 672 - data->nssn, queue, 673 - IWL_MVM_RELEASE_FROM_RSS_SYNC); 674 813 } 675 814 676 815 void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, ··· 698 855 break; 699 856 iwl_mvm_del_ba(mvm, queue, (void *)internal_notif->data); 700 857 break; 701 - case IWL_MVM_RXQ_NSSN_SYNC: 702 - if (WARN_ONCE(len != sizeof(struct iwl_mvm_nssn_sync_data), 703 - "invalid nssn sync notification size %d (%d)", 704 - len, (int)sizeof(struct iwl_mvm_nssn_sync_data))) 705 - break; 706 - iwl_mvm_nssn_sync(mvm, napi, queue, 707 - (void *)internal_notif->data); 708 - break; 709 858 default: 710 859 WARN_ONCE(1, "Invalid identifier %d", internal_notif->type); 711 860 } ··· 708 873 queue); 709 874 if (READ_ONCE(mvm->queue_sync_state) == 0) 710 875 wake_up(&mvm->rx_sync_waitq); 711 - } 712 - } 713 - 714 - static void iwl_mvm_oldsn_workaround(struct iwl_mvm *mvm, 715 - struct ieee80211_sta *sta, int tid, 716 - struct iwl_mvm_reorder_buffer *buffer, 717 - u32 reorder, u32 gp2, int queue) 718 - { 719 - struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 720 - 721 - if (gp2 != buffer->consec_oldsn_ampdu_gp2) { 722 - /* we have a new (A-)MPDU ... */ 723 - 724 - /* 725 - * reset counter to 0 if we didn't have any oldsn in 726 - * the last A-MPDU (as detected by GP2 being identical) 727 - */ 728 - if (!buffer->consec_oldsn_prev_drop) 729 - buffer->consec_oldsn_drops = 0; 730 - 731 - /* either way, update our tracking state */ 732 - buffer->consec_oldsn_ampdu_gp2 = gp2; 733 - } else if (buffer->consec_oldsn_prev_drop) { 734 - /* 735 - * tracking state didn't change, and we had an old SN 736 - * indication before - do nothing in this case, we 737 - * already noted this one down and are waiting for the 738 - * next A-MPDU (by GP2) 739 - */ 740 - return; 741 - } 742 - 743 - /* return unless this MPDU has old SN */ 744 - if (!(reorder & IWL_RX_MPDU_REORDER_BA_OLD_SN)) 745 - return; 746 - 747 - /* update state */ 748 - buffer->consec_oldsn_prev_drop = 1; 749 - buffer->consec_oldsn_drops++; 750 - 751 - /* if limit is reached, send del BA and reset state */ 752 - if (buffer->consec_oldsn_drops == IWL_MVM_AMPDU_CONSEC_DROPS_DELBA) { 753 - IWL_WARN(mvm, 754 - "reached %d old SN frames from %pM on queue %d, stopping BA session on TID %d\n", 755 - IWL_MVM_AMPDU_CONSEC_DROPS_DELBA, 756 - sta->addr, queue, tid); 757 - ieee80211_stop_rx_ba_session(mvmsta->vif, BIT(tid), sta->addr); 758 - buffer->consec_oldsn_prev_drop = 0; 759 - buffer->consec_oldsn_drops = 0; 760 876 } 761 877 } 762 878 ··· 722 936 struct sk_buff *skb, 723 937 struct iwl_rx_mpdu_desc *desc) 724 938 { 725 - struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 726 939 struct ieee80211_hdr *hdr = (void *)skb_mac_header(skb); 727 940 struct iwl_mvm_baid_data *baid_data; 728 941 struct iwl_mvm_reorder_buffer *buffer; 729 - struct sk_buff *tail; 730 942 u32 reorder = le32_to_cpu(desc->reorder_data); 731 943 bool amsdu = desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU; 732 944 bool last_subframe = ··· 740 956 741 957 baid = (reorder & IWL_RX_MPDU_REORDER_BAID_MASK) >> 742 958 IWL_RX_MPDU_REORDER_BAID_SHIFT; 959 + 960 + if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000) 961 + return false; 743 962 744 963 /* 745 964 * This also covers the case of receiving a Block Ack Request ··· 805 1018 buffer->valid = true; 806 1019 } 807 1020 808 - if (ieee80211_is_back_req(hdr->frame_control)) { 809 - iwl_mvm_release_frames(mvm, sta, napi, baid_data, 810 - buffer, nssn, 0); 1021 + /* drop any duplicated packets */ 1022 + if (desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_DUPLICATE)) 811 1023 goto drop; 812 - } 813 - 814 - /* 815 - * If there was a significant jump in the nssn - adjust. 816 - * If the SN is smaller than the NSSN it might need to first go into 817 - * the reorder buffer, in which case we just release up to it and the 818 - * rest of the function will take care of storing it and releasing up to 819 - * the nssn. 820 - * This should not happen. This queue has been lagging and it should 821 - * have been updated by a IWL_MVM_RXQ_NSSN_SYNC notification. Be nice 822 - * and update the other queues. 823 - */ 824 - if (!iwl_mvm_is_sn_less(nssn, buffer->head_sn + buffer->buf_size, 825 - buffer->buf_size) || 826 - !ieee80211_sn_less(sn, buffer->head_sn + buffer->buf_size)) { 827 - u16 min_sn = ieee80211_sn_less(sn, nssn) ? sn : nssn; 828 - 829 - iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, 830 - min_sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); 831 - } 832 - 833 - iwl_mvm_oldsn_workaround(mvm, sta, tid, buffer, reorder, 834 - rx_status->device_timestamp, queue); 835 1024 836 1025 /* drop any oudated packets */ 837 - if (ieee80211_sn_less(sn, buffer->head_sn)) 1026 + if (reorder & IWL_RX_MPDU_REORDER_BA_OLD_SN) 838 1027 goto drop; 839 1028 840 1029 /* release immediately if allowed by nssn and no stored frames */ 841 1030 if (!buffer->num_stored && ieee80211_sn_less(sn, nssn)) { 842 - if (iwl_mvm_is_sn_less(buffer->head_sn, nssn, 843 - buffer->buf_size) && 844 - (!amsdu || last_subframe)) { 845 - /* 846 - * If we crossed the 2048 or 0 SN, notify all the 847 - * queues. This is done in order to avoid having a 848 - * head_sn that lags behind for too long. When that 849 - * happens, we can get to a situation where the head_sn 850 - * is within the interval [nssn - buf_size : nssn] 851 - * which will make us think that the nssn is a packet 852 - * that we already freed because of the reordering 853 - * buffer and we will ignore it. So maintain the 854 - * head_sn somewhat updated across all the queues: 855 - * when it crosses 0 and 2048. 856 - */ 857 - if (sn == 2048 || sn == 0) 858 - iwl_mvm_sync_nssn(mvm, baid, sn); 1031 + if (!amsdu || last_subframe) 859 1032 buffer->head_sn = nssn; 860 - } 861 1033 /* No need to update AMSDU last SN - we are moving the head */ 862 1034 spin_unlock_bh(&buffer->lock); 863 1035 return false; ··· 831 1085 * while technically there is no hole and we can move forward. 832 1086 */ 833 1087 if (!buffer->num_stored && sn == buffer->head_sn) { 834 - if (!amsdu || last_subframe) { 835 - if (sn == 2048 || sn == 0) 836 - iwl_mvm_sync_nssn(mvm, baid, sn); 1088 + if (!amsdu || last_subframe) 837 1089 buffer->head_sn = ieee80211_sn_inc(buffer->head_sn); 838 - } 1090 + 839 1091 /* No need to update AMSDU last SN - we are moving the head */ 840 1092 spin_unlock_bh(&buffer->lock); 841 1093 return false; 842 1094 } 843 1095 844 - index = sn % buffer->buf_size; 845 - 846 - /* 847 - * Check if we already stored this frame 848 - * As AMSDU is either received or not as whole, logic is simple: 849 - * If we have frames in that position in the buffer and the last frame 850 - * originated from AMSDU had a different SN then it is a retransmission. 851 - * If it is the same SN then if the subframe index is incrementing it 852 - * is the same AMSDU - otherwise it is a retransmission. 853 - */ 854 - tail = skb_peek_tail(&entries[index].e.frames); 855 - if (tail && !amsdu) 856 - goto drop; 857 - else if (tail && (sn != buffer->last_amsdu || 858 - buffer->last_sub_index >= sub_frame_idx)) 859 - goto drop; 860 - 861 1096 /* put in reorder buffer */ 862 - __skb_queue_tail(&entries[index].e.frames, skb); 1097 + index = sn % buffer->buf_size; 1098 + __skb_queue_tail(&entries[index].frames, skb); 863 1099 buffer->num_stored++; 864 - entries[index].e.reorder_time = jiffies; 865 1100 866 1101 if (amsdu) { 867 1102 buffer->last_amsdu = sn; ··· 862 1135 */ 863 1136 if (!amsdu || last_subframe) 864 1137 iwl_mvm_release_frames(mvm, sta, napi, baid_data, 865 - buffer, nssn, 866 - IWL_MVM_RELEASE_SEND_RSS_SYNC); 1138 + buffer, nssn); 867 1139 868 1140 spin_unlock_bh(&buffer->lock); 869 1141 return true; ··· 2343 2617 2344 2618 if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc) && 2345 2619 likely(!iwl_mvm_time_sync_frame(mvm, skb, hdr->addr2)) && 2346 - likely(!iwl_mvm_mei_filter_scan(mvm, skb))) 2620 + likely(!iwl_mvm_mei_filter_scan(mvm, skb))) { 2621 + if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000 && 2622 + (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU) && 2623 + !(desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME)) 2624 + rx_status->flag |= RX_FLAG_AMSDU_MORE; 2625 + 2347 2626 iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta, 2348 2627 link_sta); 2628 + } 2349 2629 out: 2350 2630 rcu_read_unlock(); 2351 2631 } ··· 2494 2762 2495 2763 iwl_mvm_release_frames_from_notif(mvm, napi, release->baid, 2496 2764 le16_to_cpu(release->nssn), 2497 - queue, 0); 2765 + queue); 2498 2766 } 2499 2767 2500 2768 void iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, ··· 2538 2806 IWL_DEBUG_DROP(mvm, "Received a BAR, expect packet loss: nssn %d\n", 2539 2807 nssn); 2540 2808 2541 - iwl_mvm_release_frames_from_notif(mvm, napi, baid, nssn, queue, 0); 2809 + iwl_mvm_release_frames_from_notif(mvm, napi, baid, nssn, queue); 2542 2810 out: 2543 2811 rcu_read_unlock(); 2544 2812 }
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 3408 3408 if (!(mvm->scan_status & type)) 3409 3409 return 0; 3410 3410 3411 - if (iwl_mvm_is_radio_killed(mvm)) { 3411 + if (!test_bit(STATUS_DEVICE_ENABLED, &mvm->trans->status)) { 3412 3412 ret = 0; 3413 3413 goto out; 3414 3414 }
+11 -19
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 2060 2060 *status = IWL_MVM_QUEUE_FREE; 2061 2061 } 2062 2062 2063 - if (vif->type == NL80211_IFTYPE_STATION) { 2063 + if (vif->type == NL80211_IFTYPE_STATION && 2064 + mvm_link->ap_sta_id == sta_id) { 2064 2065 /* if associated - we can't remove the AP STA now */ 2065 2066 if (vif->cfg.assoc) 2066 2067 return true; ··· 2099 2098 return ret; 2100 2099 2101 2100 /* flush its queues here since we are freeing mvm_sta */ 2102 - ret = iwl_mvm_flush_sta(mvm, mvm_sta, false); 2101 + ret = iwl_mvm_flush_sta(mvm, mvm_sta->deflink.sta_id, 2102 + mvm_sta->tfd_queue_msk); 2103 2103 if (ret) 2104 2104 return ret; 2105 2105 if (iwl_mvm_has_new_tx_api(mvm)) { ··· 2411 2409 2412 2410 lockdep_assert_held(&mvm->mutex); 2413 2411 2414 - iwl_mvm_flush_sta(mvm, &mvmvif->deflink.bcast_sta, true); 2412 + iwl_mvm_flush_sta(mvm, mvmvif->deflink.bcast_sta.sta_id, 2413 + mvmvif->deflink.bcast_sta.tfd_queue_msk); 2415 2414 2416 2415 switch (vif->type) { 2417 2416 case NL80211_IFTYPE_AP: ··· 2668 2665 2669 2666 lockdep_assert_held(&mvm->mutex); 2670 2667 2671 - iwl_mvm_flush_sta(mvm, &mvmvif->deflink.mcast_sta, true); 2668 + iwl_mvm_flush_sta(mvm, mvmvif->deflink.mcast_sta.sta_id, 2669 + mvmvif->deflink.mcast_sta.tfd_queue_msk); 2672 2670 2673 2671 iwl_mvm_disable_txq(mvm, NULL, mvmvif->deflink.mcast_sta.sta_id, 2674 2672 &mvmvif->deflink.cab_queue, 0); ··· 2719 2715 WARN_ON(1); 2720 2716 2721 2717 for (j = 0; j < reorder_buf->buf_size; j++) 2722 - __skb_queue_purge(&entries[j].e.frames); 2723 - /* 2724 - * Prevent timer re-arm. This prevents a very far fetched case 2725 - * where we timed out on the notification. There may be prior 2726 - * RX frames pending in the RX queue before the notification 2727 - * that might get processed between now and the actual deletion 2728 - * and we would re-arm the timer although we are deleting the 2729 - * reorder buffer. 2730 - */ 2731 - reorder_buf->removed = true; 2718 + __skb_queue_purge(&entries[j].frames); 2719 + 2732 2720 spin_unlock_bh(&reorder_buf->lock); 2733 - del_timer_sync(&reorder_buf->reorder_timer); 2734 2721 } 2735 2722 } 2736 2723 ··· 2741 2746 reorder_buf->num_stored = 0; 2742 2747 reorder_buf->head_sn = ssn; 2743 2748 reorder_buf->buf_size = buf_size; 2744 - /* rx reorder timer */ 2745 - timer_setup(&reorder_buf->reorder_timer, 2746 - iwl_mvm_reorder_timer_expired, 0); 2747 2749 spin_lock_init(&reorder_buf->lock); 2748 2750 reorder_buf->mvm = mvm; 2749 2751 reorder_buf->queue = i; 2750 2752 reorder_buf->valid = false; 2751 2753 for (j = 0; j < reorder_buf->buf_size; j++) 2752 - __skb_queue_head_init(&entries[j].e.frames); 2754 + __skb_queue_head_init(&entries[j].frames); 2753 2755 } 2754 2756 } 2755 2757
-7
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 286 286 * 287 287 * @IWL_MVM_RXQ_EMPTY: empty sync notification 288 288 * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA 289 - * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN 290 289 */ 291 290 enum iwl_mvm_rxq_notif_type { 292 291 IWL_MVM_RXQ_EMPTY, 293 292 IWL_MVM_RXQ_NOTIF_DEL_BA, 294 - IWL_MVM_RXQ_NSSN_SYNC, 295 293 }; 296 294 297 295 /** ··· 311 313 312 314 struct iwl_mvm_delba_data { 313 315 u32 baid; 314 - } __packed; 315 - 316 - struct iwl_mvm_nssn_sync_data { 317 - u32 baid; 318 - u32 nssn; 319 316 } __packed; 320 317 321 318 /**
+4 -3
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
··· 2 2 /* 3 3 * Copyright (C) 2014 Intel Mobile Communications GmbH 4 4 * Copyright (C) 2017 Intel Deutschland GmbH 5 - * Copyright (C) 2018-2020, 2022 Intel Corporation 5 + * Copyright (C) 2018-2020, 2022-2023 Intel Corporation 6 6 */ 7 7 #include <linux/etherdevice.h> 8 8 #include "mvm.h" ··· 144 144 } 145 145 146 146 void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw, 147 - struct ieee80211_vif *vif) 147 + struct ieee80211_vif *vif, 148 + unsigned int link_id) 148 149 { 149 150 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 150 151 u32 duration = 2 * vif->bss_conf.dtim_period * vif->bss_conf.beacon_int; ··· 155 154 if (fw_has_capa(&mvm->fw->ucode_capa, 156 155 IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) 157 156 iwl_mvm_schedule_session_protection(mvm, vif, duration, 158 - duration, true); 157 + duration, true, link_id); 159 158 else 160 159 iwl_mvm_protect_session(mvm, vif, duration, 161 160 duration, 100, true);
+165 -33
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
··· 42 42 te_data->uid = 0; 43 43 te_data->id = TE_MAX; 44 44 te_data->vif = NULL; 45 + te_data->link_id = -1; 45 46 } 46 47 47 48 void iwl_mvm_roc_done_wk(struct work_struct *wk) ··· 79 78 */ 80 79 81 80 if (!WARN_ON(!mvm->p2p_device_vif)) { 82 - mvmvif = iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif); 83 - iwl_mvm_flush_sta(mvm, &mvmvif->deflink.bcast_sta, 84 - true); 81 + struct ieee80211_vif *vif = mvm->p2p_device_vif; 82 + 83 + mvmvif = iwl_mvm_vif_from_mac80211(vif); 84 + iwl_mvm_flush_sta(mvm, mvmvif->deflink.bcast_sta.sta_id, 85 + mvmvif->deflink.bcast_sta.tfd_queue_msk); 86 + 87 + if (mvm->mld_api_is_used) { 88 + iwl_mvm_mld_rm_bcast_sta(mvm, vif, 89 + &vif->bss_conf); 90 + 91 + iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 92 + LINK_CONTEXT_MODIFY_ACTIVE, 93 + false); 94 + } else { 95 + iwl_mvm_rm_p2p_bcast_sta(mvm, vif); 96 + iwl_mvm_binding_remove_vif(mvm, vif); 97 + } 98 + 99 + /* Do not remove the PHY context as removing and adding 100 + * a PHY context has timing overheads. Leaving it 101 + * configured in FW would be useful in case the next ROC 102 + * is with the same channel. 103 + */ 85 104 } 86 105 } 87 106 ··· 114 93 */ 115 94 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { 116 95 /* do the same in case of hot spot 2.0 */ 117 - iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true); 96 + iwl_mvm_flush_sta(mvm, mvm->aux_sta.sta_id, 97 + mvm->aux_sta.tfd_queue_msk); 118 98 119 99 if (mvm->mld_api_is_used) { 120 100 iwl_mvm_mld_rm_aux_sta(mvm); ··· 400 378 } 401 379 } 402 380 381 + void iwl_mvm_rx_roc_notif(struct iwl_mvm *mvm, 382 + struct iwl_rx_cmd_buffer *rxb) 383 + { 384 + struct iwl_rx_packet *pkt = rxb_addr(rxb); 385 + struct iwl_roc_notif *notif = (void *)pkt->data; 386 + 387 + if (le32_to_cpu(notif->success) && le32_to_cpu(notif->started) && 388 + le32_to_cpu(notif->activity) == ROC_ACTIVITY_HOTSPOT) { 389 + set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); 390 + ieee80211_ready_on_channel(mvm->hw); 391 + } else { 392 + iwl_mvm_roc_finished(mvm); 393 + ieee80211_remain_on_channel_expired(mvm->hw); 394 + } 395 + } 396 + 403 397 /* 404 398 * Handle A Aux ROC time event 405 399 */ ··· 689 651 } 690 652 } 691 653 692 - static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm, 693 - struct iwl_mvm_vif *mvmvif, 694 - u32 id) 654 + /* Determine whether mac or link id should be used, and validate the link id */ 655 + static int iwl_mvm_get_session_prot_id(struct iwl_mvm *mvm, 656 + struct ieee80211_vif *vif, 657 + u32 link_id) 695 658 { 659 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 660 + int ver = iwl_fw_lookup_cmd_ver(mvm->fw, 661 + WIDE_ID(MAC_CONF_GROUP, 662 + SESSION_PROTECTION_CMD), 1); 663 + 664 + if (ver < 2) 665 + return mvmvif->id; 666 + 667 + if (WARN(link_id < 0 || !mvmvif->link[link_id], 668 + "Invalid link ID for session protection: %u\n", link_id)) 669 + return -EINVAL; 670 + 671 + if (WARN(ieee80211_vif_is_mld(vif) && 672 + !(vif->active_links & BIT(link_id)), 673 + "Session Protection on an inactive link: %u\n", link_id)) 674 + return -EINVAL; 675 + 676 + return mvmvif->link[link_id]->fw_link_id; 677 + } 678 + 679 + static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm, 680 + struct ieee80211_vif *vif, 681 + u32 id, u32 link_id) 682 + { 683 + int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, link_id); 696 684 struct iwl_mvm_session_prot_cmd cmd = { 697 - .id_and_color = 698 - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 699 - mvmvif->color)), 685 + .id_and_color = cpu_to_le32(mac_link_id), 700 686 .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE), 701 687 .conf_id = cpu_to_le32(id), 702 688 }; 703 689 int ret; 690 + 691 + if (mac_link_id < 0) 692 + return; 704 693 705 694 ret = iwl_mvm_send_cmd_pdu(mvm, 706 695 WIDE_ID(MAC_CONF_GROUP, SESSION_PROTECTION_CMD), ··· 742 677 u32 *uid) 743 678 { 744 679 u32 id; 680 + struct ieee80211_vif *vif = te_data->vif; 745 681 struct iwl_mvm_vif *mvmvif; 746 682 enum nl80211_iftype iftype; 683 + unsigned int link_id; 747 684 748 - if (!te_data->vif) 685 + if (!vif) 749 686 return false; 750 687 751 688 mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); ··· 762 695 /* Save time event uid before clearing its data */ 763 696 *uid = te_data->uid; 764 697 id = te_data->id; 698 + link_id = te_data->link_id; 765 699 766 700 /* 767 701 * The clear_data function handles time events that were already removed ··· 780 712 id != HOT_SPOT_CMD) { 781 713 if (mvmvif && id < SESSION_PROTECT_CONF_MAX_ID) { 782 714 /* Session protection is still ongoing. Cancel it */ 783 - iwl_mvm_cancel_session_protection(mvm, mvmvif, id); 715 + iwl_mvm_cancel_session_protection(mvm, vif, id, 716 + link_id); 784 717 if (iftype == NL80211_IFTYPE_P2P_DEVICE) { 785 718 iwl_mvm_p2p_roc_finished(mvm); 786 719 } ··· 898 829 { 899 830 struct iwl_rx_packet *pkt = rxb_addr(rxb); 900 831 struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; 832 + unsigned int ver = 833 + iwl_fw_lookup_cmd_ver(mvm->fw, 834 + WIDE_ID(MAC_CONF_GROUP, 835 + SESSION_PROTECTION_CMD), 2); 836 + int id = le32_to_cpu(notif->mac_link_id); 901 837 struct ieee80211_vif *vif; 902 838 struct iwl_mvm_vif *mvmvif; 839 + unsigned int notif_link_id; 903 840 904 841 rcu_read_lock(); 905 - vif = iwl_mvm_rcu_dereference_vif_id(mvm, le32_to_cpu(notif->mac_id), 906 - true); 842 + 843 + if (ver <= 2) { 844 + vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); 845 + } else { 846 + struct ieee80211_bss_conf *link_conf = 847 + iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, true); 848 + 849 + if (!link_conf) 850 + goto out_unlock; 851 + 852 + notif_link_id = link_conf->link_id; 853 + vif = link_conf->vif; 854 + } 907 855 908 856 if (!vif) 909 857 goto out_unlock; 910 858 911 859 mvmvif = iwl_mvm_vif_from_mac80211(vif); 860 + 861 + if (WARN(ver > 2 && mvmvif->time_event_data.link_id >= 0 && 862 + mvmvif->time_event_data.link_id != notif_link_id, 863 + "SESION_PROTECTION_NOTIF was received for link %u, while the current time event is on link %u\n", 864 + notif_link_id, mvmvif->time_event_data.link_id)) 865 + goto out_unlock; 912 866 913 867 /* The vif is not a P2P_DEVICE, maintain its time_event_data */ 914 868 if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { ··· 972 880 if (!le32_to_cpu(notif->status) || !le32_to_cpu(notif->start)) { 973 881 /* End TE, notify mac80211 */ 974 882 mvmvif->time_event_data.id = SESSION_PROTECT_CONF_MAX_ID; 975 - ieee80211_remain_on_channel_expired(mvm->hw); 976 883 iwl_mvm_p2p_roc_finished(mvm); 884 + ieee80211_remain_on_channel_expired(mvm->hw); 977 885 } else if (le32_to_cpu(notif->start)) { 978 886 if (WARN_ON(mvmvif->time_event_data.id != 979 887 le32_to_cpu(notif->conf_id))) ··· 995 903 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 996 904 struct iwl_mvm_session_prot_cmd cmd = { 997 905 .id_and_color = 998 - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 999 - mvmvif->color)), 906 + cpu_to_le32(iwl_mvm_get_session_prot_id(mvm, vif, 0)), 1000 907 .action = cpu_to_le32(FW_CTXT_ACTION_ADD), 1001 908 .duration_tu = cpu_to_le32(MSEC_TO_TU(duration)), 1002 909 }; ··· 1005 914 /* The time_event_data.id field is reused to save session 1006 915 * protection's configuration. 1007 916 */ 917 + 918 + mvmvif->time_event_data.link_id = 0; 919 + 1008 920 switch (type) { 1009 921 case IEEE80211_ROC_TYPE_NORMAL: 1010 922 mvmvif->time_event_data.id = ··· 1124 1030 __iwl_mvm_remove_time_event(mvm, te_data, &uid); 1125 1031 } 1126 1032 1033 + static void iwl_mvm_roc_rm_cmd(struct iwl_mvm *mvm, u32 activity) 1034 + { 1035 + int ret; 1036 + struct iwl_roc_req roc_cmd = { 1037 + .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE), 1038 + .activity = cpu_to_le32(activity), 1039 + }; 1040 + 1041 + lockdep_assert_held(&mvm->mutex); 1042 + ret = iwl_mvm_send_cmd_pdu(mvm, 1043 + WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 1044 + 0, sizeof(roc_cmd), &roc_cmd); 1045 + WARN_ON(ret); 1046 + } 1047 + 1048 + static void iwl_mvm_roc_station_remove(struct iwl_mvm *mvm, 1049 + struct iwl_mvm_vif *mvmvif) 1050 + { 1051 + u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, ROC_CMD); 1052 + u8 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1053 + IWL_FW_CMD_VER_UNKNOWN); 1054 + 1055 + if (fw_ver == IWL_FW_CMD_VER_UNKNOWN) 1056 + iwl_mvm_remove_aux_roc_te(mvm, mvmvif, 1057 + &mvmvif->hs_time_event_data); 1058 + else if (fw_ver == 3) 1059 + iwl_mvm_roc_rm_cmd(mvm, ROC_ACTIVITY_HOTSPOT); 1060 + else 1061 + IWL_ERR(mvm, "ROC command version %d mismatch!\n", fw_ver); 1062 + } 1063 + 1127 1064 void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1128 1065 { 1129 1066 struct iwl_mvm_vif *mvmvif; ··· 1165 1040 mvmvif = iwl_mvm_vif_from_mac80211(vif); 1166 1041 1167 1042 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 1168 - iwl_mvm_cancel_session_protection(mvm, mvmvif, 1169 - mvmvif->time_event_data.id); 1043 + iwl_mvm_cancel_session_protection(mvm, vif, 1044 + mvmvif->time_event_data.id, 1045 + mvmvif->time_event_data.link_id); 1170 1046 iwl_mvm_p2p_roc_finished(mvm); 1171 1047 } else { 1172 - iwl_mvm_remove_aux_roc_te(mvm, mvmvif, 1173 - &mvmvif->hs_time_event_data); 1048 + iwl_mvm_roc_station_remove(mvm, mvmvif); 1174 1049 iwl_mvm_roc_finished(mvm); 1175 1050 } 1176 1051 ··· 1289 1164 void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, 1290 1165 struct ieee80211_vif *vif, 1291 1166 u32 duration, u32 min_duration, 1292 - bool wait_for_notif) 1167 + bool wait_for_notif, 1168 + unsigned int link_id) 1293 1169 { 1294 1170 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1295 1171 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; 1296 1172 const u16 notif[] = { WIDE_ID(MAC_CONF_GROUP, SESSION_PROTECTION_NOTIF) }; 1297 1173 struct iwl_notification_wait wait_notif; 1174 + int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, link_id); 1298 1175 struct iwl_mvm_session_prot_cmd cmd = { 1299 - .id_and_color = 1300 - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 1301 - mvmvif->color)), 1176 + .id_and_color = cpu_to_le32(mac_link_id), 1302 1177 .action = cpu_to_le32(FW_CTXT_ACTION_ADD), 1303 1178 .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), 1304 1179 .duration_tu = cpu_to_le32(MSEC_TO_TU(duration)), 1305 1180 }; 1306 1181 1182 + if (mac_link_id < 0) 1183 + return; 1184 + 1307 1185 lockdep_assert_held(&mvm->mutex); 1308 1186 1309 1187 spin_lock_bh(&mvm->time_event_lock); 1310 - if (te_data->running && 1188 + if (te_data->running && te_data->link_id == link_id && 1311 1189 time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) { 1312 1190 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", 1313 1191 jiffies_to_msecs(te_data->end_jiffies - jiffies)); ··· 1327 1199 te_data->id = le32_to_cpu(cmd.conf_id); 1328 1200 te_data->duration = le32_to_cpu(cmd.duration_tu); 1329 1201 te_data->vif = vif; 1202 + te_data->link_id = link_id; 1330 1203 spin_unlock_bh(&mvm->time_event_lock); 1331 1204 1332 1205 IWL_DEBUG_TE(mvm, "Add new session protection, duration %d TU\n", ··· 1337 1208 if (iwl_mvm_send_cmd_pdu(mvm, 1338 1209 WIDE_ID(MAC_CONF_GROUP, SESSION_PROTECTION_CMD), 1339 1210 0, sizeof(cmd), &cmd)) { 1340 - IWL_ERR(mvm, 1341 - "Couldn't send the SESSION_PROTECTION_CMD\n"); 1342 - spin_lock_bh(&mvm->time_event_lock); 1343 - iwl_mvm_te_clear_data(mvm, te_data); 1344 - spin_unlock_bh(&mvm->time_event_lock); 1211 + goto send_cmd_err; 1345 1212 } 1346 1213 1347 1214 return; ··· 1350 1225 if (iwl_mvm_send_cmd_pdu(mvm, 1351 1226 WIDE_ID(MAC_CONF_GROUP, SESSION_PROTECTION_CMD), 1352 1227 0, sizeof(cmd), &cmd)) { 1353 - IWL_ERR(mvm, 1354 - "Couldn't send the SESSION_PROTECTION_CMD\n"); 1355 1228 iwl_remove_notification(&mvm->notif_wait, &wait_notif); 1229 + goto send_cmd_err; 1356 1230 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_notif, 1357 1231 TU_TO_JIFFIES(100))) { 1358 1232 IWL_ERR(mvm, 1359 1233 "Failed to protect session until session protection\n"); 1360 1234 } 1235 + return; 1236 + 1237 + send_cmd_err: 1238 + IWL_ERR(mvm, 1239 + "Couldn't send the SESSION_PROTECTION_CMD\n"); 1240 + spin_lock_bh(&mvm->time_event_lock); 1241 + iwl_mvm_te_clear_data(mvm, te_data); 1242 + spin_unlock_bh(&mvm->time_event_lock); 1361 1243 }
+11 -1
drivers/net/wireless/intel/iwlwifi/mvm/time-event.h
··· 101 101 struct iwl_rx_cmd_buffer *rxb); 102 102 103 103 /** 104 + * iwl_mvm_rx_roc_notif - handles %DISCOVERY_ROC_NTF. 105 + * @mvm: the mvm component 106 + * @rxb: RX buffer 107 + */ 108 + void iwl_mvm_rx_roc_notif(struct iwl_mvm *mvm, 109 + struct iwl_rx_cmd_buffer *rxb); 110 + 111 + /** 104 112 * iwl_mvm_start_p2p_roc - start remain on channel for p2p device functionality 105 113 * @mvm: the mvm component 106 114 * @vif: the virtual interface for which the roc is requested. It is assumed ··· 206 198 * @duration: the requested duration of the protection 207 199 * @min_duration: the minimum duration of the protection 208 200 * @wait_for_notif: if true, will block until the start of the protection 201 + * @link_id: The link to schedule a session protection for 209 202 */ 210 203 void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, 211 204 struct ieee80211_vif *vif, 212 205 u32 duration, u32 min_duration, 213 - bool wait_for_notif); 206 + bool wait_for_notif, 207 + unsigned int link_id); 214 208 215 209 /** 216 210 * iwl_mvm_rx_session_protect_notif - handles %SESSION_PROTECTION_NOTIF
-7
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
··· 642 642 int trip, int temp) 643 643 { 644 644 struct iwl_mvm *mvm = thermal_zone_device_priv(device); 645 - struct iwl_mvm_thermal_device *tzone; 646 645 int ret; 647 646 648 647 mutex_lock(&mvm->mutex); ··· 654 655 655 656 if ((temp / 1000) > S16_MAX) { 656 657 ret = -EINVAL; 657 - goto out; 658 - } 659 - 660 - tzone = &mvm->tz_device; 661 - if (!tzone) { 662 - ret = -EIO; 663 658 goto out; 664 659 } 665 660
+6 -20
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 1623 1623 seq_ctl = le16_to_cpu(tx_resp->seq_ctl); 1624 1624 1625 1625 /* we can free until ssn % q.n_bd not inclusive */ 1626 - iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs); 1626 + iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs, false); 1627 1627 1628 1628 while (!skb_queue_empty(&skbs)) { 1629 1629 struct sk_buff *skb = __skb_dequeue(&skbs); ··· 1724 1724 RS_DRV_DATA_PACK(lq_color, tx_resp->reduced_tpc); 1725 1725 1726 1726 if (likely(!iwl_mvm_time_sync_frame(mvm, skb, hdr->addr1))) 1727 - ieee80211_tx_status(mvm->hw, skb); 1727 + ieee80211_tx_status_skb(mvm->hw, skb); 1728 1728 } 1729 1729 1730 1730 /* This is an aggregation queue or might become one, so we use ··· 1975 1975 * block-ack window (we assume that they've been successfully 1976 1976 * transmitted ... if not, it's too late anyway). 1977 1977 */ 1978 - iwl_trans_reclaim(mvm->trans, txq, index, &reclaimed_skbs); 1978 + iwl_trans_reclaim(mvm->trans, txq, index, &reclaimed_skbs, is_flush); 1979 1979 1980 1980 skb_queue_walk(&reclaimed_skbs, skb) { 1981 1981 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 2080 2080 2081 2081 while (!skb_queue_empty(&reclaimed_skbs)) { 2082 2082 skb = __skb_dequeue(&reclaimed_skbs); 2083 - ieee80211_tx_status(mvm->hw, skb); 2083 + ieee80211_tx_status_skb(mvm->hw, skb); 2084 2084 } 2085 2085 } 2086 2086 ··· 2317 2317 return ret; 2318 2318 } 2319 2319 2320 - int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal) 2320 + int iwl_mvm_flush_sta(struct iwl_mvm *mvm, u32 sta_id, u32 tfd_queue_mask) 2321 2321 { 2322 - u32 sta_id, tfd_queue_msk; 2323 - 2324 - if (internal) { 2325 - struct iwl_mvm_int_sta *int_sta = sta; 2326 - 2327 - sta_id = int_sta->sta_id; 2328 - tfd_queue_msk = int_sta->tfd_queue_msk; 2329 - } else { 2330 - struct iwl_mvm_sta *mvm_sta = sta; 2331 - 2332 - sta_id = mvm_sta->deflink.sta_id; 2333 - tfd_queue_msk = mvm_sta->tfd_queue_msk; 2334 - } 2335 - 2336 2322 if (iwl_mvm_has_new_tx_api(mvm)) 2337 2323 return iwl_mvm_flush_sta_tids(mvm, sta_id, 0xffff); 2338 2324 2339 - return iwl_mvm_flush_tx_path(mvm, tfd_queue_msk); 2325 + return iwl_mvm_flush_tx_path(mvm, tfd_queue_mask); 2340 2326 }
+61
drivers/net/wireless/intel/iwlwifi/mvm/utils.c
··· 342 342 return true; 343 343 } 344 344 345 + static int iwl_mvm_request_system_statistics(struct iwl_mvm *mvm, bool clear, 346 + u8 cmd_ver) 347 + { 348 + struct iwl_system_statistics_cmd system_cmd = { 349 + .cfg_mask = clear ? 350 + cpu_to_le32(IWL_STATS_CFG_FLG_ON_DEMAND_NTFY_MSK) : 351 + cpu_to_le32(IWL_STATS_CFG_FLG_RESET_MSK | 352 + IWL_STATS_CFG_FLG_ON_DEMAND_NTFY_MSK), 353 + .type_id_mask = cpu_to_le32(IWL_STATS_NTFY_TYPE_ID_OPER | 354 + IWL_STATS_NTFY_TYPE_ID_OPER_PART1), 355 + }; 356 + struct iwl_host_cmd cmd = { 357 + .id = WIDE_ID(SYSTEM_GROUP, SYSTEM_STATISTICS_CMD), 358 + .len[0] = sizeof(system_cmd), 359 + .data[0] = &system_cmd, 360 + }; 361 + struct iwl_notification_wait stats_wait; 362 + static const u16 stats_complete[] = { 363 + WIDE_ID(SYSTEM_GROUP, SYSTEM_STATISTICS_END_NOTIF), 364 + }; 365 + int ret; 366 + 367 + if (cmd_ver != 1) { 368 + IWL_FW_CHECK_FAILED(mvm, 369 + "Invalid system statistics command version:%d\n", 370 + cmd_ver); 371 + return -EOPNOTSUPP; 372 + } 373 + 374 + iwl_init_notification_wait(&mvm->notif_wait, &stats_wait, 375 + stats_complete, ARRAY_SIZE(stats_complete), 376 + NULL, NULL); 377 + 378 + mvm->statistics_clear = clear; 379 + ret = iwl_mvm_send_cmd(mvm, &cmd); 380 + if (ret) { 381 + iwl_remove_notification(&mvm->notif_wait, &stats_wait); 382 + return ret; 383 + } 384 + 385 + /* 500ms for OPERATIONAL, PART1 and END notification should be enough 386 + * for FW to collect data from all LMACs and send 387 + * STATISTICS_NOTIFICATION to host 388 + */ 389 + ret = iwl_wait_notification(&mvm->notif_wait, &stats_wait, HZ / 2); 390 + if (ret) 391 + return ret; 392 + 393 + if (clear) 394 + iwl_mvm_accu_radio_stats(mvm); 395 + 396 + return ret; 397 + } 398 + 345 399 int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear) 346 400 { 347 401 struct iwl_statistics_cmd scmd = { ··· 407 353 .len[0] = sizeof(scmd), 408 354 .data[0] = &scmd, 409 355 }; 356 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, 357 + WIDE_ID(SYSTEM_GROUP, 358 + SYSTEM_STATISTICS_CMD), 359 + IWL_FW_CMD_VER_UNKNOWN); 410 360 int ret; 361 + 362 + if (cmd_ver != IWL_FW_CMD_VER_UNKNOWN) 363 + return iwl_mvm_request_system_statistics(mvm, clear, cmd_ver); 411 364 412 365 /* From version 15 - STATISTICS_NOTIFICATION, the reply for 413 366 * STATISTICS_CMD is empty, and the response is with
+2 -2
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2021 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 1134 1134 1135 1135 /* Enable access to peripheral registers */ 1136 1136 val = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG); 1137 - val |= ENABLE_WFPM; 1137 + val |= WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK; 1138 1138 iwl_write_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG, val); 1139 1139 1140 1140 /* Read crf info */
+5 -1
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
··· 161 161 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 162 162 IWL_DEBUG_INFO(trans, 163 163 "DEVICE_ENABLED bit was set and is now cleared\n"); 164 + iwl_pcie_synchronize_irqs(trans); 164 165 iwl_pcie_rx_napi_sync(trans); 165 166 iwl_txq_gen2_tx_free(trans); 166 167 iwl_pcie_rx_stop(trans); ··· 231 230 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 232 231 int queue_size = max_t(u32, IWL_CMD_QUEUE_SIZE, 233 232 trans->cfg->min_txq_size); 233 + int ret; 234 234 235 235 /* TODO: most of the logic can be removed in A0 - but not in Z0 */ 236 236 spin_lock_bh(&trans_pcie->irq_lock); 237 - iwl_pcie_gen2_apm_init(trans); 237 + ret = iwl_pcie_gen2_apm_init(trans); 238 238 spin_unlock_bh(&trans_pcie->irq_lock); 239 + if (ret) 240 + return ret; 239 241 240 242 iwl_op_mode_nic_config(trans->op_mode); 241 243
+1
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 1264 1264 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 1265 1265 IWL_DEBUG_INFO(trans, 1266 1266 "DEVICE_ENABLED bit was set and is now cleared\n"); 1267 + iwl_pcie_synchronize_irqs(trans); 1267 1268 iwl_pcie_rx_napi_sync(trans); 1268 1269 iwl_pcie_tx_stop(trans); 1269 1270 iwl_pcie_rx_stop(trans);
+5 -4
drivers/net/wireless/intel/iwlwifi/queue/tx.c
··· 1575 1575 1576 1576 /* Frees buffers until index _not_ inclusive */ 1577 1577 void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn, 1578 - struct sk_buff_head *skbs) 1578 + struct sk_buff_head *skbs, bool is_flush) 1579 1579 { 1580 1580 struct iwl_txq *txq = trans->txqs.txq[txq_id]; 1581 1581 int tfd_num, read_ptr, last_to_free; ··· 1650 1650 if (iwl_txq_space(trans, txq) > txq->low_mark && 1651 1651 test_bit(txq_id, trans->txqs.queue_stopped)) { 1652 1652 struct sk_buff_head overflow_skbs; 1653 + struct sk_buff *skb; 1653 1654 1654 1655 __skb_queue_head_init(&overflow_skbs); 1655 - skb_queue_splice_init(&txq->overflow_q, &overflow_skbs); 1656 + skb_queue_splice_init(&txq->overflow_q, 1657 + is_flush ? skbs : &overflow_skbs); 1656 1658 1657 1659 /* 1658 1660 * We are going to transmit from the overflow queue. ··· 1674 1672 */ 1675 1673 spin_unlock_bh(&txq->lock); 1676 1674 1677 - while (!skb_queue_empty(&overflow_skbs)) { 1678 - struct sk_buff *skb = __skb_dequeue(&overflow_skbs); 1675 + while ((skb = __skb_dequeue(&overflow_skbs))) { 1679 1676 struct iwl_device_tx_cmd *dev_cmd_ptr; 1680 1677 1681 1678 dev_cmd_ptr = *(void **)((u8 *)skb->cb +
+1 -1
drivers/net/wireless/intel/iwlwifi/queue/tx.h
··· 181 181 struct iwl_txq *txq, u16 byte_cnt, 182 182 int num_tbs); 183 183 void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn, 184 - struct sk_buff_head *skbs); 184 + struct sk_buff_head *skbs, bool is_flush); 185 185 void iwl_txq_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr); 186 186 void iwl_trans_txq_freeze_timer(struct iwl_trans *trans, unsigned long txqs, 187 187 bool freeze);
+3 -3
drivers/net/wireless/legacy/ray_cs.c
··· 348 348 { 349 349 int ret = 0; 350 350 int i; 351 - struct net_device *dev = (struct net_device *)link->priv; 351 + struct net_device *dev = link->priv; 352 352 ray_dev_t *local = netdev_priv(dev); 353 353 354 354 dev_dbg(&link->dev, "ray_config\n"); ··· 1830 1830 =============================================================================*/ 1831 1831 static irqreturn_t ray_interrupt(int irq, void *dev_id) 1832 1832 { 1833 - struct net_device *dev = (struct net_device *)dev_id; 1833 + struct net_device *dev = dev_id; 1834 1834 struct pcmcia_device *link; 1835 1835 ray_dev_t *local; 1836 1836 struct ccs __iomem *pccs; ··· 2567 2567 link = this_device; 2568 2568 if (!link) 2569 2569 return 0; 2570 - dev = (struct net_device *)link->priv; 2570 + dev = link->priv; 2571 2571 if (!dev) 2572 2572 return 0; 2573 2573 local = netdev_priv(dev);
+3
drivers/net/wireless/mediatek/mt76/mt7921/init.c
··· 88 88 } 89 89 90 90 sband = wiphy->bands[NL80211_BAND_6GHZ]; 91 + if (!sband) 92 + return; 93 + 91 94 band_np = np ? of_get_child_by_name(np, "txpower-6g") : NULL; 92 95 for (i = 0; i < sband->n_channels; i++) { 93 96 ch = &sband->channels[i];
+1 -1
drivers/net/wireless/mediatek/mt7601u/tx.c
··· 110 110 info->flags |= IEEE80211_TX_STAT_ACK; 111 111 112 112 spin_lock_bh(&dev->mac_lock); 113 - ieee80211_tx_status(dev->hw, skb); 113 + ieee80211_tx_status_skb(dev->hw, skb); 114 114 spin_unlock_bh(&dev->mac_lock); 115 115 } 116 116
+1 -1
drivers/net/wireless/microchip/wilc1000/wlan.c
··· 1492 1492 } 1493 1493 1494 1494 if (!wilc->vmm_table) 1495 - wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL); 1495 + wilc->vmm_table = kcalloc(WILC_VMM_TBL_SIZE, sizeof(u32), GFP_KERNEL); 1496 1496 1497 1497 if (!wilc->vmm_table) { 1498 1498 ret = -ENOBUFS;
+18
drivers/net/wireless/ralink/rt2x00/rt2800.h
··· 871 871 #define LED_CFG_LED_POLAR FIELD32(0x40000000) 872 872 873 873 /* 874 + * AMPDU_MAX_LEN_20M1S: Per MCS max A-MPDU length, 20 MHz, MCS 0-7 875 + * AMPDU_MAX_LEN_20M2S: Per MCS max A-MPDU length, 20 MHz, MCS 8-15 876 + * AMPDU_MAX_LEN_40M1S: Per MCS max A-MPDU length, 40 MHz, MCS 0-7 877 + * AMPDU_MAX_LEN_40M2S: Per MCS max A-MPDU length, 40 MHz, MCS 8-15 878 + * Maximum A-MPDU length = 2^(AMPDU_MAX - 5) kilobytes 879 + */ 880 + #define AMPDU_MAX_LEN_20M1S 0x1030 881 + #define AMPDU_MAX_LEN_20M2S 0x1034 882 + #define AMPDU_MAX_LEN_40M1S 0x1038 883 + #define AMPDU_MAX_LEN_40M2S 0x103C 884 + 885 + /* 874 886 * AMPDU_BA_WINSIZE: Force BlockAck window size 875 887 * FORCE_WINSIZE_ENABLE: 876 888 * 0: Disable forcing of BlockAck window size ··· 1556 1544 * EXP_ACK_TIME: 1557 1545 */ 1558 1546 #define EXP_ACK_TIME 0x1380 1547 + 1548 + /* 1549 + * HT_FBK_TO_LEGACY: Enable/Disable HT/RTS fallback to OFDM/CCK rate 1550 + * Not available for legacy SoCs 1551 + */ 1552 + #define HT_FBK_TO_LEGACY 0x1384 1559 1553 1560 1554 /* TX_PWR_CFG_5 */ 1561 1555 #define TX_PWR_CFG_5 0x1384
+190 -110
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
··· 1237 1237 } 1238 1238 EXPORT_SYMBOL_GPL(rt2800_txdone_nostatus); 1239 1239 1240 - static int rt2800_check_hung(struct data_queue *queue) 1240 + static bool rt2800_check_hung(struct data_queue *queue) 1241 1241 { 1242 1242 unsigned int cur_idx = rt2800_drv_get_dma_done(queue); 1243 1243 1244 - if (queue->wd_idx != cur_idx) 1244 + if (queue->wd_idx != cur_idx) { 1245 + queue->wd_idx = cur_idx; 1245 1246 queue->wd_count = 0; 1246 - else 1247 + } else 1247 1248 queue->wd_count++; 1248 1249 1249 1250 return queue->wd_count > 16; ··· 1281 1280 case QID_MGMT: 1282 1281 if (rt2x00queue_empty(queue)) 1283 1282 continue; 1284 - hung_tx = rt2800_check_hung(queue); 1283 + hung_tx = hung_tx || rt2800_check_hung(queue); 1285 1284 break; 1286 1285 case QID_RX: 1287 1286 /* For station mode we should reactive at least ··· 1290 1289 */ 1291 1290 if (rt2x00dev->intf_sta_count == 0) 1292 1291 continue; 1293 - hung_rx = rt2800_check_hung(queue); 1292 + hung_rx = hung_rx || rt2800_check_hung(queue); 1294 1293 break; 1295 1294 default: 1296 1295 break; ··· 1303 1302 if (hung_rx) 1304 1303 rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); 1305 1304 1306 - if (hung_tx || hung_rx) 1305 + if (hung_tx || hung_rx) { 1306 + queue_for_each(rt2x00dev, queue) 1307 + queue->wd_count = 0; 1308 + 1307 1309 ieee80211_restart_hw(rt2x00dev->hw); 1310 + } 1308 1311 } 1309 1312 EXPORT_SYMBOL_GPL(rt2800_watchdog); 1310 1313 ··· 3861 3856 rfcsr |= tx_agc_fc; 3862 3857 rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); 3863 3858 } 3864 - 3865 - if (conf_is_ht40(conf)) { 3866 - rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); 3867 - rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); 3868 - } else { 3869 - rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); 3870 - rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); 3871 - } 3872 3859 } 3873 3860 3874 3861 static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, ··· 4429 4432 usleep_range(1000, 1500); 4430 4433 } 4431 4434 4432 - if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { 4433 - reg = 0x10; 4434 - if (!conf_is_ht40(conf)) { 4435 - if (rt2x00_rt(rt2x00dev, RT6352) && 4436 - rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 4437 - reg |= 0x5; 4438 - } else { 4439 - reg |= 0xa; 4440 - } 4441 - } 4442 - rt2800_bbp_write(rt2x00dev, 195, 141); 4443 - rt2800_bbp_write(rt2x00dev, 196, reg); 4435 + if (rt2x00_rt(rt2x00dev, RT5592)) { 4436 + bbp = conf_is_ht40(conf) ? 0x10 : 0x1a; 4437 + rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); 4444 4438 4445 - /* AGC init. 4446 - * Despite the vendor driver using different values here for 4447 - * RT6352 chip, we use 0x1c for now. This may have to be changed 4448 - * once TSSI got implemented. 4449 - */ 4450 - reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; 4451 - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); 4439 + bbp = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; 4440 + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); 4452 4441 4453 - if (rt2x00_rt(rt2x00dev, RT5592)) 4454 - rt2800_iq_calibrate(rt2x00dev, rf->channel); 4442 + rt2800_iq_calibrate(rt2x00dev, rf->channel); 4455 4443 } 4456 4444 4457 4445 if (rt2x00_rt(rt2x00dev, RT6352)) { 4458 - if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, 4459 - &rt2x00dev->cap_flags)) { 4460 - reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); 4461 - reg |= 0x00000101; 4462 - rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); 4446 + /* BBP for GLRT BW */ 4447 + bbp = conf_is_ht40(conf) ? 4448 + 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? 4449 + 0x15 : 0x1a; 4450 + rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); 4463 4451 4464 - reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); 4465 - reg |= 0x00000101; 4466 - rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); 4452 + bbp = conf_is_ht40(conf) ? 0x2f : 0x40; 4453 + rt2800_bbp_glrt_write(rt2x00dev, 157, bbp); 4467 4454 4468 - rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); 4469 - rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); 4470 - rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); 4471 - rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); 4472 - rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); 4473 - rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); 4474 - rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); 4475 - rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); 4476 - rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); 4477 - rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); 4478 - rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); 4479 - rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); 4480 - rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); 4481 - rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); 4482 - rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); 4483 - rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); 4484 - 4485 - rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 4486 - 0x36303636); 4487 - rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 4488 - 0x6C6C6B6C); 4489 - rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 4490 - 0x6C6C6B6C); 4455 + if (rt2x00dev->default_ant.rx_chain_num == 1) { 4456 + rt2800_bbp_write(rt2x00dev, 91, 0x07); 4457 + rt2800_bbp_write(rt2x00dev, 95, 0x1a); 4458 + rt2800_bbp_glrt_write(rt2x00dev, 128, 0xa0); 4459 + rt2800_bbp_glrt_write(rt2x00dev, 170, 0x12); 4460 + rt2800_bbp_glrt_write(rt2x00dev, 171, 0x10); 4461 + } else { 4462 + rt2800_bbp_write(rt2x00dev, 91, 0x06); 4463 + rt2800_bbp_write(rt2x00dev, 95, 0x9a); 4464 + rt2800_bbp_glrt_write(rt2x00dev, 128, 0xe0); 4465 + rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30); 4466 + rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30); 4491 4467 } 4468 + 4469 + /* AGC init */ 4470 + bbp = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; 4471 + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); 4472 + 4473 + usleep_range(1000, 1500); 4492 4474 } 4493 4475 4494 4476 bbp = rt2800_bbp_read(rt2x00dev, 4); ··· 5577 5601 } 5578 5602 } 5579 5603 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); 5580 - 5581 - if (rt2x00_rt(rt2x00dev, RT6352)) { 5582 - if (rt2x00dev->default_ant.rx_chain_num == 1) { 5583 - rt2800_bbp_write(rt2x00dev, 91, 0x07); 5584 - rt2800_bbp_write(rt2x00dev, 95, 0x1A); 5585 - rt2800_bbp_write(rt2x00dev, 195, 128); 5586 - rt2800_bbp_write(rt2x00dev, 196, 0xA0); 5587 - rt2800_bbp_write(rt2x00dev, 195, 170); 5588 - rt2800_bbp_write(rt2x00dev, 196, 0x12); 5589 - rt2800_bbp_write(rt2x00dev, 195, 171); 5590 - rt2800_bbp_write(rt2x00dev, 196, 0x10); 5591 - } else { 5592 - rt2800_bbp_write(rt2x00dev, 91, 0x06); 5593 - rt2800_bbp_write(rt2x00dev, 95, 0x9A); 5594 - rt2800_bbp_write(rt2x00dev, 195, 128); 5595 - rt2800_bbp_write(rt2x00dev, 196, 0xE0); 5596 - rt2800_bbp_write(rt2x00dev, 195, 170); 5597 - rt2800_bbp_write(rt2x00dev, 196, 0x30); 5598 - rt2800_bbp_write(rt2x00dev, 195, 171); 5599 - rt2800_bbp_write(rt2x00dev, 196, 0x30); 5600 - } 5601 - 5602 - if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 5603 - rt2800_bbp_write(rt2x00dev, 75, 0x68); 5604 - rt2800_bbp_write(rt2x00dev, 76, 0x4C); 5605 - rt2800_bbp_write(rt2x00dev, 79, 0x1C); 5606 - rt2800_bbp_write(rt2x00dev, 80, 0x0C); 5607 - rt2800_bbp_write(rt2x00dev, 82, 0xB6); 5608 - } 5609 - 5610 - /* On 11A, We should delay and wait RF/BBP to be stable 5611 - * and the appropriate time should be 1000 micro seconds 5612 - * 2005/06/05 - On 11G, we also need this delay time. 5613 - * Otherwise it's difficult to pass the WHQL. 5614 - */ 5615 - usleep_range(1000, 1500); 5616 - } 5617 5604 } 5618 5605 EXPORT_SYMBOL_GPL(rt2800_vco_calibration); 5619 5606 ··· 5785 5846 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; 5786 5847 u32 reg; 5787 5848 u16 eeprom; 5849 + u8 bbp; 5788 5850 unsigned int i; 5789 5851 int ret; 5790 5852 ··· 5794 5854 ret = rt2800_drv_init_registers(rt2x00dev); 5795 5855 if (ret) 5796 5856 return ret; 5857 + 5858 + if (rt2x00_rt(rt2x00dev, RT6352)) { 5859 + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x01); 5860 + 5861 + bbp = rt2800_bbp_read(rt2x00dev, 21); 5862 + bbp |= 0x01; 5863 + rt2800_bbp_write(rt2x00dev, 21, bbp); 5864 + bbp = rt2800_bbp_read(rt2x00dev, 21); 5865 + bbp &= (~0x01); 5866 + rt2800_bbp_write(rt2x00dev, 21, bbp); 5867 + 5868 + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); 5869 + } 5797 5870 5798 5871 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); 5799 5872 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); ··· 5961 6008 reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); 5962 6009 rt2x00_set_field32(&reg, TX_ALC_CFG_1_ROS_BUSY_EN, 0); 5963 6010 rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); 6011 + 6012 + rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M1S, 0x77754433); 6013 + rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M2S, 0x77765543); 6014 + rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M1S, 0x77765544); 6015 + rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M2S, 0x77765544); 6016 + 6017 + rt2800_register_write(rt2x00dev, HT_FBK_TO_LEGACY, 0x1010); 6018 + 5964 6019 } else { 5965 6020 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); 5966 6021 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); ··· 7187 7226 rt2800_bbp_dcoc_write(rt2x00dev, 159, 0x64); 7188 7227 7189 7228 rt2800_bbp4_mac_if_ctrl(rt2x00dev); 7229 + 7230 + rt2800_bbp_write(rt2x00dev, 84, 0x19); 7190 7231 } 7191 7232 7192 7233 static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) ··· 10300 10337 rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); 10301 10338 } 10302 10339 10340 + static void rt2800_restore_rf_bbp_rt6352(struct rt2x00_dev *rt2x00dev) 10341 + { 10342 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10343 + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); 10344 + rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); 10345 + } 10346 + 10347 + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 10348 + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); 10349 + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); 10350 + rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); 10351 + } 10352 + 10353 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10354 + rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xd3); 10355 + rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xb3); 10356 + rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xd5); 10357 + rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); 10358 + rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6c); 10359 + rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xfc); 10360 + rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1f); 10361 + rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); 10362 + rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); 10363 + rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xff); 10364 + rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1c); 10365 + rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); 10366 + rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6b); 10367 + rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xf7); 10368 + rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); 10369 + } 10370 + 10371 + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 10372 + rt2800_bbp_write(rt2x00dev, 75, 0x60); 10373 + rt2800_bbp_write(rt2x00dev, 76, 0x44); 10374 + rt2800_bbp_write(rt2x00dev, 79, 0x1c); 10375 + rt2800_bbp_write(rt2x00dev, 80, 0x0c); 10376 + rt2800_bbp_write(rt2x00dev, 82, 0xB6); 10377 + } 10378 + 10379 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10380 + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363a); 10381 + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c666c); 10382 + rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c666c); 10383 + } 10384 + } 10385 + 10386 + static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) 10387 + { 10388 + u32 reg; 10389 + 10390 + if (rt2x00_has_cap_external_pa(rt2x00dev) || 10391 + rt2x00_has_cap_external_lna_bg(rt2x00dev)) 10392 + rt2800_restore_rf_bbp_rt6352(rt2x00dev); 10393 + 10394 + rt2800_r_calibration(rt2x00dev); 10395 + rt2800_rf_self_txdc_cal(rt2x00dev); 10396 + rt2800_rxdcoc_calibration(rt2x00dev); 10397 + rt2800_bw_filter_calibration(rt2x00dev, true); 10398 + rt2800_bw_filter_calibration(rt2x00dev, false); 10399 + rt2800_loft_iq_calibration(rt2x00dev); 10400 + 10401 + /* missing DPD calibration for internal PA devices */ 10402 + 10403 + rt2800_rxdcoc_calibration(rt2x00dev); 10404 + rt2800_rxiq_calibration(rt2x00dev); 10405 + 10406 + if (!rt2x00_has_cap_external_pa(rt2x00dev) && 10407 + !rt2x00_has_cap_external_lna_bg(rt2x00dev)) 10408 + return; 10409 + 10410 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10411 + reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); 10412 + reg |= 0x00000101; 10413 + rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); 10414 + 10415 + reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); 10416 + reg |= 0x00000101; 10417 + rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); 10418 + } 10419 + 10420 + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 10421 + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); 10422 + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); 10423 + rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); 10424 + } 10425 + 10426 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10427 + rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); 10428 + rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); 10429 + rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); 10430 + rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); 10431 + rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xc8); 10432 + rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xa4); 10433 + rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); 10434 + rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); 10435 + rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xc8); 10436 + rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xa4); 10437 + rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); 10438 + rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); 10439 + rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xc8); 10440 + rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xa4); 10441 + rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); 10442 + } 10443 + 10444 + if (rt2x00_has_cap_external_pa(rt2x00dev)) 10445 + rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); 10446 + 10447 + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { 10448 + rt2800_bbp_write(rt2x00dev, 75, 0x68); 10449 + rt2800_bbp_write(rt2x00dev, 76, 0x4c); 10450 + rt2800_bbp_write(rt2x00dev, 79, 0x1c); 10451 + rt2800_bbp_write(rt2x00dev, 80, 0x0c); 10452 + rt2800_bbp_write(rt2x00dev, 82, 0xb6); 10453 + } 10454 + 10455 + if (rt2x00_has_cap_external_pa(rt2x00dev)) { 10456 + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); 10457 + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c6b6c); 10458 + rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c6b6c); 10459 + } 10460 + } 10461 + 10303 10462 static void rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev) 10304 10463 { 10305 10464 /* Initialize RF central register to default value */ ··· 10686 10601 rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); 10687 10602 rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); 10688 10603 10689 - rt2800_r_calibration(rt2x00dev); 10690 - rt2800_rf_self_txdc_cal(rt2x00dev); 10691 - rt2800_rxdcoc_calibration(rt2x00dev); 10692 - rt2800_bw_filter_calibration(rt2x00dev, true); 10693 - rt2800_bw_filter_calibration(rt2x00dev, false); 10694 - rt2800_loft_iq_calibration(rt2x00dev); 10695 - rt2800_rxiq_calibration(rt2x00dev); 10604 + /* Do calibration and init PA/LNA */ 10605 + rt2800_calibration_rt6352(rt2x00dev); 10696 10606 } 10697 10607 10698 10608 static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
+3
drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
··· 760 760 761 761 rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 762 762 763 + if (rt2x00_rt(rt2x00dev, RT6352)) 764 + return 0; 765 + 763 766 reg = 0; 764 767 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 765 768 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
+6
drivers/net/wireless/ralink/rt2x00/rt2x00.h
··· 1263 1263 } 1264 1264 1265 1265 static inline bool 1266 + rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev) 1267 + { 1268 + return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0); 1269 + } 1270 + 1271 + static inline bool 1266 1272 rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev) 1267 1273 { 1268 1274 return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA);
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
··· 533 533 */ 534 534 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { 535 535 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TASKLET_CONTEXT)) 536 - ieee80211_tx_status(rt2x00dev->hw, entry->skb); 536 + ieee80211_tx_status_skb(rt2x00dev->hw, entry->skb); 537 537 else 538 538 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); 539 539 } else {
-6
drivers/net/wireless/realtek/rtlwifi/base.c
··· 1317 1317 struct rtl_priv *rtlpriv = rtl_priv(hw); 1318 1318 __le16 fc = rtl_get_fc(skb); 1319 1319 1320 - if (rtlpriv->dm.supp_phymode_switch && 1321 - mac->link_state < MAC80211_LINKED && 1322 - (ieee80211_is_auth(fc) || ieee80211_is_probe_req(fc))) { 1323 - if (rtlpriv->cfg->ops->chk_switch_dmdp) 1324 - rtlpriv->cfg->ops->chk_switch_dmdp(hw); 1325 - } 1326 1320 if (ieee80211_is_auth(fc)) { 1327 1321 rtl_dbg(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n"); 1328 1322
-16
drivers/net/wireless/realtek/rtlwifi/core.c
··· 662 662 if (mac->act_scanning) 663 663 mac->n_channels++; 664 664 665 - if (rtlpriv->dm.supp_phymode_switch && 666 - mac->link_state < MAC80211_LINKED && 667 - !mac->act_scanning) { 668 - if (rtlpriv->cfg->ops->chk_switch_dmdp) 669 - rtlpriv->cfg->ops->chk_switch_dmdp(hw); 670 - } 671 - 672 665 /* 673 666 *because we should back channel to 674 667 *current_network.chan in scanning, ··· 1190 1197 mac->vendor = PEER_UNKNOWN; 1191 1198 mac->mode = 0; 1192 1199 1193 - if (rtlpriv->dm.supp_phymode_switch) { 1194 - if (rtlpriv->cfg->ops->chk_switch_dmdp) 1195 - rtlpriv->cfg->ops->chk_switch_dmdp(hw); 1196 - } 1197 1200 rtl_dbg(rtlpriv, COMP_MAC80211, DBG_DMESG, 1198 1201 "BSS_CHANGED_UN_ASSOC\n"); 1199 1202 } ··· 1452 1463 else if (rtlpriv->btcoexist.btc_ops) 1453 1464 rtlpriv->btcoexist.btc_ops->btc_scan_notify_wifi_only(rtlpriv, 1454 1465 1); 1455 - 1456 - if (rtlpriv->dm.supp_phymode_switch) { 1457 - if (rtlpriv->cfg->ops->chk_switch_dmdp) 1458 - rtlpriv->cfg->ops->chk_switch_dmdp(hw); 1459 - } 1460 1466 1461 1467 if (mac->link_state == MAC80211_LINKED) { 1462 1468 rtl_lps_leave(hw, true);
+1 -16
drivers/net/wireless/realtek/rtlwifi/ps.c
··· 681 681 ps_work.work); 682 682 struct ieee80211_hw *hw = rtlworks->hw; 683 683 struct rtl_priv *rtlpriv = rtl_priv(hw); 684 - bool ps = false; 685 - 686 - ps = (hw->conf.flags & IEEE80211_CONF_PS); 687 684 688 685 /* we can sleep after ps null send ok */ 689 - if (rtlpriv->psc.state_inap) { 686 + if (rtlpriv->psc.state_inap) 690 687 rtl_swlps_rf_sleep(hw); 691 - 692 - if (rtlpriv->psc.state && !ps) { 693 - rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies - 694 - rtlpriv->psc.last_action); 695 - } 696 - 697 - if (ps) 698 - rtlpriv->psc.last_slept = jiffies; 699 - 700 - rtlpriv->psc.last_action = jiffies; 701 - rtlpriv->psc.state = ps; 702 - } 703 688 } 704 689 705 690 static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
-1
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
··· 102 102 .set_hw_reg = rtl92cu_set_hw_reg, 103 103 .update_rate_tbl = rtl92cu_update_hal_rate_tbl, 104 104 .fill_tx_desc = rtl92cu_tx_fill_desc, 105 - .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, 106 105 .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, 107 106 .query_rx_desc = rtl92cu_rx_query_desc, 108 107 .set_channel_access = rtl92cu_update_channel_access_setting,
-26
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
··· 600 600 rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, "==>\n"); 601 601 } 602 602 603 - void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 *pdesc8, 604 - u32 buffer_len, bool is_pspoll) 605 - { 606 - __le32 *pdesc = (__le32 *)pdesc8; 607 - 608 - /* Clear all status */ 609 - memset(pdesc, 0, RTL_TX_HEADER_SIZE); 610 - set_tx_desc_first_seg(pdesc, 1); /* bFirstSeg; */ 611 - set_tx_desc_last_seg(pdesc, 1); /* bLastSeg; */ 612 - set_tx_desc_offset(pdesc, RTL_TX_HEADER_SIZE); /* Offset = 32 */ 613 - set_tx_desc_pkt_size(pdesc, buffer_len); /* Buffer size + command hdr */ 614 - set_tx_desc_queue_sel(pdesc, QSLT_MGNT); /* Fixed queue of Mgnt queue */ 615 - /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error 616 - * vlaue by Hw. */ 617 - if (is_pspoll) { 618 - set_tx_desc_nav_use_hdr(pdesc, 1); 619 - } else { 620 - set_tx_desc_hwseq_en(pdesc, 1); /* Hw set sequence number */ 621 - set_tx_desc_pkt_id(pdesc, BIT(3)); /* set bit3 to 1. */ 622 - } 623 - set_tx_desc_use_rate(pdesc, 1); /* use data rate which is set by Sw */ 624 - set_tx_desc_own(pdesc, 1); 625 - set_tx_desc_tx_rate(pdesc, DESC_RATE1M); 626 - _rtl_tx_desc_checksum(pdesc); 627 - } 628 - 629 603 void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc8, 630 604 struct sk_buff *skb) 631 605 {
-2
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
··· 394 394 struct sk_buff *skb, 395 395 u8 queue_index, 396 396 struct rtl_tcb_desc *tcb_desc); 397 - void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 *pdesc, 398 - u32 buffer_len, bool ispspoll); 399 397 void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, 400 398 struct sk_buff *skb); 401 399
-1
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
··· 199 199 .get_hw_reg = rtl92ee_get_hw_reg, 200 200 .set_hw_reg = rtl92ee_set_hw_reg, 201 201 .update_rate_tbl = rtl92ee_update_hal_rate_tbl, 202 - .pre_fill_tx_bd_desc = rtl92ee_pre_fill_tx_bd_desc, 203 202 .rx_desc_buff_remained_cnt = rtl92ee_rx_desc_buff_remained_cnt, 204 203 .rx_check_dma_ok = rtl92ee_rx_check_dma_ok, 205 204 .fill_tx_desc = rtl92ee_tx_fill_desc,
+5 -3
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
··· 550 550 return point_diff; 551 551 } 552 552 553 - void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw, 554 - u8 *tx_bd_desc8, u8 *desc8, u8 queue_index, 555 - struct sk_buff *skb, dma_addr_t addr) 553 + static void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw, 554 + u8 *tx_bd_desc8, u8 *desc8, 555 + u8 queue_index, 556 + struct sk_buff *skb, 557 + dma_addr_t addr) 556 558 { 557 559 struct rtl_priv *rtlpriv = rtl_priv(hw); 558 560 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-3
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
··· 720 720 u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, 721 721 u8 queue_index); 722 722 u16 rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 queue_index); 723 - void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw, 724 - u8 *tx_bd_desc, u8 *desc, u8 queue_index, 725 - struct sk_buff *skb, dma_addr_t addr); 726 723 727 724 void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw, 728 725 struct ieee80211_hdr *hdr, u8 *pdesc_tx,
-10
drivers/net/wireless/realtek/rtlwifi/wifi.h
··· 2032 2032 2033 2033 /* for SW LPS*/ 2034 2034 bool sw_ps_enabled; 2035 - bool state; 2036 2035 bool state_inap; 2037 2036 bool multi_buffered; 2038 2037 u16 nullfunc_seq; 2039 2038 unsigned int dtim_counter; 2040 - unsigned int sleep_ms; 2041 2039 unsigned long last_sleep_jiffies; 2042 2040 unsigned long last_awake_jiffies; 2043 2041 unsigned long last_delaylps_stamp_jiffies; 2044 2042 unsigned long last_dtim; 2045 2043 unsigned long last_beacon; 2046 - unsigned long last_action; 2047 - unsigned long last_slept; 2048 2044 2049 2045 /*For P2P PS */ 2050 2046 struct rtl_p2p_ps_info p2p_ps_info; ··· 2227 2231 void (*update_rate_tbl)(struct ieee80211_hw *hw, 2228 2232 struct ieee80211_sta *sta, u8 rssi_leve, 2229 2233 bool update_bw); 2230 - void (*pre_fill_tx_bd_desc)(struct ieee80211_hw *hw, u8 *tx_bd_desc, 2231 - u8 *desc, u8 queue_index, 2232 - struct sk_buff *skb, dma_addr_t addr); 2233 2234 void (*update_rate_mask)(struct ieee80211_hw *hw, u8 rssi_level); 2234 2235 u16 (*rx_desc_buff_remained_cnt)(struct ieee80211_hw *hw, 2235 2236 u8 queue_index); ··· 2239 2246 struct ieee80211_sta *sta, 2240 2247 struct sk_buff *skb, u8 hw_queue, 2241 2248 struct rtl_tcb_desc *ptcb_desc); 2242 - void (*fill_fake_txdesc)(struct ieee80211_hw *hw, u8 *pdesc, 2243 - u32 buffer_len, bool bsspspoll); 2244 2249 void (*fill_tx_cmddesc)(struct ieee80211_hw *hw, u8 *pdesc, 2245 2250 struct sk_buff *skb); 2246 2251 void (*fill_tx_special_desc)(struct ieee80211_hw *hw, ··· 2275 2284 void (*set_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath, 2276 2285 u32 regaddr, u32 bitmask, u32 data); 2277 2286 void (*linked_set_reg)(struct ieee80211_hw *hw); 2278 - void (*chk_switch_dmdp)(struct ieee80211_hw *hw); 2279 2287 void (*dualmac_switch_to_dmdp)(struct ieee80211_hw *hw); 2280 2288 bool (*phy_rf6052_config)(struct ieee80211_hw *hw); 2281 2289 void (*phy_rf6052_set_cck_txpower)(struct ieee80211_hw *hw,
+12
drivers/net/wireless/realtek/rtw88/debug.h
··· 48 48 49 49 #define rtw_dbg(rtwdev, a...) __rtw_dbg(rtwdev, ##a) 50 50 51 + static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev, 52 + enum rtw_debug_mask mask) 53 + { 54 + return !!(rtw_debug_mask & mask); 55 + } 56 + 51 57 #else 52 58 53 59 static inline void rtw_dbg(struct rtw_dev *rtwdev, enum rtw_debug_mask mask, 54 60 const char *fmt, ...) {} 61 + 62 + static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev, 63 + enum rtw_debug_mask mask) 64 + { 65 + return false; 66 + } 55 67 56 68 #endif /* CONFIG_RTW88_DEBUG */ 57 69
+74
drivers/net/wireless/realtek/rtw88/fw.c
··· 17 17 #include "phy.h" 18 18 #include "mac.h" 19 19 20 + static const struct rtw_hw_reg_desc fw_h2c_regs[] = { 21 + {REG_FWIMR, MASKDWORD, "FWIMR"}, 22 + {REG_FWIMR, BIT_FS_H2CCMD_INT_EN, "FWIMR enable"}, 23 + {REG_FWISR, MASKDWORD, "FWISR"}, 24 + {REG_FWISR, BIT_FS_H2CCMD_INT, "FWISR enable"}, 25 + {REG_HMETFR, BIT_INT_BOX_ALL, "BoxBitMap"}, 26 + {REG_HMEBOX0, MASKDWORD, "MSG 0"}, 27 + {REG_HMEBOX0_EX, MASKDWORD, "MSG_EX 0"}, 28 + {REG_HMEBOX1, MASKDWORD, "MSG 1"}, 29 + {REG_HMEBOX1_EX, MASKDWORD, "MSG_EX 1"}, 30 + {REG_HMEBOX2, MASKDWORD, "MSG 2"}, 31 + {REG_HMEBOX2_EX, MASKDWORD, "MSG_EX 2"}, 32 + {REG_HMEBOX3, MASKDWORD, "MSG 3"}, 33 + {REG_HMEBOX3_EX, MASKDWORD, "MSG_EX 3"}, 34 + {REG_FT1IMR, MASKDWORD, "FT1IMR"}, 35 + {REG_FT1IMR, BIT_FS_H2C_CMD_OK_INT_EN, "FT1IMR enable"}, 36 + {REG_FT1ISR, MASKDWORD, "FT1ISR"}, 37 + {REG_FT1ISR, BIT_FS_H2C_CMD_OK_INT, "FT1ISR enable "}, 38 + }; 39 + 40 + static const struct rtw_hw_reg_desc fw_c2h_regs[] = { 41 + {REG_FWIMR, MASKDWORD, "FWIMR"}, 42 + {REG_FWIMR, BIT_FS_H2CCMD_INT_EN, "CPWM"}, 43 + {REG_FWIMR, BIT_FS_HRCV_INT_EN, "HRECV"}, 44 + {REG_FWISR, MASKDWORD, "FWISR"}, 45 + {REG_FWISR, BIT_FS_H2CCMD_INT, "CPWM"}, 46 + {REG_FWISR, BIT_FS_HRCV_INT, "HRECV"}, 47 + {REG_CPWM, MASKDWORD, "REG_CPWM"}, 48 + }; 49 + 50 + static const struct rtw_hw_reg_desc fw_core_regs[] = { 51 + {REG_ARFR2_V1, MASKDWORD, "EPC"}, 52 + {REG_ARFRH2_V1, MASKDWORD, "BADADDR"}, 53 + {REG_ARFR3_V1, MASKDWORD, "CAUSE"}, 54 + {REG_ARFR3_V1, BIT_EXC_CODE, "ExcCode"}, 55 + {REG_ARFRH3_V1, MASKDWORD, "Status"}, 56 + {REG_ARFR4, MASKDWORD, "SP"}, 57 + {REG_ARFRH4, MASKDWORD, "RA"}, 58 + {REG_FW_DBG6, MASKDWORD, "DBG 6"}, 59 + {REG_FW_DBG7, MASKDWORD, "DBG 7"}, 60 + }; 61 + 62 + static void _rtw_fw_dump_dbg_info(struct rtw_dev *rtwdev, 63 + const struct rtw_hw_reg_desc regs[], u32 size) 64 + { 65 + const struct rtw_hw_reg_desc *reg; 66 + u32 val; 67 + int i; 68 + 69 + for (i = 0; i < size; i++) { 70 + reg = &regs[i]; 71 + val = rtw_read32_mask(rtwdev, reg->addr, reg->mask); 72 + 73 + rtw_dbg(rtwdev, RTW_DBG_FW, "[%s]addr:0x%x mask:0x%x value:0x%x\n", 74 + reg->desc, reg->addr, reg->mask, val); 75 + } 76 + } 77 + 78 + void rtw_fw_dump_dbg_info(struct rtw_dev *rtwdev) 79 + { 80 + int i; 81 + 82 + if (!rtw_dbg_is_enabled(rtwdev, RTW_DBG_FW)) 83 + return; 84 + 85 + _rtw_fw_dump_dbg_info(rtwdev, fw_h2c_regs, ARRAY_SIZE(fw_h2c_regs)); 86 + _rtw_fw_dump_dbg_info(rtwdev, fw_c2h_regs, ARRAY_SIZE(fw_c2h_regs)); 87 + for (i = 0 ; i < RTW_DEBUG_DUMP_TIMES; i++) { 88 + rtw_dbg(rtwdev, RTW_DBG_FW, "Firmware Coredump %dth\n", i + 1); 89 + _rtw_fw_dump_dbg_info(rtwdev, fw_core_regs, ARRAY_SIZE(fw_core_regs)); 90 + } 91 + } 92 + 20 93 static void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev, 21 94 struct sk_buff *skb) 22 95 { ··· 422 349 423 350 if (ret) { 424 351 rtw_err(rtwdev, "failed to send h2c command\n"); 352 + rtw_fw_dump_dbg_info(rtwdev); 425 353 return; 426 354 } 427 355
+3
drivers/net/wireless/realtek/rtw88/fw.h
··· 44 44 #define RTW_OLD_PROBE_PG_CNT 2 45 45 #define RTW_PROBE_PG_CNT 4 46 46 47 + #define RTW_DEBUG_DUMP_TIMES 10 48 + 47 49 enum rtw_c2h_cmd_id { 48 50 C2H_CCX_TX_RPT = 0x03, 49 51 C2H_BT_INFO = 0x09, ··· 810 808 return !!(fw->feature_ext & feature); 811 809 } 812 810 811 + void rtw_fw_dump_dbg_info(struct rtw_dev *rtwdev); 813 812 void rtw_fw_c2h_cmd_rx_irqsafe(struct rtw_dev *rtwdev, u32 pkt_offset, 814 813 struct sk_buff *skb); 815 814 void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb);
+6
drivers/net/wireless/realtek/rtw88/main.h
··· 524 524 u32 mask; 525 525 }; 526 526 527 + struct rtw_hw_reg_desc { 528 + u32 addr; 529 + u32 mask; 530 + const char *desc; 531 + }; 532 + 527 533 struct rtw_ltecoex_addr { 528 534 u32 ctrl; 529 535 u32 wdata;
+2
drivers/net/wireless/realtek/rtw88/ps.c
··· 104 104 */ 105 105 WARN(1, "firmware failed to ack driver for %s Deep Power mode\n", 106 106 enter ? "entering" : "leaving"); 107 + rtw_fw_dump_dbg_info(rtwdev); 107 108 } 108 109 } 109 110 EXPORT_SYMBOL(rtw_power_mode_change); ··· 165 164 if (ret) { 166 165 rtw_write32_clr(rtwdev, REG_TCR, BIT_PWRMGT_HWDATA_EN); 167 166 rtw_warn(rtwdev, "firmware failed to leave lps state\n"); 167 + rtw_fw_dump_dbg_info(rtwdev); 168 168 } 169 169 } 170 170
+23
drivers/net/wireless/realtek/rtw88/reg.h
··· 224 224 #define REG_RXFF_BNDY 0x011C 225 225 #define REG_FE1IMR 0x0120 226 226 #define BIT_FS_RXDONE BIT(16) 227 + #define REG_CPWM 0x012C 228 + #define REG_FWIMR 0x0130 229 + #define BIT_FS_H2CCMD_INT_EN BIT(4) 230 + #define BIT_FS_HRCV_INT_EN BIT(5) 231 + #define REG_FWISR 0x0134 232 + #define BIT_FS_H2CCMD_INT BIT(4) 233 + #define BIT_FS_HRCV_INT BIT(5) 227 234 #define REG_PKTBUF_DBG_CTRL 0x0140 228 235 #define REG_C2HEVT 0x01A0 229 236 #define REG_MCUTST_1 0x01C0 230 237 #define REG_MCUTST_II 0x01C4 231 238 #define REG_WOWLAN_WAKE_REASON 0x01C7 232 239 #define REG_HMETFR 0x01CC 240 + #define BIT_INT_BOX0 BIT(0) 241 + #define BIT_INT_BOX1 BIT(1) 242 + #define BIT_INT_BOX2 BIT(2) 243 + #define BIT_INT_BOX3 BIT(3) 244 + #define BIT_INT_BOX_ALL (BIT_INT_BOX0 | BIT_INT_BOX1 | BIT_INT_BOX2 | \ 245 + BIT_INT_BOX3) 233 246 #define REG_HMEBOX0 0x01D0 234 247 #define REG_HMEBOX1 0x01D4 235 248 #define REG_HMEBOX2 0x01D8 ··· 351 338 #define BIT_EN_GNT_BT_AWAKE BIT(3) 352 339 #define BIT_EN_EOF_V1 BIT(2) 353 340 #define REG_DATA_SC 0x0483 341 + #define REG_ARFR2_V1 0x048C 342 + #define REG_ARFRH2_V1 0x0490 343 + #define REG_ARFR3_V1 0x0494 344 + #define BIT_EXC_CODE GENMASK(6, 2) 345 + #define REG_ARFRH3_V1 0x0498 354 346 #define REG_ARFR4 0x049C 355 347 #define BIT_WL_RFK BIT(0) 356 348 #define REG_ARFRH4 0x04A0 ··· 566 548 567 549 #define REG_H2C_PKT_READADDR 0x10D0 568 550 #define REG_H2C_PKT_WRITEADDR 0x10D4 551 + #define REG_FW_DBG6 0x10F8 569 552 #define REG_FW_DBG7 0x10FC 570 553 #define FW_KEY_MASK 0xffffff00 571 554 572 555 #define REG_CR_EXT 0x1100 573 556 557 + #define REG_FT1IMR 0x1138 558 + #define BIT_FS_H2C_CMD_OK_INT_EN BIT(25) 559 + #define REG_FT1ISR 0x113c 560 + #define BIT_FS_H2C_CMD_OK_INT BIT(25) 574 561 #define REG_DDMA_CH0SA 0x1200 575 562 #define REG_DDMA_CH0DA 0x1204 576 563 #define REG_DDMA_CH0CTRL 0x1208
+1 -1
drivers/net/wireless/realtek/rtw89/coex.c
··· 3837 3837 if (mode == BTC_WLINK_25G_MCC) 3838 3838 return; 3839 3839 3840 - rtw89_ctrl_btg(rtwdev, is_btg); 3840 + rtw89_ctrl_btg_bt_rx(rtwdev, is_btg, RTW89_PHY_0); 3841 3841 } 3842 3842 3843 3843 struct rtw89_txtime_data {
+13 -9
drivers/net/wireless/realtek/rtw89/core.h
··· 3136 3136 enum rtw89_phy_idx phy_idx); 3137 3137 int (*init_txpwr_unit)(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); 3138 3138 u8 (*get_thermal)(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path); 3139 - void (*ctrl_btg)(struct rtw89_dev *rtwdev, bool btg); 3139 + void (*ctrl_btg_bt_rx)(struct rtw89_dev *rtwdev, bool en, 3140 + enum rtw89_phy_idx phy_idx); 3140 3141 void (*query_ppdu)(struct rtw89_dev *rtwdev, 3141 3142 struct rtw89_rx_phy_ppdu *phy_ppdu, 3142 3143 struct ieee80211_rx_status *status); 3143 - void (*bb_ctrl_btc_preagc)(struct rtw89_dev *rtwdev, bool bt_en); 3144 + void (*ctrl_nbtg_bt_tx)(struct rtw89_dev *rtwdev, bool en, 3145 + enum rtw89_phy_idx phy_idx); 3144 3146 void (*cfg_txrx_path)(struct rtw89_dev *rtwdev); 3145 3147 void (*set_txpwr_ul_tb_offset)(struct rtw89_dev *rtwdev, 3146 3148 s8 pw_ofst, enum rtw89_mac_idx mac_idx); ··· 3711 3709 u8 dcfo_comp_sft; 3712 3710 const struct rtw89_imr_info *imr_info; 3713 3711 const struct rtw89_rrsr_cfgs *rrsr_cfgs; 3712 + struct rtw89_reg_def bss_clr_vld; 3714 3713 u32 bss_clr_map_reg; 3715 3714 u32 dma_ch_mask; 3716 3715 u32 edcca_lvl_reg; ··· 5426 5423 chip->ops->query_ppdu(rtwdev, phy_ppdu, status); 5427 5424 } 5428 5425 5429 - static inline void rtw89_chip_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, 5430 - bool bt_en) 5426 + static inline void rtw89_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, 5427 + enum rtw89_phy_idx phy_idx) 5431 5428 { 5432 5429 const struct rtw89_chip_info *chip = rtwdev->chip; 5433 5430 5434 - if (chip->ops->bb_ctrl_btc_preagc) 5435 - chip->ops->bb_ctrl_btc_preagc(rtwdev, bt_en); 5431 + if (chip->ops->ctrl_nbtg_bt_tx) 5432 + chip->ops->ctrl_nbtg_bt_tx(rtwdev, en, phy_idx); 5436 5433 } 5437 5434 5438 5435 static inline void rtw89_chip_cfg_txrx_path(struct rtw89_dev *rtwdev) ··· 5470 5467 return regd->txpwr_regd[band]; 5471 5468 } 5472 5469 5473 - static inline void rtw89_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) 5470 + static inline void rtw89_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 5471 + enum rtw89_phy_idx phy_idx) 5474 5472 { 5475 5473 const struct rtw89_chip_info *chip = rtwdev->chip; 5476 5474 5477 - if (chip->ops->ctrl_btg) 5478 - chip->ops->ctrl_btg(rtwdev, btg); 5475 + if (chip->ops->ctrl_btg_bt_rx) 5476 + chip->ops->ctrl_btg_bt_rx(rtwdev, en, phy_idx); 5479 5477 } 5480 5478 5481 5479 static inline
+39 -32
drivers/net/wireless/realtek/rtw89/fw.c
··· 13 13 #include "reg.h" 14 14 #include "util.h" 15 15 16 + union rtw89_fw_element_arg { 17 + size_t offset; 18 + enum rtw89_rf_path rf_path; 19 + enum rtw89_fw_type fw_type; 20 + }; 21 + 22 + struct rtw89_fw_element_handler { 23 + int (*fn)(struct rtw89_dev *rtwdev, 24 + const struct rtw89_fw_element_hdr *elm, 25 + const union rtw89_fw_element_arg arg); 26 + const union rtw89_fw_element_arg arg; 27 + const char *name; 28 + }; 29 + 16 30 static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev, 17 31 struct sk_buff *skb); 18 32 static int rtw89_h2c_tx_and_wait(struct rtw89_dev *rtwdev, struct sk_buff *skb, ··· 398 384 static 399 385 int __rtw89_fw_recognize_from_elm(struct rtw89_dev *rtwdev, 400 386 const struct rtw89_fw_element_hdr *elm, 401 - const void *data) 387 + const union rtw89_fw_element_arg arg) 402 388 { 403 - enum rtw89_fw_type type = (enum rtw89_fw_type)data; 389 + enum rtw89_fw_type type = arg.fw_type; 404 390 struct rtw89_fw_suit *fw_suit; 405 391 406 392 fw_suit = rtw89_fw_suit_get(rtwdev, type); ··· 556 542 static 557 543 int rtw89_build_phy_tbl_from_elm(struct rtw89_dev *rtwdev, 558 544 const struct rtw89_fw_element_hdr *elm, 559 - const void *data) 545 + const union rtw89_fw_element_arg arg) 560 546 { 561 547 struct rtw89_fw_elm_info *elm_info = &rtwdev->fw.elm_info; 562 548 struct rtw89_phy_table *tbl; ··· 580 566 case RTW89_FW_ELEMENT_ID_RADIO_B: 581 567 case RTW89_FW_ELEMENT_ID_RADIO_C: 582 568 case RTW89_FW_ELEMENT_ID_RADIO_D: 583 - rf_path = (enum rtw89_rf_path)data; 569 + rf_path = arg.rf_path; 584 570 idx = elm->u.reg2.idx; 585 571 586 572 elm_info->rf_radio[idx] = tbl; ··· 618 604 static 619 605 int rtw89_fw_recognize_txpwr_from_elm(struct rtw89_dev *rtwdev, 620 606 const struct rtw89_fw_element_hdr *elm, 621 - const void *data) 607 + const union rtw89_fw_element_arg arg) 622 608 { 623 609 const struct __rtw89_fw_txpwr_element *txpwr_elm = &elm->u.txpwr; 624 - const unsigned long offset = (const unsigned long)data; 610 + const unsigned long offset = arg.offset; 625 611 struct rtw89_efuse *efuse = &rtwdev->efuse; 626 612 struct rtw89_txpwr_conf *conf; 627 613 ··· 658 644 return 0; 659 645 } 660 646 661 - struct rtw89_fw_element_handler { 662 - int (*fn)(struct rtw89_dev *rtwdev, 663 - const struct rtw89_fw_element_hdr *elm, const void *data); 664 - const void *data; 665 - const char *name; 666 - }; 667 - 668 647 static const struct rtw89_fw_element_handler __fw_element_handlers[] = { 669 648 [RTW89_FW_ELEMENT_ID_BBMCU0] = {__rtw89_fw_recognize_from_elm, 670 - (const void *)RTW89_FW_BBMCU0, NULL}, 649 + { .fw_type = RTW89_FW_BBMCU0 }, NULL}, 671 650 [RTW89_FW_ELEMENT_ID_BBMCU1] = {__rtw89_fw_recognize_from_elm, 672 - (const void *)RTW89_FW_BBMCU1, NULL}, 673 - [RTW89_FW_ELEMENT_ID_BB_REG] = {rtw89_build_phy_tbl_from_elm, NULL, "BB"}, 674 - [RTW89_FW_ELEMENT_ID_BB_GAIN] = {rtw89_build_phy_tbl_from_elm, NULL, NULL}, 651 + { .fw_type = RTW89_FW_BBMCU1 }, NULL}, 652 + [RTW89_FW_ELEMENT_ID_BB_REG] = {rtw89_build_phy_tbl_from_elm, {}, "BB"}, 653 + [RTW89_FW_ELEMENT_ID_BB_GAIN] = {rtw89_build_phy_tbl_from_elm, {}, NULL}, 675 654 [RTW89_FW_ELEMENT_ID_RADIO_A] = {rtw89_build_phy_tbl_from_elm, 676 - (const void *)RF_PATH_A, "radio A"}, 655 + { .rf_path = RF_PATH_A }, "radio A"}, 677 656 [RTW89_FW_ELEMENT_ID_RADIO_B] = {rtw89_build_phy_tbl_from_elm, 678 - (const void *)RF_PATH_B, NULL}, 657 + { .rf_path = RF_PATH_B }, NULL}, 679 658 [RTW89_FW_ELEMENT_ID_RADIO_C] = {rtw89_build_phy_tbl_from_elm, 680 - (const void *)RF_PATH_C, NULL}, 659 + { .rf_path = RF_PATH_C }, NULL}, 681 660 [RTW89_FW_ELEMENT_ID_RADIO_D] = {rtw89_build_phy_tbl_from_elm, 682 - (const void *)RF_PATH_D, NULL}, 683 - [RTW89_FW_ELEMENT_ID_RF_NCTL] = {rtw89_build_phy_tbl_from_elm, NULL, "NCTL"}, 661 + { .rf_path = RF_PATH_D }, NULL}, 662 + [RTW89_FW_ELEMENT_ID_RF_NCTL] = {rtw89_build_phy_tbl_from_elm, {}, "NCTL"}, 684 663 [RTW89_FW_ELEMENT_ID_TXPWR_BYRATE] = { 685 664 rtw89_fw_recognize_txpwr_from_elm, 686 - (const void *)offsetof(struct rtw89_rfe_data, byrate.conf), "TXPWR", 665 + { .offset = offsetof(struct rtw89_rfe_data, byrate.conf) }, "TXPWR", 687 666 }, 688 667 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_2GHZ] = { 689 668 rtw89_fw_recognize_txpwr_from_elm, 690 - (const void *)offsetof(struct rtw89_rfe_data, lmt_2ghz.conf), NULL, 669 + { .offset = offsetof(struct rtw89_rfe_data, lmt_2ghz.conf) }, NULL, 691 670 }, 692 671 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_5GHZ] = { 693 672 rtw89_fw_recognize_txpwr_from_elm, 694 - (const void *)offsetof(struct rtw89_rfe_data, lmt_5ghz.conf), NULL, 673 + { .offset = offsetof(struct rtw89_rfe_data, lmt_5ghz.conf) }, NULL, 695 674 }, 696 675 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_6GHZ] = { 697 676 rtw89_fw_recognize_txpwr_from_elm, 698 - (const void *)offsetof(struct rtw89_rfe_data, lmt_6ghz.conf), NULL, 677 + { .offset = offsetof(struct rtw89_rfe_data, lmt_6ghz.conf) }, NULL, 699 678 }, 700 679 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_2GHZ] = { 701 680 rtw89_fw_recognize_txpwr_from_elm, 702 - (const void *)offsetof(struct rtw89_rfe_data, lmt_ru_2ghz.conf), NULL, 681 + { .offset = offsetof(struct rtw89_rfe_data, lmt_ru_2ghz.conf) }, NULL, 703 682 }, 704 683 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_5GHZ] = { 705 684 rtw89_fw_recognize_txpwr_from_elm, 706 - (const void *)offsetof(struct rtw89_rfe_data, lmt_ru_5ghz.conf), NULL, 685 + { .offset = offsetof(struct rtw89_rfe_data, lmt_ru_5ghz.conf) }, NULL, 707 686 }, 708 687 [RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_6GHZ] = { 709 688 rtw89_fw_recognize_txpwr_from_elm, 710 - (const void *)offsetof(struct rtw89_rfe_data, lmt_ru_6ghz.conf), NULL, 689 + { .offset = offsetof(struct rtw89_rfe_data, lmt_ru_6ghz.conf) }, NULL, 711 690 }, 712 691 [RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT] = { 713 692 rtw89_fw_recognize_txpwr_from_elm, 714 - (const void *)offsetof(struct rtw89_rfe_data, tx_shape_lmt.conf), NULL, 693 + { .offset = offsetof(struct rtw89_rfe_data, tx_shape_lmt.conf) }, NULL, 715 694 }, 716 695 [RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU] = { 717 696 rtw89_fw_recognize_txpwr_from_elm, 718 - (const void *)offsetof(struct rtw89_rfe_data, tx_shape_lmt_ru.conf), NULL, 697 + { .offset = offsetof(struct rtw89_rfe_data, tx_shape_lmt_ru.conf) }, NULL, 719 698 }, 720 699 }; 721 700 ··· 749 742 if (!handler->fn) 750 743 goto next; 751 744 752 - ret = handler->fn(rtwdev, hdr, handler->data); 745 + ret = handler->fn(rtwdev, hdr, handler->arg); 753 746 if (ret) 754 747 return ret; 755 748
+32 -14
drivers/net/wireless/realtek/rtw89/phy.c
··· 2557 2557 s32 dcfo_comp_val; 2558 2558 int sign; 2559 2559 2560 + if (rtwdev->chip->chip_id == RTL8922A) 2561 + return; 2562 + 2560 2563 if (!is_linked) { 2561 2564 rtw89_debug(rtwdev, RTW89_DBG_CFO, "DCFO: is_linked=%d\n", 2562 2565 is_linked); ··· 2580 2577 2581 2578 static void rtw89_dcfo_comp_init(struct rtw89_dev *rtwdev) 2582 2579 { 2580 + const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def; 2583 2581 const struct rtw89_chip_info *chip = rtwdev->chip; 2582 + const struct rtw89_cfo_regs *cfo = phy->cfo; 2584 2583 2585 - rtw89_phy_set_phy_regs(rtwdev, R_DCFO_OPT, B_DCFO_OPT_EN, 1); 2586 - rtw89_phy_set_phy_regs(rtwdev, R_DCFO_WEIGHT, B_DCFO_WEIGHT_MSK, 8); 2584 + rtw89_phy_set_phy_regs(rtwdev, cfo->comp_seg0, cfo->valid_0_mask, 1); 2585 + rtw89_phy_set_phy_regs(rtwdev, cfo->comp, cfo->weighting_mask, 8); 2587 2586 2588 - if (chip->cfo_hw_comp) 2589 - rtw89_write32_mask(rtwdev, R_AX_PWR_UL_CTRL2, 2590 - B_AX_PWR_UL_CFO_MASK, 0x6); 2591 - else 2592 - rtw89_write32_clr(rtwdev, R_AX_PWR_UL_CTRL2, B_AX_PWR_UL_CFO_MASK); 2587 + if (chip->chip_gen == RTW89_CHIP_AX) { 2588 + if (chip->cfo_hw_comp) { 2589 + rtw89_write32_mask(rtwdev, R_AX_PWR_UL_CTRL2, 2590 + B_AX_PWR_UL_CFO_MASK, 0x6); 2591 + } else { 2592 + rtw89_phy_set_phy_regs(rtwdev, R_DCFO, B_DCFO, 1); 2593 + rtw89_write32_clr(rtwdev, R_AX_PWR_UL_CTRL2, 2594 + B_AX_PWR_UL_CFO_MASK); 2595 + } 2596 + } 2593 2597 } 2594 2598 2595 2599 static void rtw89_phy_cfo_init(struct rtw89_dev *rtwdev) ··· 2619 2609 rtw89_debug(rtwdev, RTW89_DBG_CFO, "Default xcap=%0x\n", 2620 2610 cfo->crystal_cap_default); 2621 2611 rtw89_phy_cfo_set_crystal_cap(rtwdev, cfo->crystal_cap_default, true); 2622 - rtw89_phy_set_phy_regs(rtwdev, R_DCFO, B_DCFO, 1); 2623 2612 rtw89_dcfo_comp_init(rtwdev); 2624 2613 cfo->cfo_timer_ms = 2000; 2625 2614 cfo->cfo_trig_by_timer_en = false; ··· 2635 2626 s32 cfo_abs = abs(curr_cfo); 2636 2627 int sign; 2637 2628 2629 + if (curr_cfo == 0) { 2630 + rtw89_debug(rtwdev, RTW89_DBG_CFO, "curr_cfo=0\n"); 2631 + return; 2632 + } 2638 2633 if (!cfo->is_adjust) { 2639 2634 if (cfo_abs > CFO_TRK_ENABLE_TH) 2640 2635 cfo->is_adjust = true; 2641 2636 } else { 2642 - if (cfo_abs < CFO_TRK_STOP_TH) 2637 + if (cfo_abs <= CFO_TRK_STOP_TH) 2643 2638 cfo->is_adjust = false; 2644 2639 } 2645 2640 if (!cfo->is_adjust) { ··· 2835 2822 new_cfo = rtw89_phy_average_cfo_calc(rtwdev); 2836 2823 else 2837 2824 new_cfo = rtw89_phy_multi_sta_cfo_calc(rtwdev); 2838 - if (new_cfo == 0) { 2839 - rtw89_debug(rtwdev, RTW89_DBG_CFO, "curr_cfo=0\n"); 2840 - return; 2841 - } 2842 2825 if (cfo->divergence_lock_en) { 2843 2826 cfo->lock_cnt++; 2844 2827 if (cfo->lock_cnt > CFO_PERIOD_CNT) { ··· 4645 4636 void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif) 4646 4637 { 4647 4638 const struct rtw89_chip_info *chip = rtwdev->chip; 4639 + const struct rtw89_reg_def *bss_clr_vld = &chip->bss_clr_vld; 4648 4640 enum rtw89_phy_idx phy_idx = RTW89_PHY_0; 4649 4641 u8 bss_color; 4650 4642 ··· 4654 4644 4655 4645 bss_color = vif->bss_conf.he_bss_color.color; 4656 4646 4657 - rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_VLD0, 0x1, 4647 + rtw89_phy_write32_idx(rtwdev, bss_clr_vld->addr, bss_clr_vld->mask, 0x1, 4658 4648 phy_idx); 4659 4649 rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_TGT, 4660 4650 bss_color, phy_idx); ··· 4975 4965 .dis_trigger_brk_mask = B_STS_DIS_TRIG_BY_BRK, 4976 4966 }; 4977 4967 4968 + static const struct rtw89_cfo_regs rtw89_cfo_regs_ax = { 4969 + .comp = R_DCFO_WEIGHT, 4970 + .weighting_mask = B_DCFO_WEIGHT_MSK, 4971 + .comp_seg0 = R_DCFO_OPT, 4972 + .valid_0_mask = B_DCFO_OPT_EN, 4973 + }; 4974 + 4978 4975 const struct rtw89_phy_gen_def rtw89_phy_gen_ax = { 4979 4976 .cr_base = 0x10000, 4980 4977 .ccx = &rtw89_ccx_regs_ax, 4981 4978 .physts = &rtw89_physts_regs_ax, 4979 + .cfo = &rtw89_cfo_regs_ax, 4982 4980 4983 4981 .set_txpwr_byrate = rtw89_phy_set_txpwr_byrate_ax, 4984 4982 .set_txpwr_offset = rtw89_phy_set_txpwr_offset_ax,
+8
drivers/net/wireless/realtek/rtw89/phy.h
··· 405 405 u32 dis_trigger_brk_mask; 406 406 }; 407 407 408 + struct rtw89_cfo_regs { 409 + u32 comp; 410 + u32 weighting_mask; 411 + u32 comp_seg0; 412 + u32 valid_0_mask; 413 + }; 414 + 408 415 enum rtw89_bandwidth_section_num_ax { 409 416 RTW89_BW20_SEC_NUM_AX = 8, 410 417 RTW89_BW40_SEC_NUM_AX = 4, ··· 482 475 u32 cr_base; 483 476 const struct rtw89_ccx_regs *ccx; 484 477 const struct rtw89_physts_regs *physts; 478 + const struct rtw89_cfo_regs *cfo; 485 479 486 480 void (*set_txpwr_byrate)(struct rtw89_dev *rtwdev, 487 481 const struct rtw89_chan *chan,
+8
drivers/net/wireless/realtek/rtw89/phy_be.c
··· 71 71 .dis_trigger_brk_mask = B_STS_DIS_TRIG_BY_BRK, 72 72 }; 73 73 74 + static const struct rtw89_cfo_regs rtw89_cfo_regs_be = { 75 + .comp = R_DCFO_WEIGHT_V1, 76 + .weighting_mask = B_DCFO_WEIGHT_MSK_V1, 77 + .comp_seg0 = R_DCFO_OPT_V1, 78 + .valid_0_mask = B_DCFO_OPT_EN_V1, 79 + }; 80 + 74 81 struct rtw89_byr_spec_ent_be { 75 82 struct rtw89_rate_desc init; 76 83 u8 num_of_idx; ··· 643 636 .cr_base = 0x20000, 644 637 .ccx = &rtw89_ccx_regs_be, 645 638 .physts = &rtw89_physts_regs_be, 639 + .cfo = &rtw89_cfo_regs_be, 646 640 647 641 .set_txpwr_byrate = rtw89_phy_set_txpwr_byrate_be, 648 642 .set_txpwr_offset = rtw89_phy_set_txpwr_offset_be,
+4
drivers/net/wireless/realtek/rtw89/reg.h
··· 5035 5035 #define B_S0_DACKQ7_K GENMASK(15, 8) 5036 5036 #define R_S0_DACKQ8 0x5E98 5037 5037 #define B_S0_DACKQ8_K GENMASK(15, 8) 5038 + #define R_DCFO_WEIGHT_V1 0x6244 5039 + #define B_DCFO_WEIGHT_MSK_V1 GENMASK(31, 28) 5040 + #define R_DCFO_OPT_V1 0x6260 5041 + #define B_DCFO_OPT_EN_V1 BIT(17) 5038 5042 #define R_RPL_BIAS_COMP1 0x6DF0 5039 5043 #define B_RPL_BIAS_COMP1_MASK GENMASK(7, 0) 5040 5044 #define R_P1_TSSI_ALIM1 0x7630
+10 -7
drivers/net/wireless/realtek/rtw89/rtw8851b.c
··· 1779 1779 return 0; 1780 1780 } 1781 1781 1782 - static void rtw8851b_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en) 1782 + static void rtw8851b_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, 1783 + enum rtw89_phy_idx phy_idx) 1783 1784 { 1784 1785 const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0); 1785 1786 1786 - rtw89_phy_write_reg3_tbl(rtwdev, bt_en ? &rtw8851b_btc_preagc_en_defs_tbl : 1787 + rtw89_phy_write_reg3_tbl(rtwdev, en ? &rtw8851b_btc_preagc_en_defs_tbl : 1787 1788 &rtw8851b_btc_preagc_dis_defs_tbl); 1788 1789 1789 - if (!bt_en) { 1790 + if (!en) { 1790 1791 if (chan->band_type == RTW89_BAND_2G) { 1791 1792 rtw89_phy_write32_mask(rtwdev, R_PATH0_G_LNA6_OP1DB_V1, 1792 1793 B_PATH0_G_LNA6_OP1DB_V1, 0x20); ··· 1802 1801 } 1803 1802 } 1804 1803 1805 - static void rtw8851b_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) 1804 + static void rtw8851b_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 1805 + enum rtw89_phy_idx phy_idx) 1806 1806 { 1807 1807 const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0); 1808 1808 1809 - if (btg) { 1809 + if (en) { 1810 1810 rtw89_phy_write32_mask(rtwdev, R_PATH0_BT_SHARE_V1, 1811 1811 B_PATH0_BT_SHARE_V1, 0x1); 1812 1812 rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG_PATH_V1, ··· 2304 2302 .set_txpwr_ctrl = rtw8851b_set_txpwr_ctrl, 2305 2303 .init_txpwr_unit = rtw8851b_init_txpwr_unit, 2306 2304 .get_thermal = rtw8851b_get_thermal, 2307 - .ctrl_btg = rtw8851b_ctrl_btg, 2305 + .ctrl_btg_bt_rx = rtw8851b_ctrl_btg_bt_rx, 2308 2306 .query_ppdu = rtw8851b_query_ppdu, 2309 - .bb_ctrl_btc_preagc = rtw8851b_bb_ctrl_btc_preagc, 2307 + .ctrl_nbtg_bt_tx = rtw8851b_ctrl_nbtg_bt_tx, 2310 2308 .cfg_txrx_path = rtw8851b_bb_cfg_txrx_path, 2311 2309 .set_txpwr_ul_tb_offset = rtw8851b_set_txpwr_ul_tb_offset, 2312 2310 .pwr_on_func = rtw8851b_pwr_on_func, ··· 2438 2436 .dcfo_comp_sft = 12, 2439 2437 .imr_info = &rtw8851b_imr_info, 2440 2438 .rrsr_cfgs = &rtw8851b_rrsr_cfgs, 2439 + .bss_clr_vld = {R_BSS_CLR_MAP_V1, B_BSS_CLR_MAP_VLD0}, 2441 2440 .bss_clr_map_reg = R_BSS_CLR_MAP_V1, 2442 2441 .dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) | 2443 2442 BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
+12 -9
drivers/net/wireless/realtek/rtw89/rtw8852a.c
··· 1624 1624 rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_PWR_EN, 0, idx); 1625 1625 } 1626 1626 1627 - static void rtw8852a_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en) 1627 + static void rtw8852a_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, 1628 + enum rtw89_phy_idx phy_idx) 1628 1629 { 1629 - rtw89_phy_write_reg3_tbl(rtwdev, bt_en ? &rtw8852a_btc_preagc_en_defs_tbl : 1630 + rtw89_phy_write_reg3_tbl(rtwdev, en ? &rtw8852a_btc_preagc_en_defs_tbl : 1630 1631 &rtw8852a_btc_preagc_dis_defs_tbl); 1631 1632 } 1632 1633 ··· 1684 1683 rtw89_write_rf(rtwdev, path, RR_LUTWE, 0xfffff, 0x0); 1685 1684 } 1686 1685 1687 - static void rtw8852a_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) 1686 + static void rtw8852a_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 1687 + enum rtw89_phy_idx phy_idx) 1688 1688 { 1689 - if (btg) { 1689 + if (en) { 1690 1690 rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG, B_PATH0_BTG_SHEN, 0x1); 1691 1691 rtw89_phy_write32_mask(rtwdev, R_PATH1_BTG, B_PATH1_BTG_SHEN, 0x3); 1692 1692 rtw89_phy_write32_mask(rtwdev, R_PMAC_GNT, B_PMAC_GNT_P1, 0x0); ··· 1968 1966 switch (level) { 1969 1967 case 0: /* original */ 1970 1968 default: 1971 - rtw8852a_bb_ctrl_btc_preagc(rtwdev, false); 1969 + rtw8852a_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 1972 1970 btc->dm.wl_lna2 = 0; 1973 1971 break; 1974 1972 case 1: /* for FDD free-run */ 1975 - rtw8852a_bb_ctrl_btc_preagc(rtwdev, true); 1973 + rtw8852a_ctrl_nbtg_bt_tx(rtwdev, true, RTW89_PHY_0); 1976 1974 btc->dm.wl_lna2 = 0; 1977 1975 break; 1978 1976 case 2: /* for BTG Co-Rx*/ 1979 - rtw8852a_bb_ctrl_btc_preagc(rtwdev, false); 1977 + rtw8852a_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 1980 1978 btc->dm.wl_lna2 = 1; 1981 1979 break; 1982 1980 } ··· 2048 2046 .set_txpwr_ctrl = rtw8852a_set_txpwr_ctrl, 2049 2047 .init_txpwr_unit = rtw8852a_init_txpwr_unit, 2050 2048 .get_thermal = rtw8852a_get_thermal, 2051 - .ctrl_btg = rtw8852a_ctrl_btg, 2049 + .ctrl_btg_bt_rx = rtw8852a_ctrl_btg_bt_rx, 2052 2050 .query_ppdu = rtw8852a_query_ppdu, 2053 - .bb_ctrl_btc_preagc = rtw8852a_bb_ctrl_btc_preagc, 2051 + .ctrl_nbtg_bt_tx = rtw8852a_ctrl_nbtg_bt_tx, 2054 2052 .cfg_txrx_path = NULL, 2055 2053 .set_txpwr_ul_tb_offset = rtw8852a_set_txpwr_ul_tb_offset, 2056 2054 .pwr_on_func = NULL, ··· 2175 2173 .dcfo_comp_sft = 10, 2176 2174 .imr_info = &rtw8852a_imr_info, 2177 2175 .rrsr_cfgs = &rtw8852a_rrsr_cfgs, 2176 + .bss_clr_vld = {R_BSS_CLR_MAP, B_BSS_CLR_MAP_VLD0}, 2178 2177 .bss_clr_map_reg = R_BSS_CLR_MAP, 2179 2178 .dma_ch_mask = 0, 2180 2179 .edcca_lvl_reg = R_SEG0R_EDCCA_LVL,
+14 -11
drivers/net/wireless/realtek/rtw89/rtw8852b.c
··· 1929 1929 rtw89_phy_write32_idx(rtwdev, R_TXPWR, B_TXPWR_MSK, bak->tx_pwr, idx); 1930 1930 } 1931 1931 1932 - static void rtw8852b_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en) 1932 + static void rtw8852b_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, 1933 + enum rtw89_phy_idx phy_idx) 1933 1934 { 1934 - rtw89_phy_write_reg3_tbl(rtwdev, bt_en ? &rtw8852b_btc_preagc_en_defs_tbl : 1935 + rtw89_phy_write_reg3_tbl(rtwdev, en ? &rtw8852b_btc_preagc_en_defs_tbl : 1935 1936 &rtw8852b_btc_preagc_dis_defs_tbl); 1936 1937 } 1937 1938 1938 - static void rtw8852b_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) 1939 + static void rtw8852b_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 1940 + enum rtw89_phy_idx phy_idx) 1939 1941 { 1940 - if (btg) { 1942 + if (en) { 1941 1943 rtw89_phy_write32_mask(rtwdev, R_PATH0_BT_SHARE_V1, 1942 1944 B_PATH0_BT_SHARE_V1, 0x1); 1943 1945 rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG_PATH_V1, ··· 2020 2018 2021 2019 if (chan->band_type == RTW89_BAND_2G && 2022 2020 (rx_path == RF_B || rx_path == RF_AB)) 2023 - rtw8852b_ctrl_btg(rtwdev, true); 2021 + rtw8852b_ctrl_btg_bt_rx(rtwdev, true, RTW89_PHY_0); 2024 2022 else 2025 - rtw8852b_ctrl_btg(rtwdev, false); 2023 + rtw8852b_ctrl_btg_bt_rx(rtwdev, false, RTW89_PHY_0); 2026 2024 2027 2025 rst_mask0 = B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI; 2028 2026 rst_mask1 = B_P1_TXPW_RSTB_MANON | B_P1_TXPW_RSTB_TSSI; ··· 2348 2346 switch (level) { 2349 2347 case 0: /* original */ 2350 2348 default: 2351 - rtw8852b_bb_ctrl_btc_preagc(rtwdev, false); 2349 + rtw8852b_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 2352 2350 btc->dm.wl_lna2 = 0; 2353 2351 break; 2354 2352 case 1: /* for FDD free-run */ 2355 - rtw8852b_bb_ctrl_btc_preagc(rtwdev, true); 2353 + rtw8852b_ctrl_nbtg_bt_tx(rtwdev, true, RTW89_PHY_0); 2356 2354 btc->dm.wl_lna2 = 0; 2357 2355 break; 2358 2356 case 2: /* for BTG Co-Rx*/ 2359 - rtw8852b_bb_ctrl_btc_preagc(rtwdev, false); 2357 + rtw8852b_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 2360 2358 btc->dm.wl_lna2 = 1; 2361 2359 break; 2362 2360 } ··· 2473 2471 .set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl, 2474 2472 .init_txpwr_unit = rtw8852b_init_txpwr_unit, 2475 2473 .get_thermal = rtw8852b_get_thermal, 2476 - .ctrl_btg = rtw8852b_ctrl_btg, 2474 + .ctrl_btg_bt_rx = rtw8852b_ctrl_btg_bt_rx, 2477 2475 .query_ppdu = rtw8852b_query_ppdu, 2478 - .bb_ctrl_btc_preagc = rtw8852b_bb_ctrl_btc_preagc, 2476 + .ctrl_nbtg_bt_tx = rtw8852b_ctrl_nbtg_bt_tx, 2479 2477 .cfg_txrx_path = rtw8852b_bb_cfg_txrx_path, 2480 2478 .set_txpwr_ul_tb_offset = rtw8852b_set_txpwr_ul_tb_offset, 2481 2479 .pwr_on_func = rtw8852b_pwr_on_func, ··· 2609 2607 .dcfo_comp_sft = 10, 2610 2608 .imr_info = &rtw8852b_imr_info, 2611 2609 .rrsr_cfgs = &rtw8852b_rrsr_cfgs, 2610 + .bss_clr_vld = {R_BSS_CLR_MAP_V1, B_BSS_CLR_MAP_VLD0}, 2612 2611 .bss_clr_map_reg = R_BSS_CLR_MAP_V1, 2613 2612 .dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) | 2614 2613 BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
+19 -12
drivers/net/wireless/realtek/rtw89/rtw8852c.c
··· 167 167 B_PATH1_S20_FOLLOW_BY_PAGCUGC_EN_MSK}, 168 168 }; 169 169 170 - static void rtw8852c_ctrl_btg(struct rtw89_dev *rtwdev, bool btg); 170 + static void rtw8852c_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 171 + enum rtw89_phy_idx phy_idx); 172 + 171 173 static void rtw8852c_ctrl_tx_path_tmac(struct rtw89_dev *rtwdev, u8 tx_path, 172 174 enum rtw89_mac_idx mac_idx); 173 175 ··· 1653 1651 } 1654 1652 1655 1653 rtw8852c_spur_elimination(rtwdev, chan, pri_ch_idx, phy_idx); 1656 - rtw8852c_ctrl_btg(rtwdev, chan->band_type == RTW89_BAND_2G); 1654 + rtw8852c_ctrl_btg_bt_rx(rtwdev, chan->band_type == RTW89_BAND_2G, 1655 + RTW89_PHY_0); 1657 1656 rtw8852c_5m_mask(rtwdev, chan, phy_idx); 1658 1657 1659 1658 if (chan->band_width == RTW89_CHANNEL_WIDTH_160 && ··· 2153 2150 1); 2154 2151 rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 2155 2152 1); 2156 - rtw8852c_ctrl_btg(rtwdev, band == RTW89_BAND_2G); 2153 + rtw8852c_ctrl_btg_bt_rx(rtwdev, band == RTW89_BAND_2G, 2154 + RTW89_PHY_0); 2157 2155 rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB, 2158 2156 rst_mask0, 1); 2159 2157 rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB, ··· 2230 2226 } 2231 2227 } 2232 2228 2233 - static void rtw8852c_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en) 2229 + static void rtw8852c_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, 2230 + enum rtw89_phy_idx phy_idx) 2234 2231 { 2235 - if (bt_en) { 2232 + if (en) { 2236 2233 rtw89_phy_write32_mask(rtwdev, R_PATH0_FRC_FIR_TYPE_V1, 2237 2234 B_PATH0_FRC_FIR_TYPE_MSK_V1, 0x3); 2238 2235 rtw89_phy_write32_mask(rtwdev, R_PATH1_FRC_FIR_TYPE_V1, ··· 2351 2346 } 2352 2347 } 2353 2348 2354 - static void rtw8852c_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) 2349 + static void rtw8852c_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en, 2350 + enum rtw89_phy_idx phy_idx) 2355 2351 { 2356 - if (btg) { 2352 + if (en) { 2357 2353 rtw89_phy_write32_mask(rtwdev, R_PATH0_BT_SHARE_V1, 2358 2354 B_PATH0_BT_SHARE_V1, 0x1); 2359 2355 rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG_PATH_V1, ··· 2664 2658 switch (level) { 2665 2659 case 0: /* original */ 2666 2660 default: 2667 - rtw8852c_bb_ctrl_btc_preagc(rtwdev, false); 2661 + rtw8852c_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 2668 2662 btc->dm.wl_lna2 = 0; 2669 2663 break; 2670 2664 case 1: /* for FDD free-run */ 2671 - rtw8852c_bb_ctrl_btc_preagc(rtwdev, true); 2665 + rtw8852c_ctrl_nbtg_bt_tx(rtwdev, true, RTW89_PHY_0); 2672 2666 btc->dm.wl_lna2 = 0; 2673 2667 break; 2674 2668 case 2: /* for BTG Co-Rx*/ 2675 - rtw8852c_bb_ctrl_btc_preagc(rtwdev, false); 2669 + rtw8852c_ctrl_nbtg_bt_tx(rtwdev, false, RTW89_PHY_0); 2676 2670 btc->dm.wl_lna2 = 1; 2677 2671 break; 2678 2672 } ··· 2794 2788 .set_txpwr_ctrl = rtw8852c_set_txpwr_ctrl, 2795 2789 .init_txpwr_unit = rtw8852c_init_txpwr_unit, 2796 2790 .get_thermal = rtw8852c_get_thermal, 2797 - .ctrl_btg = rtw8852c_ctrl_btg, 2791 + .ctrl_btg_bt_rx = rtw8852c_ctrl_btg_bt_rx, 2798 2792 .query_ppdu = rtw8852c_query_ppdu, 2799 - .bb_ctrl_btc_preagc = rtw8852c_bb_ctrl_btc_preagc, 2793 + .ctrl_nbtg_bt_tx = rtw8852c_ctrl_nbtg_bt_tx, 2800 2794 .cfg_txrx_path = rtw8852c_bb_cfg_txrx_path, 2801 2795 .set_txpwr_ul_tb_offset = rtw8852c_set_txpwr_ul_tb_offset, 2802 2796 .pwr_on_func = rtw8852c_pwr_on_func, ··· 2924 2918 .dcfo_comp_sft = 12, 2925 2919 .imr_info = &rtw8852c_imr_info, 2926 2920 .rrsr_cfgs = &rtw8852c_rrsr_cfgs, 2921 + .bss_clr_vld = {R_BSS_CLR_MAP, B_BSS_CLR_MAP_VLD0}, 2927 2922 .bss_clr_map_reg = R_BSS_CLR_MAP, 2928 2923 .dma_ch_mask = 0, 2929 2924 .edcca_lvl_reg = R_SEG0R_EDCCA_LVL,
+1 -1
drivers/net/wireless/st/cw1200/txrx.c
··· 994 994 txpriv->raw_link_id, txpriv->tid); 995 995 tx_policy_put(priv, txpriv->rate_id); 996 996 } 997 - ieee80211_tx_status(priv->hw, skb); 997 + ieee80211_tx_status_skb(priv->hw, skb); 998 998 } 999 999 1000 1000 void cw1200_rx_cb(struct cw1200_common *priv,
+1 -1
drivers/net/wireless/ti/wl1251/main.c
··· 404 404 405 405 /* update hw/fw version info in wiphy struct */ 406 406 wiphy->hw_version = wl->chip_id; 407 - strncpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); 407 + strscpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); 408 408 409 409 out: 410 410 if (ret < 0)
+3 -3
drivers/net/wireless/ti/wl1251/tx.c
··· 434 434 result->status, wl1251_tx_parse_status(result->status)); 435 435 436 436 437 - ieee80211_tx_status(wl->hw, skb); 437 + ieee80211_tx_status_skb(wl->hw, skb); 438 438 439 439 wl->tx_frames[result->id] = NULL; 440 440 } ··· 566 566 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) 567 567 continue; 568 568 569 - ieee80211_tx_status(wl->hw, skb); 569 + ieee80211_tx_status_skb(wl->hw, skb); 570 570 } 571 571 572 572 for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) ··· 577 577 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) 578 578 continue; 579 579 580 - ieee80211_tx_status(wl->hw, skb); 580 + ieee80211_tx_status_skb(wl->hw, skb); 581 581 wl->tx_frames[i] = NULL; 582 582 } 583 583 }
+1 -4
drivers/net/wireless/ti/wl18xx/main.c
··· 1516 1516 struct wl18xx_static_data_priv *static_data_priv = 1517 1517 (struct wl18xx_static_data_priv *) static_data->priv; 1518 1518 1519 - strncpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, 1519 + strscpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, 1520 1520 sizeof(wl->chip.phy_fw_ver_str)); 1521 - 1522 - /* make sure the string is NULL-terminated */ 1523 - wl->chip.phy_fw_ver_str[sizeof(wl->chip.phy_fw_ver_str) - 1] = '\0'; 1524 1521 1525 1522 wl1271_info("PHY firmware version: %s", static_data_priv->phy_version); 1526 1523
+1 -4
drivers/net/wireless/ti/wlcore/boot.c
··· 41 41 { 42 42 int ret; 43 43 44 - strncpy(wl->chip.fw_ver_str, static_data->fw_version, 44 + strscpy(wl->chip.fw_ver_str, static_data->fw_version, 45 45 sizeof(wl->chip.fw_ver_str)); 46 - 47 - /* make sure the string is NULL-terminated */ 48 - wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0'; 49 46 50 47 ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u", 51 48 &wl->chip.fw_ver[0], &wl->chip.fw_ver[1],
+2 -2
drivers/net/wireless/ti/wlcore/main.c
··· 1126 1126 1127 1127 /* update hw/fw version info in wiphy struct */ 1128 1128 wiphy->hw_version = wl->chip.id; 1129 - strncpy(wiphy->fw_version, wl->chip.fw_ver_str, 1129 + strscpy(wiphy->fw_version, wl->chip.fw_ver_str, 1130 1130 sizeof(wiphy->fw_version)); 1131 1131 1132 1132 goto out; ··· 2344 2344 2345 2345 /* update hw/fw version info in wiphy struct */ 2346 2346 wiphy->hw_version = wl->chip.id; 2347 - strncpy(wiphy->fw_version, wl->chip.fw_ver_str, 2347 + strscpy(wiphy->fw_version, wl->chip.fw_ver_str, 2348 2348 sizeof(wiphy->fw_version)); 2349 2349 2350 2350 /*
+2 -1
drivers/ssb/Kconfig
··· 134 134 # Assumption: We are on embedded, if we compile the MIPS core. 135 135 config SSB_EMBEDDED 136 136 bool 137 - depends on SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE 137 + depends on SSB_DRIVER_MIPS 138 + depends on PCI=n || SSB_PCICORE_HOSTMODE 138 139 default y 139 140 140 141 config SSB_DRIVER_EXTIF
+1 -2
include/linux/ieee80211.h
··· 4519 4519 /** 4520 4520 * ieee80211_get_tdls_action - get tdls packet action (or -1, if not tdls packet) 4521 4521 * @skb: the skb containing the frame, length will not be checked 4522 - * @hdr_size: the size of the ieee80211_hdr that starts at skb->data 4523 4522 * 4524 4523 * This function assumes the frame is a data frame, and that the network header 4525 4524 * is in the correct place. 4526 4525 */ 4527 - static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size) 4526 + static inline int ieee80211_get_tdls_action(struct sk_buff *skb) 4528 4527 { 4529 4528 if (!skb_is_nonlinear(skb) && 4530 4529 skb->len > (skb_network_offset(skb) + 2)) {
+21 -17
include/net/cfg80211.h
··· 2443 2443 * @user_mpm: userspace handles all MPM functions 2444 2444 * @dtim_period: DTIM period to use 2445 2445 * @beacon_interval: beacon interval to use 2446 - * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 2446 + * @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a] 2447 2447 * @basic_rates: basic rates to use when creating the mesh 2448 2448 * @beacon_rate: bitrate to be used for beacons 2449 2449 * @userspace_handles_dfs: whether user space controls DFS operation, i.e. ··· 2661 2661 * or no match (RSSI only) 2662 2662 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 2663 2663 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied 2664 - * for filtering out scan results received. Drivers advertize this support 2664 + * for filtering out scan results received. Drivers advertise this support 2665 2665 * of band specific rssi based filtering through the feature capability 2666 2666 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band 2667 2667 * specific rssi thresholds take precedence over rssi_thold, if specified. ··· 2713 2713 * @match_sets: sets of parameters to be matched for a scan result 2714 2714 * entry to be considered valid and to be passed to the host 2715 2715 * (others are filtered out). 2716 - * If ommited, all results are passed. 2716 + * If omitted, all results are passed. 2717 2717 * @n_match_sets: number of match sets 2718 2718 * @report_results: indicates that results were reported for this request 2719 2719 * @wiphy: the wiphy this was for ··· 2747 2747 * to the specified band while deciding whether a better BSS is reported 2748 2748 * using @relative_rssi. If delta is a negative number, the BSSs that 2749 2749 * belong to the specified band will be penalized by delta dB in relative 2750 - * comparisions. 2750 + * comparisons. 2751 2751 */ 2752 2752 struct cfg80211_sched_scan_request { 2753 2753 u64 reqid; ··· 3587 3587 * This structure provides information needed to transmit a mgmt frame 3588 3588 * 3589 3589 * @chan: channel to use 3590 - * @offchan: indicates wether off channel operation is required 3590 + * @offchan: indicates whether off channel operation is required 3591 3591 * @wait: duration for ROC 3592 3592 * @buf: buffer to transmit 3593 3593 * @len: buffer length ··· 3705 3705 * @publish_bcast: if true, the solicited publish should be broadcasted 3706 3706 * @subscribe_active: if true, the subscribe is active 3707 3707 * @followup_id: the instance ID for follow up 3708 - * @followup_reqid: the requestor instance ID for follow up 3708 + * @followup_reqid: the requester instance ID for follow up 3709 3709 * @followup_dest: MAC address of the recipient of the follow up 3710 3710 * @ttl: time to live counter in DW. 3711 3711 * @serv_spec_info: Service Specific Info ··· 6714 6714 * @ies: data consisting of IEs 6715 6715 * @len: length of data 6716 6716 * 6717 - * Return: %NULL if the etended element could not be found or if 6717 + * Return: %NULL if the extended element could not be found or if 6718 6718 * the element is invalid (claims to be longer than the given 6719 6719 * data) or if the byte array doesn't match; otherwise return the 6720 6720 * requested element struct. ··· 6861 6861 /** 6862 6862 * regulatory_set_wiphy_regd - set regdom info for self managed drivers 6863 6863 * @wiphy: the wireless device we want to process the regulatory domain on 6864 - * @rd: the regulatory domain informatoin to use for this wiphy 6864 + * @rd: the regulatory domain information to use for this wiphy 6865 6865 * 6866 6866 * Set the regulatory domain information for self-managed wiphys, only they 6867 6867 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more ··· 6952 6952 * Regulatory self-managed driver can use it to proactively 6953 6953 * 6954 6954 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 6955 - * @freq: the freqency(in MHz) to be queried. 6955 + * @freq: the frequency (in MHz) to be queried. 6956 6956 * @rule: pointer to store the wmm rule from the regulatory db. 6957 6957 * 6958 6958 * Self-managed wireless drivers can use this function to query ··· 7269 7269 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 7270 7270 7271 7271 /** 7272 - * struct cfg80211_rx_assoc_resp - association response data 7272 + * struct cfg80211_rx_assoc_resp_data - association response data 7273 7273 * @bss: the BSS that association was requested with, ownership of the pointer 7274 7274 * moves to cfg80211 in the call to cfg80211_rx_assoc_resp() 7275 7275 * @buf: (Re)Association Response frame (header + body) ··· 7284 7284 * @links.status: Set this (along with a BSS pointer) for links that 7285 7285 * were rejected by the AP. 7286 7286 */ 7287 - struct cfg80211_rx_assoc_resp { 7287 + struct cfg80211_rx_assoc_resp_data { 7288 7288 const u8 *buf; 7289 7289 size_t len; 7290 7290 const u8 *req_ies; ··· 7301 7301 /** 7302 7302 * cfg80211_rx_assoc_resp - notification of processed association response 7303 7303 * @dev: network device 7304 - * @data: association response data, &struct cfg80211_rx_assoc_resp 7304 + * @data: association response data, &struct cfg80211_rx_assoc_resp_data 7305 7305 * 7306 7306 * After being asked to associate via cfg80211_ops::assoc() the driver must 7307 7307 * call either this function or cfg80211_auth_timeout(). ··· 7309 7309 * This function may sleep. The caller must hold the corresponding wdev's mutex. 7310 7310 */ 7311 7311 void cfg80211_rx_assoc_resp(struct net_device *dev, 7312 - struct cfg80211_rx_assoc_resp *data); 7312 + struct cfg80211_rx_assoc_resp_data *data); 7313 7313 7314 7314 /** 7315 7315 * struct cfg80211_assoc_failure - association failure data ··· 8028 8028 * cfg80211_port_authorized - notify cfg80211 of successful security association 8029 8029 * 8030 8030 * @dev: network device 8031 - * @bssid: the BSSID of the AP 8031 + * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address 8032 + * in case of AP/P2P GO 8032 8033 * @td_bitmap: transition disable policy 8033 8034 * @td_bitmap_len: Length of transition disable policy 8034 8035 * @gfp: allocation flags ··· 8040 8039 * should be preceded with a call to cfg80211_connect_result(), 8041 8040 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 8042 8041 * indicate the 802.11 association. 8042 + * This function can also be called by AP/P2P GO driver that supports 8043 + * authentication offload. In this case the peer_mac passed is that of 8044 + * associated STA/GC. 8043 8045 */ 8044 - void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 8046 + void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr, 8045 8047 const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp); 8046 8048 8047 8049 /** ··· 9133 9129 9134 9130 /** 9135 9131 * cfg80211_assoc_comeback - notification of association that was 9136 - * temporarly rejected with a comeback 9132 + * temporarily rejected with a comeback 9137 9133 * @netdev: network device 9138 - * @ap_addr: AP (MLD) address that rejected the assocation 9134 + * @ap_addr: AP (MLD) address that rejected the association 9139 9135 * @timeout: timeout interval value TUs. 9140 9136 * 9141 9137 * this function may sleep. the caller must hold the corresponding wdev's mutex.
+43 -33
include/net/mac80211.h
··· 79 79 * helpers for sanity checking. Drivers must ensure all work added onto the 80 80 * mac80211 workqueue should be cancelled on the driver stop() callback. 81 81 * 82 - * mac80211 will flushed the workqueue upon interface removal and during 82 + * mac80211 will flush the workqueue upon interface removal and during 83 83 * suspend. 84 84 * 85 85 * All work performed on the mac80211 workqueue must not acquire the RTNL lock. ··· 138 138 * field to the frame RX timestamp and report the ack TX timestamp in the 139 139 * ieee80211_rx_status struct. 140 140 * 141 - * Similarly, To report hardware timestamps for Timing Measurement or Fine 141 + * Similarly, to report hardware timestamps for Timing Measurement or Fine 142 142 * Timing Measurement frame TX, the driver should set the SKB's hwtstamp field 143 143 * to the frame TX timestamp and report the ack RX timestamp in the 144 144 * ieee80211_tx_status struct. ··· 1767 1767 * @IEEE80211_VIF_GET_NOA_UPDATE: request to handle NOA attributes 1768 1768 * and send P2P_PS notification to the driver if NOA changed, even 1769 1769 * this is not pure P2P vif. 1770 - * @IEEE80211_VIF_DISABLE_SMPS_OVERRIDE: disable user configuration of 1771 - * SMPS mode via debugfs. 1770 + * @IEEE80211_VIF_EML_ACTIVE: The driver indicates that EML operation is 1771 + * enabled for the interface. 1772 1772 */ 1773 1773 enum ieee80211_vif_flags { 1774 1774 IEEE80211_VIF_BEACON_FILTER = BIT(0), 1775 1775 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), 1776 1776 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), 1777 1777 IEEE80211_VIF_GET_NOA_UPDATE = BIT(3), 1778 - IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(4), 1778 + IEEE80211_VIF_EML_ACTIVE = BIT(4), 1779 1779 }; 1780 1780 1781 1781 ··· 3062 3062 * The set_key() call for the %SET_KEY command should return 0 if 3063 3063 * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be 3064 3064 * added; if you return 0 then hw_key_idx must be assigned to the 3065 - * hardware key index, you are free to use the full u8 range. 3065 + * hardware key index. You are free to use the full u8 range. 3066 3066 * 3067 3067 * Note that in the case that the @IEEE80211_HW_SW_CRYPTO_CONTROL flag is 3068 3068 * set, mac80211 will not automatically fall back to software crypto if ··· 3072 3072 * When the cmd is %DISABLE_KEY then it must succeed. 3073 3073 * 3074 3074 * Note that it is permissible to not decrypt a frame even if a key 3075 - * for it has been uploaded to hardware, the stack will not make any 3075 + * for it has been uploaded to hardware. The stack will not make any 3076 3076 * decision based on whether a key has been uploaded or not but rather 3077 3077 * based on the receive flags. 3078 3078 * ··· 3087 3087 * The update_tkip_key() call updates the driver with the new phase 1 key. 3088 3088 * This happens every time the iv16 wraps around (every 65536 packets). The 3089 3089 * set_key() call will happen only once for each key (unless the AP did 3090 - * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 3090 + * rekeying); it will not include a valid phase 1 key. The valid phase 1 key is 3091 3091 * provided by update_tkip_key only. The trigger that makes mac80211 call this 3092 3092 * handler is software decryption with wrap around of iv16. 3093 3093 * ··· 3114 3114 * 3115 3115 * mac80211 has support for various powersave implementations. 3116 3116 * 3117 - * First, it can support hardware that handles all powersaving by itself, 3117 + * First, it can support hardware that handles all powersaving by itself; 3118 3118 * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware 3119 3119 * flag. In that case, it will be told about the desired powersave mode 3120 3120 * with the %IEEE80211_CONF_PS flag depending on the association status. ··· 3139 3139 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 3140 3140 * required to pass up beacons. The hardware is still required to handle 3141 3141 * waking up for multicast traffic; if it cannot the driver must handle that 3142 - * as best as it can, mac80211 is too slow to do that. 3142 + * as best as it can; mac80211 is too slow to do that. 3143 3143 * 3144 3144 * Dynamic powersave is an extension to normal powersave in which the 3145 3145 * hardware stays awake for a user-specified period of time after sending a 3146 3146 * frame so that reply frames need not be buffered and therefore delayed to 3147 - * the next wakeup. It's compromise of getting good enough latency when 3147 + * the next wakeup. It's a compromise of getting good enough latency when 3148 3148 * there's data traffic and still saving significantly power in idle 3149 3149 * periods. 3150 3150 * ··· 3209 3209 * Note that change, for the sake of simplification, also includes information 3210 3210 * elements appearing or disappearing from the beacon. 3211 3211 * 3212 - * Some hardware supports an "ignore list" instead, just make sure nothing 3212 + * Some hardware supports an "ignore list" instead. Just make sure nothing 3213 3213 * that was requested is on the ignore list, and include commonly changing 3214 3214 * information element IDs in the ignore list, for example 11 (BSS load) and 3215 3215 * the various vendor-assigned IEs with unknown contents (128, 129, 133-136, ··· 3220 3220 * In addition to these capabilities, hardware should support notifying the 3221 3221 * host of changes in the beacon RSSI. This is relevant to implement roaming 3222 3222 * when no traffic is flowing (when traffic is flowing we see the RSSI of 3223 - * the received data packets). This can consist in notifying the host when 3223 + * the received data packets). This can consist of notifying the host when 3224 3224 * the RSSI changes significantly or when it drops below or rises above 3225 3225 * configurable thresholds. In the future these thresholds will also be 3226 3226 * configured by mac80211 (which gets them from userspace) to implement ··· 3367 3367 * period starts for any reason, @release_buffered_frames is called 3368 3368 * with the number of frames to be released and which TIDs they are 3369 3369 * to come from. In this case, the driver is responsible for setting 3370 - * the EOSP (for uAPSD) and MORE_DATA bits in the released frames, 3371 - * to help the @more_data parameter is passed to tell the driver if 3370 + * the EOSP (for uAPSD) and MORE_DATA bits in the released frames. 3371 + * To help the @more_data parameter is passed to tell the driver if 3372 3372 * there is more data on other TIDs -- the TIDs to release frames 3373 3373 * from are ignored since mac80211 doesn't know how many frames the 3374 3374 * buffers for those TIDs contain. ··· 3417 3417 * Additionally, the driver has to then use these HW queue IDs for the queue 3418 3418 * management functions (ieee80211_stop_queue() et al.) 3419 3419 * 3420 - * The driver is free to set up the queue mappings as needed, multiple virtual 3420 + * The driver is free to set up the queue mappings as needed; multiple virtual 3421 3421 * interfaces may map to the same hardware queues if needed. The setup has to 3422 3422 * happen during add_interface or change_interface callbacks. For example, a 3423 3423 * driver supporting station+station and station+AP modes might decide to have ··· 3641 3641 * @success: whether the frame exchange was successful, only 3642 3642 * used with the mgd_complete_tx() method, and then only 3643 3643 * valid for auth and (re)assoc. 3644 + * @link_id: the link id on which the frame will be TX'ed. 3645 + * Only used with the mgd_prepare_tx() method. 3644 3646 */ 3645 3647 struct ieee80211_prep_tx_info { 3646 3648 u16 duration; 3647 3649 u16 subtype; 3648 3650 u8 success:1; 3651 + int link_id; 3649 3652 }; 3650 3653 3651 3654 /** ··· 3871 3868 * no RCU grace period is guaranteed between returning here and freeing 3872 3869 * the station. See @sta_pre_rcu_remove if needed. 3873 3870 * This callback can sleep. 3871 + * 3872 + * @vif_add_debugfs: Drivers can use this callback to add a debugfs vif 3873 + * directory with its files. This callback should be within a 3874 + * CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep. 3874 3875 * 3875 3876 * @link_add_debugfs: Drivers can use this callback to add debugfs files 3876 3877 * when a link is added to a mac80211 vif. This callback should be within ··· 4375 4368 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 4376 4369 struct ieee80211_sta *sta); 4377 4370 #ifdef CONFIG_MAC80211_DEBUGFS 4371 + void (*vif_add_debugfs)(struct ieee80211_hw *hw, 4372 + struct ieee80211_vif *vif); 4378 4373 void (*link_add_debugfs)(struct ieee80211_hw *hw, 4379 4374 struct ieee80211_vif *vif, 4380 4375 struct ieee80211_bss_conf *link_conf, ··· 4525 4516 struct ieee80211_prep_tx_info *info); 4526 4517 4527 4518 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw, 4528 - struct ieee80211_vif *vif); 4519 + struct ieee80211_vif *vif, 4520 + unsigned int link_id); 4529 4521 4530 4522 int (*add_chanctx)(struct ieee80211_hw *hw, 4531 4523 struct ieee80211_chanctx_conf *ctx); ··· 4911 4901 * for a single hardware must be synchronized against each other. Calls to 4912 4902 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be 4913 4903 * mixed for a single hardware. Must not run concurrently with 4914 - * ieee80211_tx_status() or ieee80211_tx_status_ni(). 4904 + * ieee80211_tx_status_skb() or ieee80211_tx_status_ni(). 4915 4905 * 4916 4906 * This function must be called with BHs disabled and RCU read lock 4917 4907 * ··· 4936 4926 * for a single hardware must be synchronized against each other. Calls to 4937 4927 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be 4938 4928 * mixed for a single hardware. Must not run concurrently with 4939 - * ieee80211_tx_status() or ieee80211_tx_status_ni(). 4929 + * ieee80211_tx_status_skb() or ieee80211_tx_status_ni(). 4940 4930 * 4941 4931 * This function must be called with BHs disabled. 4942 4932 * ··· 4961 4951 * for a single hardware must be synchronized against each other. Calls to 4962 4952 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be 4963 4953 * mixed for a single hardware. Must not run concurrently with 4964 - * ieee80211_tx_status() or ieee80211_tx_status_ni(). 4954 + * ieee80211_tx_status_skb() or ieee80211_tx_status_ni(). 4965 4955 * 4966 4956 * In process context use instead ieee80211_rx_ni(). 4967 4957 * ··· 4981 4971 * 4982 4972 * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not 4983 4973 * be mixed for a single hardware.Must not run concurrently with 4984 - * ieee80211_tx_status() or ieee80211_tx_status_ni(). 4974 + * ieee80211_tx_status_skb() or ieee80211_tx_status_ni(). 4985 4975 * 4986 4976 * @hw: the hardware this frame came in on 4987 4977 * @skb: the buffer to receive, owned by mac80211 after this call ··· 4996 4986 * 4997 4987 * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may 4998 4988 * not be mixed for a single hardware. Must not run concurrently with 4999 - * ieee80211_tx_status() or ieee80211_tx_status_ni(). 4989 + * ieee80211_tx_status_skb() or ieee80211_tx_status_ni(). 5000 4990 * 5001 4991 * @hw: the hardware this frame came in on 5002 4992 * @skb: the buffer to receive, owned by mac80211 after this call ··· 5172 5162 struct ieee80211_tx_info *info); 5173 5163 5174 5164 /** 5175 - * ieee80211_tx_status - transmit status callback 5165 + * ieee80211_tx_status_skb - transmit status callback 5176 5166 * 5177 5167 * Call this function for all transmitted frames after they have been 5178 5168 * transmitted. It is permissible to not call this function for ··· 5187 5177 * @hw: the hardware the frame was transmitted by 5188 5178 * @skb: the frame that was transmitted, owned by mac80211 after this call 5189 5179 */ 5190 - void ieee80211_tx_status(struct ieee80211_hw *hw, 5191 - struct sk_buff *skb); 5180 + void ieee80211_tx_status_skb(struct ieee80211_hw *hw, 5181 + struct sk_buff *skb); 5192 5182 5193 5183 /** 5194 5184 * ieee80211_tx_status_ext - extended transmit status callback 5195 5185 * 5196 - * This function can be used as a replacement for ieee80211_tx_status 5186 + * This function can be used as a replacement for ieee80211_tx_status_skb() 5197 5187 * in drivers that may want to provide extra information that does not 5198 5188 * fit into &struct ieee80211_tx_info. 5199 5189 * ··· 5210 5200 /** 5211 5201 * ieee80211_tx_status_noskb - transmit status callback without skb 5212 5202 * 5213 - * This function can be used as a replacement for ieee80211_tx_status 5203 + * This function can be used as a replacement for ieee80211_tx_status_skb() 5214 5204 * in drivers that cannot reliably map tx status information back to 5215 5205 * specific skbs. 5216 5206 * ··· 5238 5228 /** 5239 5229 * ieee80211_tx_status_ni - transmit status callback (in process context) 5240 5230 * 5241 - * Like ieee80211_tx_status() but can be called in process context. 5231 + * Like ieee80211_tx_status_skb() but can be called in process context. 5242 5232 * 5243 - * Calls to this function, ieee80211_tx_status() and 5233 + * Calls to this function, ieee80211_tx_status_skb() and 5244 5234 * ieee80211_tx_status_irqsafe() may not be mixed 5245 5235 * for a single hardware. 5246 5236 * ··· 5251 5241 struct sk_buff *skb) 5252 5242 { 5253 5243 local_bh_disable(); 5254 - ieee80211_tx_status(hw, skb); 5244 + ieee80211_tx_status_skb(hw, skb); 5255 5245 local_bh_enable(); 5256 5246 } 5257 5247 5258 5248 /** 5259 5249 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback 5260 5250 * 5261 - * Like ieee80211_tx_status() but can be called in IRQ context 5251 + * Like ieee80211_tx_status_skb() but can be called in IRQ context 5262 5252 * (internally defers to a tasklet.) 5263 5253 * 5264 - * Calls to this function, ieee80211_tx_status() and 5254 + * Calls to this function, ieee80211_tx_status_skb() and 5265 5255 * ieee80211_tx_status_ni() may not be mixed for a single hardware. 5266 5256 * 5267 5257 * @hw: the hardware the frame was transmitted by ··· 7266 7256 * 7267 7257 * This function is used to check whether given txq is allowed to transmit by 7268 7258 * the airtime scheduler, and can be used by drivers to access the airtime 7269 - * fairness accounting without going using the scheduling order enfored by 7259 + * fairness accounting without using the scheduling order enforced by 7270 7260 * next_txq(). 7271 7261 * 7272 7262 * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
+2 -2
include/uapi/linux/nl80211.h
··· 167 167 * following events occur. 168 168 * a) Expiration of hardware timer whose expiration time is set to maximum 169 169 * coalescing delay of matching coalesce rule. 170 - * b) Coalescing buffer in hardware reaches it's limit. 170 + * b) Coalescing buffer in hardware reaches its limit. 171 171 * c) Packet doesn't match any of the configured coalesce rules. 172 172 * 173 173 * User needs to configure following parameters for creating a coalesce ··· 326 326 /** 327 327 * DOC: Multi-Link Operation 328 328 * 329 - * In Multi-Link Operation, a connection between to MLDs utilizes multiple 329 + * In Multi-Link Operation, a connection between two MLDs utilizes multiple 330 330 * links. To use this in nl80211, various commands and responses now need 331 331 * to or will include the new %NL80211_ATTR_MLO_LINKS attribute. 332 332 * Additionally, various commands that need to operate on a specific link
+6
net/mac80211/cfg.c
··· 3158 3158 old_req = link->u.mgd.req_smps; 3159 3159 link->u.mgd.req_smps = smps_mode; 3160 3160 3161 + /* The driver indicated that EML is enabled for the interface, which 3162 + * implies that SMPS flows towards the AP should be stopped. 3163 + */ 3164 + if (sdata->vif.driver_flags & IEEE80211_VIF_EML_ACTIVE) 3165 + return 0; 3166 + 3161 3167 if (old_req == smps_mode && 3162 3168 smps_mode != IEEE80211_SMPS_AUTOMATIC) 3163 3169 return 0;
+22 -6
net/mac80211/debugfs_netdev.c
··· 323 323 struct ieee80211_sub_if_data *sdata = link->sdata; 324 324 struct ieee80211_local *local = sdata->local; 325 325 326 - if (sdata->vif.driver_flags & IEEE80211_VIF_DISABLE_SMPS_OVERRIDE) 326 + /* The driver indicated that EML is enabled for the interface, thus do 327 + * not allow to override the SMPS state. 328 + */ 329 + if (sdata->vif.driver_flags & IEEE80211_VIF_EML_ACTIVE) 327 330 return -EOPNOTSUPP; 328 331 329 332 if (!(local->hw.wiphy->features & NL80211_FEATURE_STATIC_SMPS) && ··· 937 934 } 938 935 } 939 936 940 - void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) 937 + void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata, 938 + bool mld_vif) 941 939 { 942 940 char buf[10+IFNAMSIZ]; 943 941 944 942 sprintf(buf, "netdev:%s", sdata->name); 945 943 sdata->vif.debugfs_dir = debugfs_create_dir(buf, 946 944 sdata->local->hw.wiphy->debugfsdir); 945 + /* deflink also has this */ 946 + sdata->deflink.debugfs_dir = sdata->vif.debugfs_dir; 947 947 sdata->debugfs.subdir_stations = debugfs_create_dir("stations", 948 948 sdata->vif.debugfs_dir); 949 949 add_files(sdata); 950 - 951 - if (!(sdata->local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)) 950 + if (!mld_vif) 952 951 add_link_files(&sdata->deflink, sdata->vif.debugfs_dir); 953 952 } 954 953 ··· 978 973 debugfs_rename(dir->d_parent, dir, dir->d_parent, buf); 979 974 } 980 975 976 + void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata, 977 + bool mld_vif) 978 + { 979 + ieee80211_debugfs_remove_netdev(sdata); 980 + ieee80211_debugfs_add_netdev(sdata, mld_vif); 981 + drv_vif_add_debugfs(sdata->local, sdata); 982 + if (!mld_vif) 983 + ieee80211_link_debugfs_drv_add(&sdata->deflink); 984 + } 985 + 981 986 void ieee80211_link_debugfs_add(struct ieee80211_link_data *link) 982 987 { 983 988 char link_dir_name[10]; 984 989 985 - if (WARN_ON(!link->sdata->vif.debugfs_dir)) 990 + if (WARN_ON(!link->sdata->vif.debugfs_dir || link->debugfs_dir)) 986 991 return; 987 992 988 993 /* For now, this should not be called for non-MLO capable drivers */ ··· 1029 1014 1030 1015 void ieee80211_link_debugfs_drv_add(struct ieee80211_link_data *link) 1031 1016 { 1032 - if (WARN_ON(!link->debugfs_dir)) 1017 + if (link->sdata->vif.type == NL80211_IFTYPE_MONITOR || 1018 + WARN_ON(!link->debugfs_dir)) 1033 1019 return; 1034 1020 1035 1021 drv_link_add_debugfs(link->sdata->local, link->sdata,
+12 -3
net/mac80211/debugfs_netdev.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Portions: 4 + * Copyright (C) 2023 Intel Corporation 5 + */ 2 6 /* routines exported for debugfs handling */ 3 7 4 8 #ifndef __IEEE80211_DEBUGFS_NETDEV_H ··· 11 7 #include "ieee80211_i.h" 12 8 13 9 #ifdef CONFIG_MAC80211_DEBUGFS 14 - void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); 10 + void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata, 11 + bool mld_vif); 15 12 void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); 16 13 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata); 14 + void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata, 15 + bool mld_vif); 17 16 18 17 void ieee80211_link_debugfs_add(struct ieee80211_link_data *link); 19 18 void ieee80211_link_debugfs_remove(struct ieee80211_link_data *link); ··· 25 18 void ieee80211_link_debugfs_drv_remove(struct ieee80211_link_data *link); 26 19 #else 27 20 static inline void ieee80211_debugfs_add_netdev( 28 - struct ieee80211_sub_if_data *sdata) 21 + struct ieee80211_sub_if_data *sdata, bool mld_vif) 29 22 {} 30 23 static inline void ieee80211_debugfs_remove_netdev( 31 24 struct ieee80211_sub_if_data *sdata) ··· 33 26 static inline void ieee80211_debugfs_rename_netdev( 34 27 struct ieee80211_sub_if_data *sdata) 35 28 {} 36 - 29 + static inline void ieee80211_debugfs_recreate_netdev( 30 + struct ieee80211_sub_if_data *sdata, bool mld_vif) 31 + {} 37 32 static inline void ieee80211_link_debugfs_add(struct ieee80211_link_data *link) 38 33 {} 39 34 static inline void ieee80211_link_debugfs_remove(struct ieee80211_link_data *link)
+17 -6
net/mac80211/driver-ops.c
··· 72 72 ret = local->ops->add_interface(&local->hw, &sdata->vif); 73 73 trace_drv_return_int(local, ret); 74 74 75 - if (ret == 0) 76 - sdata->flags |= IEEE80211_SDATA_IN_DRIVER; 75 + if (ret) 76 + return ret; 77 77 78 - return ret; 78 + sdata->flags |= IEEE80211_SDATA_IN_DRIVER; 79 + 80 + if (!local->in_reconfig) { 81 + drv_vif_add_debugfs(local, sdata); 82 + /* initially vif is not MLD */ 83 + ieee80211_link_debugfs_drv_add(&sdata->deflink); 84 + } 85 + 86 + return 0; 79 87 } 80 88 81 89 int drv_change_interface(struct ieee80211_local *local, ··· 534 526 if (ret) 535 527 return ret; 536 528 537 - for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) { 538 - link = rcu_access_pointer(sdata->link[link_id]); 529 + if (!local->in_reconfig) { 530 + for_each_set_bit(link_id, &links_to_add, 531 + IEEE80211_MLD_MAX_NUM_LINKS) { 532 + link = rcu_access_pointer(sdata->link[link_id]); 539 533 540 - ieee80211_link_debugfs_drv_add(link); 534 + ieee80211_link_debugfs_drv_add(link); 535 + } 541 536 } 542 537 543 538 return 0;
+30 -2
net/mac80211/driver-ops.h
··· 489 489 } 490 490 491 491 #ifdef CONFIG_MAC80211_DEBUGFS 492 + static inline void drv_vif_add_debugfs(struct ieee80211_local *local, 493 + struct ieee80211_sub_if_data *sdata) 494 + { 495 + might_sleep(); 496 + 497 + if (sdata->vif.type == NL80211_IFTYPE_MONITOR || 498 + WARN_ON(!sdata->vif.debugfs_dir)) 499 + return; 500 + 501 + sdata = get_bss_sdata(sdata); 502 + if (!check_sdata_in_driver(sdata)) 503 + return; 504 + 505 + if (local->ops->vif_add_debugfs) 506 + local->ops->vif_add_debugfs(&local->hw, &sdata->vif); 507 + } 508 + 492 509 static inline void drv_link_add_debugfs(struct ieee80211_local *local, 493 510 struct ieee80211_sub_if_data *sdata, 494 511 struct ieee80211_bss_conf *link_conf, ··· 555 538 if (local->ops->link_sta_add_debugfs) 556 539 local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif, 557 540 link_sta, dir); 541 + } 542 + #else 543 + static inline void drv_vif_add_debugfs(struct ieee80211_local *local, 544 + struct ieee80211_sub_if_data *sdata) 545 + { 546 + might_sleep(); 558 547 } 559 548 #endif 560 549 ··· 928 905 return; 929 906 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); 930 907 908 + info->link_id = info->link_id < 0 ? 0 : info->link_id; 931 909 trace_drv_mgd_prepare_tx(local, sdata, info->duration, 932 910 info->subtype, info->success); 933 911 if (local->ops->mgd_prepare_tx) ··· 956 932 957 933 static inline void 958 934 drv_mgd_protect_tdls_discover(struct ieee80211_local *local, 959 - struct ieee80211_sub_if_data *sdata) 935 + struct ieee80211_sub_if_data *sdata, 936 + int link_id) 960 937 { 961 938 might_sleep(); 962 939 lockdep_assert_wiphy(local->hw.wiphy); ··· 966 941 return; 967 942 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); 968 943 944 + link_id = link_id > 0 ? link_id : 0; 945 + 969 946 trace_drv_mgd_protect_tdls_discover(local, sdata); 970 947 if (local->ops->mgd_protect_tdls_discover) 971 - local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif); 948 + local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif, 949 + link_id); 972 950 trace_drv_return_void(local); 973 951 } 974 952
+2 -1
net/mac80211/ieee80211_i.h
··· 1746 1746 */ 1747 1747 size_t scratch_len; 1748 1748 u8 *scratch_pos; 1749 - u8 scratch[]; 1749 + u8 scratch[] __counted_by(scratch_len); 1750 1750 }; 1751 1751 1752 1752 static inline struct ieee80211_local *hw_to_local( ··· 2390 2390 struct txq_info *txq, int tid); 2391 2391 void ieee80211_txq_purge(struct ieee80211_local *local, 2392 2392 struct txq_info *txqi); 2393 + void ieee80211_purge_sta_txqs(struct sta_info *sta); 2393 2394 void ieee80211_txq_remove_vlan(struct ieee80211_local *local, 2394 2395 struct ieee80211_sub_if_data *sdata); 2395 2396 void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
+9 -1
net/mac80211/iface.c
··· 298 298 struct ieee80211_local *local = sdata->local; 299 299 int ret; 300 300 301 + /* 302 + * This happens during unregistration if there's a bond device 303 + * active (maybe other cases?) and we must get removed from it. 304 + * But we really don't care anymore if it's not registered now. 305 + */ 306 + if (!dev->ieee80211_ptr->registered) 307 + return 0; 308 + 301 309 wiphy_lock(local->hw.wiphy); 302 310 ret = _ieee80211_change_mac(sdata, addr); 303 311 wiphy_unlock(local->hw.wiphy); ··· 1783 1775 /* need to do this after the switch so vif.type is correct */ 1784 1776 ieee80211_link_setup(&sdata->deflink); 1785 1777 1786 - ieee80211_debugfs_add_netdev(sdata); 1778 + ieee80211_debugfs_add_netdev(sdata, false); 1787 1779 } 1788 1780 1789 1781 static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
+4 -2
net/mac80211/key.c
··· 881 881 if (link_id >= 0) { 882 882 link_sta = rcu_dereference_protected(sta->link[link_id], 883 883 lockdep_is_held(&sta->local->hw.wiphy->mtx)); 884 - if (!link_sta) 885 - return -ENOLINK; 884 + if (!link_sta) { 885 + ret = -ENOLINK; 886 + goto out; 887 + } 886 888 } 887 889 888 890 old_key = wiphy_dereference(sdata->local->hw.wiphy,
+6 -1
net/mac80211/link.c
··· 195 195 196 196 memset(to_free, 0, sizeof(links)); 197 197 198 - if (old_links == new_links) 198 + if (old_links == new_links && dormant_links == sdata->vif.dormant_links) 199 199 return 0; 200 200 201 201 /* if there were no old links, need to clear the pointers to deflink */ ··· 235 235 RCU_INIT_POINTER(sdata->vif.link_conf[link_id], NULL); 236 236 } 237 237 238 + if (!old_links) 239 + ieee80211_debugfs_recreate_netdev(sdata, true); 240 + 238 241 /* link them into data structures */ 239 242 for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { 240 243 WARN_ON(!use_deflink && ··· 264 261 old_links & old_active, 265 262 new_links & sdata->vif.active_links, 266 263 old); 264 + if (!new_links) 265 + ieee80211_debugfs_recreate_netdev(sdata, false); 267 266 } 268 267 269 268 if (ret) {
+1 -1
net/mac80211/main.c
··· 319 319 break; 320 320 case IEEE80211_TX_STATUS_MSG: 321 321 skb->pkt_type = 0; 322 - ieee80211_tx_status(&local->hw, skb); 322 + ieee80211_tx_status_skb(&local->hw, skb); 323 323 break; 324 324 default: 325 325 WARN(1, "mac80211: Packet is of unknown type %d\n",
+6 -2
net/mac80211/mesh.c
··· 56 56 * 57 57 * This function checks if the mesh configuration of a mesh point matches the 58 58 * local mesh configuration, i.e. if both nodes belong to the same mesh network. 59 + * 60 + * Returns: %true if both nodes belong to the same mesh 59 61 */ 60 62 bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, 61 63 struct ieee802_11_elems *ie) ··· 121 119 * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links 122 120 * 123 121 * @ie: information elements of a management frame from the mesh peer 122 + * 123 + * Returns: %true if the mesh peer is willing to establish peer links 124 124 */ 125 125 bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) 126 126 { ··· 862 858 * @meshsa: source address in the mesh. Same as TA, as frame is 863 859 * locally originated. 864 860 * 865 - * Return the length of the 802.11 (does not include a mesh control header) 861 + * Returns: the length of the 802.11 frame header (excludes mesh control header) 866 862 */ 867 863 int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, 868 864 const u8 *meshda, const u8 *meshsa) ··· 895 891 * @addr6: 2nd address in the ae header, which corresponds to addr6 of the 896 892 * mesh frame 897 893 * 898 - * Return the header length. 894 + * Returns: the header length 899 895 */ 900 896 unsigned int ieee80211_new_mesh_header(struct ieee80211_sub_if_data *sdata, 901 897 struct ieee80211s_hdr *meshhdr,
+2
net/mac80211/mesh_hwmp.c
··· 230 230 * Note: This function may be called with driver locks taken that the driver 231 231 * also acquires in the TX path. To avoid a deadlock we don't transmit the 232 232 * frame directly but add it to the pending queue instead. 233 + * 234 + * Returns: 0 on success 233 235 */ 234 236 int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, 235 237 u8 ttl, const u8 *target, u32 target_sn,
+13 -7
net/mac80211/mesh_pathtbl.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 3 * Copyright (c) 2008, 2009 open80211s Ltd. 4 + * Copyright (C) 2023 Intel Corporation 4 5 * Author: Luis Carlos Cobo <luisca@cozybit.com> 5 6 */ 6 7 ··· 174 173 /** 175 174 * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another 176 175 * 176 + * @gate_mpath: An active mpath the frames will be sent to (i.e. the gate) 177 + * @from_mpath: The failed mpath 178 + * @copy: When true, copy all the frames to the new mpath queue. When false, 179 + * move them. 180 + * 177 181 * This function is used to transfer or copy frames from an unresolved mpath to 178 182 * a gate mpath. The function also adds the Address Extension field and 179 183 * updates the next hop. ··· 187 181 * destination addresses are updated. 188 182 * 189 183 * The gate mpath must be an active mpath with a valid mpath->next_hop. 190 - * 191 - * @gate_mpath: An active mpath the frames will be sent to (i.e. the gate) 192 - * @from_mpath: The failed mpath 193 - * @copy: When true, copy all the frames to the new mpath queue. When false, 194 - * move them. 195 184 */ 196 185 static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, 197 186 struct mesh_path *from_mpath, ··· 331 330 /** 332 331 * mesh_path_add_gate - add the given mpath to a mesh gate to our path table 333 332 * @mpath: gate path to add to table 333 + * 334 + * Returns: 0 on success, -EEXIST 334 335 */ 335 336 int mesh_path_add_gate(struct mesh_path *mpath) 336 337 { ··· 391 388 /** 392 389 * mesh_gate_num - number of gates known to this interface 393 390 * @sdata: subif data 391 + * 392 + * Returns: The number of gates 394 393 */ 395 394 int mesh_gate_num(struct ieee80211_sub_if_data *sdata) 396 395 { ··· 866 861 /** 867 862 * mesh_path_flush_by_iface - Deletes all mesh paths associated with a given iface 868 863 * 869 - * This function deletes both mesh paths as well as mesh portal paths. 870 - * 871 864 * @sdata: interface data to match 872 865 * 866 + * This function deletes both mesh paths as well as mesh portal paths. 873 867 */ 874 868 void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata) 875 869 { ··· 948 944 * queue to that gate's queue. If there are more than one gates, the frames 949 945 * are copied from each gate to the next. After frames are copied, the 950 946 * mpath queues are emptied onto the transmission queue. 947 + * 948 + * Returns: 0 on success, -EHOSTUNREACH 951 949 */ 952 950 int mesh_path_send_to_gates(struct mesh_path *mpath) 953 951 {
+5 -1
net/mac80211/mesh_plink.c
··· 153 153 * selected if any non-HT peers are present in our MBSS. 20MHz-protection mode 154 154 * is selected if all peers in our 20/40MHz MBSS support HT and at least one 155 155 * HT20 peer is present. Otherwise no-protection mode is selected. 156 + * 157 + * Returns: BSS_CHANGED_HT or 0 for no change 156 158 */ 157 159 static u64 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) 158 160 { ··· 364 362 * Mesh paths with this peer as next hop should be flushed 365 363 * by the caller outside of plink_lock. 366 364 * 367 - * Returns beacon changed flag if the beacon content changed. 365 + * Returns: beacon changed flag if the beacon content changed. 368 366 * 369 367 * Locking: the caller must hold sta->mesh->plink_lock 370 368 */ ··· 392 390 * @sta: mesh peer link to deactivate 393 391 * 394 392 * All mesh paths with this peer as next hop will be flushed 393 + * 394 + * Returns: beacon changed flag if the beacon content changed. 395 395 */ 396 396 u64 mesh_plink_deactivate(struct sta_info *sta) 397 397 {
+5 -1
net/mac80211/mesh_ps.c
··· 15 15 /** 16 16 * mps_qos_null_get - create pre-addressed QoS Null frame for mesh powersave 17 17 * @sta: the station to get the frame for 18 + * 19 + * Returns: A newly allocated SKB 18 20 */ 19 21 static struct sk_buff *mps_qos_null_get(struct sta_info *sta) 20 22 { ··· 79 77 * 80 78 * sets the non-peer power mode and triggers the driver PS (re-)configuration 81 79 * Return BSS_CHANGED_BEACON if a beacon update is necessary. 80 + * 81 + * Returns: BSS_CHANGED_BEACON if a beacon update is in order. 82 82 */ 83 83 u64 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata) 84 84 { ··· 151 147 * 152 148 * @sta: mesh STA 153 149 * @pm: the power mode to set 154 - * Return BSS_CHANGED_BEACON if a beacon update is in order. 150 + * Returns: BSS_CHANGED_BEACON if a beacon update is in order. 155 151 */ 156 152 u64 ieee80211_mps_set_sta_local_pm(struct sta_info *sta, 157 153 enum nl80211_mesh_power_mode pm)
+3 -1
net/mac80211/mesh_sync.c
··· 3 3 * Copyright 2011-2012, Pavel Zubarev <pavel.zubarev@gmail.com> 4 4 * Copyright 2011-2012, Marco Porsch <marco.porsch@s2005.tu-chemnitz.de> 5 5 * Copyright 2011-2012, cozybit Inc. 6 - * Copyright (C) 2021 Intel Corporation 6 + * Copyright (C) 2021,2023 Intel Corporation 7 7 */ 8 8 9 9 #include "ieee80211_i.h" ··· 37 37 * mesh_peer_tbtt_adjusting - check if an mp is currently adjusting its TBTT 38 38 * 39 39 * @cfg: mesh config element from the mesh peer (or %NULL) 40 + * 41 + * Returns: If the mesh peer is currently adjusting its TBTT 40 42 */ 41 43 static bool mesh_peer_tbtt_adjusting(const struct ieee80211_meshconf_ie *cfg) 42 44 {
+35 -8
net/mac80211/mlme.c
··· 1584 1584 1585 1585 ifmgd->assoc_req_ies_len = pos - ie_start; 1586 1586 1587 + info.link_id = assoc_data->assoc_link_id; 1587 1588 drv_mgd_prepare_tx(local, sdata, &info); 1588 1589 1589 1590 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; ··· 2937 2936 * deauthentication frame by calling mgd_prepare_tx, if the 2938 2937 * driver requested so. 2939 2938 */ 2940 - if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) && 2941 - !sdata->deflink.u.mgd.have_beacon) { 2942 - drv_mgd_prepare_tx(sdata->local, sdata, &info); 2939 + if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP)) { 2940 + for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); 2941 + link_id++) { 2942 + struct ieee80211_link_data *link; 2943 + 2944 + link = sdata_dereference(sdata->link[link_id], 2945 + sdata); 2946 + if (!link) 2947 + continue; 2948 + if (link->u.mgd.have_beacon) 2949 + break; 2950 + } 2951 + if (link_id == IEEE80211_MLD_MAX_NUM_LINKS) { 2952 + info.link_id = ffs(sdata->vif.active_links) - 1; 2953 + drv_mgd_prepare_tx(sdata->local, sdata, &info); 2954 + } 2943 2955 } 2944 2956 2945 2957 ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr, ··· 3580 3566 u32 tx_flags = 0; 3581 3567 struct ieee80211_prep_tx_info info = { 3582 3568 .subtype = IEEE80211_STYPE_AUTH, 3569 + .link_id = auth_data->link_id, 3583 3570 }; 3584 3571 3585 3572 pos = mgmt->u.auth.variable; ··· 5281 5266 .u.mlme.data = ASSOC_EVENT, 5282 5267 }; 5283 5268 struct ieee80211_prep_tx_info info = {}; 5284 - struct cfg80211_rx_assoc_resp resp = { 5269 + struct cfg80211_rx_assoc_resp_data resp = { 5285 5270 .uapsd_queues = -1, 5286 5271 }; 5287 5272 u8 ap_mld_addr[ETH_ALEN] __aligned(2); ··· 6573 6558 if (auth_data->algorithm == WLAN_AUTH_SAE) 6574 6559 info.duration = jiffies_to_msecs(IEEE80211_AUTH_TIMEOUT_SAE); 6575 6560 6561 + info.link_id = auth_data->link_id; 6576 6562 drv_mgd_prepare_tx(local, sdata, &info); 6577 6563 6578 6564 sdata_info(sdata, "send auth to %pM (try %d/%d)\n", ··· 7734 7718 match = ether_addr_equal(ifmgd->auth_data->ap_addr, 7735 7719 assoc_data->ap_addr) && 7736 7720 ifmgd->auth_data->link_id == req->link_id; 7737 - ieee80211_destroy_auth_data(sdata, match); 7721 + 7722 + /* Cleanup is delayed if auth_data matches */ 7723 + if (!match) 7724 + ieee80211_destroy_auth_data(sdata, false); 7738 7725 } 7739 7726 7740 7727 /* prepare assoc data */ ··· 7960 7941 7961 7942 run_again(sdata, assoc_data->timeout); 7962 7943 7944 + /* We are associating, clean up auth_data */ 7945 + if (ifmgd->auth_data) 7946 + ieee80211_destroy_auth_data(sdata, true); 7947 + 7963 7948 return 0; 7964 7949 err_clear: 7965 - eth_zero_addr(sdata->deflink.u.mgd.bssid); 7966 - ieee80211_link_info_change_notify(sdata, &sdata->deflink, 7967 - BSS_CHANGED_BSSID); 7950 + if (!ifmgd->auth_data) { 7951 + eth_zero_addr(sdata->deflink.u.mgd.bssid); 7952 + ieee80211_link_info_change_notify(sdata, &sdata->deflink, 7953 + BSS_CHANGED_BSSID); 7954 + } 7968 7955 ifmgd->assoc_data = NULL; 7969 7956 err_free: 7970 7957 kfree(assoc_data); ··· 7994 7969 req->bssid, req->reason_code, 7995 7970 ieee80211_get_reason_code_string(req->reason_code)); 7996 7971 7972 + info.link_id = ifmgd->auth_data->link_id; 7997 7973 drv_mgd_prepare_tx(sdata->local, sdata, &info); 7998 7974 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, 7999 7975 IEEE80211_STYPE_DEAUTH, ··· 8015 7989 req->bssid, req->reason_code, 8016 7990 ieee80211_get_reason_code_string(req->reason_code)); 8017 7991 7992 + info.link_id = ifmgd->assoc_data->assoc_link_id; 8018 7993 drv_mgd_prepare_tx(sdata->local, sdata, &info); 8019 7994 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, 8020 7995 IEEE80211_STYPE_DEAUTH,
+17
net/mac80211/offchannel.c
··· 717 717 return ret; 718 718 } 719 719 720 + /* 721 + * We could be racing against the notification from the driver: 722 + * + driver is handling the notification on CPU0 723 + * + user space is cancelling the remain on channel and 724 + * schedules the hw_roc_done worker. 725 + * 726 + * Now hw_roc_done might start to run after the next roc will 727 + * start and mac80211 will think that this second roc has 728 + * ended prematurely. 729 + * Cancel the work to make sure that all the pending workers 730 + * have completed execution. 731 + * Note that this assumes that by the time the driver returns 732 + * from drv_cancel_remain_on_channel, it has completed all 733 + * the processing of related notifications. 734 + */ 735 + wiphy_work_cancel(local->hw.wiphy, &local->hw_roc_done); 736 + 720 737 /* TODO: 721 738 * if multiple items were combined here then we really shouldn't 722 739 * cancel them all - we should wait for as much time as needed
+9
net/mac80211/rx.c
··· 2473 2473 return RX_DROP_U_UNPROT_UNICAST_PUB_ACTION; 2474 2474 } 2475 2475 2476 + /* 2477 + * Drop robust action frames before assoc regardless of MFP state, 2478 + * after assoc we also have decided on MFP or not. 2479 + */ 2480 + if (ieee80211_is_action(fc) && 2481 + ieee80211_is_robust_mgmt_frame(rx->skb) && 2482 + (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC))) 2483 + return RX_DROP_U_UNPROT_ROBUST_ACTION; 2484 + 2476 2485 return RX_CONTINUE; 2477 2486 } 2478 2487
+38 -22
net/mac80211/sta_info.c
··· 113 113 &link_sta->link_hash_node, link_sta_rht_params); 114 114 } 115 115 116 + void ieee80211_purge_sta_txqs(struct sta_info *sta) 117 + { 118 + struct ieee80211_local *local = sta->sdata->local; 119 + int i; 120 + 121 + for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { 122 + struct txq_info *txqi; 123 + 124 + if (!sta->sta.txq[i]) 125 + continue; 126 + 127 + txqi = to_txq_info(sta->sta.txq[i]); 128 + 129 + ieee80211_txq_purge(local, txqi); 130 + } 131 + } 132 + 116 133 static void __cleanup_single_sta(struct sta_info *sta) 117 134 { 118 135 int ac, i; ··· 156 139 atomic_dec(&ps->num_sta_ps); 157 140 } 158 141 159 - for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { 160 - struct txq_info *txqi; 161 - 162 - if (!sta->sta.txq[i]) 163 - continue; 164 - 165 - txqi = to_txq_info(sta->sta.txq[i]); 166 - 167 - ieee80211_txq_purge(local, txqi); 168 - } 142 + ieee80211_purge_sta_txqs(sta); 169 143 170 144 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 171 145 local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]); ··· 1275 1267 enum ieee80211_sta_state new_state, 1276 1268 bool recalc) 1277 1269 { 1270 + struct ieee80211_local *local = sta->local; 1271 + 1278 1272 might_sleep(); 1279 1273 1280 1274 if (sta->sta_state == new_state) ··· 1352 1342 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { 1353 1343 ieee80211_vif_dec_num_mcast(sta->sdata); 1354 1344 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags); 1345 + 1346 + /* 1347 + * If we have encryption offload, flush (station) queues 1348 + * (after ensuring concurrent TX completed) so we won't 1349 + * transmit anything later unencrypted if/when keys are 1350 + * also removed, which might otherwise happen depending 1351 + * on how the hardware offload works. 1352 + */ 1353 + if (local->ops->set_key) { 1354 + synchronize_net(); 1355 + if (local->ops->flush_sta) 1356 + drv_flush_sta(local, sta->sdata, sta); 1357 + else 1358 + ieee80211_flush_queues(local, 1359 + sta->sdata, 1360 + false); 1361 + } 1362 + 1355 1363 ieee80211_clear_fast_xmit(sta); 1356 1364 ieee80211_clear_fast_rx(sta); 1357 1365 } ··· 1433 1405 if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { 1434 1406 ret = _sta_info_move_state(sta, IEEE80211_STA_ASSOC, recalc); 1435 1407 WARN_ON_ONCE(ret); 1436 - } 1437 - 1438 - /* Flush queues before removing keys, as that might remove them 1439 - * from hardware, and then depending on the offload method, any 1440 - * frames sitting on hardware queues might be sent out without 1441 - * any encryption at all. 1442 - */ 1443 - if (local->ops->set_key) { 1444 - if (local->ops->flush_sta) 1445 - drv_flush_sta(local, sta->sdata, sta); 1446 - else 1447 - ieee80211_flush_queues(local, sta->sdata, false); 1448 1408 } 1449 1409 1450 1410 /* now keys can no longer be reached */
+3 -6
net/mac80211/status.c
··· 731 731 if (!sdata) { 732 732 skb->dev = NULL; 733 733 } else if (!dropped) { 734 - unsigned int hdr_size = 735 - ieee80211_hdrlen(hdr->frame_control); 736 - 737 734 /* Check to see if packet is a TDLS teardown packet */ 738 735 if (ieee80211_is_data(hdr->frame_control) && 739 - (ieee80211_get_tdls_action(skb, hdr_size) == 736 + (ieee80211_get_tdls_action(skb) == 740 737 WLAN_TDLS_TEARDOWN)) { 741 738 ieee80211_tdls_td_tx_handle(local, sdata, skb, 742 739 info->flags); ··· 1092 1095 send_to_cooked, status); 1093 1096 } 1094 1097 1095 - void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) 1098 + void ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb) 1096 1099 { 1097 1100 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1098 1101 struct ieee80211_local *local = hw_to_local(hw); ··· 1111 1114 ieee80211_tx_status_ext(hw, &status); 1112 1115 rcu_read_unlock(); 1113 1116 } 1114 - EXPORT_SYMBOL(ieee80211_tx_status); 1117 + EXPORT_SYMBOL(ieee80211_tx_status_skb); 1115 1118 1116 1119 void ieee80211_tx_status_ext(struct ieee80211_hw *hw, 1117 1120 struct ieee80211_tx_status *status)
+1 -1
net/mac80211/tdls.c
··· 1318 1318 * response frame. It is transmitted directly and not buffered 1319 1319 * by the AP. 1320 1320 */ 1321 - drv_mgd_protect_tdls_discover(sdata->local, sdata); 1321 + drv_mgd_protect_tdls_discover(sdata->local, sdata, link_id); 1322 1322 fallthrough; 1323 1323 case WLAN_TDLS_SETUP_CONFIRM: 1324 1324 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
+14 -1
net/mac80211/util.c
··· 693 693 IEEE80211_QUEUE_STOP_REASON_FLUSH, 694 694 false); 695 695 696 + if (drop) { 697 + struct sta_info *sta; 698 + 699 + /* Purge the queues, so the frames on them won't be 700 + * sent during __ieee80211_wake_queue() 701 + */ 702 + list_for_each_entry(sta, &local->sta_list, list) { 703 + if (sdata != sta->sdata) 704 + continue; 705 + ieee80211_purge_sta_txqs(sta); 706 + } 707 + } 708 + 696 709 drv_flush(local, sdata, queues, drop); 697 710 698 711 ieee80211_wake_queues_by_reason(&local->hw, queues, ··· 1625 1612 int nontransmitted_profile_len = 0; 1626 1613 size_t scratch_len = 3 * params->len; 1627 1614 1628 - elems = kzalloc(sizeof(*elems) + scratch_len, GFP_ATOMIC); 1615 + elems = kzalloc(struct_size(elems, scratch, scratch_len), GFP_ATOMIC); 1629 1616 if (!elems) 1630 1617 return NULL; 1631 1618 elems->ie_start = params->start;
+2 -2
net/wireless/core.h
··· 270 270 struct ieee80211_channel *channel; 271 271 } ij; 272 272 struct { 273 - u8 bssid[ETH_ALEN]; 273 + u8 peer_addr[ETH_ALEN]; 274 274 const u8 *td_bitmap; 275 275 u8 td_bitmap_len; 276 276 } pa; ··· 404 404 bool wextev); 405 405 void __cfg80211_roamed(struct wireless_dev *wdev, 406 406 struct cfg80211_roam_info *info); 407 - void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid, 407 + void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *peer_addr, 408 408 const u8 *td_bitmap, u8 td_bitmap_len); 409 409 int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, 410 410 struct wireless_dev *wdev);
+1 -1
net/wireless/mlme.c
··· 22 22 23 23 24 24 void cfg80211_rx_assoc_resp(struct net_device *dev, 25 - struct cfg80211_rx_assoc_resp *data) 25 + struct cfg80211_rx_assoc_resp_data *data) 26 26 { 27 27 struct wireless_dev *wdev = dev->ieee80211_ptr; 28 28 struct wiphy *wiphy = wdev->wiphy;
+3 -3
net/wireless/nl80211.c
··· 17799 17799 17800 17800 void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, 17801 17801 struct net_device *netdev, 17802 - struct cfg80211_rx_assoc_resp *data) 17802 + struct cfg80211_rx_assoc_resp_data *data) 17803 17803 { 17804 17804 nl80211_send_mlme_event(rdev, netdev, data->buf, data->len, 17805 17805 NL80211_CMD_ASSOCIATE, GFP_KERNEL, ··· 18124 18124 } 18125 18125 18126 18126 void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev, 18127 - struct net_device *netdev, const u8 *bssid, 18127 + struct net_device *netdev, const u8 *peer_addr, 18128 18128 const u8 *td_bitmap, u8 td_bitmap_len) 18129 18129 { 18130 18130 struct sk_buff *msg; ··· 18142 18142 18143 18143 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 18144 18144 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || 18145 - nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) 18145 + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, peer_addr)) 18146 18146 goto nla_put_failure; 18147 18147 18148 18148 if ((td_bitmap_len > 0) && td_bitmap)
+5 -2
net/wireless/nl80211.h
··· 60 60 const u8 *buf, size_t len, gfp_t gfp); 61 61 void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, 62 62 struct net_device *netdev, 63 - struct cfg80211_rx_assoc_resp *data); 63 + struct cfg80211_rx_assoc_resp_data *data); 64 64 void nl80211_send_deauth(struct cfg80211_registered_device *rdev, 65 65 struct net_device *netdev, 66 66 const u8 *buf, size_t len, ··· 82 82 void nl80211_send_roamed(struct cfg80211_registered_device *rdev, 83 83 struct net_device *netdev, 84 84 struct cfg80211_roam_info *info, gfp_t gfp); 85 + /* For STA/GC, indicate port authorized with AP/GO bssid. 86 + * For GO/AP, use peer GC/STA mac_addr. 87 + */ 85 88 void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev, 86 - struct net_device *netdev, const u8 *bssid, 89 + struct net_device *netdev, const u8 *peer_addr, 87 90 const u8 *td_bitmap, u8 td_bitmap_len); 88 91 void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, 89 92 struct net_device *netdev, u16 reason,
+37
net/wireless/scan.c
··· 830 830 list_for_each_entry(intbss, &rdev->bss_list, list) { 831 831 struct cfg80211_bss *res = &intbss->pub; 832 832 const struct cfg80211_bss_ies *ies; 833 + const struct element *ssid_elem; 834 + struct cfg80211_colocated_ap *entry; 835 + u32 s_ssid_tmp; 836 + int ret; 833 837 834 838 ies = rcu_access_pointer(res->ies); 835 839 count += cfg80211_parse_colocated_ap(ies, 836 840 &coloc_ap_list); 841 + 842 + /* In case the scan request specified a specific BSSID 843 + * and the BSS is found and operating on 6GHz band then 844 + * add this AP to the collocated APs list. 845 + * This is relevant for ML probe requests when the lower 846 + * band APs have not been discovered. 847 + */ 848 + if (is_broadcast_ether_addr(rdev_req->bssid) || 849 + !ether_addr_equal(rdev_req->bssid, res->bssid) || 850 + res->channel->band != NL80211_BAND_6GHZ) 851 + continue; 852 + 853 + ret = cfg80211_calc_short_ssid(ies, &ssid_elem, 854 + &s_ssid_tmp); 855 + if (ret) 856 + continue; 857 + 858 + entry = kzalloc(sizeof(*entry) + IEEE80211_MAX_SSID_LEN, 859 + GFP_ATOMIC); 860 + 861 + if (!entry) 862 + continue; 863 + 864 + memcpy(entry->bssid, res->bssid, ETH_ALEN); 865 + entry->short_ssid = s_ssid_tmp; 866 + memcpy(entry->ssid, ssid_elem->data, 867 + ssid_elem->datalen); 868 + entry->ssid_len = ssid_elem->datalen; 869 + entry->short_ssid_valid = true; 870 + entry->center_freq = res->channel->center_freq; 871 + 872 + list_add_tail(&entry->list, &coloc_ap_list); 873 + count++; 837 874 } 838 875 spin_unlock_bh(&rdev->bss_lock); 839 876 }
+14 -9
net/wireless/sme.c
··· 1281 1281 } 1282 1282 EXPORT_SYMBOL(cfg80211_roamed); 1283 1283 1284 - void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid, 1284 + void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *peer_addr, 1285 1285 const u8 *td_bitmap, u8 td_bitmap_len) 1286 1286 { 1287 1287 lockdep_assert_wiphy(wdev->wiphy); 1288 1288 1289 1289 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && 1290 - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) 1290 + wdev->iftype != NL80211_IFTYPE_P2P_CLIENT && 1291 + wdev->iftype != NL80211_IFTYPE_AP && 1292 + wdev->iftype != NL80211_IFTYPE_P2P_GO)) 1291 1293 return; 1292 1294 1293 - if (WARN_ON(!wdev->connected) || 1294 - WARN_ON(!ether_addr_equal(wdev->u.client.connected_addr, bssid))) 1295 - return; 1295 + if (wdev->iftype == NL80211_IFTYPE_STATION || 1296 + wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) { 1297 + if (WARN_ON(!wdev->connected) || 1298 + WARN_ON(!ether_addr_equal(wdev->u.client.connected_addr, peer_addr))) 1299 + return; 1300 + } 1296 1301 1297 1302 nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev, 1298 - bssid, td_bitmap, td_bitmap_len); 1303 + peer_addr, td_bitmap, td_bitmap_len); 1299 1304 } 1300 1305 1301 - void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 1306 + void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr, 1302 1307 const u8 *td_bitmap, u8 td_bitmap_len, gfp_t gfp) 1303 1308 { 1304 1309 struct wireless_dev *wdev = dev->ieee80211_ptr; ··· 1311 1306 struct cfg80211_event *ev; 1312 1307 unsigned long flags; 1313 1308 1314 - if (WARN_ON(!bssid)) 1309 + if (WARN_ON(!peer_addr)) 1315 1310 return; 1316 1311 1317 1312 ev = kzalloc(sizeof(*ev) + td_bitmap_len, gfp); ··· 1319 1314 return; 1320 1315 1321 1316 ev->type = EVENT_PORT_AUTHORIZED; 1322 - memcpy(ev->pa.bssid, bssid, ETH_ALEN); 1317 + memcpy(ev->pa.peer_addr, peer_addr, ETH_ALEN); 1323 1318 ev->pa.td_bitmap = ((u8 *)ev) + sizeof(*ev); 1324 1319 ev->pa.td_bitmap_len = td_bitmap_len; 1325 1320 memcpy((void *)ev->pa.td_bitmap, td_bitmap, td_bitmap_len);
+1 -1
net/wireless/trace.h
··· 2928 2928 2929 2929 TRACE_EVENT(cfg80211_send_rx_assoc, 2930 2930 TP_PROTO(struct net_device *netdev, 2931 - struct cfg80211_rx_assoc_resp *data), 2931 + struct cfg80211_rx_assoc_resp_data *data), 2932 2932 TP_ARGS(netdev, data), 2933 2933 TP_STRUCT__entry( 2934 2934 NETDEV_ENTRY
+2 -1
net/wireless/util.c
··· 1062 1062 cfg80211_leave(wiphy_to_rdev(wdev->wiphy), wdev); 1063 1063 break; 1064 1064 case EVENT_PORT_AUTHORIZED: 1065 - __cfg80211_port_authorized(wdev, ev->pa.bssid, 1065 + __cfg80211_port_authorized(wdev, ev->pa.peer_addr, 1066 1066 ev->pa.td_bitmap, 1067 1067 ev->pa.td_bitmap_len); 1068 1068 break; ··· 1999 1999 *band = NL80211_BAND_5GHZ; 2000 2000 return true; 2001 2001 case 131 ... 135: 2002 + case 137: 2002 2003 *band = NL80211_BAND_6GHZ; 2003 2004 return true; 2004 2005 case 81:
+2 -2
net/wireless/wext-compat.c
··· 7 7 * we directly assign the wireless handlers of wireless interfaces. 8 8 * 9 9 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> 10 - * Copyright (C) 2019-2022 Intel Corporation 10 + * Copyright (C) 2019-2023 Intel Corporation 11 11 */ 12 12 13 13 #include <linux/export.h> ··· 227 227 * cfg80211_wext_freq - get wext frequency for non-"auto" 228 228 * @freq: the wext freq encoding 229 229 * 230 - * Returns a frequency, or a negative error code, or 0 for auto. 230 + * Returns: a frequency, or a negative error code, or 0 for auto. 231 231 */ 232 232 int cfg80211_wext_freq(struct iw_freq *freq) 233 233 {