Johannes Berg says: ==================== Plenty of things going on, notably: - iwlwifi: major cleanups/rework - brcmfmac: gets AP isolation support - mac80211: gets more S1G support * tag 'wireless-next-2025-09-11' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (94 commits) wifi: mwifiex: fix endianness handling in mwifiex_send_rgpower_table wifi: cfg80211: Remove the redundant wiphy_dev wifi: mac80211: fix incorrect comment wifi: cfg80211: update the time stamps in hidden ssid wifi: mac80211: Fix HE capabilities element check wifi: mac80211: add tx_handlers_drop statistics to ethtool wifi: mac80211: fix reporting of all valid links in sta_set_sinfo() wifi: iwlwifi: mld: CHANNEL_SURVEY_NOTIF is always supported wifi: iwlwifi: mld: remove support of iwl_esr_mode_notif version 1 wifi: iwlwifi: mld: remove support from of sta cmd version 1 wifi: iwlwifi: mld: remove support of roc cmd version 5 wifi: iwlwifi: mld: remove support of mac cmd ver 2 wifi: iwlwifi: mld: don't consider phy cmd version 5 wifi: iwlwifi: implement wowlan status notification API update wifi: iwlwifi: fw: Add ASUS to PPAG and TAS list wifi: iwlwifi: add kunit tests for nvm parse wifi: iwlwifi: api: add a flag to iwl_link_ctx_modify_flags wifi: iwlwifi: pcie: move ltr_enabled to the specific transport wifi: iwlwifi: pcie: move pm_support to the specific transport wifi: iwlwifi: rename iwl_finish_nic_init ... ====================
Unified · Split
| @@ -555,7 +555,7 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) · 554 unmodified lines | ||
| 555 | 555 | /* Check whenever the PHY can be turned off again. */ |
| 556 | 556 | |
| 557 | 557 | /* 1. What about buffered unicast traffic for our AID? */ |
| 558 | − cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid); | |
| 558 | + cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid, false); | |
| 559 | 559 | |
| 560 | 560 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ |
| 561 | 561 | cam |= !!(tim_ie->bitmap_ctrl & 0x01); |
| @@ -2708,6 +2708,7 @@ static void wil_wiphy_init(struct wiphy *wiphy) · 2707 unmodified lines | ||
| 2708 | 2708 | wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites); |
| 2709 | 2709 | wiphy->mgmt_stypes = wil_mgmt_stypes; |
| 2710 | 2710 | wiphy->features |= NL80211_FEATURE_SK_TX_STATUS; |
| 2711 | + wiphy->bss_param_support = WIPHY_BSS_PARAM_AP_ISOLATE; | |
| 2711 | 2712 | |
| 2712 | 2713 | wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands); |
| 2713 | 2714 | wiphy->vendor_commands = wil_nl80211_vendor_commands; |
| @@ -997,9 +997,9 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = { · 996 unmodified lines | ||
| 997 | 997 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356, WCC), |
| 998 | 998 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4359, WCC), |
| 999 | 999 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43751, WCC), |
| 1000 | + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43752, WCC), | |
| 1000 | 1001 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373, CYW), |
| 1001 | 1002 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012, CYW), |
| 1002 | − BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752, CYW), | |
| 1003 | 1003 | BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359, CYW), |
| 1004 | 1004 | CYW_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439, CYW), |
| 1005 | 1005 | { /* end: all zeroes */ } |
| @@ -5958,6 +5958,26 @@ static int brcmf_cfg80211_del_pmk(struct wiphy *wiphy, struct net_device *dev, · 5957 unmodified lines | ||
| 5958 | 5958 | return brcmf_set_pmk(ifp, NULL, 0); |
| 5959 | 5959 | } |
| 5960 | 5960 | |
| 5961 | +static int brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, | |
| 5962 | + struct bss_parameters *params) | |
| 5963 | +{ | |
| 5964 | + struct brcmf_if *ifp = netdev_priv(dev); | |
| 5965 | + int ret = 0; | |
| 5966 | + | |
| 5967 | + /* In AP mode, the "ap_isolate" value represents | |
| 5968 | + * 0 = allow low-level bridging of frames between associated stations | |
| 5969 | + * 1 = restrict low-level bridging of frames to isolate associated stations | |
| 5970 | + * -1 = do not change existing setting | |
| 5971 | + */ | |
| 5972 | + if (params->ap_isolate >= 0) { | |
| 5973 | + ret = brcmf_fil_iovar_int_set(ifp, "ap_isolate", params->ap_isolate); | |
| 5974 | + if (ret < 0) | |
| 5975 | + brcmf_err("ap_isolate iovar failed: ret=%d\n", ret); | |
| 5976 | + } | |
| 5977 | + | |
| 5978 | + return ret; | |
| 5979 | +} | |
| 5980 | + | |
| 5961 | 5981 | static struct cfg80211_ops brcmf_cfg80211_ops = { |
| 5962 | 5982 | .add_virtual_intf = brcmf_cfg80211_add_iface, |
| 5963 | 5983 | .del_virtual_intf = brcmf_cfg80211_del_iface, |
| @@ -6005,6 +6025,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { · 41 unmodified lines | ||
| 6005 | 6025 | .update_connect_params = brcmf_cfg80211_update_conn_params, |
| 6006 | 6026 | .set_pmk = brcmf_cfg80211_set_pmk, |
| 6007 | 6027 | .del_pmk = brcmf_cfg80211_del_pmk, |
| 6028 | + .change_bss = brcmf_cfg80211_change_bss, | |
| 6008 | 6029 | }; |
| 6009 | 6030 | |
| 6010 | 6031 | struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings) |
| @@ -7659,6 +7680,8 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) · 1648 unmodified lines | ||
| 7659 | 7680 | BIT(NL80211_BSS_SELECT_ATTR_BAND_PREF) | |
| 7660 | 7681 | BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST); |
| 7661 | 7682 | |
| 7683 | + wiphy->bss_param_support = WIPHY_BSS_PARAM_AP_ISOLATE; | |
| 7684 | + | |
| 7662 | 7685 | wiphy->flags |= WIPHY_FLAG_NETNS_OK | |
| 7663 | 7686 | WIPHY_FLAG_PS_ON_BY_DEFAULT | |
| 7664 | 7687 | WIPHY_FLAG_HAVE_AP_SME | |
| @@ -738,8 +738,8 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci) · 737 unmodified lines | ||
| 738 | 738 | case BRCM_CC_4364_CHIP_ID: |
| 739 | 739 | case CY_CC_4373_CHIP_ID: |
| 740 | 740 | return 0x160000; |
| 741 | − case CY_CC_43752_CHIP_ID: | |
| 742 | 741 | case BRCM_CC_43751_CHIP_ID: |
| 742 | + case BRCM_CC_43752_CHIP_ID: | |
| 743 | 743 | case BRCM_CC_4377_CHIP_ID: |
| 744 | 744 | return 0x170000; |
| 745 | 745 | case BRCM_CC_4378_CHIP_ID: |
| @@ -1452,7 +1452,7 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub) · 706 unmodified lines | ||
| 1452 | 1452 | return (reg & CC_SR_CTL0_ENABLE_MASK) != 0; |
| 1453 | 1453 | case BRCM_CC_4359_CHIP_ID: |
| 1454 | 1454 | case BRCM_CC_43751_CHIP_ID: |
| 1455 | − case CY_CC_43752_CHIP_ID: | |
| 1455 | + case BRCM_CC_43752_CHIP_ID: | |
| 1456 | 1456 | case CY_CC_43012_CHIP_ID: |
| 1457 | 1457 | addr = CORE_CC_REG(pmu->base, retention_ctl); |
| 1458 | 1458 | reg = chip->ops->read32(chip->ctx, addr); |
| @@ -554,12 +554,16 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) · 553 unmodified lines | ||
| 554 | 554 | data = (u8 *)fw->data; |
| 555 | 555 | data_len = fw->size; |
| 556 | 556 | } else { |
| 557 | − if ((data = bcm47xx_nvram_get_contents(&data_len))) | |
| 557 | + data = bcm47xx_nvram_get_contents(&data_len); | |
| 558 | + if (data) { | |
| 558 | 559 | free_bcm47xx_nvram = true; |
| 559 | − else if ((data = brcmf_fw_nvram_from_efi(&data_len))) | |
| 560 | − kfree_nvram = true; | |
| 561 | − else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) | |
| 562 | − goto fail; | |
| 560 | + } else { | |
| 561 | + data = brcmf_fw_nvram_from_efi(&data_len); | |
| 562 | + if (data) | |
| 563 | + kfree_nvram = true; | |
| 564 | + else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) | |
| 565 | + goto fail; | |
| 566 | + } | |
| 563 | 567 | } |
| 564 | 568 | |
| 565 | 569 | if (data) |
| @@ -655,10 +655,10 @@ static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { · 654 unmodified lines | ||
| 655 | 655 | BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), |
| 656 | 656 | BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), |
| 657 | 657 | BRCMF_FW_ENTRY(BRCM_CC_43751_CHIP_ID, 0xFFFFFFFF, 43752), |
| 658 | + BRCMF_FW_ENTRY(BRCM_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752), | |
| 658 | 659 | BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373), |
| 659 | 660 | BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012), |
| 660 | 661 | BRCMF_FW_ENTRY(CY_CC_43439_CHIP_ID, 0xFFFFFFFF, 43439), |
| 661 | − BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) | |
| 662 | 662 | }; |
| 663 | 663 | |
| 664 | 664 | #define TXCTL_CREDITS 2 |
| @@ -3426,8 +3426,8 @@ err: · 2761 unmodified lines | ||
| 3426 | 3426 | static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus) |
| 3427 | 3427 | { |
| 3428 | 3428 | if (bus->ci->chip == BRCM_CC_43751_CHIP_ID || |
| 3429 | − bus->ci->chip == CY_CC_43012_CHIP_ID || | |
| 3430 | − bus->ci->chip == CY_CC_43752_CHIP_ID) | |
| 3429 | + bus->ci->chip == BRCM_CC_43752_CHIP_ID || | |
| 3430 | + bus->ci->chip == CY_CC_43012_CHIP_ID) | |
| 3431 | 3431 | return true; |
| 3432 | 3432 | else |
| 3433 | 3433 | return false; |
| @@ -4278,8 +4278,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, · 844 unmodified lines | ||
| 4278 | 4278 | |
| 4279 | 4279 | switch (sdiod->func1->device) { |
| 4280 | 4280 | case SDIO_DEVICE_ID_BROADCOM_43751: |
| 4281 | + case SDIO_DEVICE_ID_BROADCOM_43752: | |
| 4281 | 4282 | case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373: |
| 4282 | − case SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752: | |
| 4283 | 4283 | brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", |
| 4284 | 4284 | CY_4373_F2_WATERMARK); |
| 4285 | 4285 | brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, |
| @@ -60,7 +60,6 @@ · 59 unmodified lines | ||
| 60 | 60 | #define CY_CC_4373_CHIP_ID 0x4373 |
| 61 | 61 | #define CY_CC_43012_CHIP_ID 43012 |
| 62 | 62 | #define CY_CC_43439_CHIP_ID 43439 |
| 63 | −#define CY_CC_43752_CHIP_ID 43752 | |
| 64 | 63 | |
| 65 | 64 | /* USB Device IDs */ |
| 66 | 65 | #define BRCM_USB_43143_DEVICE_ID 0xbd1e |
| @@ -50,28 +50,4 @@ struct ieee80211_measurement_params { · 49 unmodified lines | ||
| 50 | 50 | __le16 duration; |
| 51 | 51 | } __packed; |
| 52 | 52 | |
| 53 | −struct ieee80211_info_element { | |
| 54 | − u8 id; | |
| 55 | − u8 len; | |
| 56 | − u8 data[]; | |
| 57 | −} __packed; | |
| 58 | − | |
| 59 | −struct ieee80211_measurement_request { | |
| 60 | − struct ieee80211_info_element ie; | |
| 61 | − u8 token; | |
| 62 | − u8 mode; | |
| 63 | − u8 type; | |
| 64 | − struct ieee80211_measurement_params params[]; | |
| 65 | −} __packed; | |
| 66 | − | |
| 67 | −struct ieee80211_measurement_report { | |
| 68 | − struct ieee80211_info_element ie; | |
| 69 | − u8 token; | |
| 70 | − u8 mode; | |
| 71 | − u8 type; | |
| 72 | − union { | |
| 73 | − struct ieee80211_basic_report basic[0]; | |
| 74 | − } u; | |
| 75 | −} __packed; | |
| 76 | − | |
| 77 | 53 | #endif |
| @@ -9,11 +9,11 @@ · 8 unmodified lines | ||
| 9 | 9 | #include "iwl-prph.h" |
| 10 | 10 | #include "fw/api/txq.h" |
| 11 | 11 | |
| 12 | −/* Highest firmware API version supported */ | |
| 13 | −#define IWL_BZ_UCODE_API_MAX 102 | |
| 12 | +/* Highest firmware core release supported */ | |
| 13 | +#define IWL_BZ_UCODE_CORE_MAX 99 | |
| 14 | 14 | |
| 15 | 15 | /* Lowest firmware API version supported */ |
| 16 | −#define IWL_BZ_UCODE_API_MIN 98 | |
| 16 | +#define IWL_BZ_UCODE_API_MIN 100 | |
| 17 | 17 | |
| 18 | 18 | /* Memory offsets and lengths */ |
| 19 | 19 | #define IWL_BZ_SMEM_OFFSET 0x400000 |
| @@ -75,7 +75,7 @@ static const struct iwl_family_base_params iwl_bz_base = { · 55 unmodified lines | ||
| 75 | 75 | }, |
| 76 | 76 | }, |
| 77 | 77 | .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, |
| 78 | − .ucode_api_max = IWL_BZ_UCODE_API_MAX, | |
| 78 | + .ucode_api_max = ENCODE_CORE_AS_API(IWL_BZ_UCODE_CORE_MAX), | |
| 79 | 79 | .ucode_api_min = IWL_BZ_UCODE_API_MIN, |
| 80 | 80 | }; |
| 81 | 81 | |
| @@ -101,8 +101,8 @@ const struct iwl_mac_cfg iwl_gl_mac_cfg = { · 19 unmodified lines | ||
| 101 | 101 | .low_latency_xtal = true, |
| 102 | 102 | }; |
| 103 | 103 | |
| 104 | −IWL_FW_AND_PNVM(IWL_BZ_A_FM_B_FW_PRE, IWL_BZ_UCODE_API_MAX); | |
| 105 | −IWL_FW_AND_PNVM(IWL_BZ_A_FM_C_FW_PRE, IWL_BZ_UCODE_API_MAX); | |
| 106 | −IWL_FW_AND_PNVM(IWL_BZ_A_FM4_B_FW_PRE, IWL_BZ_UCODE_API_MAX); | |
| 107 | −IWL_FW_AND_PNVM(IWL_GL_B_FM_B_FW_PRE, IWL_BZ_UCODE_API_MAX); | |
| 108 | −IWL_FW_AND_PNVM(IWL_GL_C_FM_C_FW_PRE, IWL_BZ_UCODE_API_MAX); | |
| 104 | +IWL_CORE_FW(IWL_BZ_A_FM_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX); | |
| 105 | +IWL_CORE_FW(IWL_BZ_A_FM_C_FW_PRE, IWL_BZ_UCODE_CORE_MAX); | |
| 106 | +IWL_CORE_FW(IWL_BZ_A_FM4_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX); | |
| 107 | +IWL_CORE_FW(IWL_GL_B_FM_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX); | |
| 108 | +IWL_CORE_FW(IWL_GL_C_FM_C_FW_PRE, IWL_BZ_UCODE_CORE_MAX); | |
| @@ -8,11 +8,11 @@ · 7 unmodified lines | ||
| 8 | 8 | #include "iwl-prph.h" |
| 9 | 9 | #include "fw/api/txq.h" |
| 10 | 10 | |
| 11 | −/* Highest firmware API version supported */ | |
| 12 | −#define IWL_DR_UCODE_API_MAX 102 | |
| 11 | +/* Highest firmware core release supported */ | |
| 12 | +#define IWL_DR_UCODE_CORE_MAX 99 | |
| 13 | 13 | |
| 14 | 14 | /* Lowest firmware API version supported */ |
| 15 | −#define IWL_DR_UCODE_API_MIN 98 | |
| 15 | +#define IWL_DR_UCODE_API_MIN 100 | |
| 16 | 16 | |
| 17 | 17 | /* Memory offsets and lengths */ |
| 18 | 18 | #define IWL_DR_SMEM_OFFSET 0x400000 |
| @@ -20,9 +20,6 @@ · 1 unmodified line | ||
| 20 | 20 | |
| 21 | 21 | #define IWL_DR_A_PE_A_FW_PRE "iwlwifi-dr-a0-pe-a0" |
| 22 | 22 | |
| 23 | −#define IWL_DR_A_PE_A_FW_MODULE_FIRMWARE(api) \ | |
| 24 | − IWL_DR_A_PE_A_FW_PRE "-" __stringify(api) ".ucode" | |
| 25 | − | |
| 26 | 23 | static const struct iwl_family_base_params iwl_dr_base = { |
| 27 | 24 | .num_of_queues = 512, |
| 28 | 25 | .max_tfd_queue_size = 65536, |
| @@ -73,7 +70,7 @@ static const struct iwl_family_base_params iwl_dr_base = { · 44 unmodified lines | ||
| 73 | 70 | }, |
| 74 | 71 | }, |
| 75 | 72 | .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, |
| 76 | − .ucode_api_max = IWL_DR_UCODE_API_MAX, | |
| 73 | + .ucode_api_max = ENCODE_CORE_AS_API(IWL_DR_UCODE_CORE_MAX), | |
| 77 | 74 | .ucode_api_min = IWL_DR_UCODE_API_MIN, |
| 78 | 75 | }; |
| 79 | 76 | |
| @@ -89,5 +86,5 @@ const struct iwl_mac_cfg iwl_dr_mac_cfg = { · 9 unmodified lines | ||
| 89 | 86 | .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US, |
| 90 | 87 | }; |
| 91 | 88 | |
| 92 | −MODULE_FIRMWARE(IWL_DR_A_PE_A_FW_MODULE_FIRMWARE(IWL_DR_UCODE_API_MAX)); | |
| 89 | +IWL_CORE_FW(IWL_DR_A_PE_A_FW_PRE, IWL_DR_UCODE_CORE_MAX); | |
| 93 | 90 | |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #define IWL_GF_UCODE_API_MAX 100 |
| 10 | 10 | |
| 11 | 11 | /* Lowest firmware API version supported */ |
| 12 | −#define IWL_GF_UCODE_API_MIN 98 | |
| 12 | +#define IWL_GF_UCODE_API_MIN 100 | |
| 13 | 13 | |
| 14 | 14 | #define IWL_SO_A_GF_A_FW_PRE "iwlwifi-so-a0-gf-a0" |
| 15 | 15 | #define IWL_TY_A_GF_A_FW_PRE "iwlwifi-ty-a0-gf-a0" |
| @@ -23,6 +23,18 @@ · 7 unmodified lines | ||
| 23 | 23 | #define IWL_SC_A_GF_A_FW_PRE "iwlwifi-sc-a0-gf-a0" |
| 24 | 24 | #define IWL_SC_A_GF4_A_FW_PRE "iwlwifi-sc-a0-gf4-a0" |
| 25 | 25 | |
| 26 | +#define IWL_BZ_A_GF_A_MODULE_FIRMWARE(api) \ | |
| 27 | + IWL_BZ_A_GF_A_FW_PRE "-" __stringify(api) ".ucode" | |
| 28 | + | |
| 29 | +#define IWL_BZ_A_GF4_A_MODULE_FIRMWARE(api) \ | |
| 30 | + IWL_BZ_A_GF4_A_FW_PRE "-" __stringify(api) ".ucode" | |
| 31 | + | |
| 32 | +#define IWL_SC_A_GF_A_MODULE_FIRMWARE(api) \ | |
| 33 | + IWL_SC_A_GF_A_FW_PRE "-" __stringify(api) ".ucode" | |
| 34 | + | |
| 35 | +#define IWL_SC_A_GF4_A_MODULE_FIRMWARE(api) \ | |
| 36 | + IWL_SC_A_GF4_A_FW_PRE "-" __stringify(api) ".ucode" | |
| 37 | + | |
| 26 | 38 | /* NVM versions */ |
| 27 | 39 | #define IWL_GF_NVM_VERSION 0x0a1d |
| 28 | 40 | |
| @@ -67,7 +79,7 @@ IWL_FW_AND_PNVM(IWL_MA_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX); · 38 unmodified lines | ||
| 67 | 79 | IWL_FW_AND_PNVM(IWL_MA_B_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX); |
| 68 | 80 | IWL_FW_AND_PNVM(IWL_MA_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX); |
| 69 | 81 | IWL_FW_AND_PNVM(IWL_MA_B_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX); |
| 70 | −IWL_FW_AND_PNVM(IWL_BZ_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX); | |
| 71 | −IWL_FW_AND_PNVM(IWL_BZ_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX); | |
| 72 | −IWL_FW_AND_PNVM(IWL_SC_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX); | |
| 73 | −IWL_FW_AND_PNVM(IWL_SC_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX); | |
| 82 | +MODULE_FIRMWARE(IWL_BZ_A_GF_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX)); | |
| 83 | +MODULE_FIRMWARE(IWL_BZ_A_GF4_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX)); | |
| 84 | +MODULE_FIRMWARE(IWL_SC_A_GF_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX)); | |
| 85 | +MODULE_FIRMWARE(IWL_SC_A_GF4_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX)); | |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #define IWL_HR_UCODE_API_MAX 100 |
| 10 | 10 | |
| 11 | 11 | /* Lowest firmware API version supported */ |
| 12 | −#define IWL_HR_UCODE_API_MIN 98 | |
| 12 | +#define IWL_HR_UCODE_API_MIN 100 | |
| 13 | 13 | |
| 14 | 14 | #define IWL_QU_B_HR_B_FW_PRE "iwlwifi-Qu-b0-hr-b0" |
| 15 | 15 | #define IWL_QU_C_HR_B_FW_PRE "iwlwifi-Qu-c0-hr-b0" |
| @@ -9,11 +9,11 @@ · 8 unmodified lines | ||
| 9 | 9 | #include "iwl-prph.h" |
| 10 | 10 | #include "fw/api/txq.h" |
| 11 | 11 | |
| 12 | −/* Highest firmware API version supported */ | |
| 13 | −#define IWL_SC_UCODE_API_MAX 102 | |
| 12 | +/* Highest firmware core release supported */ | |
| 13 | +#define IWL_SC_UCODE_CORE_MAX 99 | |
| 14 | 14 | |
| 15 | 15 | /* Lowest firmware API version supported */ |
| 16 | −#define IWL_SC_UCODE_API_MIN 98 | |
| 16 | +#define IWL_SC_UCODE_API_MIN 100 | |
| 17 | 17 | |
| 18 | 18 | /* NVM versions */ |
| 19 | 19 | #define IWL_SC_NVM_VERSION 0x0a1d |
| @@ -78,7 +78,7 @@ static const struct iwl_family_base_params iwl_sc_base = { · 58 unmodified lines | ||
| 78 | 78 | }, |
| 79 | 79 | }, |
| 80 | 80 | .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, |
| 81 | − .ucode_api_max = IWL_SC_UCODE_API_MAX, | |
| 81 | + .ucode_api_max = ENCODE_CORE_AS_API(IWL_SC_UCODE_CORE_MAX), | |
| 82 | 82 | .ucode_api_min = IWL_SC_UCODE_API_MIN, |
| 83 | 83 | }; |
| 84 | 84 | |
| @@ -94,8 +94,8 @@ const struct iwl_mac_cfg iwl_sc_mac_cfg = { · 9 unmodified lines | ||
| 94 | 94 | .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US, |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | −IWL_FW_AND_PNVM(IWL_SC_A_FM_B_FW_PRE, IWL_SC_UCODE_API_MAX); | |
| 98 | −IWL_FW_AND_PNVM(IWL_SC_A_FM_C_FW_PRE, IWL_SC_UCODE_API_MAX); | |
| 99 | −IWL_FW_AND_PNVM(IWL_SC_A_WH_A_FW_PRE, IWL_SC_UCODE_API_MAX); | |
| 100 | −IWL_FW_AND_PNVM(IWL_SC2_A_FM_C_FW_PRE, IWL_SC_UCODE_API_MAX); | |
| 101 | −IWL_FW_AND_PNVM(IWL_SC2_A_WH_A_FW_PRE, IWL_SC_UCODE_API_MAX); | |
| 97 | +IWL_CORE_FW(IWL_SC_A_FM_B_FW_PRE, IWL_SC_UCODE_CORE_MAX); | |
| 98 | +IWL_CORE_FW(IWL_SC_A_FM_C_FW_PRE, IWL_SC_UCODE_CORE_MAX); | |
| 99 | +IWL_CORE_FW(IWL_SC_A_WH_A_FW_PRE, IWL_SC_UCODE_CORE_MAX); | |
| 100 | +IWL_CORE_FW(IWL_SC2_A_FM_C_FW_PRE, IWL_SC_UCODE_CORE_MAX); | |
| 101 | +IWL_CORE_FW(IWL_SC2_A_WH_A_FW_PRE, IWL_SC_UCODE_CORE_MAX); | |
| @@ -766,7 +766,7 @@ static int iwl_init_otp_access(struct iwl_trans *trans) · 765 unmodified lines | ||
| 766 | 766 | { |
| 767 | 767 | int ret; |
| 768 | 768 | |
| 769 | − ret = iwl_finish_nic_init(trans); | |
| 769 | + ret = iwl_trans_activate_nic(trans); | |
| 770 | 770 | if (ret) |
| 771 | 771 | return ret; |
| 772 | 772 | |
| @@ -378,7 +378,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw, · 377 unmodified lines | ||
| 378 | 378 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, |
| 379 | 379 | CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); |
| 380 | 380 | |
| 381 | − iwl_trans_d3_suspend(priv->trans, false, true); | |
| 381 | + iwl_trans_d3_suspend(priv->trans, true); | |
| 382 | 382 | |
| 383 | 383 | goto out; |
| 384 | 384 | |
| @@ -422,7 +422,6 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) · 37 unmodified lines | ||
| 422 | 422 | struct ieee80211_vif *vif; |
| 423 | 423 | u32 base; |
| 424 | 424 | int ret; |
| 425 | − enum iwl_d3_status d3_status; | |
| 426 | 425 | struct error_table_start { |
| 427 | 426 | /* cf. struct iwl_error_event_table */ |
| 428 | 427 | u32 valid; |
| @@ -451,15 +450,10 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) · 22 unmodified lines | ||
| 451 | 450 | /* we'll clear ctx->vif during iwlagn_prepare_restart() */ |
| 452 | 451 | vif = ctx->vif; |
| 453 | 452 | |
| 454 | − ret = iwl_trans_d3_resume(priv->trans, &d3_status, false, true); | |
| 453 | + ret = iwl_trans_d3_resume(priv->trans, true); | |
| 455 | 454 | if (ret) |
| 456 | 455 | goto out_unlock; |
| 457 | 456 | |
| 458 | − if (d3_status != IWL_D3_STATUS_ALIVE) { | |
| 459 | − IWL_INFO(priv, "Device was reset during suspend\n"); | |
| 460 | − goto out_unlock; | |
| 461 | − } | |
| 462 | − | |
| 463 | 457 | /* uCode is no longer operating by itself */ |
| 464 | 458 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, |
| 465 | 459 | CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); |
| @@ -368,7 +368,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) · 367 unmodified lines | ||
| 368 | 368 | /* initialize to default */ |
| 369 | 369 | void iwl_power_initialize(struct iwl_priv *priv) |
| 370 | 370 | { |
| 371 | − priv->power_data.bus_pm = priv->trans->pm_support; | |
| 371 | + priv->power_data.bus_pm = iwl_trans_is_pm_supported(priv->trans); | |
| 372 | 372 | |
| 373 | 373 | priv->power_data.debug_sleep_level_override = -1; |
| 374 | 374 | |
| @@ -9,9 +9,9 @@ · 8 unmodified lines | ||
| 9 | 9 | #include "acpi.h" |
| 10 | 10 | #include "fw/runtime.h" |
| 11 | 11 | |
| 12 | −const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6, | |
| 13 | − 0xA5, 0xB3, 0x1F, 0x73, | |
| 14 | − 0x8E, 0x28, 0x5A, 0xDE); | |
| 12 | +static const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6, | |
| 13 | + 0xA5, 0xB3, 0x1F, 0x73, | |
| 14 | + 0x8E, 0x28, 0x5A, 0xDE); | |
| 15 | 15 | |
| 16 | 16 | static const size_t acpi_dsm_size[DSM_FUNC_NUM_FUNCS] = { |
| 17 | 17 | [DSM_FUNC_QUERY] = sizeof(u32), |
| @@ -140,8 +140,6 @@ struct iwl_dsm_internal_product_reset_cmd { · 139 unmodified lines | ||
| 140 | 140 | |
| 141 | 141 | struct iwl_fw_runtime; |
| 142 | 142 | |
| 143 | −extern const guid_t iwl_guid; | |
| 144 | − | |
| 145 | 143 | union acpi_object *iwl_acpi_get_dsm_object(struct device *dev, int rev, |
| 146 | 144 | int func, union acpi_object *args, |
| 147 | 145 | const guid_t *guid); |
| @@ -367,6 +367,7 @@ enum iwl_wowlan_flags { · 366 unmodified lines | ||
| 367 | 367 | ENABLE_NBNS_FILTERING = BIT(2), |
| 368 | 368 | ENABLE_DHCP_FILTERING = BIT(3), |
| 369 | 369 | ENABLE_STORE_BEACON = BIT(4), |
| 370 | + HAS_BEACON_PROTECTION = BIT(5), | |
| 370 | 371 | }; |
| 371 | 372 | |
| 372 | 373 | /** |
| @@ -631,9 +632,64 @@ struct iwl_wowlan_gtk_status_v3 { · 258 unmodified lines | ||
| 631 | 632 | struct iwl_wowlan_all_rsc_tsc_v5 sc; |
| 632 | 633 | } __packed; /* WOWLAN_GTK_MATERIAL_VER_3 */ |
| 633 | 634 | |
| 635 | +/** | |
| 636 | + * enum iwl_wowlan_key_status - Status of security keys in WoWLAN notifications | |
| 637 | + * @IWL_WOWLAN_NOTIF_NO_KEY: No key is present; this entry should be ignored. | |
| 638 | + * @IWL_WOWLAN_STATUS_OLD_KEY: old key exists; no rekey occurred, and only | |
| 639 | + * metadata is available. | |
| 640 | + * @IWL_WOWLAN_STATUS_NEW_KEY: A new key was created after a rekey; new key | |
| 641 | + * material is available. | |
| 642 | + */ | |
| 643 | +enum iwl_wowlan_key_status { | |
| 644 | + IWL_WOWLAN_NOTIF_NO_KEY = 0, | |
| 645 | + IWL_WOWLAN_STATUS_OLD_KEY = 1, | |
| 646 | + IWL_WOWLAN_STATUS_NEW_KEY = 2 | |
| 647 | +}; | |
| 648 | + | |
| 649 | +/** | |
| 650 | + * struct iwl_wowlan_gtk_status - GTK status | |
| 651 | + * @key: GTK material | |
| 652 | + * @key_len: GTK length, if set to 0, the key is not available | |
| 653 | + * @key_flags: information about the key: | |
| 654 | + * bits[0:1]: key index assigned by the AP | |
| 655 | + * bits[2:6]: GTK index of the key in the internal DB | |
| 656 | + * bit[7]: Set iff this is the currently used GTK | |
| 657 | + * @key_status: key status, see &enum iwl_wowlan_key_status | |
| 658 | + * @reserved: padding | |
| 659 | + * @tkip_mic_key: TKIP RX MIC key | |
| 660 | + * @sc: RSC/TSC counters | |
| 661 | + */ | |
| 662 | +struct iwl_wowlan_gtk_status { | |
| 663 | + u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 664 | + u8 key_len; | |
| 665 | + u8 key_flags; | |
| 666 | + u8 key_status; | |
| 667 | + u8 reserved; | |
| 668 | + u8 tkip_mic_key[IWL_MIC_KEY_SIZE]; | |
| 669 | + struct iwl_wowlan_all_rsc_tsc_v5 sc; | |
| 670 | +} __packed; /* WOWLAN_GTK_MATERIAL_VER_4 */ | |
| 671 | + | |
| 634 | 672 | #define IWL_WOWLAN_GTK_IDX_MASK (BIT(0) | BIT(1)) |
| 635 | 673 | #define IWL_WOWLAN_IGTK_BIGTK_IDX_MASK (BIT(0)) |
| 636 | 674 | |
| 675 | +/** | |
| 676 | + * struct iwl_wowlan_igtk_status_v1 - IGTK status | |
| 677 | + * @key: IGTK material | |
| 678 | + * @ipn: the IGTK packet number (replay counter) | |
| 679 | + * @key_len: IGTK length, if set to 0, the key is not available | |
| 680 | + * @key_flags: information about the key: | |
| 681 | + * bits[0]: key index assigned by the AP (0: index 4, 1: index 5) | |
| 682 | + * (0: index 6, 1: index 7 with bigtk) | |
| 683 | + * bits[1:5]: IGTK index of the key in the internal DB | |
| 684 | + * bit[6]: Set iff this is the currently used IGTK | |
| 685 | + */ | |
| 686 | +struct iwl_wowlan_igtk_status_v1 { | |
| 687 | + u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 688 | + u8 ipn[6]; | |
| 689 | + u8 key_len; | |
| 690 | + u8 key_flags; | |
| 691 | +} __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */ | |
| 692 | + | |
| 637 | 693 | /** |
| 638 | 694 | * struct iwl_wowlan_igtk_status - IGTK status |
| 639 | 695 | * @key: IGTK material |
| @@ -644,13 +700,17 @@ struct iwl_wowlan_gtk_status_v3 { · 4 unmodified lines | ||
| 644 | 700 | * (0: index 6, 1: index 7 with bigtk) |
| 645 | 701 | * bits[1:5]: IGTK index of the key in the internal DB |
| 646 | 702 | * bit[6]: Set iff this is the currently used IGTK |
| 703 | + * @key_status: key status, see &enum iwl_wowlan_key_status | |
| 704 | + * @reserved: padding | |
| 647 | 705 | */ |
| 648 | 706 | struct iwl_wowlan_igtk_status { |
| 649 | 707 | u8 key[WOWLAN_KEY_MAX_SIZE]; |
| 650 | 708 | u8 ipn[6]; |
| 651 | 709 | u8 key_len; |
| 652 | 710 | u8 key_flags; |
| 653 | −} __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */ | |
| 711 | + u8 key_status; | |
| 712 | + u8 reserved[3]; | |
| 713 | +} __packed; /* WOWLAN_IGTK_MATERIAL_VER_2 */ | |
| 654 | 714 | |
| 655 | 715 | /** |
| 656 | 716 | * struct iwl_wowlan_status_v6 - WoWLAN status |
| @@ -700,7 +760,7 @@ struct iwl_wowlan_status_v6 { · 43 unmodified lines | ||
| 700 | 760 | */ |
| 701 | 761 | struct iwl_wowlan_status_v7 { |
| 702 | 762 | struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM]; |
| 703 | − struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 763 | + struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 704 | 764 | __le64 replay_ctr; |
| 705 | 765 | __le16 pattern_number; |
| 706 | 766 | __le16 non_qos_seq_ctr; |
| @@ -735,7 +795,7 @@ struct iwl_wowlan_status_v7 { · 28 unmodified lines | ||
| 735 | 795 | */ |
| 736 | 796 | struct iwl_wowlan_info_notif_v1 { |
| 737 | 797 | struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM]; |
| 738 | − struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 798 | + struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 739 | 799 | __le64 replay_ctr; |
| 740 | 800 | __le16 pattern_number; |
| 741 | 801 | __le16 reserved1; |
| @@ -817,8 +877,8 @@ struct iwl_wowlan_mlo_gtk { · 75 unmodified lines | ||
| 817 | 877 | */ |
| 818 | 878 | struct iwl_wowlan_info_notif_v3 { |
| 819 | 879 | struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM]; |
| 820 | − struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 821 | − struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM]; | |
| 880 | + struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 881 | + struct iwl_wowlan_igtk_status_v1 bigtk[WOWLAN_BIGTK_KEYS_NUM]; | |
| 822 | 882 | __le64 replay_ctr; |
| 823 | 883 | __le16 pattern_number; |
| 824 | 884 | __le16 reserved1; |
| @@ -832,6 +892,45 @@ struct iwl_wowlan_info_notif_v3 { · 7 unmodified lines | ||
| 832 | 892 | u8 reserved2[2]; |
| 833 | 893 | } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3 */ |
| 834 | 894 | |
| 895 | +/** | |
| 896 | + * struct iwl_wowlan_info_notif_v5 - WoWLAN information notification | |
| 897 | + * @gtk: GTK data | |
| 898 | + * @igtk: IGTK data | |
| 899 | + * @bigtk: BIGTK data | |
| 900 | + * @replay_ctr: GTK rekey replay counter | |
| 901 | + * @pattern_number: number of the matched patterns | |
| 902 | + * @qos_seq_ctr: QoS sequence counters to use next | |
| 903 | + * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason | |
| 904 | + * @num_of_gtk_rekeys: number of GTK rekeys | |
| 905 | + * @transmitted_ndps: number of transmitted neighbor discovery packets | |
| 906 | + * @received_beacons: number of received beacons | |
| 907 | + * @tid_tear_down: bit mask of tids whose BA sessions were closed | |
| 908 | + * in suspend state | |
| 909 | + * @station_id: station id | |
| 910 | + * @num_mlo_link_keys: number of &struct iwl_wowlan_mlo_gtk structs | |
| 911 | + * following this notif | |
| 912 | + * @tid_offloaded_tx: tid used by the firmware to transmit data packets | |
| 913 | + * while in wowlan | |
| 914 | + * @mlo_gtks: array of GTKs of size num_mlo_link_keys | |
| 915 | + */ | |
| 916 | +struct iwl_wowlan_info_notif_v5 { | |
| 917 | + struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM]; | |
| 918 | + struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM]; | |
| 919 | + struct iwl_wowlan_igtk_status_v1 bigtk[WOWLAN_BIGTK_KEYS_NUM]; | |
| 920 | + __le64 replay_ctr; | |
| 921 | + __le16 pattern_number; | |
| 922 | + __le16 qos_seq_ctr; | |
| 923 | + __le32 wakeup_reasons; | |
| 924 | + __le32 num_of_gtk_rekeys; | |
| 925 | + __le32 transmitted_ndps; | |
| 926 | + __le32 received_beacons; | |
| 927 | + u8 tid_tear_down; | |
| 928 | + u8 station_id; | |
| 929 | + u8 num_mlo_link_keys; | |
| 930 | + u8 tid_offloaded_tx; | |
| 931 | + struct iwl_wowlan_mlo_gtk mlo_gtks[]; | |
| 932 | +} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */ | |
| 933 | + | |
| 835 | 934 | /** |
| 836 | 935 | * struct iwl_wowlan_info_notif - WoWLAN information notification |
| 837 | 936 | * @gtk: GTK data |
| @@ -854,7 +953,7 @@ struct iwl_wowlan_info_notif_v3 { · 16 unmodified lines | ||
| 854 | 953 | * @mlo_gtks: array of GTKs of size num_mlo_link_keys |
| 855 | 954 | */ |
| 856 | 955 | struct iwl_wowlan_info_notif { |
| 857 | − struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM]; | |
| 956 | + struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM]; | |
| 858 | 957 | struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM]; |
| 859 | 958 | struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM]; |
| 860 | 959 | __le64 replay_ctr; |
| @@ -869,7 +968,7 @@ struct iwl_wowlan_info_notif { · 8 unmodified lines | ||
| 869 | 968 | u8 num_mlo_link_keys; |
| 870 | 969 | u8 tid_offloaded_tx; |
| 871 | 970 | struct iwl_wowlan_mlo_gtk mlo_gtks[]; |
| 872 | −} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */ | |
| 971 | +} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_6 */ | |
| 873 | 972 | |
| 874 | 973 | /** |
| 875 | 974 | * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification |
| @@ -420,6 +420,8 @@ struct iwl_mac_config_cmd { · 419 unmodified lines | ||
| 420 | 420 | * eht_support set to true. No longer used since _VER_3 of this command. |
| 421 | 421 | * @LINK_CONTEXT_MODIFY_BANDWIDTH: Covers iwl_link_ctx_cfg_cmd::modify_bandwidth. |
| 422 | 422 | * Request RX OMI to the AP to modify bandwidth of this link. |
| 423 | + * @LINK_CONTEXT_MODIFY_UHR_PARAMS: covers iwl_link_ctx_cfg_cmd::npca_params and | |
| 424 | + * iwl_link_ctx_cfg_cmd::prio_edca_params. Since _VER_7. | |
| 423 | 425 | * @LINK_CONTEXT_MODIFY_ALL: set all above flags |
| 424 | 426 | */ |
| 425 | 427 | enum iwl_link_ctx_modify_flags { |
| @@ -432,6 +434,7 @@ enum iwl_link_ctx_modify_flags { · 6 unmodified lines | ||
| 432 | 434 | LINK_CONTEXT_MODIFY_BSS_COLOR_DISABLE = BIT(6), |
| 433 | 435 | LINK_CONTEXT_MODIFY_EHT_PARAMS = BIT(7), |
| 434 | 436 | LINK_CONTEXT_MODIFY_BANDWIDTH = BIT(8), |
| 437 | + LINK_CONTEXT_MODIFY_UHR_PARAMS = BIT(9), | |
| 435 | 438 | LINK_CONTEXT_MODIFY_ALL = 0xff, |
| 436 | 439 | }; /* LINK_CONTEXT_MODIFY_MASK_E_VER_1 */ |
| 437 | 440 | |
| @@ -20,7 +20,7 @@ enum iwl_prot_offload_subcmd_ids { · 19 unmodified lines | ||
| 20 | 20 | /** |
| 21 | 21 | * @WOWLAN_INFO_NOTIFICATION: Notification in |
| 22 | 22 | * &struct iwl_wowlan_info_notif_v1, iwl_wowlan_info_notif_v3, |
| 23 | − * or &struct iwl_wowlan_info_notif | |
| 23 | + * &struct iwl_wowlan_info_notif_v5 or &struct iwl_wowlan_info_notif | |
| 24 | 24 | */ |
| 25 | 25 | WOWLAN_INFO_NOTIFICATION = 0xFD, |
| 26 | 26 | |
| @@ -571,17 +571,16 @@ enum iwl_ppag_flags { · 570 unmodified lines | ||
| 571 | 571 | /** |
| 572 | 572 | * union iwl_ppag_table_cmd - union for all versions of PPAG command |
| 573 | 573 | * @v1: command version 1 structure. |
| 574 | − * @v2: command version from 2 to 6 are same structure as v2. | |
| 575 | − * but has a different format of the flags bitmap | |
| 576 | − * @v3: command version 7 structure. | |
| 574 | + * @v5: command version 5 structure. | |
| 575 | + * @v7: command version 7 structure. | |
| 577 | 576 | * @v1.flags: values from &enum iwl_ppag_flags |
| 578 | 577 | * @v1.gain: table of antenna gain values per chain and sub-band |
| 579 | 578 | * @v1.reserved: reserved |
| 580 | − * @v2.flags: values from &enum iwl_ppag_flags | |
| 581 | − * @v2.gain: table of antenna gain values per chain and sub-band | |
| 582 | − * @v3.ppag_config_info: see @struct bios_value_u32 | |
| 583 | − * @v3.gain: table of antenna gain values per chain and sub-band | |
| 584 | − * @v3.reserved: reserved | |
| 579 | + * @v5.flags: values from &enum iwl_ppag_flags | |
| 580 | + * @v5.gain: table of antenna gain values per chain and sub-band | |
| 581 | + * @v7.ppag_config_info: see @struct bios_value_u32 | |
| 582 | + * @v7.gain: table of antenna gain values per chain and sub-band | |
| 583 | + * @v7.reserved: reserved | |
| 585 | 584 | */ |
| 586 | 585 | union iwl_ppag_table_cmd { |
| 587 | 586 | struct { |
| @@ -593,30 +592,19 @@ union iwl_ppag_table_cmd { · 5 unmodified lines | ||
| 593 | 592 | __le32 flags; |
| 594 | 593 | s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; |
| 595 | 594 | s8 reserved[2]; |
| 596 | − } __packed v2; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_2, VER3, VER4, | |
| 597 | − * VER5, VER6 | |
| 598 | − */ | |
| 595 | + } __packed v5; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_5 */ | |
| 599 | 596 | struct { |
| 600 | 597 | struct bios_value_u32 ppag_config_info; |
| 601 | 598 | s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; |
| 602 | 599 | s8 reserved[2]; |
| 603 | − } __packed v3; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */ | |
| 600 | + } __packed v7; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */ | |
| 604 | 601 | } __packed; |
| 605 | 602 | |
| 606 | −#define IWL_PPAG_CMD_V4_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK) | |
| 607 | −#define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V4_MASK | \ | |
| 603 | +#define IWL_PPAG_CMD_V1_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK) | |
| 604 | +#define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V1_MASK | \ | |
| 608 | 605 | IWL_PPAG_ETSI_LPI_UHB_MASK | \ |
| 609 | 606 | IWL_PPAG_USA_LPI_UHB_MASK) |
| 610 | 607 | |
| 611 | −#define IWL_PPAG_CMD_V6_MASK (IWL_PPAG_CMD_V5_MASK | \ | |
| 612 | − IWL_PPAG_ETSI_VLP_UHB_MASK | \ | |
| 613 | − IWL_PPAG_ETSI_SP_UHB_MASK | \ | |
| 614 | − IWL_PPAG_USA_VLP_UHB_MASK | \ | |
| 615 | − IWL_PPAG_USA_SP_UHB_MASK | \ | |
| 616 | − IWL_PPAG_CANADA_LPI_UHB_MASK | \ | |
| 617 | − IWL_PPAG_CANADA_VLP_UHB_MASK | \ | |
| 618 | − IWL_PPAG_CANADA_SP_UHB_MASK) | |
| 619 | − | |
| 620 | 608 | #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE 26 |
| 621 | 609 | #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE 13 |
| 622 | 610 | |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | * for BPSK (MCS 0) with 2 spatial |
| 25 | 25 | * streams |
| 26 | 26 | * @IWL_TLC_MNG_CFG_FLAGS_EHT_EXTRA_LTF_MSK: enable support for EHT extra LTF |
| 27 | + * @IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_1_5_MBPS_MSK: support ELR 1.5 Mbps | |
| 28 | + * @IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_3_MBPS_MSK: support ELR 3 Mbps | |
| 27 | 29 | */ |
| 28 | 30 | enum iwl_tlc_mng_cfg_flags { |
| 29 | 31 | IWL_TLC_MNG_CFG_FLAGS_STBC_MSK = BIT(0), |
| @@ -32,6 +34,8 @@ enum iwl_tlc_mng_cfg_flags { · 2 unmodified lines | ||
| 32 | 34 | IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK = BIT(3), |
| 33 | 35 | IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_2_MSK = BIT(4), |
| 34 | 36 | IWL_TLC_MNG_CFG_FLAGS_EHT_EXTRA_LTF_MSK = BIT(6), |
| 37 | + IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_1_5_MBPS_MSK = BIT(7), | |
| 38 | + IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_3_MBPS_MSK = BIT(8), | |
| 35 | 39 | }; |
| 36 | 40 | |
| 37 | 41 | /** |
| @@ -200,6 +204,37 @@ struct iwl_tlc_config_cmd_v4 { · 162 unmodified lines | ||
| 200 | 204 | __le16 max_tx_op; |
| 201 | 205 | } __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_4 */ |
| 202 | 206 | |
| 207 | +/** | |
| 208 | + * struct iwl_tlc_config_cmd - TLC configuration | |
| 209 | + * @sta_id: station id | |
| 210 | + * @reserved1: reserved | |
| 211 | + * @max_ch_width: max supported channel width from &enum iwl_tlc_mng_cfg_cw | |
| 212 | + * @mode: &enum iwl_tlc_mng_cfg_mode | |
| 213 | + * @chains: bitmask of &enum iwl_tlc_mng_cfg_chains | |
| 214 | + * @sgi_ch_width_supp: bitmap of SGI support per channel width | |
| 215 | + * use BIT(&enum iwl_tlc_mng_cfg_cw) | |
| 216 | + * @flags: bitmask of &enum iwl_tlc_mng_cfg_flags | |
| 217 | + * @non_ht_rates: bitmap of supported legacy rates | |
| 218 | + * @ht_rates: bitmap of &enum iwl_tlc_mng_ht_rates, per <nss, channel-width> | |
| 219 | + * pair (0 - 80mhz width and below, 1 - 160mhz, 2 - 320mhz). | |
| 220 | + * @max_mpdu_len: max MPDU length, in bytes | |
| 221 | + * @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI), | |
| 222 | + * set zero for no limit. | |
| 223 | + */ | |
| 224 | +struct iwl_tlc_config_cmd { | |
| 225 | + u8 sta_id; | |
| 226 | + u8 reserved1[3]; | |
| 227 | + u8 max_ch_width; | |
| 228 | + u8 mode; | |
| 229 | + u8 chains; | |
| 230 | + u8 sgi_ch_width_supp; | |
| 231 | + __le16 flags; | |
| 232 | + __le16 non_ht_rates; | |
| 233 | + __le32 ht_rates[IWL_TLC_NSS_MAX][IWL_TLC_MCS_PER_BW_NUM_V4]; | |
| 234 | + __le16 max_mpdu_len; | |
| 235 | + __le16 max_tx_op; | |
| 236 | +} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_5 */ | |
| 237 | + | |
| 203 | 238 | /** |
| 204 | 239 | * enum iwl_tlc_update_flags - updated fields |
| 205 | 240 | * @IWL_TLC_NOTIF_FLAG_RATE: last initial rate update |
| @@ -830,7 +830,7 @@ iwl_fw_error_dump_file(struct iwl_fw_runtime *fwrt, · 829 unmodified lines | ||
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /* reading RXF/TXF sizes */ |
| 833 | − if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status)) { | |
| 833 | + if (iwl_trans_is_fw_error(fwrt->trans)) { | |
| 834 | 834 | fifo_len = iwl_fw_rxf_len(fwrt, mem_cfg); |
| 835 | 835 | fifo_len += iwl_fw_txf_len(fwrt, mem_cfg); |
| 836 | 836 | |
| @@ -2393,7 +2393,7 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 1556 unmodified lines | ||
| 2393 | 2393 | struct iwl_fw_ini_dump_cfg_name *cfg_name; |
| 2394 | 2394 | u32 size = sizeof(*tlv) + sizeof(*dump); |
| 2395 | 2395 | u32 num_of_cfg_names = 0; |
| 2396 | − u32 hw_type, is_cdb, is_jacket; | |
| 2396 | + u32 hw_type, is_cdb; | |
| 2397 | 2397 | |
| 2398 | 2398 | list_for_each_entry(node, &fwrt->trans->dbg.debug_info_tlv_list, list) { |
| 2399 | 2399 | size += sizeof(*cfg_name); |
| @@ -2426,11 +2426,7 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 26 unmodified lines | ||
| 2426 | 2426 | hw_type = CSR_HW_REV_TYPE(fwrt->trans->info.hw_rev); |
| 2427 | 2427 | |
| 2428 | 2428 | is_cdb = CSR_HW_RFID_IS_CDB(fwrt->trans->info.hw_rf_id); |
| 2429 | − is_jacket = !!(iwl_read_umac_prph(fwrt->trans, WFPM_OTP_CFG1_ADDR) & | |
| 2430 | − WFPM_OTP_CFG1_IS_JACKET_BIT); | |
| 2431 | − | |
| 2432 | − /* Use bits 12 and 13 to indicate jacket/CDB, respectively */ | |
| 2433 | − hw_type |= (is_jacket | (is_cdb << 1)) << IWL_JACKET_CDB_SHIFT; | |
| 2429 | + hw_type |= IWL_CDB_MASK(is_cdb); | |
| 2434 | 2430 | |
| 2435 | 2431 | dump->hw_type = cpu_to_le32(hw_type); |
| 2436 | 2432 | |
| @@ -2478,36 +2474,6 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 41 unmodified lines | ||
| 2478 | 2474 | return entry->size; |
| 2479 | 2475 | } |
| 2480 | 2476 | |
| 2481 | −static u32 iwl_dump_ini_file_name_info(struct iwl_fw_runtime *fwrt, | |
| 2482 | − struct list_head *list) | |
| 2483 | −{ | |
| 2484 | − struct iwl_fw_ini_dump_entry *entry; | |
| 2485 | − struct iwl_dump_file_name_info *tlv; | |
| 2486 | − u32 len = strnlen(fwrt->trans->dbg.dump_file_name_ext, | |
| 2487 | − IWL_FW_INI_MAX_NAME); | |
| 2488 | − | |
| 2489 | − if (!fwrt->trans->dbg.dump_file_name_ext_valid) | |
| 2490 | − return 0; | |
| 2491 | − | |
| 2492 | − entry = vzalloc(sizeof(*entry) + sizeof(*tlv) + len); | |
| 2493 | − if (!entry) | |
| 2494 | − return 0; | |
| 2495 | − | |
| 2496 | − entry->size = sizeof(*tlv) + len; | |
| 2497 | − | |
| 2498 | − tlv = (void *)entry->data; | |
| 2499 | − tlv->type = cpu_to_le32(IWL_INI_DUMP_NAME_TYPE); | |
| 2500 | − tlv->len = cpu_to_le32(len); | |
| 2501 | − memcpy(tlv->data, fwrt->trans->dbg.dump_file_name_ext, len); | |
| 2502 | − | |
| 2503 | − /* add the dump file name extension tlv to the list */ | |
| 2504 | − list_add_tail(&entry->list, list); | |
| 2505 | − | |
| 2506 | − fwrt->trans->dbg.dump_file_name_ext_valid = false; | |
| 2507 | − | |
| 2508 | − return entry->size; | |
| 2509 | −} | |
| 2510 | − | |
| 2511 | 2477 | static const struct iwl_dump_ini_mem_ops iwl_dump_ini_region_ops[] = { |
| 2512 | 2478 | [IWL_FW_INI_REGION_INVALID] = {}, |
| 2513 | 2479 | [IWL_FW_INI_REGION_INTERNAL_BUFFER] = { |
| @@ -2764,7 +2730,6 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt, · 250 unmodified lines | ||
| 2764 | 2730 | &iwl_dump_ini_region_ops[IWL_FW_INI_REGION_DRAM_IMR]); |
| 2765 | 2731 | |
| 2766 | 2732 | if (size) { |
| 2767 | − size += iwl_dump_ini_file_name_info(fwrt, list); | |
| 2768 | 2733 | size += iwl_dump_ini_info(fwrt, trigger, list); |
| 2769 | 2734 | } |
| 2770 | 2735 | |
| @@ -3151,7 +3116,7 @@ static void iwl_send_dbg_dump_complete_cmd(struct iwl_fw_runtime *fwrt, · 380 unmodified lines | ||
| 3151 | 3116 | .len[0] = sizeof(hcmd_data), |
| 3152 | 3117 | }; |
| 3153 | 3118 | |
| 3154 | − if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status)) | |
| 3119 | + if (iwl_trans_is_fw_error(fwrt->trans)) | |
| 3155 | 3120 | return; |
| 3156 | 3121 | |
| 3157 | 3122 | if (fw_has_capa(&fwrt->fw->ucode_capa, |
| @@ -14,13 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | #include "iwl-csr.h" |
| 15 | 15 | #include "pnvm.h" |
| 16 | 16 | |
| 17 | −#define FW_ASSERT_LMAC_FATAL 0x70 | |
| 18 | −#define FW_ASSERT_LMAC2_FATAL 0x72 | |
| 19 | −#define FW_ASSERT_UMAC_FATAL 0x71 | |
| 20 | −#define UMAC_RT_NMI_LMAC2_FATAL 0x72 | |
| 21 | −#define RT_NMI_INTERRUPT_OTHER_LMAC_FATAL 0x73 | |
| 22 | −#define FW_ASSERT_NMI_UNKNOWN 0x84 | |
| 23 | − | |
| 24 | 17 | /* |
| 25 | 18 | * Note: This structure is read from the device with IO accesses, |
| 26 | 19 | * and the reading already does the endian conversion. As it is |
| @@ -103,17 +96,6 @@ struct iwl_umac_error_event_table { · 76 unmodified lines | ||
| 103 | 96 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
| 104 | 97 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
| 105 | 98 | |
| 106 | −static bool iwl_fwrt_if_errorid_other_cpu(u32 err_id) | |
| 107 | −{ | |
| 108 | − err_id &= 0xFF; | |
| 109 | − | |
| 110 | − if ((err_id >= FW_ASSERT_LMAC_FATAL && | |
| 111 | − err_id <= RT_NMI_INTERRUPT_OTHER_LMAC_FATAL) || | |
| 112 | − err_id == FW_ASSERT_NMI_UNKNOWN) | |
| 113 | − return true; | |
| 114 | − return false; | |
| 115 | −} | |
| 116 | − | |
| 117 | 99 | static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt) |
| 118 | 100 | { |
| 119 | 101 | struct iwl_trans *trans = fwrt->trans; |
| @@ -131,13 +113,6 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt) · 11 unmodified lines | ||
| 131 | 113 | if (table.valid) |
| 132 | 114 | fwrt->dump.umac_err_id = table.error_id; |
| 133 | 115 | |
| 134 | − if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.umac_err_id) && | |
| 135 | − !fwrt->trans->dbg.dump_file_name_ext_valid) { | |
| 136 | − fwrt->trans->dbg.dump_file_name_ext_valid = true; | |
| 137 | − snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 138 | − "0x%x", fwrt->dump.umac_err_id); | |
| 139 | − } | |
| 140 | − | |
| 141 | 116 | if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { |
| 142 | 117 | IWL_ERR(trans, "Start IWL Error Log Dump:\n"); |
| 143 | 118 | IWL_ERR(trans, "Transport status: 0x%08lX, valid: %d\n", |
| @@ -203,7 +178,7 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu · 59 unmodified lines | ||
| 203 | 178 | if (err) |
| 204 | 179 | return; |
| 205 | 180 | |
| 206 | − err = iwl_finish_nic_init(trans); | |
| 181 | + err = iwl_trans_activate_nic(trans); | |
| 207 | 182 | if (err) |
| 208 | 183 | return; |
| 209 | 184 | } |
| @@ -213,13 +188,6 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu · 3 unmodified lines | ||
| 213 | 188 | if (table.valid) |
| 214 | 189 | fwrt->dump.lmac_err_id[lmac_num] = table.error_id; |
| 215 | 190 | |
| 216 | − if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.lmac_err_id[lmac_num]) && | |
| 217 | − !fwrt->trans->dbg.dump_file_name_ext_valid) { | |
| 218 | − fwrt->trans->dbg.dump_file_name_ext_valid = true; | |
| 219 | − snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 220 | − "0x%x", fwrt->dump.lmac_err_id[lmac_num]); | |
| 221 | − } | |
| 222 | − | |
| 223 | 191 | if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { |
| 224 | 192 | IWL_ERR(trans, "Start IWL Error Log Dump:\n"); |
| 225 | 193 | IWL_ERR(trans, "Transport status: 0x%08lX, valid: %d\n", |
| @@ -305,16 +273,6 @@ static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt, int idx) · 79 unmodified lines | ||
| 305 | 273 | |
| 306 | 274 | iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); |
| 307 | 275 | |
| 308 | − if (table.valid) | |
| 309 | − fwrt->dump.tcm_err_id[idx] = table.error_id; | |
| 310 | − | |
| 311 | − if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.tcm_err_id[idx]) && | |
| 312 | − !fwrt->trans->dbg.dump_file_name_ext_valid) { | |
| 313 | − fwrt->trans->dbg.dump_file_name_ext_valid = true; | |
| 314 | − snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 315 | − "0x%x", fwrt->dump.tcm_err_id[idx]); | |
| 316 | − } | |
| 317 | − | |
| 318 | 276 | IWL_ERR(fwrt, "TCM%d status:\n", idx + 1); |
| 319 | 277 | IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id); |
| 320 | 278 | IWL_ERR(fwrt, "0x%08X | tcm branchlink2\n", table.blink2); |
| @@ -378,16 +336,6 @@ static void iwl_fwrt_dump_rcm_error_log(struct iwl_fw_runtime *fwrt, int idx) · 57 unmodified lines | ||
| 378 | 336 | |
| 379 | 337 | iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); |
| 380 | 338 | |
| 381 | − if (table.valid) | |
| 382 | − fwrt->dump.rcm_err_id[idx] = table.error_id; | |
| 383 | − | |
| 384 | − if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.rcm_err_id[idx]) && | |
| 385 | − !fwrt->trans->dbg.dump_file_name_ext_valid) { | |
| 386 | − fwrt->trans->dbg.dump_file_name_ext_valid = true; | |
| 387 | − snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 388 | − "0x%x", fwrt->dump.rcm_err_id[idx]); | |
| 389 | − } | |
| 390 | − | |
| 391 | 339 | IWL_ERR(fwrt, "RCM%d status:\n", idx + 1); |
| 392 | 340 | IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id); |
| 393 | 341 | IWL_ERR(fwrt, "0x%08X | rcm branchlink2\n", table.blink2); |
| @@ -372,7 +372,8 @@ struct iwl_fw_ini_dump_cfg_name { · 371 unmodified lines | ||
| 372 | 372 | u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME]; |
| 373 | 373 | } __packed; |
| 374 | 374 | |
| 375 | −#define IWL_JACKET_CDB_SHIFT 12 | |
| 375 | +#define IWL_CDB_MASK(val) val << 13 | |
| 376 | + | |
| 376 | 377 | |
| 377 | 378 | /* struct iwl_fw_ini_dump_info - ini dump information |
| 378 | 379 | * @version: dump version |
| @@ -237,11 +237,12 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data, · 236 unmodified lines | ||
| 237 | 237 | return -ENOENT; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | −static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len) | |
| 240 | +static u8 *iwl_pnvm_get_from_fs(struct iwl_trans *trans, size_t *len) | |
| 241 | 241 | { |
| 242 | 242 | const struct firmware *pnvm; |
| 243 | 243 | char pnvm_name[MAX_PNVM_NAME]; |
| 244 | 244 | size_t new_len; |
| 245 | + u8 *data; | |
| 245 | 246 | int ret; |
| 246 | 247 | |
| 247 | 248 | iwl_pnvm_get_fs_name(trans, pnvm_name, sizeof(pnvm_name)); |
| @@ -250,29 +251,73 @@ static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len) · 2 unmodified lines | ||
| 250 | 251 | if (ret) { |
| 251 | 252 | IWL_DEBUG_FW(trans, "PNVM file %s not found %d\n", |
| 252 | 253 | pnvm_name, ret); |
| 253 | − return ret; | |
| 254 | + return NULL; | |
| 254 | 255 | } |
| 255 | 256 | |
| 256 | 257 | new_len = pnvm->size; |
| 257 | − *data = kvmemdup(pnvm->data, pnvm->size, GFP_KERNEL); | |
| 258 | + data = kvmemdup(pnvm->data, pnvm->size, GFP_KERNEL); | |
| 258 | 259 | release_firmware(pnvm); |
| 259 | 260 | |
| 260 | − if (!*data) | |
| 261 | − return -ENOMEM; | |
| 261 | + if (!data) | |
| 262 | + return NULL; | |
| 262 | 263 | |
| 263 | 264 | *len = new_len; |
| 264 | 265 | |
| 265 | − return 0; | |
| 266 | + return data; | |
| 267 | +} | |
| 268 | + | |
| 269 | +/** | |
| 270 | + * enum iwl_pnvm_source - different PNVM possible sources | |
| 271 | + * | |
| 272 | + * @IWL_PNVM_SOURCE_NONE: No PNVM. | |
| 273 | + * @IWL_PNVM_SOURCE_BIOS: PNVM should be read from BIOS. | |
| 274 | + * @IWL_PNVM_SOURCE_EXTERNAL: read .pnvm external file | |
| 275 | + * @IWL_PNVM_SOURCE_EMBEDDED: PNVM is embedded in the .ucode file. | |
| 276 | + */ | |
| 277 | +enum iwl_pnvm_source { | |
| 278 | + IWL_PNVM_SOURCE_NONE, | |
| 279 | + IWL_PNVM_SOURCE_BIOS, | |
| 280 | + IWL_PNVM_SOURCE_EXTERNAL, | |
| 281 | + IWL_PNVM_SOURCE_EMBEDDED | |
| 282 | +}; | |
| 283 | + | |
| 284 | +static enum iwl_pnvm_source iwl_select_pnvm_source(struct iwl_trans *trans, | |
| 285 | + bool intel_sku) | |
| 286 | +{ | |
| 287 | + | |
| 288 | + /* Get PNVM from BIOS for non-Intel SKU */ | |
| 289 | + if (!intel_sku) | |
| 290 | + return IWL_PNVM_SOURCE_BIOS; | |
| 291 | + | |
| 292 | + /* Before those devices, PNVM didn't exist at all */ | |
| 293 | + if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) | |
| 294 | + return IWL_PNVM_SOURCE_NONE; | |
| 295 | + | |
| 296 | + /* After those devices, we moved to embedded PNVM */ | |
| 297 | + if (trans->mac_cfg->device_family > IWL_DEVICE_FAMILY_AX210) | |
| 298 | + return IWL_PNVM_SOURCE_EMBEDDED; | |
| 299 | + | |
| 300 | + /* For IWL_DEVICE_FAMILY_AX210, depends on the CRF */ | |
| 301 | + if (CSR_HW_RFID_TYPE(trans->info.hw_rf_id) == IWL_CFG_RF_TYPE_GF) | |
| 302 | + return IWL_PNVM_SOURCE_EXTERNAL; | |
| 303 | + | |
| 304 | + return IWL_PNVM_SOURCE_NONE; | |
| 266 | 305 | } |
| 267 | 306 | |
| 268 | 307 | static const u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len, |
| 269 | 308 | __le32 sku_id[3], const struct iwl_fw *fw) |
| 270 | 309 | { |
| 271 | 310 | struct pnvm_sku_package *package; |
| 311 | + enum iwl_pnvm_source pnvm_src = | |
| 312 | + iwl_select_pnvm_source(trans_p, sku_id[2] == 0); | |
| 272 | 313 | u8 *image = NULL; |
| 273 | 314 | |
| 274 | − /* Get PNVM from BIOS for non-Intel SKU */ | |
| 275 | − if (sku_id[2]) { | |
| 315 | + IWL_DEBUG_FW(trans_p, "PNVM source %d\n", pnvm_src); | |
| 316 | + | |
| 317 | + if (pnvm_src == IWL_PNVM_SOURCE_NONE) | |
| 318 | + return NULL; | |
| 319 | + | |
| 320 | + if (pnvm_src == IWL_PNVM_SOURCE_BIOS) { | |
| 276 | 321 | package = iwl_uefi_get_pnvm(trans_p, len); |
| 277 | 322 | if (!IS_ERR_OR_NULL(package)) { |
| 278 | 323 | if (*len >= sizeof(*package)) { |
| @@ -289,18 +334,26 @@ static const u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len, · 10 unmodified lines | ||
| 289 | 334 | if (image) |
| 290 | 335 | return image; |
| 291 | 336 | } |
| 337 | + | |
| 338 | + /* PNVM doesn't exist in BIOS. Find the fallback source */ | |
| 339 | + pnvm_src = iwl_select_pnvm_source(trans_p, true); | |
| 340 | + IWL_DEBUG_FW(trans_p, "PNVM in BIOS doesn't exist, try %d\n", | |
| 341 | + pnvm_src); | |
| 292 | 342 | } |
| 293 | 343 | |
| 294 | − if (fw->pnvm_data) { | |
| 295 | − *len = fw->pnvm_size; | |
| 344 | + if (pnvm_src == IWL_PNVM_SOURCE_EXTERNAL) { | |
| 345 | + image = iwl_pnvm_get_from_fs(trans_p, len); | |
| 346 | + if (image) | |
| 347 | + return image; | |
| 348 | + } | |
| 296 | 349 | |
| 350 | + if (pnvm_src == IWL_PNVM_SOURCE_EMBEDDED && fw->pnvm_data) { | |
| 351 | + *len = fw->pnvm_size; | |
| 297 | 352 | return fw->pnvm_data; |
| 298 | 353 | } |
| 299 | 354 | |
| 300 | − /* If it's not available, or for Intel SKU, try from the filesystem */ | |
| 301 | − if (iwl_pnvm_get_from_fs(trans_p, &image, len)) | |
| 302 | − return NULL; | |
| 303 | − return image; | |
| 355 | + IWL_ERR(trans_p, "Couldn't get PNVM from required source: %d\n", pnvm_src); | |
| 356 | + return NULL; | |
| 304 | 357 | } |
| 305 | 358 | |
| 306 | 359 | static void |
| @@ -59,11 +59,16 @@ static const struct dmi_system_id dmi_ppag_approved_list[] = { · 58 unmodified lines | ||
| 59 | 59 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), |
| 60 | 60 | }, |
| 61 | 61 | }, |
| 62 | − { .ident = "ASUS", | |
| 62 | + { .ident = "ASUSTEK", | |
| 63 | 63 | .matches = { |
| 64 | 64 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
| 65 | 65 | }, |
| 66 | 66 | }, |
| 67 | + { .ident = "ASUS", | |
| 68 | + .matches = { | |
| 69 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), | |
| 70 | + }, | |
| 71 | + }, | |
| 67 | 72 | { .ident = "GOOGLE-HP", |
| 68 | 73 | .matches = { |
| 69 | 74 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), |
| @@ -141,11 +146,16 @@ static const struct dmi_system_id dmi_tas_approved_list[] = { · 71 unmodified lines | ||
| 141 | 146 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 142 | 147 | }, |
| 143 | 148 | }, |
| 144 | − { .ident = "ASUS", | |
| 149 | + { .ident = "ASUSTEK", | |
| 145 | 150 | .matches = { |
| 146 | 151 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
| 147 | 152 | }, |
| 148 | 153 | }, |
| 154 | + { .ident = "ASUS", | |
| 155 | + .matches = { | |
| 156 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), | |
| 157 | + }, | |
| 158 | + }, | |
| 149 | 159 | { .ident = "GOOGLE-HP", |
| 150 | 160 | .matches = { |
| 151 | 161 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), |
| @@ -305,6 +315,7 @@ static bool iwl_ppag_value_valid(struct iwl_fw_runtime *fwrt, int chain, · 153 unmodified lines | ||
| 305 | 315 | return true; |
| 306 | 316 | } |
| 307 | 317 | |
| 318 | +/* Utility function for iwlmvm and iwlxvt */ | |
| 308 | 319 | int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, |
| 309 | 320 | union iwl_ppag_table_cmd *cmd, int *cmd_size) |
| 310 | 321 | { |
| @@ -344,18 +355,18 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 33 unmodified lines | ||
| 344 | 355 | num_sub_bands = IWL_NUM_SUB_BANDS_V1; |
| 345 | 356 | gain = cmd->v1.gain[0]; |
| 346 | 357 | *cmd_size = sizeof(cmd->v1); |
| 347 | − cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags); | |
| 358 | + cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags & IWL_PPAG_CMD_V1_MASK); | |
| 348 | 359 | if (fwrt->ppag_bios_rev >= 1) { |
| 349 | 360 | /* in this case FW supports revision 0 */ |
| 350 | 361 | IWL_DEBUG_RADIO(fwrt, |
| 351 | 362 | "PPAG table rev is %d, send truncated table\n", |
| 352 | 363 | fwrt->ppag_bios_rev); |
| 353 | 364 | } |
| 354 | − } else if (cmd_ver >= 2 && cmd_ver <= 6) { | |
| 365 | + } else if (cmd_ver == 5) { | |
| 355 | 366 | num_sub_bands = IWL_NUM_SUB_BANDS_V2; |
| 356 | − gain = cmd->v2.gain[0]; | |
| 357 | − *cmd_size = sizeof(cmd->v2); | |
| 358 | − cmd->v2.flags = cpu_to_le32(fwrt->ppag_flags); | |
| 367 | + gain = cmd->v5.gain[0]; | |
| 368 | + *cmd_size = sizeof(cmd->v5); | |
| 369 | + cmd->v5.flags = cpu_to_le32(fwrt->ppag_flags & IWL_PPAG_CMD_V5_MASK); | |
| 359 | 370 | if (fwrt->ppag_bios_rev == 0) { |
| 360 | 371 | /* in this case FW supports revisions 1,2 or 3 */ |
| 361 | 372 | IWL_DEBUG_RADIO(fwrt, |
| @@ -363,11 +374,11 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 1 unmodified line | ||
| 363 | 374 | } |
| 364 | 375 | } else if (cmd_ver == 7) { |
| 365 | 376 | num_sub_bands = IWL_NUM_SUB_BANDS_V2; |
| 366 | − gain = cmd->v3.gain[0]; | |
| 367 | − *cmd_size = sizeof(cmd->v3); | |
| 368 | − cmd->v3.ppag_config_info.table_source = fwrt->ppag_bios_source; | |
| 369 | − cmd->v3.ppag_config_info.table_revision = fwrt->ppag_bios_rev; | |
| 370 | − cmd->v3.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags); | |
| 377 | + gain = cmd->v7.gain[0]; | |
| 378 | + *cmd_size = sizeof(cmd->v7); | |
| 379 | + cmd->v7.ppag_config_info.table_source = fwrt->ppag_bios_source; | |
| 380 | + cmd->v7.ppag_config_info.table_revision = fwrt->ppag_bios_rev; | |
| 381 | + cmd->v7.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags); | |
| 371 | 382 | } else { |
| 372 | 383 | IWL_DEBUG_RADIO(fwrt, "Unsupported PPAG command version\n"); |
| 373 | 384 | return -EINVAL; |
| @@ -378,30 +389,22 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 4 unmodified lines | ||
| 378 | 389 | "PPAG MODE bits were read from bios: %d\n", |
| 379 | 390 | fwrt->ppag_flags); |
| 380 | 391 | |
| 381 | − if (cmd_ver == 6) | |
| 382 | − cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V6_MASK); | |
| 383 | − else if (cmd_ver == 5) | |
| 384 | − cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V5_MASK); | |
| 385 | − else if (cmd_ver < 5) | |
| 386 | − cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V4_MASK); | |
| 387 | − | |
| 388 | − if ((cmd_ver == 1 && | |
| 389 | − !fw_has_capa(&fwrt->fw->ucode_capa, | |
| 390 | − IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) || | |
| 391 | − (cmd_ver == 2 && fwrt->ppag_bios_rev >= 2)) { | |
| 392 | + if (cmd_ver == 1 && | |
| 393 | + !fw_has_capa(&fwrt->fw->ucode_capa, | |
| 394 | + IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) { | |
| 392 | 395 | cmd->v1.flags &= cpu_to_le32(IWL_PPAG_ETSI_MASK); |
| 393 | 396 | IWL_DEBUG_RADIO(fwrt, "masking ppag China bit\n"); |
| 394 | 397 | } else { |
| 395 | 398 | IWL_DEBUG_RADIO(fwrt, "isn't masking ppag China bit\n"); |
| 396 | 399 | } |
| 397 | 400 | |
| 398 | − /* The 'flags' field is the same in v1 and v2 so we can just | |
| 401 | + /* The 'flags' field is the same in v1 and v5 so we can just | |
| 399 | 402 | * use v1 to access it. |
| 400 | 403 | */ |
| 401 | 404 | IWL_DEBUG_RADIO(fwrt, |
| 402 | 405 | "PPAG MODE bits going to be sent: %d\n", |
| 403 | 406 | (cmd_ver < 7) ? le32_to_cpu(cmd->v1.flags) : |
| 404 | − le32_to_cpu(cmd->v3.ppag_config_info.value)); | |
| 407 | + le32_to_cpu(cmd->v7.ppag_config_info.value)); | |
| 405 | 408 | |
| 406 | 409 | for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) { |
| 407 | 410 | for (j = 0; j < num_sub_bands; j++) { |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #include "fw/api/phy.h" |
| 13 | 13 | #include "fw/api/config.h" |
| 14 | 14 | #include "fw/api/nvm-reg.h" |
| 15 | −#include "fw/img.h" | |
| 16 | 15 | #include "iwl-trans.h" |
| 17 | 16 | |
| 18 | 17 | #define BIOS_SAR_MAX_PROFILE_NUM 4 |
| @@ -150,8 +150,6 @@ struct iwl_fw_runtime { · 149 unmodified lines | ||
| 150 | 150 | unsigned long non_collect_ts_start[IWL_FW_INI_TIME_POINT_NUM]; |
| 151 | 151 | u32 *d3_debug_data; |
| 152 | 152 | u32 lmac_err_id[MAX_NUM_LMAC]; |
| 153 | − u32 tcm_err_id[MAX_NUM_TCM]; | |
| 154 | − u32 rcm_err_id[MAX_NUM_RCM]; | |
| 155 | 153 | u32 umac_err_id; |
| 156 | 154 | |
| 157 | 155 | struct iwl_txf_iter_data txf_iter_data; |
| @@ -727,6 +727,8 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func, · 726 unmodified lines | ||
| 727 | 727 | struct uefi_cnv_var_general_cfg *data; |
| 728 | 728 | int ret = -EINVAL; |
| 729 | 729 | |
| 730 | + BUILD_BUG_ON(ARRAY_SIZE(data->functions) < DSM_FUNC_NUM_FUNCS); | |
| 731 | + | |
| 730 | 732 | /* Not supported function index */ |
| 731 | 733 | if (func >= DSM_FUNC_NUM_FUNCS || func == 5) |
| 732 | 734 | return -EOPNOTSUPP; |
| @@ -742,11 +744,6 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func, · 9 unmodified lines | ||
| 742 | 744 | goto out; |
| 743 | 745 | } |
| 744 | 746 | |
| 745 | − if (ARRAY_SIZE(data->functions) != UEFI_MAX_DSM_FUNCS) { | |
| 746 | − IWL_DEBUG_RADIO(fwrt, "Invalid size of DSM functions array\n"); | |
| 747 | − goto out; | |
| 748 | − } | |
| 749 | − | |
| 750 | 747 | if (!(data->functions[DSM_FUNC_QUERY] & BIT(func))) { |
| 751 | 748 | IWL_DEBUG_RADIO(fwrt, "DSM func %d not in 0x%x\n", |
| 752 | 749 | func, data->functions[DSM_FUNC_QUERY]); |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/netdevice.h> |
| 12 | 12 | #include <linux/ieee80211.h> |
| 13 | 13 | #include <linux/nl80211.h> |
| 14 | +#include <linux/module.h> | |
| 14 | 15 | #include <linux/mod_devicetable.h> |
| 15 | 16 | #include "iwl-csr.h" |
| 16 | 17 | #include "iwl-drv.h" |
| @@ -107,6 +108,9 @@ enum iwl_nvm_type { · 90 unmodified lines | ||
| 107 | 108 | MODULE_FIRMWARE(pfx "-" __stringify(api) ".ucode"); \ |
| 108 | 109 | MODULE_FIRMWARE(pfx ".pnvm") |
| 109 | 110 | |
| 111 | +#define IWL_CORE_FW(pfx, core) \ | |
| 112 | + MODULE_FIRMWARE(pfx "-c" __stringify(core) ".ucode") | |
| 113 | + | |
| 110 | 114 | static inline u8 num_of_ant(u8 mask) |
| 111 | 115 | { |
| 112 | 116 | return !!((mask) & ANT_A) + |
| @@ -192,8 +196,8 @@ struct iwl_family_base_params { · 79 unmodified lines | ||
| 192 | 196 | |
| 193 | 197 | u8 max_ll_items; |
| 194 | 198 | u8 led_compensation; |
| 195 | − u8 ucode_api_max; | |
| 196 | − u8 ucode_api_min; | |
| 199 | + u16 ucode_api_max; | |
| 200 | + u16 ucode_api_min; | |
| 197 | 201 | u32 mac_addr_from_csr:10; |
| 198 | 202 | u8 nvm_hw_section_num; |
| 199 | 203 | netdev_features_t features; |
| @@ -210,6 +214,34 @@ struct iwl_family_base_params { · 10 unmodified lines | ||
| 210 | 214 | const struct iwl_fw_mon_regs mon_dbgi_regs; |
| 211 | 215 | }; |
| 212 | 216 | |
| 217 | +/* | |
| 218 | + * FW is released as "core N release", and we used to have a | |
| 219 | + * gap of 3 between the API version and core number. Now the | |
| 220 | + * reported API version will be 1000 + core and we encode it | |
| 221 | + * in the filename as "c<core>". | |
| 222 | + */ | |
| 223 | +#define API_IS_CORE_START 1000 | |
| 224 | +#define API_TO_CORE_OFFS 3 | |
| 225 | +#define ENCODE_CORE_AS_API(core) (API_IS_CORE_START + (core)) | |
| 226 | + | |
| 227 | +static inline bool iwl_api_is_core_number(int api) | |
| 228 | +{ | |
| 229 | + return api >= API_IS_CORE_START; | |
| 230 | +} | |
| 231 | + | |
| 232 | +static inline int iwl_api_to_core(int api) | |
| 233 | +{ | |
| 234 | + if (iwl_api_is_core_number(api)) | |
| 235 | + return api - API_IS_CORE_START; | |
| 236 | + | |
| 237 | + return api - API_TO_CORE_OFFS; | |
| 238 | +} | |
| 239 | + | |
| 240 | +#define FW_API_FMT "%s%d" | |
| 241 | +#define FW_API_ARG(n) \ | |
| 242 | + iwl_api_is_core_number(n) ? "c" : "", \ | |
| 243 | + iwl_api_is_core_number(n) ? (n) - API_IS_CORE_START : (n) | |
| 244 | + | |
| 213 | 245 | /* |
| 214 | 246 | * @stbc: support Tx STBC and 1*SS Rx STBC |
| 215 | 247 | * @ldpc: support Tx/Rx with LDPC |
| @@ -422,8 +454,8 @@ struct iwl_rf_cfg { · 206 unmodified lines | ||
| 422 | 454 | u8 valid_tx_ant; |
| 423 | 455 | u8 valid_rx_ant; |
| 424 | 456 | u8 non_shared_ant; |
| 425 | − u8 ucode_api_max; | |
| 426 | − u8 ucode_api_min; | |
| 457 | + u16 ucode_api_max; | |
| 458 | + u16 ucode_api_min; | |
| 427 | 459 | u16 num_rbds; |
| 428 | 460 | }; |
| 429 | 461 | |
| @@ -337,10 +337,18 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 336 unmodified lines | ||
| 337 | 337 | return -EINVAL; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | + if (CSR_HW_RFID_TYPE(drv->trans->info.hw_rf_id) == IWL_CFG_RF_TYPE_WH && | |
| 341 | + CSR_HW_RFID_STEP(drv->trans->info.hw_rf_id) == SILICON_A_STEP) { | |
| 342 | + IWL_ERR(drv, "WH A step is not supported\n"); | |
| 343 | + return -EINVAL; | |
| 344 | + } | |
| 345 | + | |
| 340 | 346 | fw_name_pre = iwl_drv_get_fwname_pre(drv->trans, _fw_name_pre); |
| 341 | 347 | |
| 342 | 348 | if (first) |
| 343 | 349 | drv->fw_index = ucode_api_max; |
| 350 | + else if (drv->fw_index == ENCODE_CORE_AS_API(99)) | |
| 351 | + drv->fw_index = 101; /* last API-scheme number below core 99 */ | |
| 344 | 352 | else |
| 345 | 353 | drv->fw_index--; |
| 346 | 354 | |
| @@ -348,13 +356,15 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 1 unmodified line | ||
| 348 | 356 | IWL_ERR(drv, "no suitable firmware found!\n"); |
| 349 | 357 | |
| 350 | 358 | if (ucode_api_min == ucode_api_max) { |
| 351 | − IWL_ERR(drv, "%s-%d is required\n", fw_name_pre, | |
| 352 | − ucode_api_max); | |
| 359 | + IWL_ERR(drv, "%s-" FW_API_FMT " is required\n", | |
| 360 | + fw_name_pre, FW_API_ARG(ucode_api_max)); | |
| 353 | 361 | } else { |
| 354 | − IWL_ERR(drv, "minimum version required: %s-%d\n", | |
| 355 | − fw_name_pre, ucode_api_min); | |
| 356 | − IWL_ERR(drv, "maximum version supported: %s-%d\n", | |
| 357 | − fw_name_pre, ucode_api_max); | |
| 362 | + IWL_ERR(drv, | |
| 363 | + "minimum version required: %s-" FW_API_FMT "\n", | |
| 364 | + fw_name_pre, FW_API_ARG(ucode_api_min)); | |
| 365 | + IWL_ERR(drv, | |
| 366 | + "maximum version supported: %s-" FW_API_FMT "\n", | |
| 367 | + fw_name_pre, FW_API_ARG(ucode_api_max)); | |
| 358 | 368 | } |
| 359 | 369 | |
| 360 | 370 | IWL_ERR(drv, |
| @@ -362,8 +372,9 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 1 unmodified line | ||
| 362 | 372 | return -ENOENT; |
| 363 | 373 | } |
| 364 | 374 | |
| 365 | − snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s-%d.ucode", | |
| 366 | − fw_name_pre, drv->fw_index); | |
| 375 | + snprintf(drv->firmware_name, sizeof(drv->firmware_name), | |
| 376 | + "%s-" FW_API_FMT ".ucode", | |
| 377 | + fw_name_pre, FW_API_ARG(drv->fw_index)); | |
| 367 | 378 | |
| 368 | 379 | IWL_DEBUG_FW_INFO(drv, "attempting to load firmware '%s'\n", |
| 369 | 380 | drv->firmware_name); |
| @@ -1588,6 +1599,7 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv) · 1218 unmodified lines | ||
| 1588 | 1599 | */ |
| 1589 | 1600 | static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
| 1590 | 1601 | { |
| 1602 | + unsigned int min_core, max_core, loaded_core; | |
| 1591 | 1603 | struct iwl_drv *drv = context; |
| 1592 | 1604 | struct iwl_fw *fw = &drv->fw; |
| 1593 | 1605 | const struct iwl_ucode_header *ucode; |
| @@ -1650,11 +1662,24 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) · 56 unmodified lines | ||
| 1650 | 1662 | * firmware filename ... but we don't check for that and only rely |
| 1651 | 1663 | * on the API version read from firmware header from here on forward |
| 1652 | 1664 | */ |
| 1653 | − if (api_ver < api_min || api_ver > api_max) { | |
| 1665 | + | |
| 1666 | + /* | |
| 1667 | + * if -cN.ucode file was loaded, core version == file version, | |
| 1668 | + * otherwise core version == file version (API version) - 3 | |
| 1669 | + */ | |
| 1670 | + if (iwl_api_is_core_number(drv->fw_index)) | |
| 1671 | + loaded_core = api_ver; | |
| 1672 | + else | |
| 1673 | + loaded_core = api_ver - API_TO_CORE_OFFS; | |
| 1674 | + | |
| 1675 | + min_core = iwl_api_to_core(api_min); | |
| 1676 | + max_core = iwl_api_to_core(api_max); | |
| 1677 | + | |
| 1678 | + if (loaded_core < min_core || loaded_core > max_core) { | |
| 1654 | 1679 | IWL_ERR(drv, |
| 1655 | 1680 | "Driver unable to support your firmware API. " |
| 1656 | − "Driver supports v%u, firmware is v%u.\n", | |
| 1657 | − api_max, api_ver); | |
| 1681 | + "Driver supports FW core %u..%u, firmware is %u.\n", | |
| 1682 | + min_core, max_core, loaded_core); | |
| 1658 | 1683 | goto try_again; |
| 1659 | 1684 | } |
| 1660 | 1685 | |
| @@ -3,7 +3,6 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright (C) 2003-2014, 2018-2022, 2024-2025 Intel Corporation |
| 4 | 4 | * Copyright (C) 2015-2016 Intel Deutschland GmbH |
| 5 | 5 | */ |
| 6 | −#include <linux/delay.h> | |
| 7 | 6 | #include <linux/device.h> |
| 8 | 7 | #include <linux/export.h> |
| 9 | 8 | |
| @@ -13,6 +12,7 @@ · 3 unmodified lines | ||
| 13 | 12 | #include "iwl-debug.h" |
| 14 | 13 | #include "iwl-prph.h" |
| 15 | 14 | #include "iwl-fh.h" |
| 15 | +#include "pcie/gen1_2/internal.h" | |
| 16 | 16 | |
| 17 | 17 | void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) |
| 18 | 18 | { |
| @@ -160,7 +160,7 @@ int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, · 141 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | do { |
| 162 | 162 | if ((iwl_read_prph(trans, addr) & mask) == (bits & mask)) |
| 163 | − return t; | |
| 163 | + return 0; | |
| 164 | 164 | udelay(IWL_POLL_INTERVAL); |
| 165 | 165 | t += IWL_POLL_INTERVAL; |
| 166 | 166 | } while (t < timeout); |
| @@ -396,96 +396,11 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf) · 229 unmodified lines | ||
| 396 | 396 | return 0; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | −#define IWL_HOST_MON_BLOCK_PEMON 0x00 | |
| 400 | −#define IWL_HOST_MON_BLOCK_HIPM 0x22 | |
| 401 | − | |
| 402 | −#define IWL_HOST_MON_BLOCK_PEMON_VEC0 0x00 | |
| 403 | −#define IWL_HOST_MON_BLOCK_PEMON_VEC1 0x01 | |
| 404 | −#define IWL_HOST_MON_BLOCK_PEMON_WFPM 0x06 | |
| 405 | − | |
| 406 | −static void iwl_dump_host_monitor_block(struct iwl_trans *trans, | |
| 407 | − u32 block, u32 vec, u32 iter) | |
| 408 | −{ | |
| 409 | − int i; | |
| 410 | − | |
| 411 | − IWL_ERR(trans, "Host monitor block 0x%x vector 0x%x\n", block, vec); | |
| 412 | − iwl_write32(trans, CSR_MONITOR_CFG_REG, (block << 8) | vec); | |
| 413 | − for (i = 0; i < iter; i++) | |
| 414 | − IWL_ERR(trans, " value [iter %d]: 0x%08x\n", | |
| 415 | − i, iwl_read32(trans, CSR_MONITOR_STATUS_REG)); | |
| 416 | −} | |
| 417 | − | |
| 418 | −static void iwl_dump_host_monitor(struct iwl_trans *trans) | |
| 419 | −{ | |
| 420 | − switch (trans->mac_cfg->device_family) { | |
| 421 | − case IWL_DEVICE_FAMILY_22000: | |
| 422 | − case IWL_DEVICE_FAMILY_AX210: | |
| 423 | − IWL_ERR(trans, "CSR_RESET = 0x%x\n", | |
| 424 | − iwl_read32(trans, CSR_RESET)); | |
| 425 | − iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 426 | − IWL_HOST_MON_BLOCK_PEMON_VEC0, 15); | |
| 427 | − iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 428 | − IWL_HOST_MON_BLOCK_PEMON_VEC1, 15); | |
| 429 | − iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 430 | − IWL_HOST_MON_BLOCK_PEMON_WFPM, 15); | |
| 431 | − iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_HIPM, | |
| 432 | − IWL_HOST_MON_BLOCK_PEMON_VEC0, 1); | |
| 433 | − break; | |
| 434 | − default: | |
| 435 | − /* not supported yet */ | |
| 436 | − return; | |
| 437 | − } | |
| 438 | −} | |
| 439 | − | |
| 440 | −int iwl_finish_nic_init(struct iwl_trans *trans) | |
| 399 | +int iwl_trans_activate_nic(struct iwl_trans *trans) | |
| 441 | 400 | { |
| 442 | − const struct iwl_mac_cfg *mac_cfg = trans->mac_cfg; | |
| 443 | − u32 poll_ready; | |
| 444 | − int err; | |
| 445 | − | |
| 446 | − if (mac_cfg->bisr_workaround) { | |
| 447 | − /* ensure the TOP FSM isn't still in previous reset */ | |
| 448 | − mdelay(2); | |
| 449 | − } | |
| 450 | − | |
| 451 | − /* | |
| 452 | − * Set "initialization complete" bit to move adapter from | |
| 453 | − * D0U* --> D0A* (powered-up active) state. | |
| 454 | − */ | |
| 455 | − if (mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) { | |
| 456 | − iwl_set_bit(trans, CSR_GP_CNTRL, | |
| 457 | − CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ | | |
| 458 | − CSR_GP_CNTRL_REG_FLAG_MAC_INIT); | |
| 459 | − poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_STATUS; | |
| 460 | − } else { | |
| 461 | − iwl_set_bit(trans, CSR_GP_CNTRL, | |
| 462 | − CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | |
| 463 | − poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY; | |
| 464 | − } | |
| 465 | − | |
| 466 | − if (mac_cfg->device_family == IWL_DEVICE_FAMILY_8000) | |
| 467 | − udelay(2); | |
| 468 | − | |
| 469 | − /* | |
| 470 | − * Wait for clock stabilization; once stabilized, access to | |
| 471 | − * device-internal resources is supported, e.g. iwl_write_prph() | |
| 472 | − * and accesses to uCode SRAM. | |
| 473 | − */ | |
| 474 | − err = iwl_poll_bits(trans, CSR_GP_CNTRL, poll_ready, 25000); | |
| 475 | − if (err < 0) { | |
| 476 | − IWL_DEBUG_INFO(trans, "Failed to wake NIC\n"); | |
| 477 | − | |
| 478 | − iwl_dump_host_monitor(trans); | |
| 479 | − } | |
| 480 | − | |
| 481 | − if (mac_cfg->bisr_workaround) { | |
| 482 | − /* ensure BISR shift has finished */ | |
| 483 | − udelay(200); | |
| 484 | − } | |
| 485 | − | |
| 486 | − return err < 0 ? err : 0; | |
| 401 | + return iwl_pcie_gen1_2_activate_nic(trans); | |
| 487 | 402 | } |
| 488 | −IWL_EXPORT_SYMBOL(iwl_finish_nic_init); | |
| 403 | +IWL_EXPORT_SYMBOL(iwl_trans_activate_nic); | |
| 489 | 404 | |
| 490 | 405 | void iwl_trans_sync_nmi_with_addr(struct iwl_trans *trans, u32 inta_addr, |
| 491 | 406 | u32 sw_err_bit) |
| @@ -57,7 +57,7 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, · 56 unmodified lines | ||
| 57 | 57 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); |
| 58 | 58 | void iwl_force_nmi(struct iwl_trans *trans); |
| 59 | 59 | |
| 60 | −int iwl_finish_nic_init(struct iwl_trans *trans); | |
| 60 | +int iwl_trans_activate_nic(struct iwl_trans *trans); | |
| 61 | 61 | |
| 62 | 62 | /* Error handling */ |
| 63 | 63 | int iwl_dump_fh(struct iwl_trans *trans, char **buf); |
| @@ -139,50 +139,6 @@ static struct ieee80211_rate iwl_cfg80211_rates[] = { · 138 unmodified lines | ||
| 139 | 139 | #define RATES_52_OFFS 4 |
| 140 | 140 | #define N_RATES_52 (N_RATES_24 - RATES_52_OFFS) |
| 141 | 141 | |
| 142 | −/** | |
| 143 | − * enum iwl_nvm_channel_flags - channel flags in NVM | |
| 144 | − * @NVM_CHANNEL_VALID: channel is usable for this SKU/geo | |
| 145 | − * @NVM_CHANNEL_IBSS: usable as an IBSS channel and deprecated | |
| 146 | − * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 147 | − * @NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY: active scanning allowed and | |
| 148 | − * AP allowed only in 20 MHz. Valid only | |
| 149 | − * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 150 | − * @NVM_CHANNEL_ACTIVE: active scanning allowed and allows IBSS | |
| 151 | − * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 152 | − * @NVM_CHANNEL_RADAR: radar detection required | |
| 153 | − * @NVM_CHANNEL_INDOOR_ONLY: only indoor use is allowed | |
| 154 | − * @NVM_CHANNEL_GO_CONCURRENT: GO operation is allowed when connected to BSS | |
| 155 | − * on same channel on 2.4 or same UNII band on 5.2 | |
| 156 | − * @NVM_CHANNEL_UNIFORM: uniform spreading required | |
| 157 | − * @NVM_CHANNEL_20MHZ: 20 MHz channel okay | |
| 158 | − * @NVM_CHANNEL_40MHZ: 40 MHz channel okay | |
| 159 | − * @NVM_CHANNEL_80MHZ: 80 MHz channel okay | |
| 160 | − * @NVM_CHANNEL_160MHZ: 160 MHz channel okay | |
| 161 | − * @NVM_CHANNEL_DC_HIGH: DC HIGH required/allowed (?) | |
| 162 | − * @NVM_CHANNEL_VLP: client support connection to UHB VLP AP | |
| 163 | − * @NVM_CHANNEL_AFC: client support connection to UHB AFC AP | |
| 164 | − * @NVM_CHANNEL_VLP_AP_NOT_ALLOWED: UHB VLP AP not allowed, | |
| 165 | − * Valid only when %NVM_CHANNEL_VLP is enabled. | |
| 166 | − */ | |
| 167 | −enum iwl_nvm_channel_flags { | |
| 168 | − NVM_CHANNEL_VALID = BIT(0), | |
| 169 | − NVM_CHANNEL_IBSS = BIT(1), | |
| 170 | − NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY = BIT(2), | |
| 171 | − NVM_CHANNEL_ACTIVE = BIT(3), | |
| 172 | − NVM_CHANNEL_RADAR = BIT(4), | |
| 173 | − NVM_CHANNEL_INDOOR_ONLY = BIT(5), | |
| 174 | − NVM_CHANNEL_GO_CONCURRENT = BIT(6), | |
| 175 | − NVM_CHANNEL_UNIFORM = BIT(7), | |
| 176 | − NVM_CHANNEL_20MHZ = BIT(8), | |
| 177 | − NVM_CHANNEL_40MHZ = BIT(9), | |
| 178 | − NVM_CHANNEL_80MHZ = BIT(10), | |
| 179 | − NVM_CHANNEL_160MHZ = BIT(11), | |
| 180 | − NVM_CHANNEL_DC_HIGH = BIT(12), | |
| 181 | − NVM_CHANNEL_VLP = BIT(13), | |
| 182 | − NVM_CHANNEL_AFC = BIT(14), | |
| 183 | − NVM_CHANNEL_VLP_AP_NOT_ALLOWED = BIT(15), | |
| 184 | −}; | |
| 185 | − | |
| 186 | 142 | /** |
| 187 | 143 | * enum iwl_reg_capa_flags_v1 - global flags applied for the whole regulatory |
| 188 | 144 | * domain. |
| @@ -282,30 +238,6 @@ enum iwl_reg_capa_flags_v4 { · 93 unmodified lines | ||
| 282 | 238 | */ |
| 283 | 239 | #define REG_CAPA_V4_RESP_VER 8 |
| 284 | 240 | |
| 285 | −/** | |
| 286 | − * struct iwl_reg_capa - struct for global regulatory capabilities, Used for | |
| 287 | − * handling the different APIs of reg_capa_flags. | |
| 288 | − * | |
| 289 | − * @allow_40mhz: 11n channel with a width of 40Mhz is allowed | |
| 290 | − * for this regulatory domain. | |
| 291 | − * @allow_80mhz: 11ac channel with a width of 80Mhz is allowed | |
| 292 | − * for this regulatory domain (valid only in 5 and 6 Ghz). | |
| 293 | − * @allow_160mhz: 11ac channel with a width of 160Mhz is allowed | |
| 294 | − * for this regulatory domain (valid only in 5 and 6 Ghz). | |
| 295 | − * @allow_320mhz: 11be channel with a width of 320Mhz is allowed | |
| 296 | − * for this regulatory domain (valid only in 6 Ghz). | |
| 297 | − * @disable_11ax: 11ax is forbidden for this regulatory domain. | |
| 298 | − * @disable_11be: 11be is forbidden for this regulatory domain. | |
| 299 | − */ | |
| 300 | −struct iwl_reg_capa { | |
| 301 | − bool allow_40mhz; | |
| 302 | − bool allow_80mhz; | |
| 303 | − bool allow_160mhz; | |
| 304 | − bool allow_320mhz; | |
| 305 | − bool disable_11ax; | |
| 306 | − bool disable_11be; | |
| 307 | −}; | |
| 308 | − | |
| 309 | 241 | static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level, |
| 310 | 242 | int chan, u32 flags) |
| 311 | 243 | { |
| @@ -1042,10 +974,6 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans, · 730 unmodified lines | ||
| 1042 | 974 | iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |= |
| 1043 | 975 | IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO; |
| 1044 | 976 | |
| 1045 | − if (fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_BROADCAST_TWT)) | |
| 1046 | − iftype_data->he_cap.he_cap_elem.mac_cap_info[2] |= | |
| 1047 | − IEEE80211_HE_MAC_CAP2_BCAST_TWT; | |
| 1048 | − | |
| 1049 | 977 | if (trans->mac_cfg->device_family == IWL_DEVICE_FAMILY_22000 && |
| 1050 | 978 | !is_ap) { |
| 1051 | 979 | iftype_data->vendor_elems.data = iwl_vendor_caps; |
| @@ -1600,9 +1528,10 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 548 unmodified lines | ||
| 1600 | 1528 | } |
| 1601 | 1529 | IWL_EXPORT_SYMBOL(iwl_parse_nvm_data); |
| 1602 | 1530 | |
| 1603 | −static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, | |
| 1604 | − int ch_idx, u16 nvm_flags, | |
| 1605 | − struct iwl_reg_capa reg_capa) | |
| 1531 | +VISIBLE_IF_IWLWIFI_KUNIT | |
| 1532 | +u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, | |
| 1533 | + int ch_idx, u16 nvm_flags, | |
| 1534 | + struct iwl_reg_capa reg_capa) | |
| 1606 | 1535 | { |
| 1607 | 1536 | u32 flags = NL80211_RRF_NO_HT40; |
| 1608 | 1537 | |
| @@ -1692,6 +1621,7 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, · 83 unmodified lines | ||
| 1692 | 1621 | |
| 1693 | 1622 | return flags; |
| 1694 | 1623 | } |
| 1624 | +EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_nvm_get_regdom_bw_flags); | |
| 1695 | 1625 | |
| 1696 | 1626 | static struct iwl_reg_capa iwl_get_reg_capa(u32 flags, u8 resp_ver) |
| 1697 | 1627 | { |
| @@ -21,6 +21,80 @@ enum iwl_nvm_sbands_flags { · 20 unmodified lines | ||
| 21 | 21 | IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ = BIT(1), |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | +/** | |
| 25 | + * struct iwl_reg_capa - struct for global regulatory capabilities, Used for | |
| 26 | + * handling the different APIs of reg_capa_flags. | |
| 27 | + * | |
| 28 | + * @allow_40mhz: 11n channel with a width of 40Mhz is allowed | |
| 29 | + * for this regulatory domain. | |
| 30 | + * @allow_80mhz: 11ac channel with a width of 80Mhz is allowed | |
| 31 | + * for this regulatory domain (valid only in 5 and 6 Ghz). | |
| 32 | + * @allow_160mhz: 11ac channel with a width of 160Mhz is allowed | |
| 33 | + * for this regulatory domain (valid only in 5 and 6 Ghz). | |
| 34 | + * @allow_320mhz: 11be channel with a width of 320Mhz is allowed | |
| 35 | + * for this regulatory domain (valid only in 6 Ghz). | |
| 36 | + * @disable_11ax: 11ax is forbidden for this regulatory domain. | |
| 37 | + * @disable_11be: 11be is forbidden for this regulatory domain. | |
| 38 | + */ | |
| 39 | +struct iwl_reg_capa { | |
| 40 | + bool allow_40mhz; | |
| 41 | + bool allow_80mhz; | |
| 42 | + bool allow_160mhz; | |
| 43 | + bool allow_320mhz; | |
| 44 | + bool disable_11ax; | |
| 45 | + bool disable_11be; | |
| 46 | +}; | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * enum iwl_nvm_channel_flags - channel flags in NVM | |
| 50 | + * @NVM_CHANNEL_VALID: channel is usable for this SKU/geo | |
| 51 | + * @NVM_CHANNEL_IBSS: usable as an IBSS channel and deprecated | |
| 52 | + * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 53 | + * @NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY: active scanning allowed and | |
| 54 | + * AP allowed only in 20 MHz. Valid only | |
| 55 | + * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 56 | + * @NVM_CHANNEL_ACTIVE: active scanning allowed and allows IBSS | |
| 57 | + * when %IWL_NVM_SBANDS_FLAGS_LAR enabled. | |
| 58 | + * @NVM_CHANNEL_RADAR: radar detection required | |
| 59 | + * @NVM_CHANNEL_INDOOR_ONLY: only indoor use is allowed | |
| 60 | + * @NVM_CHANNEL_GO_CONCURRENT: GO operation is allowed when connected to BSS | |
| 61 | + * on same channel on 2.4 or same UNII band on 5.2 | |
| 62 | + * @NVM_CHANNEL_UNIFORM: uniform spreading required | |
| 63 | + * @NVM_CHANNEL_20MHZ: 20 MHz channel okay | |
| 64 | + * @NVM_CHANNEL_40MHZ: 40 MHz channel okay | |
| 65 | + * @NVM_CHANNEL_80MHZ: 80 MHz channel okay | |
| 66 | + * @NVM_CHANNEL_160MHZ: 160 MHz channel okay | |
| 67 | + * @NVM_CHANNEL_DC_HIGH: DC HIGH required/allowed (?) | |
| 68 | + * @NVM_CHANNEL_VLP: client support connection to UHB VLP AP | |
| 69 | + * @NVM_CHANNEL_AFC: client support connection to UHB AFC AP | |
| 70 | + * @NVM_CHANNEL_VLP_AP_NOT_ALLOWED: UHB VLP AP not allowed, | |
| 71 | + * Valid only when %NVM_CHANNEL_VLP is enabled. | |
| 72 | + */ | |
| 73 | +enum iwl_nvm_channel_flags { | |
| 74 | + NVM_CHANNEL_VALID = BIT(0), | |
| 75 | + NVM_CHANNEL_IBSS = BIT(1), | |
| 76 | + NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY = BIT(2), | |
| 77 | + NVM_CHANNEL_ACTIVE = BIT(3), | |
| 78 | + NVM_CHANNEL_RADAR = BIT(4), | |
| 79 | + NVM_CHANNEL_INDOOR_ONLY = BIT(5), | |
| 80 | + NVM_CHANNEL_GO_CONCURRENT = BIT(6), | |
| 81 | + NVM_CHANNEL_UNIFORM = BIT(7), | |
| 82 | + NVM_CHANNEL_20MHZ = BIT(8), | |
| 83 | + NVM_CHANNEL_40MHZ = BIT(9), | |
| 84 | + NVM_CHANNEL_80MHZ = BIT(10), | |
| 85 | + NVM_CHANNEL_160MHZ = BIT(11), | |
| 86 | + NVM_CHANNEL_DC_HIGH = BIT(12), | |
| 87 | + NVM_CHANNEL_VLP = BIT(13), | |
| 88 | + NVM_CHANNEL_AFC = BIT(14), | |
| 89 | + NVM_CHANNEL_VLP_AP_NOT_ALLOWED = BIT(15), | |
| 90 | +}; | |
| 91 | + | |
| 92 | +#if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS) | |
| 93 | +u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, | |
| 94 | + int ch_idx, u16 nvm_flags, | |
| 95 | + struct iwl_reg_capa reg_capa); | |
| 96 | +#endif | |
| 97 | + | |
| 24 | 98 | /* |
| 25 | 99 | * iwl_parse_nvm_data - parse NVM data and return values |
| 26 | 100 | * |
| @@ -268,9 +268,7 @@ static void iwl_trans_restart_wk(struct work_struct *wk) · 267 unmodified lines | ||
| 268 | 268 | |
| 269 | 269 | struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, |
| 270 | 270 | struct device *dev, |
| 271 | − const struct iwl_mac_cfg *mac_cfg, | |
| 272 | − unsigned int txcmd_size, | |
| 273 | − unsigned int txcmd_align) | |
| 271 | + const struct iwl_mac_cfg *mac_cfg) | |
| 274 | 272 | { |
| 275 | 273 | struct iwl_trans *trans; |
| 276 | 274 | #ifdef CONFIG_LOCKDEP |
| @@ -292,22 +290,12 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, · 15 unmodified lines | ||
| 292 | 290 | |
| 293 | 291 | INIT_DELAYED_WORK(&trans->restart.wk, iwl_trans_restart_wk); |
| 294 | 292 | |
| 295 | − snprintf(trans->dev_cmd_pool_name, sizeof(trans->dev_cmd_pool_name), | |
| 296 | − "iwl_cmd_pool:%s", dev_name(trans->dev)); | |
| 297 | − trans->dev_cmd_pool = | |
| 298 | − kmem_cache_create(trans->dev_cmd_pool_name, | |
| 299 | − txcmd_size, txcmd_align, | |
| 300 | − SLAB_HWCACHE_ALIGN, NULL); | |
| 301 | − if (!trans->dev_cmd_pool) | |
| 302 | − return NULL; | |
| 303 | − | |
| 304 | 293 | return trans; |
| 305 | 294 | } |
| 306 | 295 | |
| 307 | 296 | void iwl_trans_free(struct iwl_trans *trans) |
| 308 | 297 | { |
| 309 | 298 | cancel_delayed_work_sync(&trans->restart.wk); |
| 310 | − kmem_cache_destroy(trans->dev_cmd_pool); | |
| 311 | 299 | } |
| 312 | 300 | |
| 313 | 301 | int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) |
| @@ -318,9 +306,6 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) · 4 unmodified lines | ||
| 318 | 306 | test_bit(STATUS_RFKILL_OPMODE, &trans->status))) |
| 319 | 307 | return -ERFKILL; |
| 320 | 308 | |
| 321 | − if (unlikely(test_bit(STATUS_SUSPENDED, &trans->status))) | |
| 322 | − return -EHOSTDOWN; | |
| 323 | − | |
| 324 | 309 | if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) |
| 325 | 310 | return -EIO; |
| 326 | 311 | |
| @@ -348,6 +333,19 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) · 21 unmodified lines | ||
| 348 | 333 | } |
| 349 | 334 | IWL_EXPORT_SYMBOL(iwl_trans_send_cmd); |
| 350 | 335 | |
| 336 | +struct iwl_device_tx_cmd *iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) | |
| 337 | +{ | |
| 338 | + return iwl_pcie_gen1_2_alloc_tx_cmd(trans); | |
| 339 | +} | |
| 340 | +IWL_EXPORT_SYMBOL(iwl_trans_alloc_tx_cmd); | |
| 341 | + | |
| 342 | +void iwl_trans_free_tx_cmd(struct iwl_trans *trans, | |
| 343 | + struct iwl_device_tx_cmd *dev_cmd) | |
| 344 | +{ | |
| 345 | + iwl_pcie_gen1_2_free_tx_cmd(trans, dev_cmd); | |
| 346 | +} | |
| 347 | +IWL_EXPORT_SYMBOL(iwl_trans_free_tx_cmd); | |
| 348 | + | |
| 351 | 349 | /* Comparator for struct iwl_hcmd_names. |
| 352 | 350 | * Used in the binary search over a list of host commands. |
| 353 | 351 | * |
| @@ -399,7 +397,7 @@ void iwl_trans_op_mode_enter(struct iwl_trans *trans, · 45 unmodified lines | ||
| 399 | 397 | |
| 400 | 398 | WARN_ON_ONCE(!trans->conf.rx_mpdu_cmd); |
| 401 | 399 | |
| 402 | − iwl_trans_pcie_op_mode_enter(trans); | |
| 400 | + iwl_pcie_gen1_2_op_mode_enter(trans); | |
| 403 | 401 | } |
| 404 | 402 | IWL_EXPORT_SYMBOL(iwl_trans_op_mode_enter); |
| 405 | 403 | |
| @@ -408,8 +406,6 @@ int iwl_trans_start_hw(struct iwl_trans *trans) · 2 unmodified lines | ||
| 408 | 406 | might_sleep(); |
| 409 | 407 | |
| 410 | 408 | clear_bit(STATUS_TRANS_RESET_IN_PROGRESS, &trans->status); |
| 411 | − /* opmode may not resume if it detects errors */ | |
| 412 | − clear_bit(STATUS_SUSPENDED, &trans->status); | |
| 413 | 409 | |
| 414 | 410 | return iwl_trans_pcie_start_hw(trans); |
| 415 | 411 | } |
| @@ -507,33 +503,19 @@ iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask, · 91 unmodified lines | ||
| 507 | 503 | sanitize_ops, sanitize_ctx); |
| 508 | 504 | } |
| 509 | 505 | |
| 510 | −int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test, bool reset) | |
| 506 | +int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset) | |
| 511 | 507 | { |
| 512 | − int err; | |
| 513 | − | |
| 514 | 508 | might_sleep(); |
| 515 | 509 | |
| 516 | − err = iwl_trans_pcie_d3_suspend(trans, test, reset); | |
| 517 | − | |
| 518 | − if (!err) | |
| 519 | − set_bit(STATUS_SUSPENDED, &trans->status); | |
| 520 | − | |
| 521 | − return err; | |
| 510 | + return iwl_trans_pcie_d3_suspend(trans, reset); | |
| 522 | 511 | } |
| 523 | 512 | IWL_EXPORT_SYMBOL(iwl_trans_d3_suspend); |
| 524 | 513 | |
| 525 | −int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status, | |
| 526 | − bool test, bool reset) | |
| 514 | +int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset) | |
| 527 | 515 | { |
| 528 | − int err; | |
| 529 | − | |
| 530 | 516 | might_sleep(); |
| 531 | 517 | |
| 532 | − err = iwl_trans_pcie_d3_resume(trans, status, test, reset); | |
| 533 | − | |
| 534 | − clear_bit(STATUS_SUSPENDED, &trans->status); | |
| 535 | − | |
| 536 | − return err; | |
| 518 | + return iwl_trans_pcie_d3_resume(trans, reset); | |
| 537 | 519 | } |
| 538 | 520 | IWL_EXPORT_SYMBOL(iwl_trans_d3_resume); |
| 539 | 521 | |
| @@ -825,3 +807,18 @@ void iwl_trans_set_reduce_power(struct iwl_trans *trans, · 285 unmodified lines | ||
| 825 | 807 | { |
| 826 | 808 | iwl_trans_pcie_ctx_info_v2_set_reduce_power(trans, capa); |
| 827 | 809 | } |
| 810 | + | |
| 811 | +bool iwl_trans_is_pm_supported(struct iwl_trans *trans) | |
| 812 | +{ | |
| 813 | + if (WARN_ON(trans->mac_cfg->gen2)) | |
| 814 | + return false; | |
| 815 | + | |
| 816 | + return iwl_pcie_gen1_is_pm_supported(trans); | |
| 817 | +} | |
| 818 | +IWL_EXPORT_SYMBOL(iwl_trans_is_pm_supported); | |
| 819 | + | |
| 820 | +bool iwl_trans_is_ltr_enabled(struct iwl_trans *trans) | |
| 821 | +{ | |
| 822 | + return iwl_pcie_gen1_2_is_ltr_enabled(trans); | |
| 823 | +} | |
| 824 | +IWL_EXPORT_SYMBOL(iwl_trans_is_ltr_enabled); | |
| @@ -274,16 +274,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r) · 273 unmodified lines | ||
| 274 | 274 | #define IWL_MAX_RX_HW_QUEUES 16 |
| 275 | 275 | #define IWL_9000_MAX_RX_HW_QUEUES 1 |
| 276 | 276 | |
| 277 | −/** | |
| 278 | − * enum iwl_d3_status - WoWLAN image/device status | |
| 279 | − * @IWL_D3_STATUS_ALIVE: firmware is still running after resume | |
| 280 | − * @IWL_D3_STATUS_RESET: device was reset while suspended | |
| 281 | − */ | |
| 282 | −enum iwl_d3_status { | |
| 283 | − IWL_D3_STATUS_ALIVE, | |
| 284 | − IWL_D3_STATUS_RESET, | |
| 285 | −}; | |
| 286 | − | |
| 287 | 277 | /** |
| 288 | 278 | * enum iwl_trans_status: transport status flags |
| 289 | 279 | * @STATUS_SYNC_HCMD_ACTIVE: a SYNC command is being processed |
| @@ -294,16 +284,12 @@ enum iwl_d3_status { · 4 unmodified lines | ||
| 294 | 284 | * @STATUS_RFKILL_OPMODE: RF-kill state reported to opmode |
| 295 | 285 | * @STATUS_FW_ERROR: the fw is in error state |
| 296 | 286 | * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation |
| 297 | − * @STATUS_SUPPRESS_CMD_ERROR_ONCE: suppress "FW error in SYNC CMD" once, | |
| 298 | − * e.g. for testing | |
| 299 | 287 | * @STATUS_IN_SW_RESET: device is undergoing reset, cleared by opmode |
| 300 | 288 | * via iwl_trans_finish_sw_reset() |
| 301 | 289 | * @STATUS_RESET_PENDING: reset worker was scheduled, but didn't dump |
| 302 | 290 | * the firmware state yet |
| 303 | 291 | * @STATUS_TRANS_RESET_IN_PROGRESS: reset is still in progress, don't |
| 304 | 292 | * attempt another reset yet |
| 305 | − * @STATUS_SUSPENDED: device is suspended, don't send commands that | |
| 306 | − * aren't marked accordingly | |
| 307 | 293 | */ |
| 308 | 294 | enum iwl_trans_status { |
| 309 | 295 | STATUS_SYNC_HCMD_ACTIVE, |
| @@ -314,11 +300,9 @@ enum iwl_trans_status { · 4 unmodified lines | ||
| 314 | 300 | STATUS_RFKILL_OPMODE, |
| 315 | 301 | STATUS_FW_ERROR, |
| 316 | 302 | STATUS_TRANS_DEAD, |
| 317 | − STATUS_SUPPRESS_CMD_ERROR_ONCE, | |
| 318 | 303 | STATUS_IN_SW_RESET, |
| 319 | 304 | STATUS_RESET_PENDING, |
| 320 | 305 | STATUS_TRANS_RESET_IN_PROGRESS, |
| 321 | − STATUS_SUSPENDED, | |
| 322 | 306 | }; |
| 323 | 307 | |
| 324 | 308 | static inline int |
| @@ -658,8 +642,6 @@ struct iwl_pc_data { · 333 unmodified lines | ||
| 658 | 642 | * @restart_required: indicates debug restart is required |
| 659 | 643 | * @last_tp_resetfw: last handling of reset during debug timepoint |
| 660 | 644 | * @imr_data: IMR debug data allocation |
| 661 | − * @dump_file_name_ext: dump file name extension | |
| 662 | − * @dump_file_name_ext_valid: dump file name extension if valid or not | |
| 663 | 645 | * @num_pc: number of program counter for cpu |
| 664 | 646 | * @pc_data: details of the program counter |
| 665 | 647 | * @yoyo_bin_loaded: tells if a yoyo debug file has been loaded |
| @@ -698,8 +680,6 @@ struct iwl_trans_debug { · 32 unmodified lines | ||
| 698 | 680 | bool restart_required; |
| 699 | 681 | u32 last_tp_resetfw; |
| 700 | 682 | struct iwl_imr_data imr_data; |
| 701 | − u8 dump_file_name_ext[IWL_FW_INI_MAX_NAME]; | |
| 702 | − bool dump_file_name_ext_valid; | |
| 703 | 683 | u32 num_pc; |
| 704 | 684 | struct iwl_pc_data *pc_data; |
| 705 | 685 | bool yoyo_bin_loaded; |
| @@ -830,7 +810,6 @@ struct iwl_txq { · 124 unmodified lines | ||
| 830 | 810 | * @hw_rf_id: the device RF ID |
| 831 | 811 | * @hw_cnv_id: the device CNV ID |
| 832 | 812 | * @hw_crf_id: the device CRF ID |
| 833 | − * @hw_wfpm_id: the device wfpm ID | |
| 834 | 813 | * @hw_id: the ID of the device / sub-device |
| 835 | 814 | * Bits 0:15 represent the sub-device ID |
| 836 | 815 | * Bits 16:31 represent the device ID. |
| @@ -846,7 +825,6 @@ struct iwl_trans_info { · 9 unmodified lines | ||
| 846 | 825 | u32 hw_rf_id; |
| 847 | 826 | u32 hw_crf_id; |
| 848 | 827 | u32 hw_cnv_id; |
| 849 | − u32 hw_wfpm_id; | |
| 850 | 828 | u32 hw_id; |
| 851 | 829 | u8 pcie_link_speed; |
| 852 | 830 | u8 num_rxqs; |
| @@ -866,14 +844,11 @@ struct iwl_trans_info { · 13 unmodified lines | ||
| 866 | 844 | * @dev: pointer to struct device * that represents the device |
| 867 | 845 | * @info: device information for use by other layers |
| 868 | 846 | * @pnvm_loaded: indicates PNVM was loaded |
| 869 | − * @pm_support: set to true in start_hw if link pm is supported | |
| 870 | − * @ltr_enabled: set to true if the LTR is enabled | |
| 847 | + * @suppress_cmd_error_once: suppress "FW error in SYNC CMD" once, | |
| 848 | + * e.g. for testing | |
| 871 | 849 | * @fail_to_parse_pnvm_image: set to true if pnvm parsing failed |
| 872 | 850 | * @reduce_power_loaded: indicates reduced power section was loaded |
| 873 | 851 | * @failed_to_load_reduce_power_image: set to true if pnvm loading failed |
| 874 | − * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. | |
| 875 | − * The user should use iwl_trans_{alloc,free}_tx_cmd. | |
| 876 | − * @dev_cmd_pool_name: name for the TX command allocation pool | |
| 877 | 852 | * @dbgfs_dir: iwlwifi debugfs base dir for this device |
| 878 | 853 | * @sync_cmd_lockdep_map: lockdep map for checking sync commands |
| 879 | 854 | * @dbg: additional debug data, see &struct iwl_trans_debug |
| @@ -905,18 +880,13 @@ struct iwl_trans { · 25 unmodified lines | ||
| 905 | 880 | const struct iwl_trans_info info; |
| 906 | 881 | bool reduced_cap_sku; |
| 907 | 882 | bool step_urm; |
| 883 | + bool suppress_cmd_error_once; | |
| 908 | 884 | |
| 909 | − bool pm_support; | |
| 910 | − bool ltr_enabled; | |
| 911 | 885 | u8 pnvm_loaded:1; |
| 912 | 886 | u8 fail_to_parse_pnvm_image:1; |
| 913 | 887 | u8 reduce_power_loaded:1; |
| 914 | 888 | u8 failed_to_load_reduce_power_image:1; |
| 915 | 889 | |
| 916 | − /* The following fields are internal only */ | |
| 917 | − struct kmem_cache *dev_cmd_pool; | |
| 918 | − char dev_cmd_pool_name[50]; | |
| 919 | − | |
| 920 | 890 | struct dentry *dbgfs_dir; |
| 921 | 891 | |
| 922 | 892 | #ifdef CONFIG_LOCKDEP |
| @@ -956,29 +926,21 @@ int iwl_trans_start_fw(struct iwl_trans *trans, const struct iwl_fw *fw, · 33 unmodified lines | ||
| 956 | 926 | |
| 957 | 927 | void iwl_trans_stop_device(struct iwl_trans *trans); |
| 958 | 928 | |
| 959 | −int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test, bool reset); | |
| 929 | +int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset); | |
| 960 | 930 | |
| 961 | −int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status, | |
| 962 | − bool test, bool reset); | |
| 931 | +int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset); | |
| 963 | 932 | |
| 964 | 933 | struct iwl_trans_dump_data * |
| 965 | 934 | iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask, |
| 966 | 935 | const struct iwl_dump_sanitize_ops *sanitize_ops, |
| 967 | 936 | void *sanitize_ctx); |
| 968 | 937 | |
| 969 | −static inline struct iwl_device_tx_cmd * | |
| 970 | −iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) | |
| 971 | −{ | |
| 972 | − return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC); | |
| 973 | −} | |
| 938 | +struct iwl_device_tx_cmd *iwl_trans_alloc_tx_cmd(struct iwl_trans *trans); | |
| 974 | 939 | |
| 975 | 940 | int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); |
| 976 | 941 | |
| 977 | −static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans, | |
| 978 | − struct iwl_device_tx_cmd *dev_cmd) | |
| 979 | −{ | |
| 980 | − kmem_cache_free(trans->dev_cmd_pool, dev_cmd); | |
| 981 | −} | |
| 942 | +void iwl_trans_free_tx_cmd(struct iwl_trans *trans, | |
| 943 | + struct iwl_device_tx_cmd *dev_cmd); | |
| 982 | 944 | |
| 983 | 945 | int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, |
| 984 | 946 | struct iwl_device_tx_cmd *dev_cmd, int queue); |
| @@ -1205,9 +1167,7 @@ static inline void iwl_trans_finish_sw_reset(struct iwl_trans *trans) · 220 unmodified lines | ||
| 1205 | 1167 | *****************************************************/ |
| 1206 | 1168 | struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, |
| 1207 | 1169 | struct device *dev, |
| 1208 | − const struct iwl_mac_cfg *mac_cfg, | |
| 1209 | − unsigned int txcmd_size, | |
| 1210 | − unsigned int txcmd_align); | |
| 1170 | + const struct iwl_mac_cfg *mac_cfg); | |
| 1211 | 1171 | void iwl_trans_free(struct iwl_trans *trans); |
| 1212 | 1172 | |
| 1213 | 1173 | static inline bool iwl_trans_is_hw_error_value(u32 val) |
| @@ -1230,11 +1190,6 @@ static inline u16 iwl_trans_get_num_rbds(struct iwl_trans *trans) · 16 unmodified lines | ||
| 1230 | 1190 | return result; |
| 1231 | 1191 | } |
| 1232 | 1192 | |
| 1233 | −static inline void iwl_trans_suppress_cmd_error_once(struct iwl_trans *trans) | |
| 1234 | −{ | |
| 1235 | − set_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, &trans->status); | |
| 1236 | −} | |
| 1237 | − | |
| 1238 | 1193 | static inline bool iwl_trans_device_enabled(struct iwl_trans *trans) |
| 1239 | 1194 | { |
| 1240 | 1195 | return test_bit(STATUS_DEVICE_ENABLED, &trans->status); |
| @@ -1245,6 +1200,20 @@ static inline bool iwl_trans_is_dead(struct iwl_trans *trans) · 4 unmodified lines | ||
| 1245 | 1200 | return test_bit(STATUS_TRANS_DEAD, &trans->status); |
| 1246 | 1201 | } |
| 1247 | 1202 | |
| 1203 | +static inline bool iwl_trans_is_fw_error(struct iwl_trans *trans) | |
| 1204 | +{ | |
| 1205 | + return test_bit(STATUS_FW_ERROR, &trans->status); | |
| 1206 | +} | |
| 1207 | + | |
| 1208 | +/* | |
| 1209 | + * This function notifies the transport layer of firmware error, the recovery | |
| 1210 | + * will be handled by the op mode | |
| 1211 | + */ | |
| 1212 | +static inline void iwl_trans_notify_fw_error(struct iwl_trans *trans) | |
| 1213 | +{ | |
| 1214 | + trans->state = IWL_TRANS_NO_FW; | |
| 1215 | + set_bit(STATUS_FW_ERROR, &trans->status); | |
| 1216 | +} | |
| 1248 | 1217 | /***************************************************** |
| 1249 | 1218 | * PCIe handling |
| 1250 | 1219 | *****************************************************/ |
| @@ -1289,4 +1258,8 @@ static inline u16 iwl_trans_get_device_id(struct iwl_trans *trans) · 38 unmodified lines | ||
| 1289 | 1258 | return u32_get_bits(trans->info.hw_id, GENMASK(31, 16)); |
| 1290 | 1259 | } |
| 1291 | 1260 | |
| 1261 | +bool iwl_trans_is_pm_supported(struct iwl_trans *trans); | |
| 1262 | + | |
| 1263 | +bool iwl_trans_is_ltr_enabled(struct iwl_trans *trans); | |
| 1264 | + | |
| 1292 | 1265 | #endif /* __iwl_trans_h__ */ |
| @@ -300,13 +300,11 @@ enum iwl_sap_msg { · 299 unmodified lines | ||
| 300 | 300 | * @type: See &enum iwl_sap_msg. |
| 301 | 301 | * @len: The length of the message (header not included). |
| 302 | 302 | * @seq_num: For debug. |
| 303 | − * @payload: The payload of the message. | |
| 304 | 303 | */ |
| 305 | 304 | struct iwl_sap_hdr { |
| 306 | 305 | __le16 type; |
| 307 | 306 | __le16 len; |
| 308 | 307 | __le32 seq_num; |
| 309 | − u8 payload[]; | |
| 310 | 308 | }; |
| 311 | 309 | |
| 312 | 310 | /** |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include "mcc.h" |
| 12 | 12 | #include "sta.h" |
| 13 | 13 | #include "mlo.h" |
| 14 | +#include "key.h" | |
| 14 | 15 | |
| 15 | 16 | #include "fw/api/d3.h" |
| 16 | 17 | #include "fw/api/offload.h" |
| @@ -40,8 +41,6 @@ enum iwl_mld_d3_notif { · 23 unmodified lines | ||
| 40 | 41 | struct iwl_mld_resume_key_iter_data { |
| 41 | 42 | struct iwl_mld *mld; |
| 42 | 43 | struct iwl_mld_wowlan_status *wowlan_status; |
| 43 | − u32 num_keys, gtk_cipher, igtk_cipher, bigtk_cipher; | |
| 44 | − bool unhandled_cipher; | |
| 45 | 44 | }; |
| 46 | 45 | |
| 47 | 46 | struct iwl_mld_suspend_key_iter_data { |
| @@ -71,6 +70,12 @@ struct iwl_mld_mcast_key_data { · 23 unmodified lines | ||
| 71 | 70 | |
| 72 | 71 | }; |
| 73 | 72 | |
| 73 | +struct iwl_mld_wowlan_mlo_key { | |
| 74 | + u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 75 | + u8 idx, type, link_id; | |
| 76 | + u8 pn[6]; | |
| 77 | +}; | |
| 78 | + | |
| 74 | 79 | /** |
| 75 | 80 | * struct iwl_mld_wowlan_status - contains wowlan status data from |
| 76 | 81 | * all wowlan notifications |
| @@ -89,6 +94,8 @@ struct iwl_mld_mcast_key_data { · 12 unmodified lines | ||
| 89 | 94 | * @bigtk: data of the last two used gtk's by the FW upon resume |
| 90 | 95 | * @ptk: last seq numbers per tid passed by the FW, |
| 91 | 96 | * holds both in tkip and aes formats |
| 97 | + * @num_mlo_keys: number of &struct iwl_mld_wowlan_mlo_key structs | |
| 98 | + * @mlo_keys: array of MLO keys | |
| 92 | 99 | */ |
| 93 | 100 | struct iwl_mld_wowlan_status { |
| 94 | 101 | u32 wakeup_reasons; |
| @@ -108,6 +115,9 @@ struct iwl_mld_wowlan_status { · 13 unmodified lines | ||
| 108 | 115 | struct ieee80211_key_seq tkip_seq[IWL_MAX_TID_COUNT]; |
| 109 | 116 | |
| 110 | 117 | } ptk; |
| 118 | + | |
| 119 | + int num_mlo_keys; | |
| 120 | + struct iwl_mld_wowlan_mlo_key mlo_keys[WOWLAN_MAX_MLO_KEYS]; | |
| 111 | 121 | }; |
| 112 | 122 | |
| 113 | 123 | #define NETDETECT_QUERY_BUF_LEN \ |
| @@ -271,7 +281,7 @@ iwl_mld_convert_gtk_resume_seq(struct iwl_mld_mcast_key_data *gtk_data, · 157 unmodified lines | ||
| 271 | 281 | static void |
| 272 | 282 | iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, |
| 273 | 283 | struct iwl_mld_wowlan_status *wowlan_status, |
| 274 | − const struct iwl_wowlan_gtk_status_v3 *gtk_data, | |
| 284 | + const struct iwl_wowlan_gtk_status *gtk_data, | |
| 275 | 285 | const struct iwl_wowlan_all_rsc_tsc_v5 *sc) |
| 276 | 286 | { |
| 277 | 287 | int status_idx = 0; |
| @@ -283,8 +293,9 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 5 unmodified lines | ||
| 283 | 293 | for (int notif_idx = 0; notif_idx < ARRAY_SIZE(wowlan_status->gtk); |
| 284 | 294 | notif_idx++) { |
| 285 | 295 | int rsc_idx; |
| 296 | + u8 key_status = gtk_data[notif_idx].key_status; | |
| 286 | 297 | |
| 287 | − if (!(gtk_data[notif_idx].key_len)) | |
| 298 | + if (!key_status) | |
| 288 | 299 | continue; |
| 289 | 300 | |
| 290 | 301 | wowlan_status->gtk[status_idx].len = |
| @@ -294,10 +305,6 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 3 unmodified lines | ||
| 294 | 305 | wowlan_status->gtk[status_idx].id = |
| 295 | 306 | wowlan_status->gtk[status_idx].flags & |
| 296 | 307 | IWL_WOWLAN_GTK_IDX_MASK; |
| 297 | − memcpy(wowlan_status->gtk[status_idx].key, | |
| 298 | − gtk_data[notif_idx].key, | |
| 299 | − sizeof(gtk_data[notif_idx].key)); | |
| 300 | − | |
| 301 | 308 | /* The rsc for both gtk keys are stored in gtk[0]->sc->mcast_rsc |
| 302 | 309 | * The gtk ids can be any two numbers between 0 and 3, |
| 303 | 310 | * the id_map maps between the key id and the index in sc->mcast |
| @@ -307,13 +314,27 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 3 unmodified lines | ||
| 307 | 314 | iwl_mld_convert_gtk_resume_seq(&wowlan_status->gtk[status_idx], |
| 308 | 315 | sc, rsc_idx); |
| 309 | 316 | |
| 310 | − /* if it's as long as the TKIP encryption key, copy MIC key */ | |
| 311 | − if (wowlan_status->gtk[status_idx].len == | |
| 312 | − NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY) | |
| 313 | − memcpy(wowlan_status->gtk[status_idx].key + | |
| 314 | − NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, | |
| 315 | − gtk_data[notif_idx].tkip_mic_key, | |
| 316 | − sizeof(gtk_data[notif_idx].tkip_mic_key)); | |
| 317 | + if (key_status == IWL_WOWLAN_STATUS_NEW_KEY) { | |
| 318 | + memcpy(wowlan_status->gtk[status_idx].key, | |
| 319 | + gtk_data[notif_idx].key, | |
| 320 | + sizeof(gtk_data[notif_idx].key)); | |
| 321 | + | |
| 322 | + /* if it's as long as the TKIP encryption key, | |
| 323 | + * copy MIC key | |
| 324 | + */ | |
| 325 | + if (wowlan_status->gtk[status_idx].len == | |
| 326 | + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY) | |
| 327 | + memcpy(wowlan_status->gtk[status_idx].key + | |
| 328 | + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, | |
| 329 | + gtk_data[notif_idx].tkip_mic_key, | |
| 330 | + sizeof(gtk_data[notif_idx].tkip_mic_key)); | |
| 331 | + } else { | |
| 332 | + /* If the key status is WOWLAN_STATUS_OLD_KEY, it | |
| 333 | + * indicates that no key material is present, Set the | |
| 334 | + * key length to 0 as an indication | |
| 335 | + */ | |
| 336 | + wowlan_status->gtk[status_idx].len = 0; | |
| 337 | + } | |
| 317 | 338 | status_idx++; |
| 318 | 339 | } |
| 319 | 340 | } |
| @@ -360,11 +381,11 @@ static void · 40 unmodified lines | ||
| 360 | 381 | iwl_mld_convert_igtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, |
| 361 | 382 | const struct iwl_wowlan_igtk_status *igtk) |
| 362 | 383 | { |
| 363 | − BUILD_BUG_ON(sizeof(wowlan_status->igtk.key) < sizeof(igtk->key)); | |
| 364 | − | |
| 365 | − if (!igtk->key_len) | |
| 384 | + if (!igtk->key_status) | |
| 366 | 385 | return; |
| 367 | 386 | |
| 387 | + BUILD_BUG_ON(sizeof(wowlan_status->igtk.key) < sizeof(igtk->key)); | |
| 388 | + | |
| 368 | 389 | wowlan_status->igtk.len = igtk->key_len; |
| 369 | 390 | wowlan_status->igtk.flags = igtk->key_flags; |
| 370 | 391 | wowlan_status->igtk.id = |
| @@ -372,7 +393,15 @@ iwl_mld_convert_igtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 1 unmodified line | ||
| 372 | 393 | IWL_WOWLAN_IGTK_BIGTK_IDX_MASK) + |
| 373 | 394 | WOWLAN_IGTK_MIN_INDEX; |
| 374 | 395 | |
| 375 | − memcpy(wowlan_status->igtk.key, igtk->key, sizeof(igtk->key)); | |
| 396 | + if (igtk->key_status == IWL_WOWLAN_STATUS_NEW_KEY) | |
| 397 | + memcpy(wowlan_status->igtk.key, igtk->key, sizeof(igtk->key)); | |
| 398 | + else | |
| 399 | + /* If the key status is WOWLAN_STATUS_OLD_KEY, it indicates | |
| 400 | + * that no key material is present. Set the key length to 0 | |
| 401 | + * as an indication. | |
| 402 | + */ | |
| 403 | + wowlan_status->igtk.len = 0; | |
| 404 | + | |
| 376 | 405 | iwl_mld_convert_mcast_ipn(&wowlan_status->igtk, igtk); |
| 377 | 406 | } |
| 378 | 407 | |
| @@ -386,7 +415,7 @@ iwl_mld_convert_bigtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 7 unmodified lines | ||
| 386 | 415 | |
| 387 | 416 | for (int notif_idx = 0; notif_idx < WOWLAN_BIGTK_KEYS_NUM; |
| 388 | 417 | notif_idx++) { |
| 389 | − if (!bigtk[notif_idx].key_len) | |
| 418 | + if (!bigtk[notif_idx].key_status) | |
| 390 | 419 | continue; |
| 391 | 420 | |
| 392 | 421 | wowlan_status->bigtk[status_idx].len = bigtk[notif_idx].key_len; |
| @@ -399,32 +428,218 @@ iwl_mld_convert_bigtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 6 unmodified lines | ||
| 399 | 428 | |
| 400 | 429 | BUILD_BUG_ON(sizeof(wowlan_status->bigtk[status_idx].key) < |
| 401 | 430 | sizeof(bigtk[notif_idx].key)); |
| 402 | − memcpy(wowlan_status->bigtk[status_idx].key, | |
| 403 | − bigtk[notif_idx].key, sizeof(bigtk[notif_idx].key)); | |
| 431 | + if (bigtk[notif_idx].key_status == IWL_WOWLAN_STATUS_NEW_KEY) | |
| 432 | + memcpy(wowlan_status->bigtk[status_idx].key, | |
| 433 | + bigtk[notif_idx].key, | |
| 434 | + sizeof(bigtk[notif_idx].key)); | |
| 435 | + else | |
| 436 | + /* If the key status is WOWLAN_STATUS_OLD_KEY, it | |
| 437 | + * indicates that no key material is present. Set the | |
| 438 | + * key length to 0 as an indication. | |
| 439 | + */ | |
| 440 | + wowlan_status->bigtk[status_idx].len = 0; | |
| 441 | + | |
| 404 | 442 | iwl_mld_convert_mcast_ipn(&wowlan_status->bigtk[status_idx], |
| 405 | 443 | &bigtk[notif_idx]); |
| 406 | 444 | status_idx++; |
| 407 | 445 | } |
| 408 | 446 | } |
| 409 | 447 | |
| 448 | +static void | |
| 449 | +iwl_mld_convert_mlo_keys(struct iwl_mld *mld, | |
| 450 | + const struct iwl_wowlan_info_notif *notif, | |
| 451 | + struct iwl_mld_wowlan_status *wowlan_status) | |
| 452 | +{ | |
| 453 | + if (!notif->num_mlo_link_keys) | |
| 454 | + return; | |
| 455 | + | |
| 456 | + wowlan_status->num_mlo_keys = notif->num_mlo_link_keys; | |
| 457 | + | |
| 458 | + if (IWL_FW_CHECK(mld, wowlan_status->num_mlo_keys > WOWLAN_MAX_MLO_KEYS, | |
| 459 | + "Too many MLO keys: %d, max %d\n", | |
| 460 | + wowlan_status->num_mlo_keys, WOWLAN_MAX_MLO_KEYS)) | |
| 461 | + wowlan_status->num_mlo_keys = WOWLAN_MAX_MLO_KEYS; | |
| 462 | + | |
| 463 | + for (int i = 0; i < wowlan_status->num_mlo_keys; i++) { | |
| 464 | + const struct iwl_wowlan_mlo_gtk *fw_mlo_key = ¬if->mlo_gtks[i]; | |
| 465 | + struct iwl_mld_wowlan_mlo_key *driver_mlo_key = | |
| 466 | + &wowlan_status->mlo_keys[i]; | |
| 467 | + u16 flags = le16_to_cpu(fw_mlo_key->flags); | |
| 468 | + | |
| 469 | + driver_mlo_key->link_id = | |
| 470 | + u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK); | |
| 471 | + driver_mlo_key->type = | |
| 472 | + u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK); | |
| 473 | + driver_mlo_key->idx = | |
| 474 | + u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK); | |
| 475 | + | |
| 476 | + BUILD_BUG_ON(sizeof(driver_mlo_key->key) != sizeof(fw_mlo_key->key)); | |
| 477 | + BUILD_BUG_ON(sizeof(driver_mlo_key->pn) != sizeof(fw_mlo_key->pn)); | |
| 478 | + | |
| 479 | + memcpy(driver_mlo_key->key, fw_mlo_key->key, sizeof(fw_mlo_key->key)); | |
| 480 | + memcpy(driver_mlo_key->pn, fw_mlo_key->pn, sizeof(fw_mlo_key->pn)); | |
| 481 | + } | |
| 482 | +} | |
| 483 | + | |
| 484 | +static void | |
| 485 | +iwl_mld_convert_wowlan_notif_v5(const struct iwl_wowlan_info_notif_v5 *notif_v5, | |
| 486 | + struct iwl_wowlan_info_notif *notif) | |
| 487 | +{ | |
| 488 | + /* Convert GTK from v3 to the new format */ | |
| 489 | + BUILD_BUG_ON(ARRAY_SIZE(notif->gtk) != ARRAY_SIZE(notif_v5->gtk)); | |
| 490 | + | |
| 491 | + for (int i = 0; i < ARRAY_SIZE(notif_v5->gtk); i++) { | |
| 492 | + const struct iwl_wowlan_gtk_status_v3 *gtk_v3 = ¬if_v5->gtk[i]; | |
| 493 | + struct iwl_wowlan_gtk_status *gtk = ¬if->gtk[i]; | |
| 494 | + | |
| 495 | + /* Copy key material and metadata */ | |
| 496 | + BUILD_BUG_ON(sizeof(gtk->key) != sizeof(gtk_v3->key)); | |
| 497 | + BUILD_BUG_ON(sizeof(gtk->tkip_mic_key) != sizeof(gtk_v3->tkip_mic_key)); | |
| 498 | + | |
| 499 | + memcpy(gtk->key, gtk_v3->key, sizeof(gtk_v3->key)); | |
| 500 | + | |
| 501 | + gtk->key_len = gtk_v3->key_len; | |
| 502 | + gtk->key_flags = gtk_v3->key_flags; | |
| 503 | + | |
| 504 | + memcpy(gtk->tkip_mic_key, gtk_v3->tkip_mic_key, | |
| 505 | + sizeof(gtk_v3->tkip_mic_key)); | |
| 506 | + gtk->sc = gtk_v3->sc; | |
| 507 | + | |
| 508 | + /* Set key_status based on whether key material is present. | |
| 509 | + * in v5, a key is either invalid (should be skipped) or has | |
| 510 | + * both meta data and the key itself. | |
| 511 | + */ | |
| 512 | + if (gtk_v3->key_len) | |
| 513 | + gtk->key_status = IWL_WOWLAN_STATUS_NEW_KEY; | |
| 514 | + } | |
| 515 | + | |
| 516 | + /* Convert IGTK from v1 to the new format, only one IGTK is passed by FW */ | |
| 517 | + BUILD_BUG_ON(offsetof(struct iwl_wowlan_igtk_status, key_status) != | |
| 518 | + sizeof(struct iwl_wowlan_igtk_status_v1)); | |
| 519 | + | |
| 520 | + memcpy(¬if->igtk[0], ¬if_v5->igtk[0], | |
| 521 | + offsetof(struct iwl_wowlan_igtk_status, key_status)); | |
| 522 | + | |
| 523 | + /* Set key_status based on whether key material is present. | |
| 524 | + * in v5, a key is either invalid (should be skipped) or has | |
| 525 | + * both meta data and the key itself. | |
| 526 | + */ | |
| 527 | + if (notif_v5->igtk[0].key_len) | |
| 528 | + notif->igtk[0].key_status = IWL_WOWLAN_STATUS_NEW_KEY; | |
| 529 | + | |
| 530 | + /* Convert BIGTK from v1 to the new format */ | |
| 531 | + BUILD_BUG_ON(ARRAY_SIZE(notif->bigtk) != ARRAY_SIZE(notif_v5->bigtk)); | |
| 532 | + | |
| 533 | + for (int i = 0; i < ARRAY_SIZE(notif_v5->bigtk); i++) { | |
| 534 | + /* Copy everything until key_status */ | |
| 535 | + memcpy(¬if->bigtk[i], ¬if_v5->bigtk[i], | |
| 536 | + offsetof(struct iwl_wowlan_igtk_status, key_status)); | |
| 537 | + | |
| 538 | + /* Set key_status based on whether key material is present. | |
| 539 | + * in v5, a key is either invalid (should be skipped) or has | |
| 540 | + * both meta data and the key itself. | |
| 541 | + */ | |
| 542 | + if (notif_v5->bigtk[i].key_len) | |
| 543 | + notif->bigtk[i].key_status = IWL_WOWLAN_STATUS_NEW_KEY; | |
| 544 | + } | |
| 545 | + | |
| 546 | + notif->replay_ctr = notif_v5->replay_ctr; | |
| 547 | + notif->pattern_number = notif_v5->pattern_number; | |
| 548 | + notif->qos_seq_ctr = notif_v5->qos_seq_ctr; | |
| 549 | + notif->wakeup_reasons = notif_v5->wakeup_reasons; | |
| 550 | + notif->num_of_gtk_rekeys = notif_v5->num_of_gtk_rekeys; | |
| 551 | + notif->transmitted_ndps = notif_v5->transmitted_ndps; | |
| 552 | + notif->received_beacons = notif_v5->received_beacons; | |
| 553 | + notif->tid_tear_down = notif_v5->tid_tear_down; | |
| 554 | + notif->station_id = notif_v5->station_id; | |
| 555 | + notif->num_mlo_link_keys = notif_v5->num_mlo_link_keys; | |
| 556 | + notif->tid_offloaded_tx = notif_v5->tid_offloaded_tx; | |
| 557 | + | |
| 558 | + /* Copy MLO GTK keys */ | |
| 559 | + if (notif_v5->num_mlo_link_keys) { | |
| 560 | + memcpy(notif->mlo_gtks, notif_v5->mlo_gtks, | |
| 561 | + notif_v5->num_mlo_link_keys * sizeof(struct iwl_wowlan_mlo_gtk)); | |
| 562 | + } | |
| 563 | +} | |
| 564 | + | |
| 565 | +static bool iwl_mld_validate_wowlan_notif_size(struct iwl_mld *mld, | |
| 566 | + u32 len, | |
| 567 | + u32 expected_len, | |
| 568 | + u8 num_mlo_keys, | |
| 569 | + int version) | |
| 570 | +{ | |
| 571 | + u32 len_with_mlo_keys; | |
| 572 | + | |
| 573 | + if (IWL_FW_CHECK(mld, len < expected_len, | |
| 574 | + "Invalid wowlan_info_notif v%d (expected=%u got=%u)\n", | |
| 575 | + version, expected_len, len)) | |
| 576 | + return false; | |
| 577 | + | |
| 578 | + len_with_mlo_keys = expected_len + | |
| 579 | + (num_mlo_keys * sizeof(struct iwl_wowlan_mlo_gtk)); | |
| 580 | + | |
| 581 | + if (IWL_FW_CHECK(mld, len < len_with_mlo_keys, | |
| 582 | + "Invalid wowlan_info_notif v%d with MLO keys (expected=%u got=%u)\n", | |
| 583 | + version, len_with_mlo_keys, len)) | |
| 584 | + return false; | |
| 585 | + | |
| 586 | + return true; | |
| 587 | +} | |
| 588 | + | |
| 410 | 589 | static bool |
| 411 | 590 | iwl_mld_handle_wowlan_info_notif(struct iwl_mld *mld, |
| 412 | 591 | struct iwl_mld_wowlan_status *wowlan_status, |
| 413 | 592 | struct iwl_rx_packet *pkt) |
| 414 | 593 | { |
| 415 | − const struct iwl_wowlan_info_notif *notif = (void *)pkt->data; | |
| 416 | − u32 expected_len, len = iwl_rx_packet_payload_len(pkt); | |
| 417 | − | |
| 418 | − expected_len = sizeof(*notif); | |
| 594 | + const struct iwl_wowlan_info_notif *notif; | |
| 595 | + struct iwl_wowlan_info_notif *converted_notif __free(kfree) = NULL; | |
| 596 | + u32 len = iwl_rx_packet_payload_len(pkt); | |
| 597 | + int wowlan_info_ver = iwl_fw_lookup_notif_ver(mld->fw, | |
| 598 | + PROT_OFFLOAD_GROUP, | |
| 599 | + WOWLAN_INFO_NOTIFICATION, | |
| 600 | + IWL_FW_CMD_VER_UNKNOWN); | |
| 601 | + | |
| 602 | + if (wowlan_info_ver == 5) { | |
| 603 | + /* v5 format - validate before conversion */ | |
| 604 | + const struct iwl_wowlan_info_notif_v5 *notif_v5 = (void *)pkt->data; | |
| 605 | + | |
| 606 | + if (!iwl_mld_validate_wowlan_notif_size(mld, len, | |
| 607 | + sizeof(*notif_v5), | |
| 608 | + notif_v5->num_mlo_link_keys, | |
| 609 | + 5)) | |
| 610 | + return true; | |
| 611 | + | |
| 612 | + converted_notif = kzalloc(struct_size(converted_notif, | |
| 613 | + mlo_gtks, | |
| 614 | + notif_v5->num_mlo_link_keys), | |
| 615 | + GFP_ATOMIC); | |
| 616 | + if (!converted_notif) { | |
| 617 | + IWL_ERR(mld, | |
| 618 | + "Failed to allocate memory for converted wowlan_info_notif\n"); | |
| 619 | + return true; | |
| 620 | + } | |
| 419 | 621 | |
| 420 | − if (IWL_FW_CHECK(mld, len < expected_len, | |
| 421 | − "Invalid wowlan_info_notif (expected=%ud got=%ud)\n", | |
| 422 | − expected_len, len)) | |
| 622 | + iwl_mld_convert_wowlan_notif_v5(notif_v5, | |
| 623 | + converted_notif); | |
| 624 | + notif = converted_notif; | |
| 625 | + } else if (wowlan_info_ver == 6) { | |
| 626 | + notif = (void *)pkt->data; | |
| 627 | + if (!iwl_mld_validate_wowlan_notif_size(mld, len, | |
| 628 | + sizeof(*notif), | |
| 629 | + notif->num_mlo_link_keys, | |
| 630 | + 6)) | |
| 631 | + return true; | |
| 632 | + } else { | |
| 633 | + /* smaller versions are not supported */ | |
| 634 | + IWL_WARN(mld, | |
| 635 | + "Unsupported wowlan_info_notif version %d\n", | |
| 636 | + wowlan_info_ver); | |
| 423 | 637 | return true; |
| 638 | + } | |
| 424 | 639 | |
| 425 | 640 | if (IWL_FW_CHECK(mld, notif->tid_offloaded_tx != IWL_WOWLAN_OFFLOAD_TID, |
| 426 | 641 | "Invalid tid_offloaded_tx %d\n", |
| 427 | − wowlan_status->tid_offloaded_tx)) | |
| 642 | + notif->tid_offloaded_tx)) | |
| 428 | 643 | return true; |
| 429 | 644 | |
| 430 | 645 | iwl_mld_convert_gtk_resume_data(mld, wowlan_status, notif->gtk, |
| @@ -442,8 +657,10 @@ iwl_mld_handle_wowlan_info_notif(struct iwl_mld *mld, · 11 unmodified lines | ||
| 442 | 657 | wowlan_status->num_of_gtk_rekeys = |
| 443 | 658 | le32_to_cpu(notif->num_of_gtk_rekeys); |
| 444 | 659 | wowlan_status->wakeup_reasons = le32_to_cpu(notif->wakeup_reasons); |
| 660 | + | |
| 661 | + iwl_mld_convert_mlo_keys(mld, notif, wowlan_status); | |
| 662 | + | |
| 445 | 663 | return false; |
| 446 | − /* TODO: mlo_links (task=MLO)*/ | |
| 447 | 664 | } |
| 448 | 665 | |
| 449 | 666 | static bool |
| @@ -619,8 +836,8 @@ iwl_mld_set_key_rx_seq_tids(struct ieee80211_key_conf *key, · 169 unmodified lines | ||
| 619 | 836 | } |
| 620 | 837 | |
| 621 | 838 | static void |
| 622 | −iwl_mld_set_key_rx_seq(struct ieee80211_key_conf *key, | |
| 623 | − struct iwl_mld_mcast_key_data *key_data) | |
| 839 | +iwl_mld_update_mcast_rx_seq(struct ieee80211_key_conf *key, | |
| 840 | + struct iwl_mld_mcast_key_data *key_data) | |
| 624 | 841 | { |
| 625 | 842 | switch (key->cipher) { |
| 626 | 843 | case WLAN_CIPHER_SUITE_CCMP: |
| @@ -687,132 +904,53 @@ iwl_mld_resume_keys_iter(struct ieee80211_hw *hw, · 60 unmodified lines | ||
| 687 | 904 | struct iwl_mld_wowlan_status *wowlan_status = data->wowlan_status; |
| 688 | 905 | u8 status_idx; |
| 689 | 906 | |
| 690 | − /* TODO: check key link id (task=MLO) */ | |
| 691 | − if (data->unhandled_cipher) | |
| 692 | − return; | |
| 693 | − | |
| 694 | − switch (key->cipher) { | |
| 695 | − case WLAN_CIPHER_SUITE_WEP40: | |
| 696 | − case WLAN_CIPHER_SUITE_WEP104: | |
| 697 | − /* ignore WEP completely, nothing to do */ | |
| 698 | − return; | |
| 699 | − case WLAN_CIPHER_SUITE_CCMP: | |
| 700 | − case WLAN_CIPHER_SUITE_GCMP: | |
| 701 | − case WLAN_CIPHER_SUITE_GCMP_256: | |
| 702 | − case WLAN_CIPHER_SUITE_TKIP: | |
| 907 | + if (key->keyidx >= 0 && key->keyidx <= 3) { | |
| 908 | + /* PTK */ | |
| 703 | 909 | if (sta) { |
| 704 | 910 | iwl_mld_update_ptk_rx_seq(data->mld, wowlan_status, |
| 705 | 911 | sta, key, |
| 706 | 912 | key->cipher == |
| 707 | 913 | WLAN_CIPHER_SUITE_TKIP); |
| 708 | − return; | |
| 914 | + /* GTK */ | |
| 915 | + } else { | |
| 916 | + status_idx = key->keyidx == wowlan_status->gtk[1].id; | |
| 917 | + iwl_mld_update_mcast_rx_seq(key, | |
| 918 | + &wowlan_status->gtk[status_idx]); | |
| 709 | 919 | } |
| 920 | + } | |
| 710 | 921 | |
| 711 | − if (WARN_ON(data->gtk_cipher && | |
| 712 | − data->gtk_cipher != key->cipher)) | |
| 713 | − return; | |
| 922 | + /* IGTK */ | |
| 923 | + if (key->keyidx == 4 || key->keyidx == 5) { | |
| 924 | + if (key->keyidx == wowlan_status->igtk.id) | |
| 925 | + iwl_mld_update_mcast_rx_seq(key, &wowlan_status->igtk); | |
| 926 | + } | |
| 714 | 927 | |
| 715 | − data->gtk_cipher = key->cipher; | |
| 716 | − status_idx = key->keyidx == wowlan_status->gtk[1].id; | |
| 717 | − iwl_mld_set_key_rx_seq(key, &wowlan_status->gtk[status_idx]); | |
| 718 | − break; | |
| 719 | − case WLAN_CIPHER_SUITE_BIP_GMAC_128: | |
| 720 | − case WLAN_CIPHER_SUITE_BIP_GMAC_256: | |
| 721 | − case WLAN_CIPHER_SUITE_BIP_CMAC_256: | |
| 722 | − case WLAN_CIPHER_SUITE_AES_CMAC: | |
| 723 | − if (key->keyidx == 4 || key->keyidx == 5) { | |
| 724 | − if (WARN_ON(data->igtk_cipher && | |
| 725 | − data->igtk_cipher != key->cipher)) | |
| 726 | − return; | |
| 727 | − | |
| 728 | − data->igtk_cipher = key->cipher; | |
| 729 | − if (key->keyidx == wowlan_status->igtk.id) | |
| 730 | − iwl_mld_set_key_rx_seq(key, &wowlan_status->igtk); | |
| 731 | − } | |
| 732 | − if (key->keyidx == 6 || key->keyidx == 7) { | |
| 733 | − if (WARN_ON(data->bigtk_cipher && | |
| 734 | − data->bigtk_cipher != key->cipher)) | |
| 735 | − return; | |
| 736 | − | |
| 737 | − data->bigtk_cipher = key->cipher; | |
| 738 | − status_idx = key->keyidx == wowlan_status->bigtk[1].id; | |
| 739 | − iwl_mld_set_key_rx_seq(key, &wowlan_status->bigtk[status_idx]); | |
| 740 | − } | |
| 741 | − break; | |
| 742 | − default: | |
| 743 | − data->unhandled_cipher = true; | |
| 744 | − return; | |
| 928 | + /* BIGTK */ | |
| 929 | + if (key->keyidx == 6 || key->keyidx == 7) { | |
| 930 | + status_idx = key->keyidx == wowlan_status->bigtk[1].id; | |
| 931 | + iwl_mld_update_mcast_rx_seq(key, | |
| 932 | + &wowlan_status->bigtk[status_idx]); | |
| 745 | 933 | } |
| 746 | − data->num_keys++; | |
| 747 | 934 | } |
| 748 | 935 | |
| 749 | 936 | static void |
| 750 | 937 | iwl_mld_add_mcast_rekey(struct ieee80211_vif *vif, |
| 751 | 938 | struct iwl_mld *mld, |
| 752 | 939 | struct iwl_mld_mcast_key_data *key_data, |
| 753 | − struct ieee80211_bss_conf *link_conf, | |
| 754 | − u32 cipher) | |
| 940 | + struct ieee80211_bss_conf *link_conf) | |
| 755 | 941 | { |
| 756 | 942 | struct ieee80211_key_conf *key_config; |
| 757 | − struct { | |
| 758 | − struct ieee80211_key_conf conf; | |
| 759 | − u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 760 | − } conf = { | |
| 761 | − .conf.cipher = cipher, | |
| 762 | − .conf.keyidx = key_data->id, | |
| 763 | − }; | |
| 764 | 943 | int link_id = vif->active_links ? __ffs(vif->active_links) : -1; |
| 765 | − u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 766 | − | |
| 767 | − BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP); | |
| 768 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_CCMP); | |
| 769 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_GCMP_256); | |
| 770 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_TKIP); | |
| 771 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_128); | |
| 772 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_256); | |
| 773 | − BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_AES_CMAC); | |
| 774 | − BUILD_BUG_ON(sizeof(conf.key) < sizeof(key_data->key)); | |
| 775 | 944 | |
| 776 | 945 | if (!key_data->len) |
| 777 | 946 | return; |
| 778 | 947 | |
| 779 | − switch (cipher) { | |
| 780 | − case WLAN_CIPHER_SUITE_CCMP: | |
| 781 | − case WLAN_CIPHER_SUITE_GCMP: | |
| 782 | − conf.conf.keylen = WLAN_KEY_LEN_CCMP; | |
| 783 | − break; | |
| 784 | − case WLAN_CIPHER_SUITE_GCMP_256: | |
| 785 | − conf.conf.keylen = WLAN_KEY_LEN_GCMP_256; | |
| 786 | − break; | |
| 787 | − case WLAN_CIPHER_SUITE_TKIP: | |
| 788 | − conf.conf.keylen = WLAN_KEY_LEN_TKIP; | |
| 789 | − break; | |
| 790 | − case WLAN_CIPHER_SUITE_BIP_GMAC_128: | |
| 791 | − conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_128; | |
| 792 | − break; | |
| 793 | − case WLAN_CIPHER_SUITE_BIP_GMAC_256: | |
| 794 | − conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_256; | |
| 795 | − break; | |
| 796 | − case WLAN_CIPHER_SUITE_AES_CMAC: | |
| 797 | − conf.conf.keylen = WLAN_KEY_LEN_AES_CMAC; | |
| 798 | − break; | |
| 799 | − case WLAN_CIPHER_SUITE_BIP_CMAC_256: | |
| 800 | − conf.conf.keylen = WLAN_KEY_LEN_BIP_CMAC_256; | |
| 801 | − break; | |
| 802 | − default: | |
| 803 | − WARN_ON(1); | |
| 804 | − } | |
| 805 | − | |
| 806 | − memcpy(conf.conf.key, key_data->key, conf.conf.keylen); | |
| 807 | − | |
| 808 | − memcpy(key, key_data->key, sizeof(key_data->key)); | |
| 809 | − | |
| 810 | − key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key, | |
| 811 | − sizeof(key), link_id); | |
| 948 | + key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key_data->key, | |
| 949 | + sizeof(key_data->key), link_id); | |
| 812 | 950 | if (IS_ERR(key_config)) |
| 813 | 951 | return; |
| 814 | 952 | |
| 815 | − iwl_mld_set_key_rx_seq(key_config, key_data); | |
| 953 | + iwl_mld_update_mcast_rx_seq(key_config, key_data); | |
| 816 | 954 | |
| 817 | 955 | /* The FW holds only one igtk so we keep track of the valid one */ |
| 818 | 956 | if (key_config->keyidx == 4 || key_config->keyidx == 5) { |
| @@ -831,37 +969,78 @@ iwl_mld_add_mcast_rekey(struct ieee80211_vif *vif, · 12 unmodified lines | ||
| 831 | 969 | } |
| 832 | 970 | |
| 833 | 971 | /* Also keep track of the new BIGTK */ |
| 834 | − if ((key_config->keyidx == 6 || key_config->keyidx == 7) && | |
| 835 | − vif->type == NL80211_IFTYPE_STATION) { | |
| 836 | − struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif); | |
| 837 | − | |
| 838 | − rcu_assign_pointer(mld_vif->bigtks[key_config->keyidx - 6], key_config); | |
| 839 | − } | |
| 972 | + if (key_config->keyidx == 6 || key_config->keyidx == 7) | |
| 973 | + iwl_mld_track_bigtk(mld, vif, key_config, true); | |
| 840 | 974 | } |
| 841 | 975 | |
| 842 | 976 | static void |
| 843 | −iwl_mld_add_all_rekeys(struct ieee80211_vif *vif, | |
| 977 | +iwl_mld_add_all_rekeys(struct iwl_mld *mld, | |
| 978 | + struct ieee80211_vif *vif, | |
| 844 | 979 | struct iwl_mld_wowlan_status *wowlan_status, |
| 845 | − struct iwl_mld_resume_key_iter_data *key_iter_data, | |
| 846 | 980 | struct ieee80211_bss_conf *link_conf) |
| 847 | 981 | { |
| 848 | 982 | int i; |
| 849 | 983 | |
| 850 | 984 | for (i = 0; i < ARRAY_SIZE(wowlan_status->gtk); i++) |
| 851 | − iwl_mld_add_mcast_rekey(vif, key_iter_data->mld, | |
| 852 | − &wowlan_status->gtk[i], | |
| 853 | − link_conf, | |
| 854 | − key_iter_data->gtk_cipher); | |
| 985 | + iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->gtk[i], | |
| 986 | + link_conf); | |
| 855 | 987 | |
| 856 | − iwl_mld_add_mcast_rekey(vif, key_iter_data->mld, | |
| 857 | − &wowlan_status->igtk, | |
| 858 | − link_conf, key_iter_data->igtk_cipher); | |
| 988 | + iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->igtk, link_conf); | |
| 859 | 989 | |
| 860 | 990 | for (i = 0; i < ARRAY_SIZE(wowlan_status->bigtk); i++) |
| 861 | − iwl_mld_add_mcast_rekey(vif, key_iter_data->mld, | |
| 862 | − &wowlan_status->bigtk[i], | |
| 863 | − link_conf, | |
| 864 | − key_iter_data->bigtk_cipher); | |
| 991 | + iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->bigtk[i], | |
| 992 | + link_conf); | |
| 993 | +} | |
| 994 | + | |
| 995 | +static void iwl_mld_mlo_rekey(struct iwl_mld *mld, | |
| 996 | + struct iwl_mld_wowlan_status *wowlan_status, | |
| 997 | + struct ieee80211_vif *vif) | |
| 998 | +{ | |
| 999 | + struct iwl_mld_old_mlo_keys *old_keys __free(kfree) = NULL; | |
| 1000 | + | |
| 1001 | + IWL_DEBUG_WOWLAN(mld, "Num of MLO Keys: %d\n", wowlan_status->num_mlo_keys); | |
| 1002 | + | |
| 1003 | + if (!wowlan_status->num_mlo_keys) | |
| 1004 | + return; | |
| 1005 | + | |
| 1006 | + for (int i = 0; i < wowlan_status->num_mlo_keys; i++) { | |
| 1007 | + struct iwl_mld_wowlan_mlo_key *mlo_key = &wowlan_status->mlo_keys[i]; | |
| 1008 | + struct ieee80211_key_conf *key; | |
| 1009 | + struct ieee80211_key_seq seq; | |
| 1010 | + u8 link_id = mlo_key->link_id; | |
| 1011 | + | |
| 1012 | + if (IWL_FW_CHECK(mld, mlo_key->link_id >= IEEE80211_MLD_MAX_NUM_LINKS || | |
| 1013 | + mlo_key->idx >= 8 || | |
| 1014 | + mlo_key->type >= WOWLAN_MLO_GTK_KEY_NUM_TYPES, | |
| 1015 | + "Invalid MLO key link_id %d, idx %d, type %d\n", | |
| 1016 | + mlo_key->link_id, mlo_key->idx, mlo_key->type)) | |
| 1017 | + continue; | |
| 1018 | + | |
| 1019 | + if (!(vif->valid_links & BIT(link_id)) || | |
| 1020 | + (vif->active_links & BIT(link_id))) | |
| 1021 | + continue; | |
| 1022 | + | |
| 1023 | + IWL_DEBUG_WOWLAN(mld, "Add MLO key id %d, link id %d\n", | |
| 1024 | + mlo_key->idx, link_id); | |
| 1025 | + | |
| 1026 | + key = ieee80211_gtk_rekey_add(vif, mlo_key->idx, mlo_key->key, | |
| 1027 | + sizeof(mlo_key->key), link_id); | |
| 1028 | + | |
| 1029 | + if (IS_ERR(key)) | |
| 1030 | + continue; | |
| 1031 | + | |
| 1032 | + /* | |
| 1033 | + * mac80211 expects the PN in big-endian | |
| 1034 | + * also note that seq is a union of all cipher types | |
| 1035 | + * (ccmp, gcmp, cmac, gmac), and they all have the same | |
| 1036 | + * pn field (of length 6) so just copy it to ccmp.pn. | |
| 1037 | + */ | |
| 1038 | + for (int j = 5; j >= 0; j--) | |
| 1039 | + seq.ccmp.pn[5 - j] = mlo_key->pn[j]; | |
| 1040 | + | |
| 1041 | + /* group keys are non-QoS and use TID 0 */ | |
| 1042 | + ieee80211_set_key_rx_seq(key, 0, &seq); | |
| 1043 | + } | |
| 865 | 1044 | } |
| 866 | 1045 | |
| 867 | 1046 | static bool |
| @@ -884,23 +1063,19 @@ iwl_mld_update_sec_keys(struct iwl_mld *mld, · 16 unmodified lines | ||
| 884 | 1063 | ieee80211_iter_keys(mld->hw, vif, iwl_mld_resume_keys_iter, |
| 885 | 1064 | &key_iter_data); |
| 886 | 1065 | |
| 887 | − if (key_iter_data.unhandled_cipher) | |
| 888 | − return false; | |
| 889 | − | |
| 890 | − IWL_DEBUG_WOWLAN(mld, | |
| 891 | − "Number of installed keys: %d, Number of rekeys: %d\n", | |
| 892 | − key_iter_data.num_keys, | |
| 1066 | + IWL_DEBUG_WOWLAN(mld, "Number of rekeys: %d\n", | |
| 893 | 1067 | wowlan_status->num_of_gtk_rekeys); |
| 894 | 1068 | |
| 895 | − if (!key_iter_data.num_keys || !wowlan_status->num_of_gtk_rekeys) | |
| 1069 | + if (!wowlan_status->num_of_gtk_rekeys) | |
| 896 | 1070 | return true; |
| 897 | 1071 | |
| 898 | − iwl_mld_add_all_rekeys(vif, wowlan_status, &key_iter_data, | |
| 1072 | + iwl_mld_add_all_rekeys(mld, vif, wowlan_status, | |
| 899 | 1073 | link_conf); |
| 900 | 1074 | |
| 1075 | + iwl_mld_mlo_rekey(mld, wowlan_status, vif); | |
| 1076 | + | |
| 901 | 1077 | ieee80211_gtk_rekey_notify(vif, link_conf->bssid, |
| 902 | 1078 | (void *)&replay_ctr, GFP_KERNEL); |
| 903 | − /* TODO: MLO rekey (task=MLO) */ | |
| 904 | 1079 | return true; |
| 905 | 1080 | } |
| 906 | 1081 | |
| @@ -1179,7 +1354,6 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld, · 272 unmodified lines | ||
| 1179 | 1354 | WIDE_ID(PROT_OFFLOAD_GROUP, D3_END_NOTIFICATION) |
| 1180 | 1355 | }; |
| 1181 | 1356 | struct iwl_notification_wait wait_d3_notif; |
| 1182 | − enum iwl_d3_status d3_status; | |
| 1183 | 1357 | int ret; |
| 1184 | 1358 | |
| 1185 | 1359 | if (with_wowlan) |
| @@ -1195,14 +1369,10 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld, · 9 unmodified lines | ||
| 1195 | 1369 | iwl_mld_handle_d3_notif, |
| 1196 | 1370 | resume_data); |
| 1197 | 1371 | |
| 1198 | − ret = iwl_trans_d3_resume(mld->trans, &d3_status, false, false); | |
| 1199 | − if (ret || d3_status != IWL_D3_STATUS_ALIVE) { | |
| 1200 | − if (d3_status != IWL_D3_STATUS_ALIVE) { | |
| 1201 | − IWL_INFO(mld, "Device was reset during suspend\n"); | |
| 1202 | − ret = -ENOENT; | |
| 1203 | − } else { | |
| 1204 | − IWL_ERR(mld, "Transport resume failed\n"); | |
| 1205 | − } | |
| 1372 | + ret = iwl_trans_d3_resume(mld->trans, false); | |
| 1373 | + if (ret) { | |
| 1374 | + /* Avoid sending commands if the FW is dead */ | |
| 1375 | + iwl_trans_notify_fw_error(mld->trans); | |
| 1206 | 1376 | iwl_remove_notification(&mld->notif_wait, &wait_d3_notif); |
| 1207 | 1377 | return ret; |
| 1208 | 1378 | } |
| @@ -1236,16 +1406,11 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld) · 27 unmodified lines | ||
| 1236 | 1406 | |
| 1237 | 1407 | iwl_mld_low_latency_stop(mld); |
| 1238 | 1408 | |
| 1239 | − /* This will happen if iwl_mld_supsend failed with FW error */ | |
| 1240 | − if (mld->trans->state == IWL_TRANS_NO_FW && | |
| 1241 | − test_bit(STATUS_FW_ERROR, &mld->trans->status)) | |
| 1242 | − return -ENODEV; | |
| 1243 | − | |
| 1244 | 1409 | ret = iwl_mld_update_device_power(mld, true); |
| 1245 | 1410 | if (ret) { |
| 1246 | 1411 | IWL_ERR(mld, |
| 1247 | 1412 | "d3 suspend: couldn't send power_device %d\n", ret); |
| 1248 | − goto out; | |
| 1413 | + return ret; | |
| 1249 | 1414 | } |
| 1250 | 1415 | |
| 1251 | 1416 | ret = iwl_mld_send_cmd_pdu(mld, D3_CONFIG_CMD, |
| @@ -1253,24 +1418,20 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld) · 1 unmodified line | ||
| 1253 | 1418 | if (ret) { |
| 1254 | 1419 | IWL_ERR(mld, |
| 1255 | 1420 | "d3 suspend: couldn't send D3_CONFIG_CMD %d\n", ret); |
| 1256 | − goto out; | |
| 1421 | + return ret; | |
| 1257 | 1422 | } |
| 1258 | 1423 | |
| 1259 | − ret = iwl_trans_d3_suspend(mld->trans, false, false); | |
| 1424 | + ret = iwl_trans_d3_suspend(mld->trans, false); | |
| 1260 | 1425 | if (ret) { |
| 1261 | 1426 | IWL_ERR(mld, "d3 suspend: trans_d3_suspend failed %d\n", ret); |
| 1427 | + /* We are going to stop the FW. Avoid sending commands in that flow */ | |
| 1428 | + iwl_trans_notify_fw_error(mld->trans); | |
| 1262 | 1429 | } else { |
| 1263 | 1430 | /* Async notification might send hcmds, which is not allowed in suspend */ |
| 1264 | 1431 | iwl_mld_cancel_async_notifications(mld); |
| 1265 | 1432 | mld->fw_status.in_d3 = true; |
| 1266 | 1433 | } |
| 1267 | 1434 | |
| 1268 | − out: | |
| 1269 | − if (ret) { | |
| 1270 | − mld->trans->state = IWL_TRANS_NO_FW; | |
| 1271 | − set_bit(STATUS_FW_ERROR, &mld->trans->status); | |
| 1272 | − } | |
| 1273 | − | |
| 1274 | 1435 | return ret; |
| 1275 | 1436 | } |
| 1276 | 1437 | |
| @@ -1290,15 +1451,12 @@ int iwl_mld_no_wowlan_resume(struct iwl_mld *mld) · 13 unmodified lines | ||
| 1290 | 1451 | iwl_fw_dbg_read_d3_debug_data(&mld->fwrt); |
| 1291 | 1452 | |
| 1292 | 1453 | ret = iwl_mld_wait_d3_notif(mld, &resume_data, false); |
| 1454 | + if (ret) | |
| 1455 | + return ret; | |
| 1293 | 1456 | |
| 1294 | 1457 | if (!ret && (resume_data.d3_end_flags & IWL_D0I3_RESET_REQUIRE)) |
| 1295 | 1458 | return -ENODEV; |
| 1296 | 1459 | |
| 1297 | − if (ret) { | |
| 1298 | − mld->trans->state = IWL_TRANS_NO_FW; | |
| 1299 | − set_bit(STATUS_FW_ERROR, &mld->trans->status); | |
| 1300 | − return ret; | |
| 1301 | − } | |
| 1302 | 1460 | iwl_mld_low_latency_restart(mld); |
| 1303 | 1461 | |
| 1304 | 1462 | return iwl_mld_update_device_power(mld, false); |
| @@ -1530,7 +1688,8 @@ static void · 225 unmodified lines | ||
| 1530 | 1688 | iwl_mld_set_wowlan_config_cmd(struct iwl_mld *mld, |
| 1531 | 1689 | struct cfg80211_wowlan *wowlan, |
| 1532 | 1690 | struct iwl_wowlan_config_cmd *wowlan_config_cmd, |
| 1533 | − struct ieee80211_sta *ap_sta) | |
| 1691 | + struct ieee80211_sta *ap_sta, | |
| 1692 | + struct ieee80211_bss_conf *link) | |
| 1534 | 1693 | { |
| 1535 | 1694 | wowlan_config_cmd->is_11n_connection = |
| 1536 | 1695 | ap_sta->deflink.ht_cap.ht_supported; |
| @@ -1540,6 +1699,9 @@ iwl_mld_set_wowlan_config_cmd(struct iwl_mld *mld, · 3 unmodified lines | ||
| 1540 | 1699 | if (ap_sta->mfp) |
| 1541 | 1700 | wowlan_config_cmd->flags |= IS_11W_ASSOC; |
| 1542 | 1701 | |
| 1702 | + if (iwl_mld_beacon_protection_enabled(mld, link)) | |
| 1703 | + wowlan_config_cmd->flags |= HAS_BEACON_PROTECTION; | |
| 1704 | + | |
| 1543 | 1705 | if (wowlan->disconnect) |
| 1544 | 1706 | wowlan_config_cmd->wakeup_filter |= |
| 1545 | 1707 | cpu_to_le32(IWL_WOWLAN_WAKEUP_BEACON_MISS | |
| @@ -1737,7 +1899,7 @@ iwl_mld_wowlan_config(struct iwl_mld *mld, struct ieee80211_vif *bss_vif, · 191 unmodified lines | ||
| 1737 | 1899 | return ret; |
| 1738 | 1900 | |
| 1739 | 1901 | iwl_mld_set_wowlan_config_cmd(mld, wowlan, |
| 1740 | − &wowlan_config_cmd, ap_sta); | |
| 1902 | + &wowlan_config_cmd, ap_sta, link_conf); | |
| 1741 | 1903 | ret = iwl_mld_send_cmd_pdu(mld, WOWLAN_CONFIGURATION, |
| 1742 | 1904 | &wowlan_config_cmd); |
| 1743 | 1905 | if (ret) |
| @@ -1807,7 +1969,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 63 unmodified lines | ||
| 1807 | 1969 | }; |
| 1808 | 1970 | int link_id; |
| 1809 | 1971 | int ret; |
| 1810 | − bool fw_err = false; | |
| 1811 | 1972 | |
| 1812 | 1973 | lockdep_assert_wiphy(mld->wiphy); |
| 1813 | 1974 | |
| @@ -1850,7 +2011,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 36 unmodified lines | ||
| 1850 | 2011 | ret = iwl_mld_wait_d3_notif(mld, &resume_data, true); |
| 1851 | 2012 | if (ret) { |
| 1852 | 2013 | IWL_ERR(mld, "Couldn't get the d3 notifs %d\n", ret); |
| 1853 | − fw_err = true; | |
| 1854 | 2014 | goto err; |
| 1855 | 2015 | } |
| 1856 | 2016 | |
| @@ -1887,11 +2047,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 30 unmodified lines | ||
| 1887 | 2047 | goto out; |
| 1888 | 2048 | |
| 1889 | 2049 | err: |
| 1890 | − if (fw_err) { | |
| 1891 | − mld->trans->state = IWL_TRANS_NO_FW; | |
| 1892 | − set_bit(STATUS_FW_ERROR, &mld->trans->status); | |
| 1893 | − } | |
| 1894 | − | |
| 1895 | 2050 | mld->fw_status.in_hw_restart = true; |
| 1896 | 2051 | ret = 1; |
| 1897 | 2052 | out: |
| @@ -86,7 +86,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mld *mld, char *buf, · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | if (count == 6 && !strcmp(buf, "nolog\n")) { |
| 88 | 88 | mld->fw_status.do_not_dump_once = true; |
| 89 | − iwl_trans_suppress_cmd_error_once(mld->trans); | |
| 89 | + mld->trans->suppress_cmd_error_once = true; | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /* take the return value to make compiler happy - it will |
| @@ -1001,8 +1001,12 @@ void iwl_mld_add_link_debugfs(struct ieee80211_hw *hw, · 908 unmodified lines | ||
| 1001 | 1001 | * If not, this is a per-link dir of a MLO vif, add in it the iwlmld |
| 1002 | 1002 | * dir. |
| 1003 | 1003 | */ |
| 1004 | − if (!mld_link_dir) | |
| 1004 | + if (!mld_link_dir) { | |
| 1005 | 1005 | mld_link_dir = debugfs_create_dir("iwlmld", dir); |
| 1006 | + } else { | |
| 1007 | + /* Release the reference from debugfs_lookup */ | |
| 1008 | + dput(mld_link_dir); | |
| 1009 | + } | |
| 1006 | 1010 | } |
| 1007 | 1011 | |
| 1008 | 1012 | static ssize_t _iwl_dbgfs_fixed_rate_write(struct iwl_mld *mld, char *buf, |
| @@ -115,20 +115,12 @@ static bool iwl_mld_is_nic_ack_enabled(struct iwl_mld *mld, · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | static void iwl_mld_set_he_support(struct iwl_mld *mld, |
| 117 | 117 | struct ieee80211_vif *vif, |
| 118 | − struct iwl_mac_config_cmd *cmd, | |
| 119 | − int cmd_ver) | |
| 118 | + struct iwl_mac_config_cmd *cmd) | |
| 120 | 119 | { |
| 121 | − if (vif->type == NL80211_IFTYPE_AP) { | |
| 122 | − if (cmd_ver == 2) | |
| 123 | − cmd->wifi_gen_v2.he_ap_support = cpu_to_le16(1); | |
| 124 | − else | |
| 125 | − cmd->wifi_gen.he_ap_support = 1; | |
| 126 | − } else { | |
| 127 | − if (cmd_ver == 2) | |
| 128 | − cmd->wifi_gen_v2.he_support = cpu_to_le16(1); | |
| 129 | − else | |
| 130 | − cmd->wifi_gen.he_support = 1; | |
| 131 | − } | |
| 120 | + if (vif->type == NL80211_IFTYPE_AP) | |
| 121 | + cmd->wifi_gen.he_ap_support = 1; | |
| 122 | + else | |
| 123 | + cmd->wifi_gen.he_support = 1; | |
| 132 | 124 | } |
| 133 | 125 | |
| 134 | 126 | /* fill the common part for all interface types */ |
| @@ -140,9 +132,6 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 5 unmodified lines | ||
| 140 | 132 | struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif); |
| 141 | 133 | struct ieee80211_bss_conf *link_conf; |
| 142 | 134 | unsigned int link_id; |
| 143 | − int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, | |
| 144 | − WIDE_ID(MAC_CONF_GROUP, | |
| 145 | − MAC_CONFIG_CMD), 0); | |
| 146 | 135 | |
| 147 | 136 | lockdep_assert_wiphy(mld->wiphy); |
| 148 | 137 | |
| @@ -169,11 +158,8 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 20 unmodified lines | ||
| 169 | 158 | * and enable both when we have MLO. |
| 170 | 159 | */ |
| 171 | 160 | if (ieee80211_vif_is_mld(vif)) { |
| 172 | − iwl_mld_set_he_support(mld, vif, cmd, cmd_ver); | |
| 173 | − if (cmd_ver == 2) | |
| 174 | − cmd->wifi_gen_v2.eht_support = cpu_to_le32(1); | |
| 175 | − else | |
| 176 | − cmd->wifi_gen.eht_support = 1; | |
| 161 | + iwl_mld_set_he_support(mld, vif, cmd); | |
| 162 | + cmd->wifi_gen.eht_support = 1; | |
| 177 | 163 | return; |
| 178 | 164 | } |
| 179 | 165 | |
| @@ -181,7 +167,7 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 1 unmodified line | ||
| 181 | 167 | if (!link_conf->he_support) |
| 182 | 168 | continue; |
| 183 | 169 | |
| 184 | − iwl_mld_set_he_support(mld, vif, cmd, cmd_ver); | |
| 170 | + iwl_mld_set_he_support(mld, vif, cmd); | |
| 185 | 171 | |
| 186 | 172 | /* EHT, if supported, was already set above */ |
| 187 | 173 | break; |
| @@ -451,24 +437,21 @@ int iwl_mld_add_vif(struct iwl_mld *mld, struct ieee80211_vif *vif) · 263 unmodified lines | ||
| 451 | 437 | return ret; |
| 452 | 438 | } |
| 453 | 439 | |
| 454 | −int iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif) | |
| 440 | +void iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif) | |
| 455 | 441 | { |
| 456 | 442 | struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif); |
| 457 | − int ret; | |
| 458 | 443 | |
| 459 | 444 | lockdep_assert_wiphy(mld->wiphy); |
| 460 | 445 | |
| 461 | − ret = iwl_mld_mac_fw_action(mld, vif, FW_CTXT_ACTION_REMOVE); | |
| 446 | + iwl_mld_mac_fw_action(mld, vif, FW_CTXT_ACTION_REMOVE); | |
| 462 | 447 | |
| 463 | 448 | if (WARN_ON(mld_vif->fw_id >= ARRAY_SIZE(mld->fw_id_to_vif))) |
| 464 | − return -EINVAL; | |
| 449 | + return; | |
| 465 | 450 | |
| 466 | 451 | RCU_INIT_POINTER(mld->fw_id_to_vif[mld_vif->fw_id], NULL); |
| 467 | 452 | |
| 468 | 453 | iwl_mld_cancel_notifications_of_object(mld, IWL_MLD_OBJECT_TYPE_VIF, |
| 469 | 454 | mld_vif->fw_id); |
| 470 | − | |
| 471 | − return ret; | |
| 472 | 455 | } |
| 473 | 456 | |
| 474 | 457 | void iwl_mld_set_vif_associated(struct iwl_mld *mld, |
| @@ -125,8 +125,6 @@ struct iwl_mld_emlsr { · 124 unmodified lines | ||
| 125 | 125 | * @ap_sta: pointer to AP sta, for easier access to it. |
| 126 | 126 | * Relevant only for STA vifs. |
| 127 | 127 | * @authorized: indicates the AP station was set to authorized |
| 128 | − * @bigtks: BIGTKs of the AP, for beacon protection. | |
| 129 | − * Only valid for STA. (FIXME: needs to be per link) | |
| 130 | 128 | * @num_associated_stas: number of associated STAs. Relevant only for AP mode. |
| 131 | 129 | * @ap_ibss_active: whether the AP/IBSS was started |
| 132 | 130 | * @cca_40mhz_workaround: When we are connected in 2.4 GHz and 40 MHz, and the |
| @@ -158,7 +156,6 @@ struct iwl_mld_vif { · 25 unmodified lines | ||
| 158 | 156 | struct iwl_mld_session_protect session_protect; |
| 159 | 157 | struct ieee80211_sta *ap_sta; |
| 160 | 158 | bool authorized; |
| 161 | − struct ieee80211_key_conf __rcu *bigtks[2]; | |
| 162 | 159 | u8 num_associated_stas; |
| 163 | 160 | bool ap_ibss_active; |
| 164 | 161 | enum iwl_mld_cca_40mhz_wa_status cca_40mhz_workaround; |
| @@ -227,7 +224,7 @@ void iwl_mld_cleanup_vif(void *data, u8 *mac, struct ieee80211_vif *vif); · 62 unmodified lines | ||
| 227 | 224 | int iwl_mld_mac_fw_action(struct iwl_mld *mld, struct ieee80211_vif *vif, |
| 228 | 225 | u32 action); |
| 229 | 226 | int iwl_mld_add_vif(struct iwl_mld *mld, struct ieee80211_vif *vif); |
| 230 | −int iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif); | |
| 227 | +void iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif); | |
| 231 | 228 | void iwl_mld_set_vif_associated(struct iwl_mld *mld, |
| 232 | 229 | struct ieee80211_vif *vif); |
| 233 | 230 | u8 iwl_mld_get_fw_bss_vifs_ids(struct iwl_mld *mld); |
| @@ -368,3 +368,41 @@ int iwl_mld_update_sta_keys(struct iwl_mld *mld, · 367 unmodified lines | ||
| 368 | 368 | &data); |
| 369 | 369 | return data.err; |
| 370 | 370 | } |
| 371 | + | |
| 372 | +void iwl_mld_track_bigtk(struct iwl_mld *mld, | |
| 373 | + struct ieee80211_vif *vif, | |
| 374 | + struct ieee80211_key_conf *key, bool add) | |
| 375 | +{ | |
| 376 | + struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif); | |
| 377 | + struct iwl_mld_link *link; | |
| 378 | + | |
| 379 | + if (vif->type != NL80211_IFTYPE_STATION) | |
| 380 | + return; | |
| 381 | + | |
| 382 | + if (WARN_ON(key->keyidx < 6 || key->keyidx > 7)) | |
| 383 | + return; | |
| 384 | + | |
| 385 | + if (WARN_ON(key->link_id < 0)) | |
| 386 | + return; | |
| 387 | + | |
| 388 | + link = iwl_mld_link_dereference_check(mld_vif, key->link_id); | |
| 389 | + if (WARN_ON(!link)) | |
| 390 | + return; | |
| 391 | + | |
| 392 | + if (add) | |
| 393 | + rcu_assign_pointer(link->bigtks[key->keyidx - 6], key); | |
| 394 | + else | |
| 395 | + RCU_INIT_POINTER(link->bigtks[key->keyidx - 6], NULL); | |
| 396 | +} | |
| 397 | + | |
| 398 | +bool iwl_mld_beacon_protection_enabled(struct iwl_mld *mld, | |
| 399 | + struct ieee80211_bss_conf *link) | |
| 400 | +{ | |
| 401 | + struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link); | |
| 402 | + | |
| 403 | + if (WARN_ON(!mld_link)) | |
| 404 | + return false; | |
| 405 | + | |
| 406 | + return rcu_access_pointer(mld_link->bigtks[0]) || | |
| 407 | + rcu_access_pointer(mld_link->bigtks[1]); | |
| 408 | +} | |
| @@ -36,4 +36,11 @@ iwl_mld_cleanup_keys_iter(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 35 unmodified lines | ||
| 36 | 36 | key->hw_key_idx = STA_KEY_IDX_INVALID; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | +void iwl_mld_track_bigtk(struct iwl_mld *mld, | |
| 40 | + struct ieee80211_vif *vif, | |
| 41 | + struct ieee80211_key_conf *key, bool add); | |
| 42 | + | |
| 43 | +bool iwl_mld_beacon_protection_enabled(struct iwl_mld *mld, | |
| 44 | + struct ieee80211_bss_conf *link); | |
| 45 | + | |
| 39 | 46 | #endif /* __iwl_mld_key_h__ */ |
| @@ -532,7 +532,8 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 531 unmodified lines | ||
| 532 | 532 | le32_to_cpu(notif->consec_missed_beacons_other_link); |
| 533 | 533 | struct ieee80211_bss_conf *link_conf = |
| 534 | 534 | iwl_mld_fw_id_to_link_conf(mld, fw_link_id); |
| 535 | − u32 bss_param_ch_cnt_link_id; | |
| 535 | + struct ieee80211_bss_conf *other_link; | |
| 536 | + u32 bss_param_ch_cnt_link_id, other_link_fw_id; | |
| 536 | 537 | struct ieee80211_vif *vif; |
| 537 | 538 | u8 link_id; |
| 538 | 539 | |
| @@ -550,11 +551,6 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 11 unmodified lines | ||
| 550 | 551 | if (WARN_ON(!vif)) |
| 551 | 552 | return; |
| 552 | 553 | |
| 553 | − mld->trans->dbg.dump_file_name_ext_valid = true; | |
| 554 | − snprintf(mld->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 555 | − "LinkId_%d_MacType_%d", fw_link_id, | |
| 556 | − iwl_mld_mac80211_iftype_to_fw(vif)); | |
| 557 | − | |
| 558 | 554 | iwl_dbg_tlv_time_point(&mld->fwrt, |
| 559 | 555 | IWL_FW_INI_TIME_POINT_MISSED_BEACONS, &tp_data); |
| 560 | 556 | |
| @@ -572,8 +568,11 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 11 unmodified lines | ||
| 572 | 568 | if (missed_bcon_since_rx > IWL_MLD_MISSED_BEACONS_THRESHOLD) { |
| 573 | 569 | ieee80211_cqm_beacon_loss_notify(vif, GFP_ATOMIC); |
| 574 | 570 | |
| 575 | − /* try to switch links, no-op if we don't have MLO */ | |
| 576 | − iwl_mld_int_mlo_scan(mld, vif); | |
| 571 | + /* Not in EMLSR and we can't hear the link. | |
| 572 | + * Try to switch to a better link. EMLSR case is handled below. | |
| 573 | + */ | |
| 574 | + if (!iwl_mld_emlsr_active(vif)) | |
| 575 | + iwl_mld_int_mlo_scan(mld, vif); | |
| 577 | 576 | } |
| 578 | 577 | |
| 579 | 578 | /* no more logic if we're not in EMLSR */ |
| @@ -584,6 +583,17 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 4 unmodified lines | ||
| 584 | 583 | if (le32_to_cpu(notif->other_link_id) == FW_CTXT_ID_INVALID) |
| 585 | 584 | return; |
| 586 | 585 | |
| 586 | + other_link_fw_id = le32_to_cpu(notif->other_link_id); | |
| 587 | + other_link = iwl_mld_fw_id_to_link_conf(mld, other_link_fw_id); | |
| 588 | + | |
| 589 | + if (IWL_FW_CHECK(mld, !other_link, "link doesn't exist for: %d\n", | |
| 590 | + other_link_fw_id)) | |
| 591 | + return; | |
| 592 | + | |
| 593 | + IWL_DEBUG_EHT(mld, | |
| 594 | + "missed bcn on the other link (link_id=%u): %u\n", | |
| 595 | + other_link->link_id, scnd_lnk_bcn_lost); | |
| 596 | + | |
| 587 | 597 | /* Exit EMLSR if we lost more than |
| 588 | 598 | * IWL_MLD_MISSED_BEACONS_EXIT_ESR_THRESH beacons on boths links |
| 589 | 599 | * OR more than IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH on current link. |
| @@ -36,6 +36,7 @@ struct iwl_probe_resp_data { · 35 unmodified lines | ||
| 36 | 36 | * @he_ru_2mhz_block: 26-tone RU OFDMA transmissions should be blocked. |
| 37 | 37 | * @igtk: fw can only have one IGTK at a time, whereas mac80211 can have two. |
| 38 | 38 | * This tracks the one IGTK that currently exists in FW. |
| 39 | + * @bigtks: BIGTKs of the AP. Only valid for STA mode. | |
| 39 | 40 | * @bcast_sta: station used for broadcast packets. Used in AP, GO and IBSS. |
| 40 | 41 | * @mcast_sta: station used for multicast packets. Used in AP, GO and IBSS. |
| 41 | 42 | * @mon_sta: station used for TX injection in monitor interface. |
| @@ -59,6 +60,7 @@ struct iwl_mld_link { · 17 unmodified lines | ||
| 59 | 60 | struct ieee80211_chanctx_conf __rcu *chan_ctx; |
| 60 | 61 | bool he_ru_2mhz_block; |
| 61 | 62 | struct ieee80211_key_conf *igtk; |
| 63 | + struct ieee80211_key_conf __rcu *bigtks[2]; | |
| 62 | 64 | ); |
| 63 | 65 | /* And here fields that survive a fw restart */ |
| 64 | 66 | struct iwl_mld_int_sta bcast_sta; |
| @@ -626,7 +626,7 @@ int iwl_mld_mac80211_add_interface(struct ieee80211_hw *hw, · 625 unmodified lines | ||
| 626 | 626 | IEEE80211_VIF_SUPPORTS_CQM_RSSI; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | − if (vif->p2p || iwl_fw_lookup_cmd_ver(mld->fw, PHY_CONTEXT_CMD, 0) < 5) | |
| 629 | + if (vif->p2p) | |
| 630 | 630 | vif->driver_flags |= IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW; |
| 631 | 631 | |
| 632 | 632 | /* |
| @@ -1966,13 +1966,8 @@ iwl_mld_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 1333 unmodified lines | ||
| 1966 | 1966 | iwl_fw_runtime_suspend(&mld->fwrt); |
| 1967 | 1967 | |
| 1968 | 1968 | ret = iwl_mld_wowlan_suspend(mld, wowlan); |
| 1969 | − if (ret) { | |
| 1970 | − if (ret < 0) { | |
| 1971 | − mld->trans->state = IWL_TRANS_NO_FW; | |
| 1972 | − set_bit(STATUS_FW_ERROR, &mld->trans->status); | |
| 1973 | − } | |
| 1969 | + if (ret) | |
| 1974 | 1970 | return 1; |
| 1975 | − } | |
| 1976 | 1971 | |
| 1977 | 1972 | if (iwl_mld_no_wowlan_suspend(mld)) |
| 1978 | 1973 | return 1; |
| @@ -2065,9 +2060,8 @@ static int iwl_mld_set_key_add(struct iwl_mld *mld, · 86 unmodified lines | ||
| 2065 | 2060 | return -EOPNOTSUPP; |
| 2066 | 2061 | } |
| 2067 | 2062 | |
| 2068 | − if (vif->type == NL80211_IFTYPE_STATION && | |
| 2069 | − (keyidx == 6 || keyidx == 7)) | |
| 2070 | − rcu_assign_pointer(mld_vif->bigtks[keyidx - 6], key); | |
| 2063 | + if (keyidx == 6 || keyidx == 7) | |
| 2064 | + iwl_mld_track_bigtk(mld, vif, key, true); | |
| 2071 | 2065 | |
| 2072 | 2066 | /* After exiting from RFKILL, hostapd configures GTK/ITGK before the |
| 2073 | 2067 | * AP is started, but those keys can't be sent to the FW before the |
| @@ -2116,9 +2110,8 @@ static void iwl_mld_set_key_remove(struct iwl_mld *mld, · 42 unmodified lines | ||
| 2116 | 2110 | sta ? iwl_mld_sta_from_mac80211(sta) : NULL; |
| 2117 | 2111 | int keyidx = key->keyidx; |
| 2118 | 2112 | |
| 2119 | − if (vif->type == NL80211_IFTYPE_STATION && | |
| 2120 | − (keyidx == 6 || keyidx == 7)) | |
| 2121 | − RCU_INIT_POINTER(mld_vif->bigtks[keyidx - 6], NULL); | |
| 2113 | + if (keyidx == 6 || keyidx == 7) | |
| 2114 | + iwl_mld_track_bigtk(mld, vif, key, false); | |
| 2122 | 2115 | |
| 2123 | 2116 | if (mld_sta && key->flags & IEEE80211_KEY_FLAG_PAIRWISE && |
| 2124 | 2117 | (key->cipher == WLAN_CIPHER_SUITE_CCMP || |
| @@ -147,6 +147,7 @@ iwl_mld_construct_fw_runtime(struct iwl_mld *mld, struct iwl_trans *trans, · 146 unmodified lines | ||
| 147 | 147 | */ |
| 148 | 148 | static const struct iwl_hcmd_names iwl_mld_legacy_names[] = { |
| 149 | 149 | HCMD_NAME(UCODE_ALIVE_NTFY), |
| 150 | + HCMD_NAME(REPLY_ERROR), | |
| 150 | 151 | HCMD_NAME(INIT_COMPLETE_NOTIF), |
| 151 | 152 | HCMD_NAME(PHY_CONTEXT_CMD), |
| 152 | 153 | HCMD_NAME(SCAN_CFG_CMD), |
| @@ -158,12 +159,14 @@ static const struct iwl_hcmd_names iwl_mld_legacy_names[] = { · 5 unmodified lines | ||
| 158 | 159 | HCMD_NAME(LEDS_CMD), |
| 159 | 160 | HCMD_NAME(WNM_80211V_TIMING_MEASUREMENT_NOTIFICATION), |
| 160 | 161 | HCMD_NAME(WNM_80211V_TIMING_MEASUREMENT_CONFIRM_NOTIFICATION), |
| 162 | + HCMD_NAME(PHY_CONFIGURATION_CMD), | |
| 161 | 163 | HCMD_NAME(SCAN_OFFLOAD_UPDATE_PROFILES_CMD), |
| 162 | 164 | HCMD_NAME(POWER_TABLE_CMD), |
| 163 | 165 | HCMD_NAME(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION), |
| 164 | 166 | HCMD_NAME(BEACON_NOTIFICATION), |
| 165 | 167 | HCMD_NAME(BEACON_TEMPLATE_CMD), |
| 166 | 168 | HCMD_NAME(TX_ANT_CONFIGURATION_CMD), |
| 169 | + HCMD_NAME(BT_CONFIG), | |
| 167 | 170 | HCMD_NAME(REDUCE_TX_POWER_CMD), |
| 168 | 171 | HCMD_NAME(MISSED_BEACONS_NOTIFICATION), |
| 169 | 172 | HCMD_NAME(MAC_PM_POWER_TABLE), |
| @@ -251,6 +254,7 @@ static const struct iwl_hcmd_names iwl_mld_data_path_names[] = { · 81 unmodified lines | ||
| 251 | 254 | HCMD_NAME(TLC_MNG_CONFIG_CMD), |
| 252 | 255 | HCMD_NAME(RX_BAID_ALLOCATION_CONFIG_CMD), |
| 253 | 256 | HCMD_NAME(SCD_QUEUE_CONFIG_CMD), |
| 257 | + HCMD_NAME(SEC_KEY_CMD), | |
| 254 | 258 | HCMD_NAME(ESR_MODE_NOTIF), |
| 255 | 259 | HCMD_NAME(MONITOR_NOTIF), |
| 256 | 260 | HCMD_NAME(TLC_MNG_UPDATE_NOTIF), |
| @@ -357,38 +357,26 @@ iwl_mld_vif_iter_emlsr_mode_notif(void *data, u8 *mac, · 356 unmodified lines | ||
| 357 | 357 | struct ieee80211_vif *vif) |
| 358 | 358 | { |
| 359 | 359 | const struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif); |
| 360 | − enum iwl_mvm_fw_esr_recommendation action; | |
| 361 | − const struct iwl_esr_mode_notif *notif = NULL; | |
| 362 | − | |
| 363 | − if (iwl_fw_lookup_notif_ver(mld_vif->mld->fw, DATA_PATH_GROUP, | |
| 364 | − ESR_MODE_NOTIF, 0) > 1) { | |
| 365 | − notif = (void *)data; | |
| 366 | − action = le32_to_cpu(notif->action); | |
| 367 | − } else { | |
| 368 | − const struct iwl_esr_mode_notif_v1 *notif_v1 = (void *)data; | |
| 369 | − | |
| 370 | − action = le32_to_cpu(notif_v1->action); | |
| 371 | − } | |
| 360 | + const struct iwl_esr_mode_notif *notif = (void *)data; | |
| 361 | + enum iwl_mvm_fw_esr_recommendation action = le32_to_cpu(notif->action); | |
| 372 | 362 | |
| 373 | 363 | if (!iwl_mld_vif_has_emlsr_cap(vif)) |
| 374 | 364 | return; |
| 375 | 365 | |
| 376 | 366 | switch (action) { |
| 377 | 367 | case ESR_RECOMMEND_LEAVE: |
| 378 | − if (notif) | |
| 379 | − IWL_DEBUG_INFO(mld_vif->mld, | |
| 380 | − "FW recommend leave reason = 0x%x\n", | |
| 381 | − le32_to_cpu(notif->leave_reason_mask)); | |
| 368 | + IWL_DEBUG_INFO(mld_vif->mld, | |
| 369 | + "FW recommend leave reason = 0x%x\n", | |
| 370 | + le32_to_cpu(notif->leave_reason_mask)); | |
| 382 | 371 | |
| 383 | 372 | iwl_mld_exit_emlsr(mld_vif->mld, vif, |
| 384 | 373 | IWL_MLD_EMLSR_EXIT_FW_REQUEST, |
| 385 | 374 | iwl_mld_get_primary_link(vif)); |
| 386 | 375 | break; |
| 387 | 376 | case ESR_FORCE_LEAVE: |
| 388 | − if (notif) | |
| 389 | − IWL_DEBUG_INFO(mld_vif->mld, | |
| 390 | − "FW force leave reason = 0x%x\n", | |
| 391 | − le32_to_cpu(notif->leave_reason_mask)); | |
| 377 | + IWL_DEBUG_INFO(mld_vif->mld, | |
| 378 | + "FW force leave reason = 0x%x\n", | |
| 379 | + le32_to_cpu(notif->leave_reason_mask)); | |
| 392 | 380 | fallthrough; |
| 393 | 381 | case ESR_RECOMMEND_ENTER: |
| 394 | 382 | default: |
| @@ -735,12 +723,6 @@ iwl_mld_set_link_sel_data(struct iwl_mld *mld, · 340 unmodified lines | ||
| 735 | 723 | u16 max_grade = 0; |
| 736 | 724 | unsigned long link_id; |
| 737 | 725 | |
| 738 | − /* | |
| 739 | − * TODO: don't select links that weren't discovered in the last scan | |
| 740 | − * This requires mac80211 (or cfg80211) changes to forward/track when | |
| 741 | − * a BSS was last updated. cfg80211 already tracks this information but | |
| 742 | − * it is not exposed within the kernel. | |
| 743 | − */ | |
| 744 | 726 | for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { |
| 745 | 727 | struct ieee80211_bss_conf *link_conf = |
| 746 | 728 | link_conf_dereference_protected(vif, link_id); |
| @@ -333,7 +333,6 @@ CMD_VERSIONS(bt_coex_notif, · 332 unmodified lines | ||
| 333 | 333 | CMD_VERSIONS(beacon_notification, |
| 334 | 334 | CMD_VER_ENTRY(6, iwl_extended_beacon_notif)) |
| 335 | 335 | CMD_VERSIONS(emlsr_mode_notif, |
| 336 | − CMD_VER_ENTRY(1, iwl_esr_mode_notif_v1) | |
| 337 | 336 | CMD_VER_ENTRY(2, iwl_esr_mode_notif)) |
| 338 | 337 | CMD_VERSIONS(emlsr_trans_fail_notif, |
| 339 | 338 | CMD_VER_ENTRY(1, iwl_esr_trans_fail_notif)) |
| @@ -163,18 +163,32 @@ int iwl_mld_init_sgom(struct iwl_mld *mld) · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | static int iwl_mld_ppag_send_cmd(struct iwl_mld *mld) |
| 165 | 165 | { |
| 166 | − union iwl_ppag_table_cmd cmd = {}; | |
| 167 | − int ret, len; | |
| 166 | + struct iwl_fw_runtime *fwrt = &mld->fwrt; | |
| 167 | + union iwl_ppag_table_cmd cmd = { | |
| 168 | + .v7.ppag_config_info.table_source = fwrt->ppag_bios_source, | |
| 169 | + .v7.ppag_config_info.table_revision = fwrt->ppag_bios_rev, | |
| 170 | + .v7.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags), | |
| 171 | + }; | |
| 172 | + int ret; | |
| 168 | 173 | |
| 169 | − ret = iwl_fill_ppag_table(&mld->fwrt, &cmd, &len); | |
| 170 | − /* Not supporting PPAG table is a valid scenario */ | |
| 171 | − if (ret < 0) | |
| 172 | − return 0; | |
| 174 | + IWL_DEBUG_RADIO(fwrt, | |
| 175 | + "PPAG MODE bits going to be sent: %d\n", | |
| 176 | + fwrt->ppag_flags); | |
| 177 | + | |
| 178 | + for (int chain = 0; chain < IWL_NUM_CHAIN_LIMITS; chain++) { | |
| 179 | + for (int subband = 0; subband < IWL_NUM_SUB_BANDS_V2; subband++) { | |
| 180 | + cmd.v7.gain[chain][subband] = | |
| 181 | + fwrt->ppag_chains[chain].subbands[subband]; | |
| 182 | + IWL_DEBUG_RADIO(fwrt, | |
| 183 | + "PPAG table: chain[%d] band[%d]: gain = %d\n", | |
| 184 | + chain, subband, cmd.v7.gain[chain][subband]); | |
| 185 | + } | |
| 186 | + } | |
| 173 | 187 | |
| 174 | 188 | IWL_DEBUG_RADIO(mld, "Sending PER_PLATFORM_ANT_GAIN_CMD\n"); |
| 175 | 189 | ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(PHY_OPS_GROUP, |
| 176 | 190 | PER_PLATFORM_ANT_GAIN_CMD), |
| 177 | − &cmd, len); | |
| 191 | + &cmd, sizeof(cmd.v7)); | |
| 178 | 192 | if (ret < 0) |
| 179 | 193 | IWL_ERR(mld, "failed to send PER_PLATFORM_ANT_GAIN_CMD (%d)\n", |
| 180 | 194 | ret); |
| @@ -82,9 +82,6 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 81 unmodified lines | ||
| 82 | 82 | struct iwl_roc_req cmd = { |
| 83 | 83 | .action = cpu_to_le32(FW_CTXT_ACTION_ADD), |
| 84 | 84 | }; |
| 85 | − u8 ver = iwl_fw_lookup_cmd_ver(mld->fw, | |
| 86 | − WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); | |
| 87 | − u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(cmd); | |
| 88 | 85 | enum iwl_roc_activity activity; |
| 89 | 86 | int ret = 0; |
| 90 | 87 | |
| @@ -140,7 +137,7 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 49 unmodified lines | ||
| 140 | 137 | memcpy(cmd.node_addr, vif->addr, ETH_ALEN); |
| 141 | 138 | |
| 142 | 139 | ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), |
| 143 | − &cmd, cmd_len); | |
| 140 | + &cmd); | |
| 144 | 141 | if (ret) { |
| 145 | 142 | IWL_ERR(mld, "Couldn't send the ROC_CMD\n"); |
| 146 | 143 | return ret; |
| @@ -190,9 +187,6 @@ int iwl_mld_cancel_roc(struct ieee80211_hw *hw, · 43 unmodified lines | ||
| 190 | 187 | struct iwl_roc_req cmd = { |
| 191 | 188 | .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE), |
| 192 | 189 | }; |
| 193 | − u8 ver = iwl_fw_lookup_cmd_ver(mld->fw, | |
| 194 | − WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); | |
| 195 | − u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(cmd); | |
| 196 | 190 | int ret; |
| 197 | 191 | |
| 198 | 192 | lockdep_assert_wiphy(mld->wiphy); |
| @@ -208,7 +202,7 @@ int iwl_mld_cancel_roc(struct ieee80211_hw *hw, · 9 unmodified lines | ||
| 208 | 202 | cmd.activity = cpu_to_le32(mld_vif->roc_activity); |
| 209 | 203 | |
| 210 | 204 | ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), |
| 211 | − &cmd, cmd_len); | |
| 205 | + &cmd); | |
| 212 | 206 | if (ret) |
| 213 | 207 | IWL_ERR(mld, "Couldn't send the command to cancel the ROC\n"); |
| 214 | 208 | |
| @@ -1611,20 +1611,21 @@ iwl_mld_rx_with_sta(struct iwl_mld *mld, struct ieee80211_hdr *hdr, · 1610 unmodified lines | ||
| 1611 | 1611 | return sta; |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | −#define KEY_IDX_LEN 2 | |
| 1615 | − | |
| 1616 | 1614 | static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta, |
| 1617 | 1615 | struct ieee80211_hdr *hdr, |
| 1618 | 1616 | struct ieee80211_rx_status *rx_status, |
| 1619 | 1617 | u32 mpdu_status, |
| 1620 | 1618 | u32 mpdu_len) |
| 1621 | 1619 | { |
| 1620 | + struct iwl_mld_link *link; | |
| 1622 | 1621 | struct wireless_dev *wdev; |
| 1623 | 1622 | struct iwl_mld_sta *mld_sta; |
| 1624 | 1623 | struct iwl_mld_vif *mld_vif; |
| 1625 | 1624 | u8 keyidx; |
| 1626 | 1625 | struct ieee80211_key_conf *key; |
| 1627 | 1626 | const u8 *frame = (void *)hdr; |
| 1627 | + const u8 *mmie; | |
| 1628 | + u8 link_id; | |
| 1628 | 1629 | |
| 1629 | 1630 | if ((mpdu_status & IWL_RX_MPDU_STATUS_SEC_MASK) == |
| 1630 | 1631 | IWL_RX_MPDU_STATUS_SEC_NONE) |
| @@ -1657,21 +1658,30 @@ static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta, · 26 unmodified lines | ||
| 1657 | 1658 | return 0; |
| 1658 | 1659 | } |
| 1659 | 1660 | |
| 1661 | + link_id = rx_status->link_valid ? rx_status->link_id : 0; | |
| 1662 | + link = rcu_dereference(mld_vif->link[link_id]); | |
| 1663 | + if (WARN_ON_ONCE(!link)) | |
| 1664 | + return -1; | |
| 1665 | + | |
| 1660 | 1666 | /* both keys will have the same cipher and MIC length, use |
| 1661 | 1667 | * whichever one is available |
| 1662 | 1668 | */ |
| 1663 | − key = rcu_dereference(mld_vif->bigtks[0]); | |
| 1669 | + key = rcu_dereference(link->bigtks[0]); | |
| 1664 | 1670 | if (!key) { |
| 1665 | − key = rcu_dereference(mld_vif->bigtks[1]); | |
| 1671 | + key = rcu_dereference(link->bigtks[1]); | |
| 1666 | 1672 | if (!key) |
| 1667 | 1673 | goto report; |
| 1668 | 1674 | } |
| 1669 | 1675 | |
| 1670 | − if (mpdu_len < key->icv_len + IEEE80211_GMAC_PN_LEN + KEY_IDX_LEN) | |
| 1676 | + /* get the real key ID */ | |
| 1677 | + if (mpdu_len < key->icv_len) | |
| 1671 | 1678 | goto report; |
| 1672 | 1679 | |
| 1673 | − /* get the real key ID */ | |
| 1674 | − keyidx = frame[mpdu_len - key->icv_len - IEEE80211_GMAC_PN_LEN - KEY_IDX_LEN]; | |
| 1680 | + mmie = frame + (mpdu_len - key->icv_len); | |
| 1681 | + | |
| 1682 | + /* the position of the key_id in ieee80211_mmie_16 is the same */ | |
| 1683 | + keyidx = le16_to_cpu(((const struct ieee80211_mmie *) mmie)->key_id); | |
| 1684 | + | |
| 1675 | 1685 | /* and if that's the other key, look it up */ |
| 1676 | 1686 | if (keyidx != key->keyidx) { |
| 1677 | 1687 | /* shouldn't happen since firmware checked, but be safe |
| @@ -1680,7 +1690,7 @@ static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta, · 2 unmodified lines | ||
| 1680 | 1690 | if (keyidx != 6 && keyidx != 7) |
| 1681 | 1691 | return -1; |
| 1682 | 1692 | |
| 1683 | − key = rcu_dereference(mld_vif->bigtks[keyidx - 6]); | |
| 1693 | + key = rcu_dereference(link->bigtks[keyidx - 6]); | |
| 1684 | 1694 | if (!key) |
| 1685 | 1695 | goto report; |
| 1686 | 1696 | } |
| @@ -504,9 +504,7 @@ iwl_mld_scan_get_cmd_gen_flags2(struct iwl_mld *mld, · 503 unmodified lines | ||
| 504 | 504 | */ |
| 505 | 505 | if (scan_status == IWL_MLD_SCAN_REGULAR && |
| 506 | 506 | ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_AP && |
| 507 | − gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE && | |
| 508 | − iwl_fw_lookup_notif_ver(mld->fw, SCAN_GROUP, | |
| 509 | − CHANNEL_SURVEY_NOTIF, 0) >= 1) | |
| 507 | + gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE) | |
| 510 | 508 | flags |= IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS; |
| 511 | 509 | |
| 512 | 510 | return flags; |
| @@ -401,11 +401,9 @@ static u32 iwl_mld_get_htc_flags(struct ieee80211_link_sta *link_sta) · 400 unmodified lines | ||
| 401 | 401 | static int iwl_mld_send_sta_cmd(struct iwl_mld *mld, |
| 402 | 402 | const struct iwl_sta_cfg_cmd *cmd) |
| 403 | 403 | { |
| 404 | − u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, STA_CONFIG_CMD); | |
| 405 | − int cmd_len = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0) > 1 ? | |
| 406 | − sizeof(*cmd) : | |
| 407 | − sizeof(struct iwl_sta_cfg_cmd_v1); | |
| 408 | − int ret = iwl_mld_send_cmd_pdu(mld, cmd_id, cmd, cmd_len); | |
| 404 | + int ret = iwl_mld_send_cmd_pdu(mld, | |
| 405 | + WIDE_ID(MAC_CONF_GROUP, STA_CONFIG_CMD), | |
| 406 | + cmd); | |
| 409 | 407 | if (ret) |
| 410 | 408 | IWL_ERR(mld, "STA_CONFIG_CMD send failed, ret=0x%x\n", ret); |
| 411 | 409 | return ret; |
| @@ -379,11 +379,14 @@ static void iwl_mld_update_link_sig(struct ieee80211_vif *vif, int sig, · 378 unmodified lines | ||
| 379 | 379 | |
| 380 | 380 | /* TODO: task=statistics handle CQM notifications */ |
| 381 | 381 | |
| 382 | − if (sig < IWL_MLD_LOW_RSSI_MLO_SCAN_THRESH) | |
| 383 | − iwl_mld_int_mlo_scan(mld, vif); | |
| 384 | − | |
| 385 | − if (!iwl_mld_emlsr_active(vif)) | |
| 382 | + if (!iwl_mld_emlsr_active(vif)) { | |
| 383 | + /* We're not in EMLSR and our signal is bad, | |
| 384 | + * try to switch link maybe. EMLSR will be handled below. | |
| 385 | + */ | |
| 386 | + if (sig < IWL_MLD_LOW_RSSI_MLO_SCAN_THRESH) | |
| 387 | + iwl_mld_int_mlo_scan(mld, vif); | |
| 386 | 388 | return; |
| 389 | + } | |
| 387 | 390 | |
| 388 | 391 | /* We are in EMLSR, check if we need to exit */ |
| 389 | 392 | exit_emlsr_thresh = |
| @@ -157,9 +157,9 @@ iwl_mld_get_highest_fw_mcs(const struct ieee80211_sta_vht_cap *vht_cap, · 156 unmodified lines | ||
| 157 | 157 | static void |
| 158 | 158 | iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta, |
| 159 | 159 | const struct ieee80211_sta_vht_cap *vht_cap, |
| 160 | − struct iwl_tlc_config_cmd_v4 *cmd) | |
| 160 | + struct iwl_tlc_config_cmd *cmd) | |
| 161 | 161 | { |
| 162 | − u16 supp; | |
| 162 | + u32 supp; | |
| 163 | 163 | int i, highest_mcs; |
| 164 | 164 | u8 max_nss = link_sta->rx_nss; |
| 165 | 165 | struct ieee80211_vht_cap ieee_vht_cap = { |
| @@ -182,7 +182,7 @@ iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta, · 16 unmodified lines | ||
| 182 | 182 | if (link_sta->bandwidth == IEEE80211_STA_RX_BW_20) |
| 183 | 183 | supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9); |
| 184 | 184 | |
| 185 | − cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = cpu_to_le16(supp); | |
| 185 | + cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = cpu_to_le32(supp); | |
| 186 | 186 | /* Check if VHT extended NSS indicates that the bandwidth/NSS |
| 187 | 187 | * configuration is supported - only for MCS 0 since we already |
| 188 | 188 | * decoded the MCS bits anyway ourselves. |
| @@ -196,7 +196,7 @@ iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta, · 7 unmodified lines | ||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | −static u16 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs) | |
| 199 | +static u32 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs) | |
| 200 | 200 | { |
| 201 | 201 | switch (mcs) { |
| 202 | 202 | case IEEE80211_HE_MCS_SUPPORT_0_7: |
| @@ -216,7 +216,7 @@ static u16 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs) · 13 unmodified lines | ||
| 216 | 216 | static void |
| 217 | 217 | iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta, |
| 218 | 218 | const struct ieee80211_sta_he_cap *own_he_cap, |
| 219 | − struct iwl_tlc_config_cmd_v4 *cmd) | |
| 219 | + struct iwl_tlc_config_cmd *cmd) | |
| 220 | 220 | { |
| 221 | 221 | const struct ieee80211_sta_he_cap *he_cap = &link_sta->he_cap; |
| 222 | 222 | u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); |
| @@ -245,7 +245,7 @@ iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta, · 22 unmodified lines | ||
| 245 | 245 | if (_mcs_80 > _tx_mcs_80) |
| 246 | 246 | _mcs_80 = _tx_mcs_80; |
| 247 | 247 | cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = |
| 248 | − cpu_to_le16(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_80)); | |
| 248 | + cpu_to_le32(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_80)); | |
| 249 | 249 | |
| 250 | 250 | /* If one side doesn't support - mark both as not supporting */ |
| 251 | 251 | if (_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED || |
| @@ -256,19 +256,19 @@ iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta, · 4 unmodified lines | ||
| 256 | 256 | if (_mcs_160 > _tx_mcs_160) |
| 257 | 257 | _mcs_160 = _tx_mcs_160; |
| 258 | 258 | cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_160] = |
| 259 | − cpu_to_le16(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_160)); | |
| 259 | + cpu_to_le32(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_160)); | |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | −static void iwl_mld_set_eht_mcs(__le16 ht_rates[][3], | |
| 263 | +static void iwl_mld_set_eht_mcs(__le32 ht_rates[][3], | |
| 264 | 264 | enum IWL_TLC_MCS_PER_BW bw, |
| 265 | − u8 max_nss, u16 mcs_msk) | |
| 265 | + u8 max_nss, u32 mcs_msk) | |
| 266 | 266 | { |
| 267 | 267 | if (max_nss >= 2) |
| 268 | − ht_rates[IWL_TLC_NSS_2][bw] |= cpu_to_le16(mcs_msk); | |
| 268 | + ht_rates[IWL_TLC_NSS_2][bw] |= cpu_to_le32(mcs_msk); | |
| 269 | 269 | |
| 270 | 270 | if (max_nss >= 1) |
| 271 | − ht_rates[IWL_TLC_NSS_1][bw] |= cpu_to_le16(mcs_msk); | |
| 271 | + ht_rates[IWL_TLC_NSS_1][bw] |= cpu_to_le32(mcs_msk); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | static const |
| @@ -307,7 +307,7 @@ iwl_mld_fill_eht_rates(struct ieee80211_vif *vif, · 32 unmodified lines | ||
| 307 | 307 | const struct ieee80211_link_sta *link_sta, |
| 308 | 308 | const struct ieee80211_sta_he_cap *own_he_cap, |
| 309 | 309 | const struct ieee80211_sta_eht_cap *own_eht_cap, |
| 310 | − struct iwl_tlc_config_cmd_v4 *cmd) | |
| 310 | + struct iwl_tlc_config_cmd *cmd) | |
| 311 | 311 | { |
| 312 | 312 | /* peer RX mcs capa */ |
| 313 | 313 | const struct ieee80211_eht_mcs_nss_supp *eht_rx_mcs = |
| @@ -405,7 +405,7 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 91 unmodified lines | ||
| 405 | 405 | struct ieee80211_supported_band *sband, |
| 406 | 406 | const struct ieee80211_sta_he_cap *own_he_cap, |
| 407 | 407 | const struct ieee80211_sta_eht_cap *own_eht_cap, |
| 408 | − struct iwl_tlc_config_cmd_v4 *cmd) | |
| 408 | + struct iwl_tlc_config_cmd *cmd) | |
| 409 | 409 | { |
| 410 | 410 | int i; |
| 411 | 411 | u16 non_ht_rates = 0; |
| @@ -435,7 +435,7 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 23 unmodified lines | ||
| 435 | 435 | } else if (ht_cap->ht_supported) { |
| 436 | 436 | cmd->mode = IWL_TLC_MNG_MODE_HT; |
| 437 | 437 | cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_MCS_PER_BW_80] = |
| 438 | − cpu_to_le16(ht_cap->mcs.rx_mask[0]); | |
| 438 | + cpu_to_le32(ht_cap->mcs.rx_mask[0]); | |
| 439 | 439 | |
| 440 | 440 | /* the station support only a single receive chain */ |
| 441 | 441 | if (link_sta->smps_mode == IEEE80211_SMPS_STATIC) |
| @@ -443,10 +443,30 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 1 unmodified line | ||
| 443 | 443 | 0; |
| 444 | 444 | else |
| 445 | 445 | cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_MCS_PER_BW_80] = |
| 446 | − cpu_to_le16(ht_cap->mcs.rx_mask[1]); | |
| 446 | + cpu_to_le32(ht_cap->mcs.rx_mask[1]); | |
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | +static void iwl_mld_convert_tlc_cmd_to_v4(struct iwl_tlc_config_cmd *cmd, | |
| 451 | + struct iwl_tlc_config_cmd_v4 *cmd_v4) | |
| 452 | +{ | |
| 453 | + /* Copy everything until ht_rates */ | |
| 454 | + memcpy(cmd_v4, cmd, offsetof(struct iwl_tlc_config_cmd, ht_rates)); | |
| 455 | + | |
| 456 | + /* Convert ht_rates from __le32 to __le16 */ | |
| 457 | + BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates) != ARRAY_SIZE(cmd->ht_rates)); | |
| 458 | + BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates[0]) != ARRAY_SIZE(cmd->ht_rates[0])); | |
| 459 | + | |
| 460 | + for (int nss = 0; nss < ARRAY_SIZE(cmd->ht_rates); nss++) | |
| 461 | + for (int bw = 0; bw < ARRAY_SIZE(cmd->ht_rates[nss]); bw++) | |
| 462 | + cmd_v4->ht_rates[nss][bw] = | |
| 463 | + cpu_to_le16(le32_to_cpu(cmd->ht_rates[nss][bw])); | |
| 464 | + | |
| 465 | + /* Copy the rest */ | |
| 466 | + cmd_v4->max_mpdu_len = cmd->max_mpdu_len; | |
| 467 | + cmd_v4->max_tx_op = cmd->max_tx_op; | |
| 468 | +} | |
| 469 | + | |
| 450 | 470 | static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, |
| 451 | 471 | struct ieee80211_vif *vif, |
| 452 | 472 | struct ieee80211_link_sta *link_sta, |
| @@ -458,7 +478,7 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines | ||
| 458 | 478 | ieee80211_get_he_iftype_cap_vif(sband, vif); |
| 459 | 479 | const struct ieee80211_sta_eht_cap *own_eht_cap = |
| 460 | 480 | ieee80211_get_eht_iftype_cap_vif(sband, vif); |
| 461 | − struct iwl_tlc_config_cmd_v4 cmd = { | |
| 481 | + struct iwl_tlc_config_cmd cmd = { | |
| 462 | 482 | /* For AP mode, use 20 MHz until the STA is authorized */ |
| 463 | 483 | .max_ch_width = mld_sta->sta_state > IEEE80211_STA_ASSOC ? |
| 464 | 484 | iwl_mld_fw_bw_from_sta_bw(link_sta) : |
| @@ -470,6 +490,11 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines | ||
| 470 | 490 | .max_mpdu_len = cpu_to_le16(link_sta->agg.max_amsdu_len), |
| 471 | 491 | }; |
| 472 | 492 | int fw_sta_id = iwl_mld_fw_sta_id_from_link_sta(mld, link_sta); |
| 493 | + u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, TLC_MNG_CONFIG_CMD); | |
| 494 | + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0); | |
| 495 | + struct iwl_tlc_config_cmd_v4 cmd_v4; | |
| 496 | + void *cmd_ptr; | |
| 497 | + u8 cmd_size; | |
| 473 | 498 | int ret; |
| 474 | 499 | |
| 475 | 500 | if (fw_sta_id < 0) |
| @@ -481,14 +506,26 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines | ||
| 481 | 506 | own_he_cap, own_eht_cap, |
| 482 | 507 | &cmd); |
| 483 | 508 | |
| 509 | + if (cmd_ver == 5) { | |
| 510 | + cmd_ptr = &cmd; | |
| 511 | + cmd_size = sizeof(cmd); | |
| 512 | + } else if (cmd_ver == 4) { | |
| 513 | + iwl_mld_convert_tlc_cmd_to_v4(&cmd, &cmd_v4); | |
| 514 | + cmd_ptr = &cmd_v4; | |
| 515 | + cmd_size = sizeof(cmd_v4); | |
| 516 | + } else { | |
| 517 | + IWL_ERR(mld, "Unsupported TLC config cmd version %d\n", | |
| 518 | + cmd_ver); | |
| 519 | + return; | |
| 520 | + } | |
| 521 | + | |
| 484 | 522 | IWL_DEBUG_RATE(mld, |
| 485 | 523 | "TLC CONFIG CMD, sta_id=%d, max_ch_width=%d, mode=%d\n", |
| 486 | 524 | cmd.sta_id, cmd.max_ch_width, cmd.mode); |
| 487 | 525 | |
| 488 | 526 | /* Send async since this can be called within a RCU-read section */ |
| 489 | − ret = iwl_mld_send_cmd_with_flags_pdu(mld, WIDE_ID(DATA_PATH_GROUP, | |
| 490 | − TLC_MNG_CONFIG_CMD), | |
| 491 | − CMD_ASYNC, &cmd); | |
| 527 | + ret = iwl_mld_send_cmd_with_flags_pdu(mld, cmd_id, CMD_ASYNC, cmd_ptr, | |
| 528 | + cmd_size); | |
| 492 | 529 | if (ret) |
| 493 | 530 | IWL_ERR(mld, "Failed to send TLC cmd (%d)\n", ret); |
| 494 | 531 | } |
| @@ -253,93 +253,6 @@ static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm, · 252 unmodified lines | ||
| 253 | 253 | swap(data->primary, data->secondary); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | −/* | |
| 257 | − * This function receives the LB link id and checks if eSR should be | |
| 258 | − * enabled or disabled (due to BT coex) | |
| 259 | − */ | |
| 260 | −bool | |
| 261 | −iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm, | |
| 262 | − struct ieee80211_vif *vif, | |
| 263 | − s32 link_rssi, | |
| 264 | − bool primary) | |
| 265 | −{ | |
| 266 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 267 | − bool have_wifi_loss_rate = | |
| 268 | − iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, | |
| 269 | − BT_PROFILE_NOTIFICATION, 0) > 4 || | |
| 270 | − iwl_fw_lookup_notif_ver(mvm->fw, BT_COEX_GROUP, | |
| 271 | − PROFILE_NOTIF, 0) >= 1; | |
| 272 | − u8 wifi_loss_mid_high_rssi; | |
| 273 | − u8 wifi_loss_low_rssi; | |
| 274 | − u8 wifi_loss_rate; | |
| 275 | − | |
| 276 | − if (iwl_fw_lookup_notif_ver(mvm->fw, BT_COEX_GROUP, | |
| 277 | − PROFILE_NOTIF, 0) >= 1) { | |
| 278 | − /* For now, we consider 2.4 GHz band / ANT_A only */ | |
| 279 | − wifi_loss_mid_high_rssi = | |
| 280 | − mvm->last_bt_wifi_loss.wifi_loss_mid_high_rssi[PHY_BAND_24][0]; | |
| 281 | − wifi_loss_low_rssi = | |
| 282 | − mvm->last_bt_wifi_loss.wifi_loss_low_rssi[PHY_BAND_24][0]; | |
| 283 | − } else { | |
| 284 | − wifi_loss_mid_high_rssi = mvm->last_bt_notif.wifi_loss_mid_high_rssi; | |
| 285 | − wifi_loss_low_rssi = mvm->last_bt_notif.wifi_loss_low_rssi; | |
| 286 | − } | |
| 287 | − | |
| 288 | − if (wifi_loss_low_rssi == BT_OFF) | |
| 289 | − return true; | |
| 290 | − | |
| 291 | − if (primary) | |
| 292 | − return false; | |
| 293 | − | |
| 294 | − /* The feature is not supported */ | |
| 295 | − if (!have_wifi_loss_rate) | |
| 296 | − return true; | |
| 297 | − | |
| 298 | − | |
| 299 | − /* | |
| 300 | − * In case we don't know the RSSI - take the lower wifi loss, | |
| 301 | − * so we will more likely enter eSR, and if RSSI is low - | |
| 302 | − * we will get an update on this and exit eSR. | |
| 303 | − */ | |
| 304 | − if (!link_rssi) | |
| 305 | − wifi_loss_rate = wifi_loss_mid_high_rssi; | |
| 306 | − | |
| 307 | − else if (mvmvif->esr_active) | |
| 308 | − /* RSSI needs to get really low to disable eSR... */ | |
| 309 | − wifi_loss_rate = | |
| 310 | − link_rssi <= -IWL_MVM_BT_COEX_DISABLE_ESR_THRESH ? | |
| 311 | − wifi_loss_low_rssi : | |
| 312 | − wifi_loss_mid_high_rssi; | |
| 313 | − else | |
| 314 | − /* ...And really high before we enable it back */ | |
| 315 | − wifi_loss_rate = | |
| 316 | − link_rssi <= -IWL_MVM_BT_COEX_ENABLE_ESR_THRESH ? | |
| 317 | − wifi_loss_low_rssi : | |
| 318 | − wifi_loss_mid_high_rssi; | |
| 319 | − | |
| 320 | − return wifi_loss_rate <= IWL_MVM_BT_COEX_WIFI_LOSS_THRESH; | |
| 321 | −} | |
| 322 | − | |
| 323 | −void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm, | |
| 324 | − struct ieee80211_vif *vif, | |
| 325 | − int link_id) | |
| 326 | −{ | |
| 327 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 328 | − struct iwl_mvm_vif_link_info *link = mvmvif->link[link_id]; | |
| 329 | − | |
| 330 | − if (!ieee80211_vif_is_mld(vif) || | |
| 331 | − !iwl_mvm_vif_from_mac80211(vif)->authorized || | |
| 332 | − WARN_ON(!link)) | |
| 333 | − return; | |
| 334 | − | |
| 335 | − if (!iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, | |
| 336 | − (s8)link->beacon_stats.avg_signal, | |
| 337 | − link_id == iwl_mvm_get_primary_link(vif))) | |
| 338 | − /* In case we decided to exit eSR - stay with the primary */ | |
| 339 | − iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_COEX, | |
| 340 | − iwl_mvm_get_primary_link(vif)); | |
| 341 | −} | |
| 342 | − | |
| 343 | 256 | static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm, |
| 344 | 257 | struct ieee80211_vif *vif, |
| 345 | 258 | struct iwl_bt_iterator_data *data, |
| @@ -385,8 +298,6 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm, · 39 unmodified lines | ||
| 385 | 298 | return; |
| 386 | 299 | } |
| 387 | 300 | |
| 388 | − iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id); | |
| 389 | − | |
| 390 | 301 | if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2)) |
| 391 | 302 | min_ag_for_static_smps = BT_VERY_HIGH_TRAFFIC; |
| 392 | 303 | else |
| @@ -525,32 +436,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, · 132 unmodified lines | ||
| 525 | 436 | iwl_mvm_bt_notif_per_link(mvm, vif, data, link_id); |
| 526 | 437 | } |
| 527 | 438 | |
| 528 | −/* must be called under rcu_read_lock */ | |
| 529 | −static void iwl_mvm_bt_coex_notif_iterator(void *_data, u8 *mac, | |
| 530 | − struct ieee80211_vif *vif) | |
| 531 | −{ | |
| 532 | − struct iwl_mvm *mvm = _data; | |
| 533 | − struct ieee80211_bss_conf *link_conf; | |
| 534 | − unsigned int link_id; | |
| 535 | − | |
| 536 | − lockdep_assert_held(&mvm->mutex); | |
| 537 | − | |
| 538 | − if (vif->type != NL80211_IFTYPE_STATION) | |
| 539 | − return; | |
| 540 | − | |
| 541 | − for_each_vif_active_link(vif, link_conf, link_id) { | |
| 542 | − struct ieee80211_chanctx_conf *chanctx_conf = | |
| 543 | − rcu_dereference_check(link_conf->chanctx_conf, | |
| 544 | − lockdep_is_held(&mvm->mutex)); | |
| 545 | − | |
| 546 | − if ((!chanctx_conf || | |
| 547 | − chanctx_conf->def.chan->band != NL80211_BAND_2GHZ)) | |
| 548 | − continue; | |
| 549 | − | |
| 550 | − iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id); | |
| 551 | − } | |
| 552 | −} | |
| 553 | − | |
| 554 | 439 | static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) |
| 555 | 440 | { |
| 556 | 441 | struct iwl_bt_iterator_data data = { |
| @@ -654,22 +539,6 @@ void iwl_mvm_rx_bt_coex_old_notif(struct iwl_mvm *mvm, · 97 unmodified lines | ||
| 654 | 539 | iwl_mvm_bt_coex_notif_handle(mvm); |
| 655 | 540 | } |
| 656 | 541 | |
| 657 | −void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, | |
| 658 | − struct iwl_rx_cmd_buffer *rxb) | |
| 659 | −{ | |
| 660 | − const struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
| 661 | − const struct iwl_bt_coex_profile_notif *notif = (const void *)pkt->data; | |
| 662 | − | |
| 663 | − lockdep_assert_held(&mvm->mutex); | |
| 664 | − | |
| 665 | − mvm->last_bt_wifi_loss = *notif; | |
| 666 | − | |
| 667 | − ieee80211_iterate_active_interfaces(mvm->hw, | |
| 668 | − IEEE80211_IFACE_ITER_NORMAL, | |
| 669 | − iwl_mvm_bt_coex_notif_iterator, | |
| 670 | − mvm); | |
| 671 | −} | |
| 672 | − | |
| 673 | 542 | void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 674 | 543 | enum ieee80211_rssi_event_data rssi_event) |
| 675 | 544 | { |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2013-2015 Intel Mobile Communications GmbH |
| 4 | − * Copyright (C) 2013-2014, 2018-2024 Intel Corporation | |
| 4 | + * Copyright (C) 2013-2014, 2018-2025 Intel Corporation | |
| 5 | 5 | * Copyright (C) 2015 Intel Deutschland GmbH |
| 6 | 6 | */ |
| 7 | 7 | #ifndef __MVM_CONSTANTS_H |
| @@ -11,15 +11,7 @@ · 3 unmodified lines | ||
| 11 | 11 | #include "fw-api.h" |
| 12 | 12 | |
| 13 | 13 | #define IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM 20 |
| 14 | −#define IWL_MVM_BT_COEX_DISABLE_ESR_THRESH 69 | |
| 15 | −#define IWL_MVM_BT_COEX_ENABLE_ESR_THRESH 63 | |
| 16 | −#define IWL_MVM_BT_COEX_WIFI_LOSS_THRESH 0 | |
| 17 | 14 | #define IWL_MVM_TRIGGER_LINK_SEL_TIME_SEC 30 |
| 18 | −#define IWL_MVM_TPT_COUNT_WINDOW_SEC 5 | |
| 19 | −#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS 5 | |
| 20 | −#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH 15 | |
| 21 | −#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED 11 | |
| 22 | −#define IWL_MVM_LOW_RSSI_MLO_SCAN_THRESH -72 | |
| 23 | 15 | |
| 24 | 16 | #define IWL_MVM_DEFAULT_PS_TX_DATA_TIMEOUT (100 * USEC_PER_MSEC) |
| 25 | 17 | #define IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * USEC_PER_MSEC) |
| @@ -129,14 +121,4 @@ · 103 unmodified lines | ||
| 129 | 121 | #define IWL_MVM_MIN_BEACON_INTERVAL_TU 16 |
| 130 | 122 | #define IWL_MVM_AUTO_EML_ENABLE true |
| 131 | 123 | |
| 132 | −#define IWL_MVM_HIGH_RSSI_THRESH_20MHZ -67 | |
| 133 | −#define IWL_MVM_LOW_RSSI_THRESH_20MHZ -71 | |
| 134 | −#define IWL_MVM_HIGH_RSSI_THRESH_40MHZ -64 | |
| 135 | −#define IWL_MVM_LOW_RSSI_THRESH_40MHZ -67 | |
| 136 | −#define IWL_MVM_HIGH_RSSI_THRESH_80MHZ -61 | |
| 137 | −#define IWL_MVM_LOW_RSSI_THRESH_80MHZ -74 | |
| 138 | −#define IWL_MVM_HIGH_RSSI_THRESH_160MHZ -58 | |
| 139 | −#define IWL_MVM_LOW_RSSI_THRESH_160MHZ -61 | |
| 140 | − | |
| 141 | −#define IWL_MVM_ENTER_ESR_TPT_THRESH 400 | |
| 142 | 124 | #endif /* __MVM_CONSTANTS_H */ |
| @@ -928,6 +928,10 @@ iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm, · 927 unmodified lines | ||
| 928 | 928 | if (ap_sta->mfp) |
| 929 | 929 | wowlan_config_cmd->flags |= IS_11W_ASSOC; |
| 930 | 930 | |
| 931 | + if (rcu_access_pointer(mvmvif->bcn_prot.keys[0]) || | |
| 932 | + rcu_access_pointer(mvmvif->bcn_prot.keys[1])) | |
| 933 | + wowlan_config_cmd->flags |= HAS_BEACON_PROTECTION; | |
| 934 | + | |
| 931 | 935 | if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) < 6) { |
| 932 | 936 | /* Query the last used seqno and set it */ |
| 933 | 937 | int ret = iwl_mvm_get_last_nonqos_seq(mvm, vif); |
| @@ -1238,15 +1242,14 @@ static void iwl_mvm_free_nd(struct iwl_mvm *mvm) · 304 unmodified lines | ||
| 1238 | 1242 | } |
| 1239 | 1243 | |
| 1240 | 1244 | static int __iwl_mvm_suspend(struct ieee80211_hw *hw, |
| 1241 | − struct cfg80211_wowlan *wowlan, | |
| 1242 | − bool test) | |
| 1245 | + struct cfg80211_wowlan *wowlan) | |
| 1243 | 1246 | { |
| 1244 | 1247 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 1245 | 1248 | struct ieee80211_vif *vif = NULL; |
| 1246 | 1249 | struct iwl_mvm_vif *mvmvif = NULL; |
| 1247 | 1250 | struct ieee80211_sta *ap_sta = NULL; |
| 1248 | 1251 | struct iwl_mvm_vif_link_info *mvm_link; |
| 1249 | − struct iwl_d3_manager_config d3_cfg_cmd_data = { | |
| 1252 | + struct iwl_d3_manager_config d3_cfg_cmd = { | |
| 1250 | 1253 | /* |
| 1251 | 1254 | * Program the minimum sleep time to 10 seconds, as many |
| 1252 | 1255 | * platforms have issues processing a wakeup signal while |
| @@ -1254,23 +1257,14 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 1 unmodified line | ||
| 1254 | 1257 | */ |
| 1255 | 1258 | .min_sleep_time = cpu_to_le32(10 * 1000 * 1000), |
| 1256 | 1259 | }; |
| 1257 | − struct iwl_host_cmd d3_cfg_cmd = { | |
| 1258 | − .id = D3_CONFIG_CMD, | |
| 1259 | − .flags = CMD_WANT_SKB, | |
| 1260 | − .data[0] = &d3_cfg_cmd_data, | |
| 1261 | − .len[0] = sizeof(d3_cfg_cmd_data), | |
| 1262 | − }; | |
| 1263 | 1260 | int ret; |
| 1264 | 1261 | int len __maybe_unused; |
| 1265 | 1262 | bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, |
| 1266 | 1263 | IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); |
| 1267 | 1264 | |
| 1268 | 1265 | if (!wowlan) { |
| 1269 | − /* | |
| 1270 | − * mac80211 shouldn't get here, but for D3 test | |
| 1271 | − * it doesn't warrant a warning | |
| 1272 | − */ | |
| 1273 | − WARN_ON(!test); | |
| 1266 | + /* mac80211 shouldn't get here */ | |
| 1267 | + WARN_ON(1); | |
| 1274 | 1268 | return -EINVAL; |
| 1275 | 1269 | } |
| 1276 | 1270 | |
| @@ -1278,10 +1272,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 1 unmodified line | ||
| 1278 | 1272 | if (IS_ERR_OR_NULL(vif)) |
| 1279 | 1273 | return 1; |
| 1280 | 1274 | |
| 1281 | − ret = iwl_mvm_block_esr_sync(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); | |
| 1282 | − if (ret) | |
| 1283 | − return ret; | |
| 1284 | − | |
| 1285 | 1275 | mutex_lock(&mvm->mutex); |
| 1286 | 1276 | |
| 1287 | 1277 | set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); |
| @@ -1351,7 +1341,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 63 unmodified lines | ||
| 1351 | 1341 | |
| 1352 | 1342 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 1353 | 1343 | if (mvm->d3_wake_sysassert) |
| 1354 | − d3_cfg_cmd_data.wakeup_flags |= | |
| 1344 | + d3_cfg_cmd.wakeup_flags |= | |
| 1355 | 1345 | cpu_to_le32(IWL_WAKEUP_D3_CONFIG_FW_ERROR); |
| 1356 | 1346 | #endif |
| 1357 | 1347 | |
| @@ -1364,21 +1354,14 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 6 unmodified lines | ||
| 1364 | 1354 | iwl_fw_dbg_stop_restart_recording(&mvm->fwrt, NULL, true); |
| 1365 | 1355 | |
| 1366 | 1356 | /* must be last -- this switches firmware state */ |
| 1367 | − ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); | |
| 1357 | + ret = iwl_mvm_send_cmd_pdu(mvm, D3_CONFIG_CMD, 0, sizeof(d3_cfg_cmd), | |
| 1358 | + &d3_cfg_cmd); | |
| 1368 | 1359 | if (ret) |
| 1369 | 1360 | goto out; |
| 1370 | −#ifdef CONFIG_IWLWIFI_DEBUGFS | |
| 1371 | − len = iwl_rx_packet_payload_len(d3_cfg_cmd.resp_pkt); | |
| 1372 | − if (len >= sizeof(u32)) { | |
| 1373 | − mvm->d3_test_pme_ptr = | |
| 1374 | − le32_to_cpup((__le32 *)d3_cfg_cmd.resp_pkt->data); | |
| 1375 | − } | |
| 1376 | −#endif | |
| 1377 | − iwl_free_resp(&d3_cfg_cmd); | |
| 1378 | 1361 | |
| 1379 | 1362 | clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); |
| 1380 | 1363 | |
| 1381 | − ret = iwl_trans_d3_suspend(mvm->trans, test, !unified_image); | |
| 1364 | + ret = iwl_trans_d3_suspend(mvm->trans, !unified_image); | |
| 1382 | 1365 | out: |
| 1383 | 1366 | if (ret < 0) { |
| 1384 | 1367 | iwl_mvm_free_nd(mvm); |
| @@ -1401,7 +1384,7 @@ int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 16 unmodified lines | ||
| 1401 | 1384 | iwl_fw_runtime_suspend(&mvm->fwrt); |
| 1402 | 1385 | mutex_unlock(&mvm->mutex); |
| 1403 | 1386 | |
| 1404 | − return __iwl_mvm_suspend(hw, wowlan, false); | |
| 1387 | + return __iwl_mvm_suspend(hw, wowlan); | |
| 1405 | 1388 | } |
| 1406 | 1389 | |
| 1407 | 1390 | struct iwl_multicast_key_data { |
| @@ -1794,63 +1777,8 @@ static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, · 386 unmodified lines | ||
| 1794 | 1777 | struct iwl_mvm_d3_gtk_iter_data { |
| 1795 | 1778 | struct iwl_mvm *mvm; |
| 1796 | 1779 | struct iwl_wowlan_status_data *status; |
| 1797 | − u32 gtk_cipher, igtk_cipher, bigtk_cipher; | |
| 1798 | − bool unhandled_cipher, igtk_support, bigtk_support; | |
| 1799 | − int num_keys; | |
| 1800 | 1780 | }; |
| 1801 | 1781 | |
| 1802 | −static void iwl_mvm_d3_find_last_keys(struct ieee80211_hw *hw, | |
| 1803 | − struct ieee80211_vif *vif, | |
| 1804 | − struct ieee80211_sta *sta, | |
| 1805 | − struct ieee80211_key_conf *key, | |
| 1806 | − void *_data) | |
| 1807 | −{ | |
| 1808 | − struct iwl_mvm_d3_gtk_iter_data *data = _data; | |
| 1809 | − int link_id = vif->active_links ? __ffs(vif->active_links) : -1; | |
| 1810 | − | |
| 1811 | − if (link_id >= 0 && key->link_id >= 0 && link_id != key->link_id) | |
| 1812 | − return; | |
| 1813 | − | |
| 1814 | − if (data->unhandled_cipher) | |
| 1815 | − return; | |
| 1816 | − | |
| 1817 | − switch (key->cipher) { | |
| 1818 | − case WLAN_CIPHER_SUITE_WEP40: | |
| 1819 | − case WLAN_CIPHER_SUITE_WEP104: | |
| 1820 | − /* ignore WEP completely, nothing to do */ | |
| 1821 | − return; | |
| 1822 | − case WLAN_CIPHER_SUITE_CCMP: | |
| 1823 | − case WLAN_CIPHER_SUITE_GCMP: | |
| 1824 | − case WLAN_CIPHER_SUITE_GCMP_256: | |
| 1825 | − case WLAN_CIPHER_SUITE_TKIP: | |
| 1826 | − /* we support these */ | |
| 1827 | − data->gtk_cipher = key->cipher; | |
| 1828 | − break; | |
| 1829 | − case WLAN_CIPHER_SUITE_BIP_GMAC_128: | |
| 1830 | − case WLAN_CIPHER_SUITE_BIP_GMAC_256: | |
| 1831 | − case WLAN_CIPHER_SUITE_BIP_CMAC_256: | |
| 1832 | − case WLAN_CIPHER_SUITE_AES_CMAC: | |
| 1833 | − /* we support these */ | |
| 1834 | − if (data->igtk_support && | |
| 1835 | − (key->keyidx == 4 || key->keyidx == 5)) { | |
| 1836 | − data->igtk_cipher = key->cipher; | |
| 1837 | − } else if (data->bigtk_support && | |
| 1838 | − (key->keyidx == 6 || key->keyidx == 7)) { | |
| 1839 | − data->bigtk_cipher = key->cipher; | |
| 1840 | − } else { | |
| 1841 | − data->unhandled_cipher = true; | |
| 1842 | − return; | |
| 1843 | − } | |
| 1844 | − break; | |
| 1845 | − default: | |
| 1846 | − /* everything else - disconnect from AP */ | |
| 1847 | − data->unhandled_cipher = true; | |
| 1848 | − return; | |
| 1849 | − } | |
| 1850 | − | |
| 1851 | − data->num_keys++; | |
| 1852 | −} | |
| 1853 | − | |
| 1854 | 1782 | static void |
| 1855 | 1783 | iwl_mvm_d3_set_igtk_bigtk_ipn(const struct iwl_multicast_key_data *key, |
| 1856 | 1784 | struct ieee80211_key_seq *seq, u32 cipher) |
| @@ -1896,9 +1824,6 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw, · 39 unmodified lines | ||
| 1896 | 1824 | if (link_id >= 0 && key->link_id >= 0 && link_id != key->link_id) |
| 1897 | 1825 | return; |
| 1898 | 1826 | |
| 1899 | − if (data->unhandled_cipher) | |
| 1900 | − return; | |
| 1901 | − | |
| 1902 | 1827 | switch (key->cipher) { |
| 1903 | 1828 | case WLAN_CIPHER_SUITE_WEP40: |
| 1904 | 1829 | case WLAN_CIPHER_SUITE_WEP104: |
| @@ -1947,52 +1872,24 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw, · 42 unmodified lines | ||
| 1947 | 1872 | |
| 1948 | 1873 | static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status, |
| 1949 | 1874 | struct ieee80211_vif *vif, |
| 1950 | − struct iwl_mvm *mvm, u32 gtk_cipher) | |
| 1875 | + struct iwl_mvm *mvm) | |
| 1951 | 1876 | { |
| 1952 | 1877 | int i, j; |
| 1953 | 1878 | struct ieee80211_key_conf *key; |
| 1954 | − DEFINE_RAW_FLEX(struct ieee80211_key_conf, conf, key, | |
| 1955 | − WOWLAN_KEY_MAX_SIZE); | |
| 1956 | 1879 | int link_id = vif->active_links ? __ffs(vif->active_links) : -1; |
| 1957 | − u8 key_data[WOWLAN_KEY_MAX_SIZE]; | |
| 1958 | − | |
| 1959 | − conf->cipher = gtk_cipher; | |
| 1960 | − | |
| 1961 | − BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP); | |
| 1962 | − BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_CCMP); | |
| 1963 | − BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_GCMP_256); | |
| 1964 | − BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_TKIP); | |
| 1965 | − BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < sizeof(status->gtk[0].key)); | |
| 1966 | − | |
| 1967 | − switch (gtk_cipher) { | |
| 1968 | − case WLAN_CIPHER_SUITE_CCMP: | |
| 1969 | − case WLAN_CIPHER_SUITE_GCMP: | |
| 1970 | − conf->keylen = WLAN_KEY_LEN_CCMP; | |
| 1971 | − break; | |
| 1972 | − case WLAN_CIPHER_SUITE_GCMP_256: | |
| 1973 | − conf->keylen = WLAN_KEY_LEN_GCMP_256; | |
| 1974 | − break; | |
| 1975 | − case WLAN_CIPHER_SUITE_TKIP: | |
| 1976 | − conf->keylen = WLAN_KEY_LEN_TKIP; | |
| 1977 | − break; | |
| 1978 | − default: | |
| 1979 | − WARN_ON(1); | |
| 1980 | − } | |
| 1981 | 1880 | |
| 1982 | 1881 | for (i = 0; i < ARRAY_SIZE(status->gtk); i++) { |
| 1983 | 1882 | if (!status->gtk[i].len) |
| 1984 | 1883 | continue; |
| 1985 | 1884 | |
| 1986 | − conf->keyidx = status->gtk[i].id; | |
| 1987 | 1885 | IWL_DEBUG_WOWLAN(mvm, |
| 1988 | − "Received from FW GTK cipher %d, key index %d\n", | |
| 1989 | − conf->cipher, conf->keyidx); | |
| 1990 | − memcpy(conf->key, status->gtk[i].key, | |
| 1991 | − sizeof(status->gtk[i].key)); | |
| 1992 | − memcpy(key_data, status->gtk[i].key, sizeof(status->gtk[i].key)); | |
| 1993 | − | |
| 1994 | − key = ieee80211_gtk_rekey_add(vif, status->gtk[i].id, key_data, | |
| 1995 | − sizeof(key_data), link_id); | |
| 1886 | + "Received from FW GTK: key index %d\n", | |
| 1887 | + status->gtk[i].id); | |
| 1888 | + | |
| 1889 | + key = ieee80211_gtk_rekey_add(vif, status->gtk[i].id, | |
| 1890 | + status->gtk[i].key, | |
| 1891 | + sizeof(status->gtk[i].key), | |
| 1892 | + link_id); | |
| 1996 | 1893 | if (IS_ERR(key)) { |
| 1997 | 1894 | /* FW may send also the old keys */ |
| 1998 | 1895 | if (PTR_ERR(key) == -EALREADY) |
| @@ -2015,53 +1912,26 @@ static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status, · 16 unmodified lines | ||
| 2015 | 1912 | |
| 2016 | 1913 | static bool |
| 2017 | 1914 | iwl_mvm_d3_igtk_bigtk_rekey_add(struct iwl_wowlan_status_data *status, |
| 2018 | − struct ieee80211_vif *vif, u32 cipher, | |
| 1915 | + struct ieee80211_vif *vif, | |
| 2019 | 1916 | struct iwl_multicast_key_data *key_data) |
| 2020 | 1917 | { |
| 2021 | 1918 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 2022 | − DEFINE_RAW_FLEX(struct ieee80211_key_conf, conf, key, | |
| 2023 | − WOWLAN_KEY_MAX_SIZE); | |
| 2024 | 1919 | struct ieee80211_key_conf *key_config; |
| 2025 | 1920 | struct ieee80211_key_seq seq; |
| 2026 | 1921 | int link_id = vif->active_links ? __ffs(vif->active_links) : -1; |
| 2027 | − u8 key[WOWLAN_KEY_MAX_SIZE]; | |
| 2028 | 1922 | s8 keyidx = key_data->id; |
| 2029 | 1923 | |
| 2030 | − conf->cipher = cipher; | |
| 2031 | − conf->keyidx = keyidx; | |
| 2032 | − | |
| 2033 | 1924 | if (!key_data->len) |
| 2034 | 1925 | return true; |
| 2035 | 1926 | |
| 2036 | − iwl_mvm_d3_set_igtk_bigtk_ipn(key_data, &seq, conf->cipher); | |
| 2037 | − | |
| 2038 | − switch (cipher) { | |
| 2039 | − case WLAN_CIPHER_SUITE_BIP_GMAC_128: | |
| 2040 | − conf->keylen = WLAN_KEY_LEN_BIP_GMAC_128; | |
| 2041 | − break; | |
| 2042 | − case WLAN_CIPHER_SUITE_BIP_GMAC_256: | |
| 2043 | − conf->keylen = WLAN_KEY_LEN_BIP_GMAC_256; | |
| 2044 | − break; | |
| 2045 | − case WLAN_CIPHER_SUITE_AES_CMAC: | |
| 2046 | − conf->keylen = WLAN_KEY_LEN_AES_CMAC; | |
| 2047 | − break; | |
| 2048 | − case WLAN_CIPHER_SUITE_BIP_CMAC_256: | |
| 2049 | − conf->keylen = WLAN_KEY_LEN_BIP_CMAC_256; | |
| 2050 | − break; | |
| 2051 | − default: | |
| 2052 | − WARN_ON(1); | |
| 2053 | − } | |
| 2054 | − BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < sizeof(key_data->key)); | |
| 2055 | − memcpy(conf->key, key_data->key, conf->keylen); | |
| 2056 | − | |
| 2057 | − memcpy(key, key_data->key, sizeof(key_data->key)); | |
| 2058 | − | |
| 2059 | − key_config = ieee80211_gtk_rekey_add(vif, keyidx, key, sizeof(key), | |
| 2060 | − link_id); | |
| 1927 | + key_config = ieee80211_gtk_rekey_add(vif, keyidx, key_data->key, | |
| 1928 | + sizeof(key_data->key), link_id); | |
| 2061 | 1929 | if (IS_ERR(key_config)) { |
| 2062 | 1930 | /* FW may send also the old keys */ |
| 2063 | 1931 | return PTR_ERR(key_config) == -EALREADY; |
| 2064 | 1932 | } |
| 1933 | + | |
| 1934 | + iwl_mvm_d3_set_igtk_bigtk_ipn(key_data, &seq, key_config->cipher); | |
| 2065 | 1935 | ieee80211_set_key_rx_seq(key_config, 0, &seq); |
| 2066 | 1936 | |
| 2067 | 1937 | if (keyidx == 4 || keyidx == 5) { |
| @@ -2115,27 +1985,6 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 47 unmodified lines | ||
| 2115 | 1985 | |
| 2116 | 1986 | if (!status || !vif->bss_conf.bssid) |
| 2117 | 1987 | return false; |
| 2118 | − | |
| 2119 | − if (iwl_mvm_lookup_wowlan_status_ver(mvm) > 6 || | |
| 2120 | − iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, | |
| 2121 | − WOWLAN_INFO_NOTIFICATION, | |
| 2122 | − 0)) | |
| 2123 | − gtkdata.igtk_support = true; | |
| 2124 | − | |
| 2125 | − if (iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, | |
| 2126 | − WOWLAN_INFO_NOTIFICATION, | |
| 2127 | − 0) >= 3) | |
| 2128 | − gtkdata.bigtk_support = true; | |
| 2129 | − | |
| 2130 | − /* find last GTK that we used initially, if any */ | |
| 2131 | − ieee80211_iter_keys(mvm->hw, vif, | |
| 2132 | − iwl_mvm_d3_find_last_keys, >kdata); | |
| 2133 | − /* not trying to keep connections with MFP/unhandled ciphers */ | |
| 2134 | − if (gtkdata.unhandled_cipher) | |
| 2135 | − return false; | |
| 2136 | − if (!gtkdata.num_keys) | |
| 2137 | − goto out; | |
| 2138 | − | |
| 2139 | 1988 | /* |
| 2140 | 1989 | * invalidate all other GTKs that might still exist and update |
| 2141 | 1990 | * the one that we used |
| @@ -2149,17 +1998,15 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 7 unmodified lines | ||
| 2149 | 1998 | IWL_DEBUG_WOWLAN(mvm, "num of GTK rekeying %d\n", |
| 2150 | 1999 | status->num_of_gtk_rekeys); |
| 2151 | 2000 | |
| 2152 | − if (!iwl_mvm_gtk_rekey(status, vif, mvm, gtkdata.gtk_cipher)) | |
| 2001 | + if (!iwl_mvm_gtk_rekey(status, vif, mvm)) | |
| 2153 | 2002 | return false; |
| 2154 | 2003 | |
| 2155 | 2004 | if (!iwl_mvm_d3_igtk_bigtk_rekey_add(status, vif, |
| 2156 | − gtkdata.igtk_cipher, | |
| 2157 | 2005 | &status->igtk)) |
| 2158 | 2006 | return false; |
| 2159 | 2007 | |
| 2160 | 2008 | for (i = 0; i < ARRAY_SIZE(status->bigtk); i++) { |
| 2161 | 2009 | if (!iwl_mvm_d3_igtk_bigtk_rekey_add(status, vif, |
| 2162 | − gtkdata.bigtk_cipher, | |
| 2163 | 2010 | &status->bigtk[i])) |
| 2164 | 2011 | return false; |
| 2165 | 2012 | } |
| @@ -2168,7 +2015,6 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 2 unmodified lines | ||
| 2168 | 2015 | (void *)&replay_ctr, GFP_KERNEL); |
| 2169 | 2016 | } |
| 2170 | 2017 | |
| 2171 | −out: | |
| 2172 | 2018 | if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, |
| 2173 | 2019 | WOWLAN_GET_STATUSES, |
| 2174 | 2020 | IWL_FW_CMD_VER_UNKNOWN) < 10) { |
| @@ -2236,7 +2082,7 @@ static void iwl_mvm_convert_gtk_v3(struct iwl_wowlan_status_data *status, · 61 unmodified lines | ||
| 2236 | 2082 | } |
| 2237 | 2083 | |
| 2238 | 2084 | static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, |
| 2239 | − struct iwl_wowlan_igtk_status *data) | |
| 2085 | + struct iwl_wowlan_igtk_status_v1 *data) | |
| 2240 | 2086 | { |
| 2241 | 2087 | int i; |
| 2242 | 2088 | |
| @@ -2260,7 +2106,7 @@ static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, · 17 unmodified lines | ||
| 2260 | 2106 | } |
| 2261 | 2107 | |
| 2262 | 2108 | static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status, |
| 2263 | − const struct iwl_wowlan_igtk_status *data) | |
| 2109 | + const struct iwl_wowlan_igtk_status_v1 *data) | |
| 2264 | 2110 | { |
| 2265 | 2111 | int data_idx, status_idx = 0; |
| 2266 | 2112 | |
| @@ -2291,7 +2137,7 @@ static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status, · 24 unmodified lines | ||
| 2291 | 2137 | } |
| 2292 | 2138 | |
| 2293 | 2139 | static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, |
| 2294 | − struct iwl_wowlan_info_notif *data, | |
| 2140 | + struct iwl_wowlan_info_notif_v5 *data, | |
| 2295 | 2141 | struct iwl_wowlan_status_data *status, |
| 2296 | 2142 | u32 len) |
| 2297 | 2143 | { |
| @@ -2727,7 +2573,6 @@ enum iwl_d3_notif { · 429 unmodified lines | ||
| 2727 | 2573 | /* manage d3 resume data */ |
| 2728 | 2574 | struct iwl_d3_data { |
| 2729 | 2575 | struct iwl_wowlan_status_data *status; |
| 2730 | − bool test; | |
| 2731 | 2576 | u32 d3_end_flags; |
| 2732 | 2577 | u32 notif_expected; /* bitmap - see &enum iwl_d3_notif */ |
| 2733 | 2578 | u32 notif_received; /* bitmap - see &enum iwl_d3_notif */ |
| @@ -2919,18 +2764,11 @@ iwl_mvm_choose_query_wakeup_reasons(struct iwl_mvm *mvm, · 185 unmodified lines | ||
| 2919 | 2764 | |
| 2920 | 2765 | if (mvm->net_detect) { |
| 2921 | 2766 | iwl_mvm_query_netdetect_reasons(mvm, vif, d3_data); |
| 2922 | − } else { | |
| 2923 | − bool keep = iwl_mvm_query_wakeup_reasons(mvm, vif, | |
| 2924 | − d3_data->status); | |
| 2925 | − | |
| 2926 | −#ifdef CONFIG_IWLWIFI_DEBUGFS | |
| 2927 | − if (keep) | |
| 2928 | − mvm->keep_vif = vif; | |
| 2929 | −#endif | |
| 2930 | − | |
| 2931 | − return keep; | |
| 2767 | + return false; | |
| 2932 | 2768 | } |
| 2933 | − return false; | |
| 2769 | + | |
| 2770 | + return iwl_mvm_query_wakeup_reasons(mvm, vif, | |
| 2771 | + d3_data->status); | |
| 2934 | 2772 | } |
| 2935 | 2773 | |
| 2936 | 2774 | #define IWL_WOWLAN_WAKEUP_REASON_HAS_WAKEUP_PKT (IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET | \ |
| @@ -3069,7 +2907,7 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 132 unmodified lines | ||
| 3069 | 2907 | iwl_mvm_parse_wowlan_info_notif_v3(mvm, notif, |
| 3070 | 2908 | d3_data->status, len); |
| 3071 | 2909 | } else if (wowlan_info_ver == 5) { |
| 3072 | − struct iwl_wowlan_info_notif *notif = | |
| 2910 | + struct iwl_wowlan_info_notif_v5 *notif = | |
| 3073 | 2911 | (void *)pkt->data; |
| 3074 | 2912 | |
| 3075 | 2913 | iwl_mvm_parse_wowlan_info_notif(mvm, notif, |
| @@ -3143,10 +2981,9 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 67 unmodified lines | ||
| 3143 | 2981 | return d3_data->notif_received == d3_data->notif_expected; |
| 3144 | 2982 | } |
| 3145 | 2983 | |
| 3146 | −static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test) | |
| 2984 | +static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm) | |
| 3147 | 2985 | { |
| 3148 | 2986 | int ret; |
| 3149 | − enum iwl_d3_status d3_status; | |
| 3150 | 2987 | struct iwl_host_cmd cmd = { |
| 3151 | 2988 | .id = D0I3_END_CMD, |
| 3152 | 2989 | .flags = CMD_WANT_SKB, |
| @@ -3154,15 +2991,10 @@ static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test) · 1 unmodified line | ||
| 3154 | 2991 | bool reset = fw_has_capa(&mvm->fw->ucode_capa, |
| 3155 | 2992 | IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); |
| 3156 | 2993 | |
| 3157 | − ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !reset); | |
| 2994 | + ret = iwl_trans_d3_resume(mvm->trans, !reset); | |
| 3158 | 2995 | if (ret) |
| 3159 | 2996 | return ret; |
| 3160 | 2997 | |
| 3161 | − if (d3_status != IWL_D3_STATUS_ALIVE) { | |
| 3162 | − IWL_INFO(mvm, "Device was reset during suspend\n"); | |
| 3163 | − return -ENOENT; | |
| 3164 | − } | |
| 3165 | − | |
| 3166 | 2998 | /* |
| 3167 | 2999 | * We should trigger resume flow using command only for 22000 family |
| 3168 | 3000 | * AX210 and above don't need the command since they have |
| @@ -3207,7 +3039,7 @@ static int iwl_mvm_d3_notif_wait(struct iwl_mvm *mvm, · 38 unmodified lines | ||
| 3207 | 3039 | ARRAY_SIZE(d3_resume_notif), |
| 3208 | 3040 | iwl_mvm_wait_d3_notif, d3_data); |
| 3209 | 3041 | |
| 3210 | − ret = iwl_mvm_resume_firmware(mvm, d3_data->test); | |
| 3042 | + ret = iwl_mvm_resume_firmware(mvm); | |
| 3211 | 3043 | if (ret) { |
| 3212 | 3044 | iwl_remove_notification(&mvm->notif_wait, &wait_d3_notif); |
| 3213 | 3045 | return ret; |
| @@ -3227,13 +3059,12 @@ static inline bool iwl_mvm_d3_resume_notif_based(struct iwl_mvm *mvm) · 13 unmodified lines | ||
| 3227 | 3059 | D3_END_NOTIFICATION, 0); |
| 3228 | 3060 | } |
| 3229 | 3061 | |
| 3230 | −static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) | |
| 3062 | +static int __iwl_mvm_resume(struct iwl_mvm *mvm) | |
| 3231 | 3063 | { |
| 3232 | 3064 | struct ieee80211_vif *vif = NULL; |
| 3233 | 3065 | int ret = 1; |
| 3234 | 3066 | struct iwl_mvm_nd_results results = {}; |
| 3235 | 3067 | struct iwl_d3_data d3_data = { |
| 3236 | − .test = test, | |
| 3237 | 3068 | .notif_expected = |
| 3238 | 3069 | IWL_D3_NOTIF_WOWLAN_INFO | |
| 3239 | 3070 | IWL_D3_NOTIF_D3_END_NOTIF, |
| @@ -3271,7 +3102,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) · 31 unmodified lines | ||
| 3271 | 3102 | |
| 3272 | 3103 | rt_status = iwl_mvm_check_rt_status(mvm, vif); |
| 3273 | 3104 | if (rt_status != FW_ALIVE) { |
| 3274 | − set_bit(STATUS_FW_ERROR, &mvm->trans->status); | |
| 3105 | + iwl_trans_notify_fw_error(mvm->trans); | |
| 3275 | 3106 | if (rt_status == FW_ERROR) { |
| 3276 | 3107 | IWL_ERR(mvm, "FW Error occurred during suspend. Restarting.\n"); |
| 3277 | 3108 | iwl_mvm_dump_nic_error_log(mvm); |
| @@ -3298,13 +3129,11 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) · 20 unmodified lines | ||
| 3298 | 3129 | if (ret) |
| 3299 | 3130 | goto err; |
| 3300 | 3131 | } else { |
| 3301 | − ret = iwl_mvm_resume_firmware(mvm, test); | |
| 3132 | + ret = iwl_mvm_resume_firmware(mvm); | |
| 3302 | 3133 | if (ret < 0) |
| 3303 | 3134 | goto err; |
| 3304 | 3135 | } |
| 3305 | 3136 | |
| 3306 | − iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); | |
| 3307 | − | |
| 3308 | 3137 | /* when reset is required we can't send these following commands */ |
| 3309 | 3138 | if (d3_data.d3_end_flags & IWL_D0I3_RESET_REQUIRE) |
| 3310 | 3139 | goto query_wakeup_reasons; |
| @@ -3346,7 +3175,7 @@ out: · 35 unmodified lines | ||
| 3346 | 3175 | kfree(d3_data.status); |
| 3347 | 3176 | iwl_mvm_free_nd(mvm); |
| 3348 | 3177 | |
| 3349 | − if (!d3_data.test && !mvm->net_detect) | |
| 3178 | + if (!mvm->net_detect) | |
| 3350 | 3179 | ieee80211_iterate_active_interfaces_mtx(mvm->hw, |
| 3351 | 3180 | IEEE80211_IFACE_ITER_NORMAL, |
| 3352 | 3181 | iwl_mvm_d3_disconnect_iter, |
| @@ -3385,7 +3214,7 @@ int iwl_mvm_resume(struct ieee80211_hw *hw) · 32 unmodified lines | ||
| 3385 | 3214 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 3386 | 3215 | int ret; |
| 3387 | 3216 | |
| 3388 | − ret = __iwl_mvm_resume(mvm, false); | |
| 3217 | + ret = __iwl_mvm_resume(mvm); | |
| 3389 | 3218 | |
| 3390 | 3219 | iwl_mvm_resume_tcm(mvm); |
| 3391 | 3220 | |
| @@ -3420,7 +3249,7 @@ void iwl_mvm_fast_suspend(struct iwl_mvm *mvm) · 28 unmodified lines | ||
| 3420 | 3249 | IWL_ERR(mvm, |
| 3421 | 3250 | "fast suspend: couldn't send D3_CONFIG_CMD %d\n", ret); |
| 3422 | 3251 | |
| 3423 | − ret = iwl_trans_d3_suspend(mvm->trans, false, false); | |
| 3252 | + ret = iwl_trans_d3_suspend(mvm->trans, false); | |
| 3424 | 3253 | if (ret) |
| 3425 | 3254 | IWL_ERR(mvm, "fast suspend: trans_d3_suspend failed %d\n", ret); |
| 3426 | 3255 | } |
| @@ -3443,7 +3272,7 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm) · 16 unmodified lines | ||
| 3443 | 3272 | |
| 3444 | 3273 | rt_status = iwl_mvm_check_rt_status(mvm, NULL); |
| 3445 | 3274 | if (rt_status != FW_ALIVE) { |
| 3446 | − set_bit(STATUS_FW_ERROR, &mvm->trans->status); | |
| 3275 | + iwl_trans_notify_fw_error(mvm->trans); | |
| 3447 | 3276 | if (rt_status == FW_ERROR) { |
| 3448 | 3277 | IWL_ERR(mvm, |
| 3449 | 3278 | "iwl_mvm_check_rt_status failed, device is gone during suspend\n"); |
| @@ -3455,7 +3284,6 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm) · 5 unmodified lines | ||
| 3455 | 3284 | &iwl_dump_desc_assert, |
| 3456 | 3285 | false, 0); |
| 3457 | 3286 | } |
| 3458 | − mvm->trans->state = IWL_TRANS_NO_FW; | |
| 3459 | 3287 | ret = -ENODEV; |
| 3460 | 3288 | |
| 3461 | 3289 | goto out; |
| @@ -3473,125 +3301,3 @@ out: · 11 unmodified lines | ||
| 3473 | 3301 | |
| 3474 | 3302 | return ret; |
| 3475 | 3303 | } |
| 3476 | − | |
| 3477 | −#ifdef CONFIG_IWLWIFI_DEBUGFS | |
| 3478 | −static int iwl_mvm_d3_test_open(struct inode *inode, struct file *file) | |
| 3479 | −{ | |
| 3480 | − struct iwl_mvm *mvm = inode->i_private; | |
| 3481 | − int err; | |
| 3482 | − | |
| 3483 | − if (mvm->d3_test_active) | |
| 3484 | − return -EBUSY; | |
| 3485 | − | |
| 3486 | − file->private_data = inode->i_private; | |
| 3487 | − | |
| 3488 | − iwl_mvm_pause_tcm(mvm, true); | |
| 3489 | − | |
| 3490 | − iwl_fw_runtime_suspend(&mvm->fwrt); | |
| 3491 | − | |
| 3492 | − /* start pseudo D3 */ | |
| 3493 | − rtnl_lock(); | |
| 3494 | − wiphy_lock(mvm->hw->wiphy); | |
| 3495 | − err = __iwl_mvm_suspend(mvm->hw, mvm->hw->wiphy->wowlan_config, true); | |
| 3496 | − wiphy_unlock(mvm->hw->wiphy); | |
| 3497 | − rtnl_unlock(); | |
| 3498 | − if (err > 0) | |
| 3499 | − err = -EINVAL; | |
| 3500 | − if (err) | |
| 3501 | − return err; | |
| 3502 | − | |
| 3503 | − mvm->d3_test_active = true; | |
| 3504 | − mvm->keep_vif = NULL; | |
| 3505 | − return 0; | |
| 3506 | −} | |
| 3507 | − | |
| 3508 | −static ssize_t iwl_mvm_d3_test_read(struct file *file, char __user *user_buf, | |
| 3509 | − size_t count, loff_t *ppos) | |
| 3510 | −{ | |
| 3511 | − struct iwl_mvm *mvm = file->private_data; | |
| 3512 | − unsigned long end = jiffies + 60 * HZ; | |
| 3513 | − u32 pme_asserted; | |
| 3514 | − | |
| 3515 | − while (true) { | |
| 3516 | − /* read pme_ptr if available */ | |
| 3517 | − if (mvm->d3_test_pme_ptr) { | |
| 3518 | − pme_asserted = iwl_trans_read_mem32(mvm->trans, | |
| 3519 | − mvm->d3_test_pme_ptr); | |
| 3520 | − if (pme_asserted) | |
| 3521 | − break; | |
| 3522 | − } | |
| 3523 | − | |
| 3524 | − if (msleep_interruptible(100)) | |
| 3525 | − break; | |
| 3526 | − | |
| 3527 | − if (time_is_before_jiffies(end)) { | |
| 3528 | − IWL_ERR(mvm, | |
| 3529 | − "ending pseudo-D3 with timeout after ~60 seconds\n"); | |
| 3530 | − return -ETIMEDOUT; | |
| 3531 | − } | |
| 3532 | − } | |
| 3533 | − | |
| 3534 | − return 0; | |
| 3535 | −} | |
| 3536 | − | |
| 3537 | −static void iwl_mvm_d3_test_disconn_work_iter(void *_data, u8 *mac, | |
| 3538 | − struct ieee80211_vif *vif) | |
| 3539 | −{ | |
| 3540 | − /* skip the one we keep connection on */ | |
| 3541 | − if (_data == vif) | |
| 3542 | − return; | |
| 3543 | − | |
| 3544 | − if (vif->type == NL80211_IFTYPE_STATION) | |
| 3545 | − ieee80211_connection_loss(vif); | |
| 3546 | −} | |
| 3547 | − | |
| 3548 | −static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file) | |
| 3549 | −{ | |
| 3550 | − struct iwl_mvm *mvm = inode->i_private; | |
| 3551 | − bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, | |
| 3552 | − IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); | |
| 3553 | − | |
| 3554 | − mvm->d3_test_active = false; | |
| 3555 | − | |
| 3556 | − iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); | |
| 3557 | − | |
| 3558 | − rtnl_lock(); | |
| 3559 | − wiphy_lock(mvm->hw->wiphy); | |
| 3560 | − __iwl_mvm_resume(mvm, true); | |
| 3561 | − wiphy_unlock(mvm->hw->wiphy); | |
| 3562 | − rtnl_unlock(); | |
| 3563 | − | |
| 3564 | − iwl_mvm_resume_tcm(mvm); | |
| 3565 | − | |
| 3566 | − iwl_fw_runtime_resume(&mvm->fwrt); | |
| 3567 | − | |
| 3568 | − iwl_abort_notification_waits(&mvm->notif_wait); | |
| 3569 | − if (!unified_image) { | |
| 3570 | − int remaining_time = 10; | |
| 3571 | − | |
| 3572 | − ieee80211_restart_hw(mvm->hw); | |
| 3573 | − | |
| 3574 | − /* wait for restart and disconnect all interfaces */ | |
| 3575 | − while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && | |
| 3576 | − remaining_time > 0) { | |
| 3577 | − remaining_time--; | |
| 3578 | − msleep(1000); | |
| 3579 | − } | |
| 3580 | − | |
| 3581 | − if (remaining_time == 0) | |
| 3582 | − IWL_ERR(mvm, "Timed out waiting for HW restart!\n"); | |
| 3583 | − } | |
| 3584 | − | |
| 3585 | − ieee80211_iterate_active_interfaces_atomic( | |
| 3586 | − mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | |
| 3587 | − iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif); | |
| 3588 | − | |
| 3589 | − return 0; | |
| 3590 | −} | |
| 3591 | − | |
| 3592 | −const struct file_operations iwl_dbgfs_d3_test_ops = { | |
| 3593 | − .open = iwl_mvm_d3_test_open, | |
| 3594 | − .read = iwl_mvm_d3_test_read, | |
| 3595 | − .release = iwl_mvm_d3_test_release, | |
| 3596 | −}; | |
| 3597 | −#endif | |
| @@ -762,96 +762,6 @@ static ssize_t iwl_dbgfs_max_tx_op_read(struct file *file, · 761 unmodified lines | ||
| 762 | 762 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | −static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif, | |
| 766 | − char *buf, size_t count, | |
| 767 | − loff_t *ppos) | |
| 768 | −{ | |
| 769 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 770 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 771 | − u32 action; | |
| 772 | − int ret; | |
| 773 | − | |
| 774 | − if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif)) | |
| 775 | − return -EINVAL; | |
| 776 | − | |
| 777 | − if (kstrtou32(buf, 0, &action)) | |
| 778 | − return -EINVAL; | |
| 779 | − | |
| 780 | − mutex_lock(&mvm->mutex); | |
| 781 | − | |
| 782 | − if (!action) { | |
| 783 | − ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false); | |
| 784 | − } else if (action == 1) { | |
| 785 | − ret = iwl_mvm_int_mlo_scan(mvm, vif); | |
| 786 | − } else { | |
| 787 | − ret = -EINVAL; | |
| 788 | − } | |
| 789 | − | |
| 790 | − mutex_unlock(&mvm->mutex); | |
| 791 | − | |
| 792 | − return ret ?: count; | |
| 793 | −} | |
| 794 | − | |
| 795 | −static ssize_t iwl_dbgfs_esr_disable_reason_read(struct file *file, | |
| 796 | − char __user *user_buf, | |
| 797 | − size_t count, loff_t *ppos) | |
| 798 | −{ | |
| 799 | − struct ieee80211_vif *vif = file->private_data; | |
| 800 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 801 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 802 | − unsigned long esr_mask; | |
| 803 | − char *buf; | |
| 804 | − int bufsz, pos, i; | |
| 805 | − ssize_t rv; | |
| 806 | − | |
| 807 | − mutex_lock(&mvm->mutex); | |
| 808 | − esr_mask = mvmvif->esr_disable_reason; | |
| 809 | − mutex_unlock(&mvm->mutex); | |
| 810 | − | |
| 811 | − bufsz = hweight32(esr_mask) * 32 + 40; | |
| 812 | − buf = kmalloc(bufsz, GFP_KERNEL); | |
| 813 | − if (!buf) | |
| 814 | − return -ENOMEM; | |
| 815 | − | |
| 816 | − pos = scnprintf(buf, bufsz, "EMLSR state: '0x%lx'\nreasons:\n", | |
| 817 | − esr_mask); | |
| 818 | − for_each_set_bit(i, &esr_mask, BITS_PER_LONG) | |
| 819 | − pos += scnprintf(buf + pos, bufsz - pos, " - %s\n", | |
| 820 | − iwl_get_esr_state_string(BIT(i))); | |
| 821 | − | |
| 822 | − rv = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | |
| 823 | − kfree(buf); | |
| 824 | − return rv; | |
| 825 | −} | |
| 826 | − | |
| 827 | −static ssize_t iwl_dbgfs_esr_disable_reason_write(struct ieee80211_vif *vif, | |
| 828 | − char *buf, size_t count, | |
| 829 | − loff_t *ppos) | |
| 830 | −{ | |
| 831 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 832 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 833 | − u32 reason; | |
| 834 | − u8 block; | |
| 835 | − int ret; | |
| 836 | − | |
| 837 | − ret = sscanf(buf, "%u %hhu", &reason, &block); | |
| 838 | − if (ret < 0) | |
| 839 | − return ret; | |
| 840 | − | |
| 841 | − if (hweight16(reason) != 1 || !(reason & IWL_MVM_BLOCK_ESR_REASONS)) | |
| 842 | − return -EINVAL; | |
| 843 | − | |
| 844 | − mutex_lock(&mvm->mutex); | |
| 845 | − if (block) | |
| 846 | − iwl_mvm_block_esr(mvm, vif, reason, | |
| 847 | − iwl_mvm_get_primary_link(vif)); | |
| 848 | − else | |
| 849 | − iwl_mvm_unblock_esr(mvm, vif, reason); | |
| 850 | − mutex_unlock(&mvm->mutex); | |
| 851 | − | |
| 852 | − return count; | |
| 853 | −} | |
| 854 | − | |
| 855 | 765 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
| 856 | 766 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
| 857 | 767 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
| @@ -884,8 +794,6 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10); · 26 unmodified lines | ||
| 884 | 794 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); |
| 885 | 795 | MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff); |
| 886 | 796 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(max_tx_op, 10); |
| 887 | −MVM_DEBUGFS_WRITE_FILE_OPS(int_mlo_scan, 32); | |
| 888 | −MVM_DEBUGFS_READ_WRITE_FILE_OPS(esr_disable_reason, 32); | |
| 889 | 797 | |
| 890 | 798 | void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
| 891 | 799 | { |
| @@ -916,8 +824,6 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) · 24 unmodified lines | ||
| 916 | 824 | MVM_DEBUGFS_ADD_FILE_VIF(max_tx_op, mvmvif->dbgfs_dir, 0600); |
| 917 | 825 | debugfs_create_bool("ftm_unprotected", 0200, mvmvif->dbgfs_dir, |
| 918 | 826 | &mvmvif->ftm_unprotected); |
| 919 | − MVM_DEBUGFS_ADD_FILE_VIF(int_mlo_scan, mvmvif->dbgfs_dir, 0200); | |
| 920 | − MVM_DEBUGFS_ADD_FILE_VIF(esr_disable_reason, mvmvif->dbgfs_dir, 0600); | |
| 921 | 827 | |
| 922 | 828 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
| 923 | 829 | mvmvif == mvm->bf_allowed_vif) |
| @@ -1134,7 +1134,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, · 1133 unmodified lines | ||
| 1134 | 1134 | |
| 1135 | 1135 | if (count == 6 && !strcmp(buf, "nolog\n")) { |
| 1136 | 1136 | set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status); |
| 1137 | − iwl_trans_suppress_cmd_error_once(mvm->trans); | |
| 1137 | + mvm->trans->suppress_cmd_error_once = true; | |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | 1140 | /* take the return value to make compiler happy - it will fail anyway */ |
| @@ -2159,7 +2159,6 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) · 1018 unmodified lines | ||
| 2159 | 2159 | MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR); |
| 2160 | 2160 | |
| 2161 | 2161 | #ifdef CONFIG_PM_SLEEP |
| 2162 | − MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, 0400); | |
| 2163 | 2162 | debugfs_create_bool("d3_wake_sysassert", 0600, mvm->debugfs_dir, |
| 2164 | 2163 | &mvm->d3_wake_sysassert); |
| 2165 | 2164 | debugfs_create_u32("last_netdetect_scans", 0400, mvm->debugfs_dir, |
| @@ -837,7 +837,7 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) · 836 unmodified lines | ||
| 837 | 837 | .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE), |
| 838 | 838 | }; |
| 839 | 839 | |
| 840 | − if (!mvm->trans->ltr_enabled) | |
| 840 | + if (!iwl_trans_is_ltr_enabled(mvm->trans)) | |
| 841 | 841 | return 0; |
| 842 | 842 | |
| 843 | 843 | return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, |
| @@ -5,50 +5,6 @@ · 4 unmodified lines | ||
| 5 | 5 | #include "mvm.h" |
| 6 | 6 | #include "time-event.h" |
| 7 | 7 | |
| 8 | −#define HANDLE_ESR_REASONS(HOW) \ | |
| 9 | − HOW(BLOCKED_PREVENTION) \ | |
| 10 | − HOW(BLOCKED_WOWLAN) \ | |
| 11 | − HOW(BLOCKED_TPT) \ | |
| 12 | − HOW(BLOCKED_FW) \ | |
| 13 | − HOW(BLOCKED_NON_BSS) \ | |
| 14 | − HOW(BLOCKED_ROC) \ | |
| 15 | − HOW(BLOCKED_TMP_NON_BSS) \ | |
| 16 | − HOW(EXIT_MISSED_BEACON) \ | |
| 17 | − HOW(EXIT_LOW_RSSI) \ | |
| 18 | − HOW(EXIT_COEX) \ | |
| 19 | − HOW(EXIT_BANDWIDTH) \ | |
| 20 | − HOW(EXIT_CSA) \ | |
| 21 | − HOW(EXIT_LINK_USAGE) | |
| 22 | − | |
| 23 | −static const char *const iwl_mvm_esr_states_names[] = { | |
| 24 | −#define NAME_ENTRY(x) [ilog2(IWL_MVM_ESR_##x)] = #x, | |
| 25 | − HANDLE_ESR_REASONS(NAME_ENTRY) | |
| 26 | −}; | |
| 27 | − | |
| 28 | −const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state) | |
| 29 | −{ | |
| 30 | − int offs = ilog2(state); | |
| 31 | − | |
| 32 | − if (offs >= ARRAY_SIZE(iwl_mvm_esr_states_names) || | |
| 33 | − !iwl_mvm_esr_states_names[offs]) | |
| 34 | − return "UNKNOWN"; | |
| 35 | − | |
| 36 | − return iwl_mvm_esr_states_names[offs]; | |
| 37 | −} | |
| 38 | − | |
| 39 | −static void iwl_mvm_print_esr_state(struct iwl_mvm *mvm, u32 mask) | |
| 40 | −{ | |
| 41 | −#define NAME_FMT(x) "%s" | |
| 42 | −#define NAME_PR(x) (mask & IWL_MVM_ESR_##x) ? "[" #x "]" : "", | |
| 43 | − IWL_DEBUG_INFO(mvm, | |
| 44 | − "EMLSR state = " HANDLE_ESR_REASONS(NAME_FMT) | |
| 45 | − " (0x%x)\n", | |
| 46 | − HANDLE_ESR_REASONS(NAME_PR) | |
| 47 | − mask); | |
| 48 | −#undef NAME_FMT | |
| 49 | −#undef NAME_PR | |
| 50 | −} | |
| 51 | − | |
| 52 | 8 | static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm, |
| 53 | 9 | struct iwl_link_config_cmd *cmd, |
| 54 | 10 | enum iwl_ctxt_action action) |
| @@ -114,65 +70,6 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 59 unmodified lines | ||
| 114 | 70 | return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_ADD); |
| 115 | 71 | } |
| 116 | 72 | |
| 117 | −struct iwl_mvm_esr_iter_data { | |
| 118 | − struct ieee80211_vif *vif; | |
| 119 | − unsigned int link_id; | |
| 120 | − bool lift_block; | |
| 121 | −}; | |
| 122 | − | |
| 123 | −static void iwl_mvm_esr_vif_iterator(void *_data, u8 *mac, | |
| 124 | − struct ieee80211_vif *vif) | |
| 125 | −{ | |
| 126 | − struct iwl_mvm_esr_iter_data *data = _data; | |
| 127 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 128 | − int link_id; | |
| 129 | − | |
| 130 | − if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_STATION) | |
| 131 | − return; | |
| 132 | − | |
| 133 | − for_each_mvm_vif_valid_link(mvmvif, link_id) { | |
| 134 | − struct iwl_mvm_vif_link_info *link_info = | |
| 135 | − mvmvif->link[link_id]; | |
| 136 | − if (vif == data->vif && link_id == data->link_id) | |
| 137 | − continue; | |
| 138 | − if (link_info->active) | |
| 139 | − data->lift_block = false; | |
| 140 | − } | |
| 141 | −} | |
| 142 | − | |
| 143 | −int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 144 | − unsigned int link_id, bool active) | |
| 145 | −{ | |
| 146 | − /* An active link of a non-station vif blocks EMLSR. Upon activation | |
| 147 | − * block EMLSR on the bss vif. Upon deactivation, check if this link | |
| 148 | − * was the last non-station link active, and if so unblock the bss vif | |
| 149 | − */ | |
| 150 | − struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); | |
| 151 | − struct iwl_mvm_esr_iter_data data = { | |
| 152 | − .vif = vif, | |
| 153 | − .link_id = link_id, | |
| 154 | − .lift_block = true, | |
| 155 | − }; | |
| 156 | − | |
| 157 | − if (IS_ERR_OR_NULL(bss_vif)) | |
| 158 | − return 0; | |
| 159 | − | |
| 160 | − if (active) | |
| 161 | − return iwl_mvm_block_esr_sync(mvm, bss_vif, | |
| 162 | − IWL_MVM_ESR_BLOCKED_NON_BSS); | |
| 163 | − | |
| 164 | − ieee80211_iterate_active_interfaces(mvm->hw, | |
| 165 | − IEEE80211_IFACE_ITER_NORMAL, | |
| 166 | − iwl_mvm_esr_vif_iterator, &data); | |
| 167 | − if (data.lift_block) { | |
| 168 | − mutex_lock(&mvm->mutex); | |
| 169 | − iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_NON_BSS); | |
| 170 | − mutex_unlock(&mvm->mutex); | |
| 171 | − } | |
| 172 | − | |
| 173 | − return 0; | |
| 174 | −} | |
| 175 | − | |
| 176 | 73 | int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 177 | 74 | struct ieee80211_bss_conf *link_conf, |
| 178 | 75 | u32 changes, bool active) |
| @@ -388,452 +285,6 @@ int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 209 unmodified lines | ||
| 388 | 285 | return ret; |
| 389 | 286 | } |
| 390 | 287 | |
| 391 | −struct iwl_mvm_rssi_to_grade { | |
| 392 | − s8 rssi[2]; | |
| 393 | − u16 grade; | |
| 394 | −}; | |
| 395 | − | |
| 396 | −#define RSSI_TO_GRADE_LINE(_lb, _hb_uhb, _grade) \ | |
| 397 | − { \ | |
| 398 | − .rssi = {_lb, _hb_uhb}, \ | |
| 399 | − .grade = _grade \ | |
| 400 | − } | |
| 401 | − | |
| 402 | −/* | |
| 403 | − * This array must be sorted by increasing RSSI for proper functionality. | |
| 404 | − * The grades are actually estimated throughput, represented as fixed-point | |
| 405 | − * with a scale factor of 1/10. | |
| 406 | − */ | |
| 407 | −static const struct iwl_mvm_rssi_to_grade rssi_to_grade_map[] = { | |
| 408 | − RSSI_TO_GRADE_LINE(-85, -89, 177), | |
| 409 | − RSSI_TO_GRADE_LINE(-83, -86, 344), | |
| 410 | − RSSI_TO_GRADE_LINE(-82, -85, 516), | |
| 411 | − RSSI_TO_GRADE_LINE(-80, -83, 688), | |
| 412 | − RSSI_TO_GRADE_LINE(-77, -79, 1032), | |
| 413 | − RSSI_TO_GRADE_LINE(-73, -76, 1376), | |
| 414 | − RSSI_TO_GRADE_LINE(-70, -74, 1548), | |
| 415 | − RSSI_TO_GRADE_LINE(-69, -72, 1750), | |
| 416 | − RSSI_TO_GRADE_LINE(-65, -68, 2064), | |
| 417 | − RSSI_TO_GRADE_LINE(-61, -66, 2294), | |
| 418 | − RSSI_TO_GRADE_LINE(-58, -61, 2580), | |
| 419 | − RSSI_TO_GRADE_LINE(-55, -58, 2868), | |
| 420 | − RSSI_TO_GRADE_LINE(-46, -55, 3098), | |
| 421 | − RSSI_TO_GRADE_LINE(-43, -54, 3442) | |
| 422 | −}; | |
| 423 | − | |
| 424 | −#define MAX_GRADE (rssi_to_grade_map[ARRAY_SIZE(rssi_to_grade_map) - 1].grade) | |
| 425 | − | |
| 426 | −#define DEFAULT_CHAN_LOAD_LB 30 | |
| 427 | −#define DEFAULT_CHAN_LOAD_HB 15 | |
| 428 | −#define DEFAULT_CHAN_LOAD_UHB 0 | |
| 429 | − | |
| 430 | −/* Factors calculation is done with fixed-point with a scaling factor of 1/256 */ | |
| 431 | −#define SCALE_FACTOR 256 | |
| 432 | − | |
| 433 | −/* Convert a percentage from [0,100] to [0,255] */ | |
| 434 | −#define NORMALIZE_PERCENT_TO_255(percentage) ((percentage) * SCALE_FACTOR / 100) | |
| 435 | − | |
| 436 | −static unsigned int | |
| 437 | −iwl_mvm_get_puncturing_factor(const struct ieee80211_bss_conf *link_conf) | |
| 438 | −{ | |
| 439 | − enum nl80211_chan_width chan_width = | |
| 440 | − link_conf->chanreq.oper.width; | |
| 441 | − int mhz = nl80211_chan_width_to_mhz(chan_width); | |
| 442 | − unsigned int n_subchannels, n_punctured, puncturing_penalty; | |
| 443 | − | |
| 444 | − if (WARN_ONCE(mhz < 20 || mhz > 320, | |
| 445 | − "Invalid channel width : (%d)\n", mhz)) | |
| 446 | − return SCALE_FACTOR; | |
| 447 | − | |
| 448 | − /* No puncturing, no penalty */ | |
| 449 | − if (mhz < 80) | |
| 450 | − return SCALE_FACTOR; | |
| 451 | − | |
| 452 | − /* total number of subchannels */ | |
| 453 | − n_subchannels = mhz / 20; | |
| 454 | − /* how many of these are punctured */ | |
| 455 | − n_punctured = hweight16(link_conf->chanreq.oper.punctured); | |
| 456 | − | |
| 457 | − puncturing_penalty = n_punctured * SCALE_FACTOR / n_subchannels; | |
| 458 | − return SCALE_FACTOR - puncturing_penalty; | |
| 459 | −} | |
| 460 | − | |
| 461 | −static unsigned int | |
| 462 | −iwl_mvm_get_chan_load(struct ieee80211_bss_conf *link_conf) | |
| 463 | −{ | |
| 464 | − struct ieee80211_vif *vif = link_conf->vif; | |
| 465 | − struct iwl_mvm_vif_link_info *mvm_link = | |
| 466 | − iwl_mvm_vif_from_mac80211(link_conf->vif)->link[link_conf->link_id]; | |
| 467 | − const struct element *bss_load_elem; | |
| 468 | − const struct ieee80211_bss_load_elem *bss_load; | |
| 469 | − enum nl80211_band band = link_conf->chanreq.oper.chan->band; | |
| 470 | − const struct cfg80211_bss_ies *ies; | |
| 471 | − unsigned int chan_load; | |
| 472 | − u32 chan_load_by_us; | |
| 473 | − | |
| 474 | − rcu_read_lock(); | |
| 475 | − if (ieee80211_vif_link_active(vif, link_conf->link_id)) | |
| 476 | − ies = rcu_dereference(link_conf->bss->beacon_ies); | |
| 477 | − else | |
| 478 | − ies = rcu_dereference(link_conf->bss->ies); | |
| 479 | − | |
| 480 | − if (ies) | |
| 481 | − bss_load_elem = cfg80211_find_elem(WLAN_EID_QBSS_LOAD, | |
| 482 | − ies->data, ies->len); | |
| 483 | − else | |
| 484 | − bss_load_elem = NULL; | |
| 485 | − | |
| 486 | − /* If there isn't BSS Load element, take the defaults */ | |
| 487 | − if (!bss_load_elem || | |
| 488 | − bss_load_elem->datalen != sizeof(*bss_load)) { | |
| 489 | − rcu_read_unlock(); | |
| 490 | − switch (band) { | |
| 491 | − case NL80211_BAND_2GHZ: | |
| 492 | − chan_load = DEFAULT_CHAN_LOAD_LB; | |
| 493 | − break; | |
| 494 | − case NL80211_BAND_5GHZ: | |
| 495 | − chan_load = DEFAULT_CHAN_LOAD_HB; | |
| 496 | − break; | |
| 497 | − case NL80211_BAND_6GHZ: | |
| 498 | − chan_load = DEFAULT_CHAN_LOAD_UHB; | |
| 499 | − break; | |
| 500 | − default: | |
| 501 | − chan_load = 0; | |
| 502 | − break; | |
| 503 | − } | |
| 504 | − /* The defaults are given in percentage */ | |
| 505 | − return NORMALIZE_PERCENT_TO_255(chan_load); | |
| 506 | − } | |
| 507 | − | |
| 508 | − bss_load = (const void *)bss_load_elem->data; | |
| 509 | − /* Channel util is in range 0-255 */ | |
| 510 | − chan_load = bss_load->channel_util; | |
| 511 | − rcu_read_unlock(); | |
| 512 | − | |
| 513 | − if (!mvm_link || !mvm_link->active) | |
| 514 | − return chan_load; | |
| 515 | − | |
| 516 | − if (WARN_ONCE(!mvm_link->phy_ctxt, | |
| 517 | − "Active link (%u) without phy ctxt assigned!\n", | |
| 518 | − link_conf->link_id)) | |
| 519 | − return chan_load; | |
| 520 | − | |
| 521 | − /* channel load by us is given in percentage */ | |
| 522 | − chan_load_by_us = | |
| 523 | − NORMALIZE_PERCENT_TO_255(mvm_link->phy_ctxt->channel_load_by_us); | |
| 524 | − | |
| 525 | − /* Use only values that firmware sends that can possibly be valid */ | |
| 526 | − if (chan_load_by_us <= chan_load) | |
| 527 | − chan_load -= chan_load_by_us; | |
| 528 | − | |
| 529 | − return chan_load; | |
| 530 | −} | |
| 531 | − | |
| 532 | −static unsigned int | |
| 533 | −iwl_mvm_get_chan_load_factor(struct ieee80211_bss_conf *link_conf) | |
| 534 | −{ | |
| 535 | − return SCALE_FACTOR - iwl_mvm_get_chan_load(link_conf); | |
| 536 | −} | |
| 537 | − | |
| 538 | −/* This function calculates the grade of a link. Returns 0 in error case */ | |
| 539 | −VISIBLE_IF_IWLWIFI_KUNIT | |
| 540 | −unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf) | |
| 541 | −{ | |
| 542 | − enum nl80211_band band; | |
| 543 | − int i, rssi_idx; | |
| 544 | − s32 link_rssi; | |
| 545 | − unsigned int grade = MAX_GRADE; | |
| 546 | − | |
| 547 | − if (WARN_ON_ONCE(!link_conf)) | |
| 548 | − return 0; | |
| 549 | − | |
| 550 | − band = link_conf->chanreq.oper.chan->band; | |
| 551 | − if (WARN_ONCE(band != NL80211_BAND_2GHZ && | |
| 552 | − band != NL80211_BAND_5GHZ && | |
| 553 | − band != NL80211_BAND_6GHZ, | |
| 554 | − "Invalid band (%u)\n", band)) | |
| 555 | − return 0; | |
| 556 | − | |
| 557 | − link_rssi = MBM_TO_DBM(link_conf->bss->signal); | |
| 558 | − /* | |
| 559 | − * For 6 GHz the RSSI of the beacons is lower than | |
| 560 | − * the RSSI of the data. | |
| 561 | − */ | |
| 562 | − if (band == NL80211_BAND_6GHZ) | |
| 563 | − link_rssi += 4; | |
| 564 | − | |
| 565 | − rssi_idx = band == NL80211_BAND_2GHZ ? 0 : 1; | |
| 566 | − | |
| 567 | − /* No valid RSSI - take the lowest grade */ | |
| 568 | − if (!link_rssi) | |
| 569 | − link_rssi = rssi_to_grade_map[0].rssi[rssi_idx]; | |
| 570 | − | |
| 571 | − /* Get grade based on RSSI */ | |
| 572 | − for (i = 0; i < ARRAY_SIZE(rssi_to_grade_map); i++) { | |
| 573 | − const struct iwl_mvm_rssi_to_grade *line = | |
| 574 | − &rssi_to_grade_map[i]; | |
| 575 | − | |
| 576 | − if (link_rssi > line->rssi[rssi_idx]) | |
| 577 | − continue; | |
| 578 | − grade = line->grade; | |
| 579 | − break; | |
| 580 | − } | |
| 581 | − | |
| 582 | − /* apply the channel load and puncturing factors */ | |
| 583 | − grade = grade * iwl_mvm_get_chan_load_factor(link_conf) / SCALE_FACTOR; | |
| 584 | − grade = grade * iwl_mvm_get_puncturing_factor(link_conf) / SCALE_FACTOR; | |
| 585 | − return grade; | |
| 586 | −} | |
| 587 | −EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_get_link_grade); | |
| 588 | − | |
| 589 | −static | |
| 590 | −u8 iwl_mvm_set_link_selection_data(struct ieee80211_vif *vif, | |
| 591 | − struct iwl_mvm_link_sel_data *data, | |
| 592 | − unsigned long usable_links, | |
| 593 | − u8 *best_link_idx) | |
| 594 | −{ | |
| 595 | − u8 n_data = 0; | |
| 596 | − u16 max_grade = 0; | |
| 597 | − unsigned long link_id; | |
| 598 | − | |
| 599 | − /* TODO: don't select links that weren't discovered in the last scan */ | |
| 600 | − for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { | |
| 601 | − struct ieee80211_bss_conf *link_conf = | |
| 602 | − link_conf_dereference_protected(vif, link_id); | |
| 603 | − | |
| 604 | − if (WARN_ON_ONCE(!link_conf)) | |
| 605 | − continue; | |
| 606 | − | |
| 607 | − data[n_data].link_id = link_id; | |
| 608 | − data[n_data].chandef = &link_conf->chanreq.oper; | |
| 609 | − data[n_data].signal = link_conf->bss->signal / 100; | |
| 610 | − data[n_data].grade = iwl_mvm_get_link_grade(link_conf); | |
| 611 | − | |
| 612 | − if (data[n_data].grade > max_grade) { | |
| 613 | − max_grade = data[n_data].grade; | |
| 614 | − *best_link_idx = n_data; | |
| 615 | − } | |
| 616 | − n_data++; | |
| 617 | − } | |
| 618 | − | |
| 619 | − return n_data; | |
| 620 | −} | |
| 621 | − | |
| 622 | −struct iwl_mvm_bw_to_rssi_threshs { | |
| 623 | − s8 low; | |
| 624 | − s8 high; | |
| 625 | −}; | |
| 626 | − | |
| 627 | −#define BW_TO_RSSI_THRESHOLDS(_bw) \ | |
| 628 | − [IWL_PHY_CHANNEL_MODE ## _bw] = { \ | |
| 629 | − .low = IWL_MVM_LOW_RSSI_THRESH_##_bw##MHZ, \ | |
| 630 | − .high = IWL_MVM_HIGH_RSSI_THRESH_##_bw##MHZ \ | |
| 631 | − } | |
| 632 | − | |
| 633 | −s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm, | |
| 634 | − const struct cfg80211_chan_def *chandef, | |
| 635 | − bool low) | |
| 636 | −{ | |
| 637 | − const struct iwl_mvm_bw_to_rssi_threshs bw_to_rssi_threshs_map[] = { | |
| 638 | − BW_TO_RSSI_THRESHOLDS(20), | |
| 639 | − BW_TO_RSSI_THRESHOLDS(40), | |
| 640 | − BW_TO_RSSI_THRESHOLDS(80), | |
| 641 | − BW_TO_RSSI_THRESHOLDS(160) | |
| 642 | − /* 320 MHz has the same thresholds as 20 MHz */ | |
| 643 | − }; | |
| 644 | − const struct iwl_mvm_bw_to_rssi_threshs *threshs; | |
| 645 | − u8 chan_width = iwl_mvm_get_channel_width(chandef); | |
| 646 | − | |
| 647 | − if (WARN_ON(chandef->chan->band != NL80211_BAND_2GHZ && | |
| 648 | − chandef->chan->band != NL80211_BAND_5GHZ && | |
| 649 | − chandef->chan->band != NL80211_BAND_6GHZ)) | |
| 650 | − return S8_MAX; | |
| 651 | − | |
| 652 | − /* 6 GHz will always use 20 MHz thresholds, regardless of the BW */ | |
| 653 | − if (chan_width == IWL_PHY_CHANNEL_MODE320) | |
| 654 | − chan_width = IWL_PHY_CHANNEL_MODE20; | |
| 655 | − | |
| 656 | − threshs = &bw_to_rssi_threshs_map[chan_width]; | |
| 657 | − | |
| 658 | − return low ? threshs->low : threshs->high; | |
| 659 | −} | |
| 660 | − | |
| 661 | −static u32 | |
| 662 | −iwl_mvm_esr_disallowed_with_link(struct iwl_mvm *mvm, | |
| 663 | − struct ieee80211_vif *vif, | |
| 664 | − const struct iwl_mvm_link_sel_data *link, | |
| 665 | − bool primary) | |
| 666 | −{ | |
| 667 | − struct wiphy *wiphy = mvm->hw->wiphy; | |
| 668 | − struct ieee80211_bss_conf *conf; | |
| 669 | − enum iwl_mvm_esr_state ret = 0; | |
| 670 | − s8 thresh; | |
| 671 | − | |
| 672 | − conf = wiphy_dereference(wiphy, vif->link_conf[link->link_id]); | |
| 673 | − if (WARN_ON_ONCE(!conf)) | |
| 674 | − return false; | |
| 675 | − | |
| 676 | − /* BT Coex effects eSR mode only if one of the links is on LB */ | |
| 677 | − if (link->chandef->chan->band == NL80211_BAND_2GHZ && | |
| 678 | − (!iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link->signal, | |
| 679 | − primary))) | |
| 680 | − ret |= IWL_MVM_ESR_EXIT_COEX; | |
| 681 | − | |
| 682 | − thresh = iwl_mvm_get_esr_rssi_thresh(mvm, link->chandef, | |
| 683 | − false); | |
| 684 | − | |
| 685 | − if (link->signal < thresh) | |
| 686 | − ret |= IWL_MVM_ESR_EXIT_LOW_RSSI; | |
| 687 | − | |
| 688 | − if (conf->csa_active) | |
| 689 | − ret |= IWL_MVM_ESR_EXIT_CSA; | |
| 690 | − | |
| 691 | − if (ret) { | |
| 692 | − IWL_DEBUG_INFO(mvm, | |
| 693 | − "Link %d is not allowed for esr\n", | |
| 694 | − link->link_id); | |
| 695 | − iwl_mvm_print_esr_state(mvm, ret); | |
| 696 | − } | |
| 697 | − return ret; | |
| 698 | −} | |
| 699 | − | |
| 700 | −VISIBLE_IF_IWLWIFI_KUNIT | |
| 701 | −bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif, | |
| 702 | − const struct iwl_mvm_link_sel_data *a, | |
| 703 | − const struct iwl_mvm_link_sel_data *b) | |
| 704 | −{ | |
| 705 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 706 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 707 | − enum iwl_mvm_esr_state ret = 0; | |
| 708 | − | |
| 709 | − /* Per-link considerations */ | |
| 710 | − if (iwl_mvm_esr_disallowed_with_link(mvm, vif, a, true) || | |
| 711 | − iwl_mvm_esr_disallowed_with_link(mvm, vif, b, false)) | |
| 712 | − return false; | |
| 713 | − | |
| 714 | − if (a->chandef->chan->band == b->chandef->chan->band || | |
| 715 | − a->chandef->width != b->chandef->width) | |
| 716 | − ret |= IWL_MVM_ESR_EXIT_BANDWIDTH; | |
| 717 | − | |
| 718 | − if (ret) { | |
| 719 | − IWL_DEBUG_INFO(mvm, | |
| 720 | − "Links %d and %d are not a valid pair for EMLSR\n", | |
| 721 | − a->link_id, b->link_id); | |
| 722 | − iwl_mvm_print_esr_state(mvm, ret); | |
| 723 | − return false; | |
| 724 | − } | |
| 725 | − | |
| 726 | − return true; | |
| 727 | − | |
| 728 | −} | |
| 729 | −EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_mld_valid_link_pair); | |
| 730 | − | |
| 731 | −/* | |
| 732 | − * Returns the combined eSR grade of two given links. | |
| 733 | − * Returns 0 if eSR is not allowed with these 2 links. | |
| 734 | − */ | |
| 735 | −static | |
| 736 | −unsigned int iwl_mvm_get_esr_grade(struct ieee80211_vif *vif, | |
| 737 | − const struct iwl_mvm_link_sel_data *a, | |
| 738 | − const struct iwl_mvm_link_sel_data *b, | |
| 739 | − u8 *primary_id) | |
| 740 | −{ | |
| 741 | − struct ieee80211_bss_conf *primary_conf; | |
| 742 | − struct wiphy *wiphy = ieee80211_vif_to_wdev(vif)->wiphy; | |
| 743 | − unsigned int primary_load; | |
| 744 | − | |
| 745 | − lockdep_assert_wiphy(wiphy); | |
| 746 | − | |
| 747 | − /* a is always primary, b is always secondary */ | |
| 748 | − if (b->grade > a->grade) | |
| 749 | − swap(a, b); | |
| 750 | − | |
| 751 | − *primary_id = a->link_id; | |
| 752 | − | |
| 753 | − if (!iwl_mvm_mld_valid_link_pair(vif, a, b)) | |
| 754 | − return 0; | |
| 755 | − | |
| 756 | − primary_conf = wiphy_dereference(wiphy, vif->link_conf[*primary_id]); | |
| 757 | − | |
| 758 | − if (WARN_ON_ONCE(!primary_conf)) | |
| 759 | − return 0; | |
| 760 | − | |
| 761 | − primary_load = iwl_mvm_get_chan_load(primary_conf); | |
| 762 | − | |
| 763 | − return a->grade + | |
| 764 | − ((b->grade * primary_load) / SCALE_FACTOR); | |
| 765 | −} | |
| 766 | − | |
| 767 | −void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |
| 768 | −{ | |
| 769 | − struct iwl_mvm_link_sel_data data[IEEE80211_MLD_MAX_NUM_LINKS]; | |
| 770 | − struct iwl_mvm_link_sel_data *best_link; | |
| 771 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 772 | − u32 max_active_links = iwl_mvm_max_active_links(mvm, vif); | |
| 773 | − u16 usable_links = ieee80211_vif_usable_links(vif); | |
| 774 | − u8 best, primary_link, best_in_pair, n_data; | |
| 775 | − u16 max_esr_grade = 0, new_active_links; | |
| 776 | − | |
| 777 | − lockdep_assert_wiphy(mvm->hw->wiphy); | |
| 778 | − | |
| 779 | − if (!mvmvif->authorized || !ieee80211_vif_is_mld(vif)) | |
| 780 | − return; | |
| 781 | − | |
| 782 | − if (!IWL_MVM_AUTO_EML_ENABLE) | |
| 783 | − return; | |
| 784 | − | |
| 785 | − /* The logic below is a simple version that doesn't suit more than 2 | |
| 786 | − * links | |
| 787 | − */ | |
| 788 | − WARN_ON_ONCE(max_active_links > 2); | |
| 789 | − | |
| 790 | − n_data = iwl_mvm_set_link_selection_data(vif, data, usable_links, | |
| 791 | − &best); | |
| 792 | − | |
| 793 | − if (WARN(!n_data, "Couldn't find a valid grade for any link!\n")) | |
| 794 | − return; | |
| 795 | − | |
| 796 | − best_link = &data[best]; | |
| 797 | − primary_link = best_link->link_id; | |
| 798 | − new_active_links = BIT(best_link->link_id); | |
| 799 | − | |
| 800 | − /* eSR is not supported/blocked, or only one usable link */ | |
| 801 | − if (max_active_links == 1 || !iwl_mvm_vif_has_esr_cap(mvm, vif) || | |
| 802 | − mvmvif->esr_disable_reason || n_data == 1) | |
| 803 | − goto set_active; | |
| 804 | − | |
| 805 | − for (u8 a = 0; a < n_data; a++) | |
| 806 | − for (u8 b = a + 1; b < n_data; b++) { | |
| 807 | − u16 esr_grade = iwl_mvm_get_esr_grade(vif, &data[a], | |
| 808 | − &data[b], | |
| 809 | − &best_in_pair); | |
| 810 | − | |
| 811 | − if (esr_grade <= max_esr_grade) | |
| 812 | − continue; | |
| 813 | − | |
| 814 | − max_esr_grade = esr_grade; | |
| 815 | − primary_link = best_in_pair; | |
| 816 | − new_active_links = BIT(data[a].link_id) | | |
| 817 | − BIT(data[b].link_id); | |
| 818 | − } | |
| 819 | − | |
| 820 | − /* No valid pair was found, go with the best link */ | |
| 821 | − if (hweight16(new_active_links) <= 1) | |
| 822 | − goto set_active; | |
| 823 | − | |
| 824 | − /* For equal grade - prefer EMLSR */ | |
| 825 | − if (best_link->grade > max_esr_grade) { | |
| 826 | − primary_link = best_link->link_id; | |
| 827 | − new_active_links = BIT(best_link->link_id); | |
| 828 | − } | |
| 829 | −set_active: | |
| 830 | − IWL_DEBUG_INFO(mvm, "Link selection result: 0x%x. Primary = %d\n", | |
| 831 | − new_active_links, primary_link); | |
| 832 | − ieee80211_set_active_links_async(vif, new_active_links); | |
| 833 | − mvmvif->link_selection_res = new_active_links; | |
| 834 | − mvmvif->link_selection_primary = primary_link; | |
| 835 | −} | |
| 836 | − | |
| 837 | 288 | u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif) |
| 838 | 289 | { |
| 839 | 290 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| @@ -856,266 +307,6 @@ u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif) · 16 unmodified lines | ||
| 856 | 307 | return __ffs(vif->active_links); |
| 857 | 308 | } |
| 858 | 309 | |
| 859 | −/* | |
| 860 | − * For non-MLO/single link, this will return the deflink/single active link, | |
| 861 | − * respectively | |
| 862 | − */ | |
| 863 | −u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id) | |
| 864 | −{ | |
| 865 | − switch (hweight16(vif->active_links)) { | |
| 866 | − case 0: | |
| 867 | − return 0; | |
| 868 | − default: | |
| 869 | − WARN_ON(1); | |
| 870 | − fallthrough; | |
| 871 | − case 1: | |
| 872 | − return __ffs(vif->active_links); | |
| 873 | − case 2: | |
| 874 | − return __ffs(vif->active_links & ~BIT(link_id)); | |
| 875 | − } | |
| 876 | −} | |
| 877 | − | |
| 878 | −/* Reasons that can cause esr prevention */ | |
| 879 | −#define IWL_MVM_ESR_PREVENT_REASONS IWL_MVM_ESR_EXIT_MISSED_BEACON | |
| 880 | −#define IWL_MVM_PREVENT_ESR_TIMEOUT (HZ * 400) | |
| 881 | −#define IWL_MVM_ESR_PREVENT_SHORT (HZ * 300) | |
| 882 | −#define IWL_MVM_ESR_PREVENT_LONG (HZ * 600) | |
| 883 | − | |
| 884 | −static bool iwl_mvm_check_esr_prevention(struct iwl_mvm *mvm, | |
| 885 | − struct iwl_mvm_vif *mvmvif, | |
| 886 | − enum iwl_mvm_esr_state reason) | |
| 887 | −{ | |
| 888 | − bool timeout_expired = time_after(jiffies, | |
| 889 | − mvmvif->last_esr_exit.ts + | |
| 890 | − IWL_MVM_PREVENT_ESR_TIMEOUT); | |
| 891 | − unsigned long delay; | |
| 892 | − | |
| 893 | − lockdep_assert_held(&mvm->mutex); | |
| 894 | − | |
| 895 | − /* Only handle reasons that can cause prevention */ | |
| 896 | − if (!(reason & IWL_MVM_ESR_PREVENT_REASONS)) | |
| 897 | − return false; | |
| 898 | − | |
| 899 | − /* | |
| 900 | − * Reset the counter if more than 400 seconds have passed between one | |
| 901 | − * exit and the other, or if we exited due to a different reason. | |
| 902 | − * Will also reset the counter after the long prevention is done. | |
| 903 | − */ | |
| 904 | − if (timeout_expired || mvmvif->last_esr_exit.reason != reason) { | |
| 905 | − mvmvif->exit_same_reason_count = 1; | |
| 906 | − return false; | |
| 907 | − } | |
| 908 | − | |
| 909 | − mvmvif->exit_same_reason_count++; | |
| 910 | − if (WARN_ON(mvmvif->exit_same_reason_count < 2 || | |
| 911 | − mvmvif->exit_same_reason_count > 3)) | |
| 912 | − return false; | |
| 913 | − | |
| 914 | − mvmvif->esr_disable_reason |= IWL_MVM_ESR_BLOCKED_PREVENTION; | |
| 915 | − | |
| 916 | − /* | |
| 917 | − * For the second exit, use a short prevention, and for the third one, | |
| 918 | − * use a long prevention. | |
| 919 | − */ | |
| 920 | − delay = mvmvif->exit_same_reason_count == 2 ? | |
| 921 | − IWL_MVM_ESR_PREVENT_SHORT : | |
| 922 | − IWL_MVM_ESR_PREVENT_LONG; | |
| 923 | − | |
| 924 | − IWL_DEBUG_INFO(mvm, | |
| 925 | − "Preventing EMLSR for %ld seconds due to %u exits with the reason = %s (0x%x)\n", | |
| 926 | − delay / HZ, mvmvif->exit_same_reason_count, | |
| 927 | − iwl_get_esr_state_string(reason), reason); | |
| 928 | − | |
| 929 | − wiphy_delayed_work_queue(mvm->hw->wiphy, | |
| 930 | − &mvmvif->prevent_esr_done_wk, delay); | |
| 931 | − return true; | |
| 932 | −} | |
| 933 | − | |
| 934 | −#define IWL_MVM_TRIGGER_LINK_SEL_TIME (IWL_MVM_TRIGGER_LINK_SEL_TIME_SEC * HZ) | |
| 935 | − | |
| 936 | −/* API to exit eSR mode */ | |
| 937 | −void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 938 | − enum iwl_mvm_esr_state reason, | |
| 939 | − u8 link_to_keep) | |
| 940 | −{ | |
| 941 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 942 | − u16 new_active_links; | |
| 943 | − bool prevented; | |
| 944 | − | |
| 945 | − lockdep_assert_held(&mvm->mutex); | |
| 946 | − | |
| 947 | − if (!IWL_MVM_AUTO_EML_ENABLE) | |
| 948 | − return; | |
| 949 | − | |
| 950 | − /* Nothing to do */ | |
| 951 | − if (!mvmvif->esr_active) | |
| 952 | − return; | |
| 953 | − | |
| 954 | − if (WARN_ON(!ieee80211_vif_is_mld(vif) || !mvmvif->authorized)) | |
| 955 | − return; | |
| 956 | − | |
| 957 | − if (WARN_ON(!(vif->active_links & BIT(link_to_keep)))) | |
| 958 | − link_to_keep = __ffs(vif->active_links); | |
| 959 | − | |
| 960 | − new_active_links = BIT(link_to_keep); | |
| 961 | − IWL_DEBUG_INFO(mvm, | |
| 962 | − "Exiting EMLSR. reason = %s (0x%x). Current active links=0x%x, new active links = 0x%x\n", | |
| 963 | − iwl_get_esr_state_string(reason), reason, | |
| 964 | − vif->active_links, new_active_links); | |
| 965 | − | |
| 966 | − ieee80211_set_active_links_async(vif, new_active_links); | |
| 967 | − | |
| 968 | − /* Prevent EMLSR if needed */ | |
| 969 | − prevented = iwl_mvm_check_esr_prevention(mvm, mvmvif, reason); | |
| 970 | − | |
| 971 | − /* Remember why and when we exited EMLSR */ | |
| 972 | − mvmvif->last_esr_exit.ts = jiffies; | |
| 973 | − mvmvif->last_esr_exit.reason = reason; | |
| 974 | − | |
| 975 | − /* | |
| 976 | − * If EMLSR is prevented now - don't try to get back to EMLSR. | |
| 977 | − * If we exited due to a blocking event, we will try to get back to | |
| 978 | − * EMLSR when the corresponding unblocking event will happen. | |
| 979 | − */ | |
| 980 | − if (prevented || reason & IWL_MVM_BLOCK_ESR_REASONS) | |
| 981 | − return; | |
| 982 | − | |
| 983 | − /* If EMLSR is not blocked - try enabling it again in 30 seconds */ | |
| 984 | − wiphy_delayed_work_queue(mvm->hw->wiphy, | |
| 985 | − &mvmvif->mlo_int_scan_wk, | |
| 986 | − round_jiffies_relative(IWL_MVM_TRIGGER_LINK_SEL_TIME)); | |
| 987 | −} | |
| 988 | − | |
| 989 | −void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 990 | − enum iwl_mvm_esr_state reason, | |
| 991 | − u8 link_to_keep) | |
| 992 | −{ | |
| 993 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 994 | − | |
| 995 | − lockdep_assert_held(&mvm->mutex); | |
| 996 | − | |
| 997 | − if (!IWL_MVM_AUTO_EML_ENABLE) | |
| 998 | − return; | |
| 999 | − | |
| 1000 | − /* This should be called only with disable reasons */ | |
| 1001 | − if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS))) | |
| 1002 | − return; | |
| 1003 | − | |
| 1004 | − if (mvmvif->esr_disable_reason & reason) | |
| 1005 | − return; | |
| 1006 | − | |
| 1007 | − IWL_DEBUG_INFO(mvm, | |
| 1008 | − "Blocking EMLSR mode. reason = %s (0x%x)\n", | |
| 1009 | − iwl_get_esr_state_string(reason), reason); | |
| 1010 | − | |
| 1011 | − mvmvif->esr_disable_reason |= reason; | |
| 1012 | − | |
| 1013 | − iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason); | |
| 1014 | − | |
| 1015 | − iwl_mvm_exit_esr(mvm, vif, reason, link_to_keep); | |
| 1016 | −} | |
| 1017 | − | |
| 1018 | −int iwl_mvm_block_esr_sync(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 1019 | − enum iwl_mvm_esr_state reason) | |
| 1020 | −{ | |
| 1021 | − int primary_link = iwl_mvm_get_primary_link(vif); | |
| 1022 | − int ret; | |
| 1023 | − | |
| 1024 | − if (!IWL_MVM_AUTO_EML_ENABLE || !ieee80211_vif_is_mld(vif)) | |
| 1025 | − return 0; | |
| 1026 | − | |
| 1027 | − /* This should be called only with blocking reasons */ | |
| 1028 | − if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS))) | |
| 1029 | − return 0; | |
| 1030 | − | |
| 1031 | − /* leave ESR immediately, not only async with iwl_mvm_block_esr() */ | |
| 1032 | − ret = ieee80211_set_active_links(vif, BIT(primary_link)); | |
| 1033 | − if (ret) | |
| 1034 | − return ret; | |
| 1035 | − | |
| 1036 | − mutex_lock(&mvm->mutex); | |
| 1037 | − /* only additionally block for consistency and to avoid concurrency */ | |
| 1038 | − iwl_mvm_block_esr(mvm, vif, reason, primary_link); | |
| 1039 | − mutex_unlock(&mvm->mutex); | |
| 1040 | − | |
| 1041 | − return 0; | |
| 1042 | −} | |
| 1043 | − | |
| 1044 | −static void iwl_mvm_esr_unblocked(struct iwl_mvm *mvm, | |
| 1045 | − struct ieee80211_vif *vif) | |
| 1046 | −{ | |
| 1047 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 1048 | − bool need_new_sel = time_after(jiffies, mvmvif->last_esr_exit.ts + | |
| 1049 | − IWL_MVM_TRIGGER_LINK_SEL_TIME); | |
| 1050 | − | |
| 1051 | − lockdep_assert_held(&mvm->mutex); | |
| 1052 | − | |
| 1053 | − if (!ieee80211_vif_is_mld(vif) || !mvmvif->authorized || | |
| 1054 | − mvmvif->esr_active) | |
| 1055 | − return; | |
| 1056 | − | |
| 1057 | − IWL_DEBUG_INFO(mvm, "EMLSR is unblocked\n"); | |
| 1058 | − | |
| 1059 | − /* If we exited due to an EXIT reason, and the exit was in less than | |
| 1060 | − * 30 seconds, then a MLO scan was scheduled already. | |
| 1061 | − */ | |
| 1062 | − if (!need_new_sel && | |
| 1063 | − !(mvmvif->last_esr_exit.reason & IWL_MVM_BLOCK_ESR_REASONS)) { | |
| 1064 | − IWL_DEBUG_INFO(mvm, "Wait for MLO scan\n"); | |
| 1065 | − return; | |
| 1066 | − } | |
| 1067 | − | |
| 1068 | − /* | |
| 1069 | − * If EMLSR was blocked for more than 30 seconds, or the last link | |
| 1070 | − * selection decided to not enter EMLSR, trigger a new scan. | |
| 1071 | − */ | |
| 1072 | − if (need_new_sel || hweight16(mvmvif->link_selection_res) < 2) { | |
| 1073 | − IWL_DEBUG_INFO(mvm, "Trigger MLO scan\n"); | |
| 1074 | − wiphy_delayed_work_queue(mvm->hw->wiphy, | |
| 1075 | − &mvmvif->mlo_int_scan_wk, 0); | |
| 1076 | − /* | |
| 1077 | − * If EMLSR was blocked for less than 30 seconds, and the last link | |
| 1078 | − * selection decided to use EMLSR, activate EMLSR using the previous | |
| 1079 | − * link selection result. | |
| 1080 | − */ | |
| 1081 | − } else { | |
| 1082 | − IWL_DEBUG_INFO(mvm, | |
| 1083 | − "Use the latest link selection result: 0x%x\n", | |
| 1084 | − mvmvif->link_selection_res); | |
| 1085 | − ieee80211_set_active_links_async(vif, | |
| 1086 | − mvmvif->link_selection_res); | |
| 1087 | − } | |
| 1088 | −} | |
| 1089 | − | |
| 1090 | −void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 1091 | − enum iwl_mvm_esr_state reason) | |
| 1092 | −{ | |
| 1093 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 1094 | − | |
| 1095 | − lockdep_assert_held(&mvm->mutex); | |
| 1096 | − | |
| 1097 | − if (!IWL_MVM_AUTO_EML_ENABLE) | |
| 1098 | − return; | |
| 1099 | − | |
| 1100 | − /* This should be called only with disable reasons */ | |
| 1101 | − if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS))) | |
| 1102 | − return; | |
| 1103 | − | |
| 1104 | − /* No Change */ | |
| 1105 | − if (!(mvmvif->esr_disable_reason & reason)) | |
| 1106 | − return; | |
| 1107 | − | |
| 1108 | − mvmvif->esr_disable_reason &= ~reason; | |
| 1109 | − | |
| 1110 | − IWL_DEBUG_INFO(mvm, | |
| 1111 | − "Unblocking EMLSR mode. reason = %s (0x%x)\n", | |
| 1112 | − iwl_get_esr_state_string(reason), reason); | |
| 1113 | − iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason); | |
| 1114 | − | |
| 1115 | − if (!mvmvif->esr_disable_reason) | |
| 1116 | − iwl_mvm_esr_unblocked(mvm, vif); | |
| 1117 | −} | |
| 1118 | − | |
| 1119 | 310 | void iwl_mvm_init_link(struct iwl_mvm_vif_link_info *link) |
| 1120 | 311 | { |
| 1121 | 312 | link->bcast_sta.sta_id = IWL_INVALID_STA; |
| @@ -1586,13 +1586,11 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 1585 unmodified lines | ||
| 1586 | 1586 | u32 id = le32_to_cpu(mb->link_id); |
| 1587 | 1587 | union iwl_dbg_tlv_tp_data tp_data = { .fw_pkt = pkt }; |
| 1588 | 1588 | u32 mac_type; |
| 1589 | − int link_id; | |
| 1590 | 1589 | u8 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, |
| 1591 | 1590 | MISSED_BEACONS_NOTIFICATION, |
| 1592 | 1591 | 0); |
| 1593 | 1592 | u8 new_notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, |
| 1594 | 1593 | MISSED_BEACONS_NOTIF, 0); |
| 1595 | − struct ieee80211_bss_conf *bss_conf; | |
| 1596 | 1594 | |
| 1597 | 1595 | /* If the firmware uses the new notification (from MAC_CONF_GROUP), |
| 1598 | 1596 | * refer to that notification's version. |
| @@ -1617,16 +1615,10 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 18 unmodified lines | ||
| 1617 | 1615 | if (!vif) |
| 1618 | 1616 | return; |
| 1619 | 1617 | |
| 1620 | − bss_conf = &vif->bss_conf; | |
| 1621 | − link_id = bss_conf->link_id; | |
| 1622 | 1618 | mac_type = iwl_mvm_get_mac_type(vif); |
| 1623 | 1619 | |
| 1624 | 1620 | IWL_DEBUG_INFO(mvm, "missed beacon mac_type=%u,\n", mac_type); |
| 1625 | 1621 | |
| 1626 | − mvm->trans->dbg.dump_file_name_ext_valid = true; | |
| 1627 | − snprintf(mvm->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME, | |
| 1628 | − "MacId_%d_MacType_%d", id, mac_type); | |
| 1629 | − | |
| 1630 | 1622 | rx_missed_bcon = le32_to_cpu(mb->consec_missed_beacons); |
| 1631 | 1623 | rx_missed_bcon_since_rx = |
| 1632 | 1624 | le32_to_cpu(mb->consec_missed_beacons_since_last_rx); |
| @@ -1644,41 +1636,11 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 11 unmodified lines | ||
| 1644 | 1636 | "missed_beacons:%d, missed_beacons_since_rx:%d\n", |
| 1645 | 1637 | rx_missed_bcon, rx_missed_bcon_since_rx); |
| 1646 | 1638 | } |
| 1647 | − } else if (link_id >= 0 && hweight16(vif->active_links) > 1) { | |
| 1648 | − u32 bss_param_ch_cnt_link_id = | |
| 1649 | − bss_conf->bss_param_ch_cnt_link_id; | |
| 1650 | − u32 scnd_lnk_bcn_lost = 0; | |
| 1651 | − | |
| 1652 | − if (notif_ver >= 5 && | |
| 1653 | − !IWL_FW_CHECK(mvm, | |
| 1654 | − le32_to_cpu(mb->other_link_id) == IWL_MVM_FW_LINK_ID_INVALID, | |
| 1655 | − "No data for other link id but we are in EMLSR active_links: 0x%x\n", | |
| 1656 | − vif->active_links)) | |
| 1657 | − scnd_lnk_bcn_lost = | |
| 1658 | − le32_to_cpu(mb->consec_missed_beacons_other_link); | |
| 1659 | − | |
| 1660 | − /* Exit EMLSR if we lost more than | |
| 1661 | − * IWL_MVM_MISSED_BEACONS_EXIT_ESR_THRESH beacons on boths links | |
| 1662 | − * OR more than IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH on any link. | |
| 1663 | − * OR more than IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED | |
| 1664 | − * and the link's bss_param_ch_count has changed. | |
| 1665 | − */ | |
| 1666 | − if ((rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS && | |
| 1667 | − scnd_lnk_bcn_lost >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS) || | |
| 1668 | − rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH || | |
| 1669 | − (bss_param_ch_cnt_link_id != link_id && | |
| 1670 | − rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED)) | |
| 1671 | − iwl_mvm_exit_esr(mvm, vif, | |
| 1672 | − IWL_MVM_ESR_EXIT_MISSED_BEACON, | |
| 1673 | − iwl_mvm_get_primary_link(vif)); | |
| 1674 | 1639 | } else if (rx_missed_bcon_since_rx > IWL_MVM_MISSED_BEACONS_THRESHOLD) { |
| 1675 | 1640 | if (!iwl_mvm_has_new_tx_api(mvm)) |
| 1676 | 1641 | ieee80211_beacon_loss(vif); |
| 1677 | 1642 | else |
| 1678 | 1643 | ieee80211_cqm_beacon_loss_notify(vif, GFP_ATOMIC); |
| 1679 | − | |
| 1680 | − /* try to switch links, no-op if we don't have MLO */ | |
| 1681 | − iwl_mvm_int_mlo_scan(mvm, vif); | |
| 1682 | 1644 | } |
| 1683 | 1645 | |
| 1684 | 1646 | iwl_dbg_tlv_time_point(&mvm->fwrt, |
| @@ -1425,12 +1425,6 @@ void iwl_mvm_mac_stop(struct ieee80211_hw *hw, bool suspend) · 1424 unmodified lines | ||
| 1425 | 1425 | { |
| 1426 | 1426 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 1427 | 1427 | |
| 1428 | − /* Stop internal MLO scan, if running */ | |
| 1429 | − mutex_lock(&mvm->mutex); | |
| 1430 | − iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false); | |
| 1431 | − mutex_unlock(&mvm->mutex); | |
| 1432 | − | |
| 1433 | − wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk); | |
| 1434 | 1428 | wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk); |
| 1435 | 1429 | flush_work(&mvm->async_handlers_wk); |
| 1436 | 1430 | flush_work(&mvm->add_stream_wk); |
| @@ -1715,57 +1709,6 @@ static int iwl_mvm_alloc_bcast_mcast_sta(struct iwl_mvm *mvm, · 278 unmodified lines | ||
| 1715 | 1709 | IWL_STA_MULTICAST); |
| 1716 | 1710 | } |
| 1717 | 1711 | |
| 1718 | −static void iwl_mvm_prevent_esr_done_wk(struct wiphy *wiphy, | |
| 1719 | − struct wiphy_work *wk) | |
| 1720 | −{ | |
| 1721 | − struct iwl_mvm_vif *mvmvif = | |
| 1722 | − container_of(wk, struct iwl_mvm_vif, prevent_esr_done_wk.work); | |
| 1723 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 1724 | − struct ieee80211_vif *vif = | |
| 1725 | − container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); | |
| 1726 | − | |
| 1727 | − guard(mvm)(mvm); | |
| 1728 | − iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_PREVENTION); | |
| 1729 | −} | |
| 1730 | − | |
| 1731 | −static void iwl_mvm_mlo_int_scan_wk(struct wiphy *wiphy, struct wiphy_work *wk) | |
| 1732 | −{ | |
| 1733 | − struct iwl_mvm_vif *mvmvif = container_of(wk, struct iwl_mvm_vif, | |
| 1734 | − mlo_int_scan_wk.work); | |
| 1735 | − struct ieee80211_vif *vif = | |
| 1736 | − container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); | |
| 1737 | − | |
| 1738 | − guard(mvm)(mvmvif->mvm); | |
| 1739 | − iwl_mvm_int_mlo_scan(mvmvif->mvm, vif); | |
| 1740 | −} | |
| 1741 | − | |
| 1742 | −static void iwl_mvm_unblock_esr_tpt(struct wiphy *wiphy, struct wiphy_work *wk) | |
| 1743 | −{ | |
| 1744 | − struct iwl_mvm_vif *mvmvif = | |
| 1745 | − container_of(wk, struct iwl_mvm_vif, unblock_esr_tpt_wk); | |
| 1746 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 1747 | − struct ieee80211_vif *vif = | |
| 1748 | − container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); | |
| 1749 | − | |
| 1750 | − guard(mvm)(mvm); | |
| 1751 | − iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT); | |
| 1752 | −} | |
| 1753 | − | |
| 1754 | −static void iwl_mvm_unblock_esr_tmp_non_bss(struct wiphy *wiphy, | |
| 1755 | − struct wiphy_work *wk) | |
| 1756 | −{ | |
| 1757 | − struct iwl_mvm_vif *mvmvif = | |
| 1758 | − container_of(wk, struct iwl_mvm_vif, | |
| 1759 | − unblock_esr_tmp_non_bss_wk.work); | |
| 1760 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 1761 | − struct ieee80211_vif *vif = | |
| 1762 | − container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); | |
| 1763 | − | |
| 1764 | − mutex_lock(&mvm->mutex); | |
| 1765 | − iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TMP_NON_BSS); | |
| 1766 | − mutex_unlock(&mvm->mutex); | |
| 1767 | −} | |
| 1768 | − | |
| 1769 | 1712 | void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif) |
| 1770 | 1713 | { |
| 1771 | 1714 | lockdep_assert_held(&mvm->mutex); |
| @@ -1777,18 +1720,6 @@ void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif) · 5 unmodified lines | ||
| 1777 | 1720 | |
| 1778 | 1721 | INIT_DELAYED_WORK(&mvmvif->csa_work, |
| 1779 | 1722 | iwl_mvm_channel_switch_disconnect_wk); |
| 1780 | − | |
| 1781 | − wiphy_delayed_work_init(&mvmvif->prevent_esr_done_wk, | |
| 1782 | − iwl_mvm_prevent_esr_done_wk); | |
| 1783 | − | |
| 1784 | − wiphy_delayed_work_init(&mvmvif->mlo_int_scan_wk, | |
| 1785 | − iwl_mvm_mlo_int_scan_wk); | |
| 1786 | − | |
| 1787 | − wiphy_work_init(&mvmvif->unblock_esr_tpt_wk, | |
| 1788 | − iwl_mvm_unblock_esr_tpt); | |
| 1789 | − | |
| 1790 | − wiphy_delayed_work_init(&mvmvif->unblock_esr_tmp_non_bss_wk, | |
| 1791 | − iwl_mvm_unblock_esr_tmp_non_bss); | |
| 1792 | 1723 | } |
| 1793 | 1724 | |
| 1794 | 1725 | static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, |
| @@ -1926,16 +1857,6 @@ void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, · 131 unmodified lines | ||
| 1926 | 1857 | flush_work(&mvm->roc_done_wk); |
| 1927 | 1858 | } |
| 1928 | 1859 | |
| 1929 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 1930 | − &mvmvif->prevent_esr_done_wk); | |
| 1931 | − | |
| 1932 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 1933 | − &mvmvif->mlo_int_scan_wk); | |
| 1934 | − | |
| 1935 | − wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); | |
| 1936 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 1937 | − &mvmvif->unblock_esr_tmp_non_bss_wk); | |
| 1938 | − | |
| 1939 | 1860 | cancel_delayed_work_sync(&mvmvif->csa_work); |
| 1940 | 1861 | } |
| 1941 | 1862 | |
| @@ -4008,21 +3929,6 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm, · 2066 unmodified lines | ||
| 4008 | 3929 | |
| 4009 | 3930 | callbacks->mac_ctxt_changed(mvm, vif, false); |
| 4010 | 3931 | iwl_mvm_mei_host_associated(mvm, vif, mvm_sta); |
| 4011 | − | |
| 4012 | − memset(&mvmvif->last_esr_exit, 0, | |
| 4013 | − sizeof(mvmvif->last_esr_exit)); | |
| 4014 | − | |
| 4015 | − iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT, 0); | |
| 4016 | − | |
| 4017 | − /* Block until FW notif will arrive */ | |
| 4018 | − iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW, 0); | |
| 4019 | − | |
| 4020 | − /* when client is authorized (AP station marked as such), | |
| 4021 | − * try to enable the best link(s). | |
| 4022 | − */ | |
| 4023 | − if (vif->type == NL80211_IFTYPE_STATION && | |
| 4024 | − !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) | |
| 4025 | − iwl_mvm_select_links(mvm, vif); | |
| 4026 | 3932 | } |
| 4027 | 3933 | |
| 4028 | 3934 | mvm_sta->authorized = true; |
| @@ -4070,16 +3976,6 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm, · 41 unmodified lines | ||
| 4070 | 3976 | |
| 4071 | 3977 | /* disable beacon filtering */ |
| 4072 | 3978 | iwl_mvm_disable_beacon_filter(mvm, vif); |
| 4073 | − | |
| 4074 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 4075 | − &mvmvif->prevent_esr_done_wk); | |
| 4076 | − | |
| 4077 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 4078 | − &mvmvif->mlo_int_scan_wk); | |
| 4079 | − | |
| 4080 | − wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); | |
| 4081 | − wiphy_delayed_work_cancel(mvm->hw->wiphy, | |
| 4082 | − &mvmvif->unblock_esr_tmp_non_bss_wk); | |
| 4083 | 3979 | } |
| 4084 | 3980 | |
| 4085 | 3981 | return 0; |
| @@ -4920,7 +4816,6 @@ int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 834 unmodified lines | ||
| 4920 | 4816 | const struct iwl_mvm_roc_ops *ops) |
| 4921 | 4817 | { |
| 4922 | 4818 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 4923 | − struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); | |
| 4924 | 4819 | u32 lmac_id; |
| 4925 | 4820 | int ret; |
| 4926 | 4821 | |
| @@ -4933,13 +4828,6 @@ int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 6 unmodified lines | ||
| 4933 | 4828 | */ |
| 4934 | 4829 | flush_work(&mvm->roc_done_wk); |
| 4935 | 4830 | |
| 4936 | − if (!IS_ERR_OR_NULL(bss_vif)) { | |
| 4937 | − ret = iwl_mvm_block_esr_sync(mvm, bss_vif, | |
| 4938 | − IWL_MVM_ESR_BLOCKED_ROC); | |
| 4939 | − if (ret) | |
| 4940 | − return ret; | |
| 4941 | − } | |
| 4942 | − | |
| 4943 | 4831 | guard(mvm)(mvm); |
| 4944 | 4832 | |
| 4945 | 4833 | switch (vif->type) { |
| @@ -5604,9 +5492,9 @@ static void iwl_mvm_csa_block_txqs(void *data, struct ieee80211_sta *sta) · 658 unmodified lines | ||
| 5604 | 5492 | } |
| 5605 | 5493 | |
| 5606 | 5494 | #define IWL_MAX_CSA_BLOCK_TX 1500 |
| 5607 | −int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm, | |
| 5608 | − struct ieee80211_vif *vif, | |
| 5609 | − struct ieee80211_channel_switch *chsw) | |
| 5495 | +static int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm, | |
| 5496 | + struct ieee80211_vif *vif, | |
| 5497 | + struct ieee80211_channel_switch *chsw) | |
| 5610 | 5498 | { |
| 5611 | 5499 | struct ieee80211_vif *csa_vif; |
| 5612 | 5500 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| @@ -5724,9 +5612,9 @@ int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm, · 111 unmodified lines | ||
| 5724 | 5612 | return ret; |
| 5725 | 5613 | } |
| 5726 | 5614 | |
| 5727 | −static int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw, | |
| 5728 | − struct ieee80211_vif *vif, | |
| 5729 | − struct ieee80211_channel_switch *chsw) | |
| 5615 | +int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw, | |
| 5616 | + struct ieee80211_vif *vif, | |
| 5617 | + struct ieee80211_channel_switch *chsw) | |
| 5730 | 5618 | { |
| 5731 | 5619 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 5732 | 5620 | |
| @@ -340,20 +340,6 @@ static int iwl_mvm_mld_assign_vif_chanctx(struct ieee80211_hw *hw, · 339 unmodified lines | ||
| 340 | 340 | { |
| 341 | 341 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 342 | 342 | |
| 343 | − /* update EMLSR mode */ | |
| 344 | − if (ieee80211_vif_type_p2p(vif) != NL80211_IFTYPE_STATION) { | |
| 345 | − int ret; | |
| 346 | − | |
| 347 | − ret = iwl_mvm_esr_non_bss_link(mvm, vif, link_conf->link_id, | |
| 348 | − true); | |
| 349 | − /* | |
| 350 | − * Don't activate this link if failed to exit EMLSR in | |
| 351 | − * the BSS interface | |
| 352 | − */ | |
| 353 | − if (ret) | |
| 354 | − return ret; | |
| 355 | − } | |
| 356 | − | |
| 357 | 343 | guard(mvm)(mvm); |
| 358 | 344 | return __iwl_mvm_mld_assign_vif_chanctx(mvm, vif, link_conf, ctx, false); |
| 359 | 345 | } |
| @@ -472,10 +458,6 @@ static void iwl_mvm_mld_unassign_vif_chanctx(struct ieee80211_hw *hw, · 112 unmodified lines | ||
| 472 | 458 | iwl_mvm_add_link(mvm, vif, link_conf); |
| 473 | 459 | } |
| 474 | 460 | mutex_unlock(&mvm->mutex); |
| 475 | − | |
| 476 | − /* update EMLSR mode */ | |
| 477 | − if (ieee80211_vif_type_p2p(vif) != NL80211_IFTYPE_STATION) | |
| 478 | − iwl_mvm_esr_non_bss_link(mvm, vif, link_conf->link_id, false); | |
| 479 | 461 | } |
| 480 | 462 | |
| 481 | 463 | static void |
| @@ -684,25 +666,6 @@ static int iwl_mvm_mld_mac_sta_state(struct ieee80211_hw *hw, · 202 unmodified lines | ||
| 684 | 666 | &callbacks); |
| 685 | 667 | } |
| 686 | 668 | |
| 687 | −static bool iwl_mvm_esr_bw_criteria(struct iwl_mvm *mvm, | |
| 688 | − struct ieee80211_vif *vif, | |
| 689 | − struct ieee80211_bss_conf *link_conf) | |
| 690 | −{ | |
| 691 | − struct ieee80211_bss_conf *other_link; | |
| 692 | − int link_id; | |
| 693 | − | |
| 694 | − /* Exit EMLSR if links don't have equal bandwidths */ | |
| 695 | − for_each_vif_active_link(vif, other_link, link_id) { | |
| 696 | − if (link_id == link_conf->link_id) | |
| 697 | − continue; | |
| 698 | − if (link_conf->chanreq.oper.width == | |
| 699 | − other_link->chanreq.oper.width) | |
| 700 | − return true; | |
| 701 | − } | |
| 702 | − | |
| 703 | − return false; | |
| 704 | −} | |
| 705 | − | |
| 706 | 669 | static void |
| 707 | 670 | iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm, |
| 708 | 671 | struct ieee80211_vif *vif, |
| @@ -737,14 +700,6 @@ iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm, · 28 unmodified lines | ||
| 737 | 700 | link_changes |= LINK_CONTEXT_MODIFY_HE_PARAMS; |
| 738 | 701 | } |
| 739 | 702 | |
| 740 | − if ((changes & BSS_CHANGED_BANDWIDTH) && | |
| 741 | − ieee80211_vif_link_active(vif, link_conf->link_id) && | |
| 742 | − mvmvif->esr_active && | |
| 743 | − !iwl_mvm_esr_bw_criteria(mvm, vif, link_conf)) | |
| 744 | − iwl_mvm_exit_esr(mvm, vif, | |
| 745 | − IWL_MVM_ESR_EXIT_BANDWIDTH, | |
| 746 | − iwl_mvm_get_primary_link(vif)); | |
| 747 | − | |
| 748 | 703 | /* if associated, maybe puncturing changed - we'll check later */ |
| 749 | 704 | if (vif->cfg.assoc) |
| 750 | 705 | link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS; |
| @@ -879,11 +834,6 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, · 128 unmodified lines | ||
| 879 | 834 | if (ret) |
| 880 | 835 | IWL_ERR(mvm, "failed to update power mode\n"); |
| 881 | 836 | } |
| 882 | − | |
| 883 | − if (changes & (BSS_CHANGED_MLD_VALID_LINKS | BSS_CHANGED_MLD_TTLM) && | |
| 884 | − ieee80211_vif_is_mld(vif) && mvmvif->authorized) | |
| 885 | − wiphy_delayed_work_queue(mvm->hw->wiphy, | |
| 886 | − &mvmvif->mlo_int_scan_wk, 0); | |
| 887 | 837 | } |
| 888 | 838 | |
| 889 | 839 | static void |
| @@ -1239,91 +1189,6 @@ iwl_mvm_mld_can_neg_ttlm(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 349 unmodified lines | ||
| 1239 | 1189 | return NEG_TTLM_RES_ACCEPT; |
| 1240 | 1190 | } |
| 1241 | 1191 | |
| 1242 | −static int | |
| 1243 | −iwl_mvm_mld_mac_pre_channel_switch(struct ieee80211_hw *hw, | |
| 1244 | − struct ieee80211_vif *vif, | |
| 1245 | − struct ieee80211_channel_switch *chsw) | |
| 1246 | −{ | |
| 1247 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 1248 | − struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
| 1249 | − int ret; | |
| 1250 | − | |
| 1251 | − mutex_lock(&mvm->mutex); | |
| 1252 | − if (mvmvif->esr_active) { | |
| 1253 | − u8 primary = iwl_mvm_get_primary_link(vif); | |
| 1254 | − int selected; | |
| 1255 | − | |
| 1256 | − /* prefer primary unless quiet CSA on it */ | |
| 1257 | − if (chsw->link_id == primary && chsw->block_tx) | |
| 1258 | − selected = iwl_mvm_get_other_link(vif, primary); | |
| 1259 | − else | |
| 1260 | − selected = primary; | |
| 1261 | − | |
| 1262 | − /* | |
| 1263 | − * remembers to tell the firmware that this link can't tx | |
| 1264 | − * Note that this logic seems to be unrelated to esr, but it | |
| 1265 | − * really is needed only when esr is active. When we have a | |
| 1266 | − * single link, the firmware will handle all this on its own. | |
| 1267 | − * In multi-link scenarios, we can learn about the CSA from | |
| 1268 | − * another link and this logic is too complex for the firmware | |
| 1269 | − * to track. | |
| 1270 | − * Since we want to de-activate the link that got a CSA, we | |
| 1271 | − * need to tell the firmware not to send any frame on that link | |
| 1272 | − * as the firmware may not be aware that link is under a CSA | |
| 1273 | − * with mode=1 (no Tx allowed). | |
| 1274 | − */ | |
| 1275 | − if (chsw->block_tx && mvmvif->link[chsw->link_id]) | |
| 1276 | − mvmvif->link[chsw->link_id]->csa_block_tx = true; | |
| 1277 | − | |
| 1278 | − iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_CSA, selected); | |
| 1279 | − mutex_unlock(&mvm->mutex); | |
| 1280 | − | |
| 1281 | − /* | |
| 1282 | − * If we've not kept the link active that's doing the CSA | |
| 1283 | − * then we don't need to do anything else, just return. | |
| 1284 | − */ | |
| 1285 | − if (selected != chsw->link_id) | |
| 1286 | − return 0; | |
| 1287 | − | |
| 1288 | − mutex_lock(&mvm->mutex); | |
| 1289 | − } | |
| 1290 | − | |
| 1291 | − ret = iwl_mvm_pre_channel_switch(mvm, vif, chsw); | |
| 1292 | − mutex_unlock(&mvm->mutex); | |
| 1293 | − | |
| 1294 | − return ret; | |
| 1295 | −} | |
| 1296 | − | |
| 1297 | −#define IWL_MVM_MLD_UNBLOCK_ESR_NON_BSS_TIMEOUT (5 * HZ) | |
| 1298 | − | |
| 1299 | −static void iwl_mvm_mld_prep_add_interface(struct ieee80211_hw *hw, | |
| 1300 | − enum nl80211_iftype type) | |
| 1301 | −{ | |
| 1302 | − struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
| 1303 | − struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); | |
| 1304 | − struct iwl_mvm_vif *mvmvif; | |
| 1305 | − int ret; | |
| 1306 | − | |
| 1307 | − IWL_DEBUG_MAC80211(mvm, "prep_add_interface: type=%u\n", | |
| 1308 | − type); | |
| 1309 | − | |
| 1310 | − if (IS_ERR_OR_NULL(bss_vif) || | |
| 1311 | − !(type == NL80211_IFTYPE_AP || | |
| 1312 | − type == NL80211_IFTYPE_P2P_GO || | |
| 1313 | − type == NL80211_IFTYPE_P2P_CLIENT)) | |
| 1314 | − return; | |
| 1315 | − | |
| 1316 | − mvmvif = iwl_mvm_vif_from_mac80211(bss_vif); | |
| 1317 | − ret = iwl_mvm_block_esr_sync(mvm, bss_vif, | |
| 1318 | − IWL_MVM_ESR_BLOCKED_TMP_NON_BSS); | |
| 1319 | − if (ret) | |
| 1320 | − return; | |
| 1321 | − | |
| 1322 | − wiphy_delayed_work_queue(mvmvif->mvm->hw->wiphy, | |
| 1323 | − &mvmvif->unblock_esr_tmp_non_bss_wk, | |
| 1324 | − IWL_MVM_MLD_UNBLOCK_ESR_NON_BSS_TIMEOUT); | |
| 1325 | −} | |
| 1326 | − | |
| 1327 | 1192 | const struct ieee80211_ops iwl_mvm_mld_hw_ops = { |
| 1328 | 1193 | .tx = iwl_mvm_mac_tx, |
| 1329 | 1194 | .wake_tx_queue = iwl_mvm_mac_wake_tx_queue, |
| @@ -1377,7 +1242,7 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = { · 47 unmodified lines | ||
| 1377 | 1242 | .tx_last_beacon = iwl_mvm_tx_last_beacon, |
| 1378 | 1243 | |
| 1379 | 1244 | .channel_switch = iwl_mvm_channel_switch, |
| 1380 | − .pre_channel_switch = iwl_mvm_mld_mac_pre_channel_switch, | |
| 1245 | + .pre_channel_switch = iwl_mvm_mac_pre_channel_switch, | |
| 1381 | 1246 | .post_channel_switch = iwl_mvm_post_channel_switch, |
| 1382 | 1247 | .abort_channel_switch = iwl_mvm_abort_channel_switch, |
| 1383 | 1248 | .channel_switch_rx_beacon = iwl_mvm_channel_switch_rx_beacon, |
| @@ -1418,5 +1283,4 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = { · 34 unmodified lines | ||
| 1418 | 1283 | .change_sta_links = iwl_mvm_mld_change_sta_links, |
| 1419 | 1284 | .can_activate_links = iwl_mvm_mld_can_activate_links, |
| 1420 | 1285 | .can_neg_ttlm = iwl_mvm_mld_can_neg_ttlm, |
| 1421 | − .prep_add_interface = iwl_mvm_mld_prep_add_interface, | |
| 1422 | 1286 | }; |
| @@ -852,8 +852,6 @@ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 851 unmodified lines | ||
| 852 | 852 | |
| 853 | 853 | iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta, link_id); |
| 854 | 854 | } |
| 855 | − kfree(mvm_sta->mpdu_counters); | |
| 856 | − mvm_sta->mpdu_counters = NULL; | |
| 857 | 855 | |
| 858 | 856 | return ret; |
| 859 | 857 | } |
| @@ -347,68 +347,6 @@ struct iwl_mvm_vif_link_info { · 346 unmodified lines | ||
| 347 | 347 | u32 average_beacon_energy; |
| 348 | 348 | }; |
| 349 | 349 | |
| 350 | −/** | |
| 351 | − * enum iwl_mvm_esr_state - defines reasons for which the EMLSR is exited or | |
| 352 | − * blocked. | |
| 353 | − * The low 16 bits are used for blocking reasons, and the 16 higher bits | |
| 354 | − * are used for exit reasons. | |
| 355 | − * For the blocking reasons - use iwl_mvm_(un)block_esr(), and for the exit | |
| 356 | − * reasons - use iwl_mvm_exit_esr(). | |
| 357 | − * | |
| 358 | − * Note: new reasons shall be added to HANDLE_ESR_REASONS as well (for logs) | |
| 359 | − * | |
| 360 | − * @IWL_MVM_ESR_BLOCKED_PREVENTION: Prevent EMLSR to avoid entering and exiting | |
| 361 | − * in a loop. | |
| 362 | − * @IWL_MVM_ESR_BLOCKED_WOWLAN: WOWLAN is preventing the enablement of EMLSR | |
| 363 | − * @IWL_MVM_ESR_BLOCKED_TPT: block EMLSR when there is not enough traffic | |
| 364 | − * @IWL_MVM_ESR_BLOCKED_FW: FW didn't recommended/forced exit from EMLSR | |
| 365 | − * @IWL_MVM_ESR_BLOCKED_NON_BSS: An active non-BSS interface's link is | |
| 366 | − * preventing EMLSR | |
| 367 | − * @IWL_MVM_ESR_BLOCKED_ROC: remain-on-channel is preventing EMLSR | |
| 368 | − * @IWL_MVM_ESR_BLOCKED_TMP_NON_BSS: An expected active non-BSS interface's link | |
| 369 | − * is preventing EMLSR. This is a temporary blocking that is set when there | |
| 370 | − * is an indication that a non-BSS interface is to be added. | |
| 371 | − * @IWL_MVM_ESR_EXIT_MISSED_BEACON: exited EMLSR due to missed beacons | |
| 372 | − * @IWL_MVM_ESR_EXIT_LOW_RSSI: link is deactivated/not allowed for EMLSR | |
| 373 | − * due to low RSSI. | |
| 374 | − * @IWL_MVM_ESR_EXIT_COEX: link is deactivated/not allowed for EMLSR | |
| 375 | − * due to BT Coex. | |
| 376 | − * @IWL_MVM_ESR_EXIT_BANDWIDTH: Bandwidths of primary and secondry links | |
| 377 | − * preventing the enablement of EMLSR | |
| 378 | − * @IWL_MVM_ESR_EXIT_CSA: CSA happened, so exit EMLSR | |
| 379 | − * @IWL_MVM_ESR_EXIT_LINK_USAGE: Exit EMLSR due to low tpt on secondary link | |
| 380 | − */ | |
| 381 | −enum iwl_mvm_esr_state { | |
| 382 | − IWL_MVM_ESR_BLOCKED_PREVENTION = 0x1, | |
| 383 | − IWL_MVM_ESR_BLOCKED_WOWLAN = 0x2, | |
| 384 | − IWL_MVM_ESR_BLOCKED_TPT = 0x4, | |
| 385 | − IWL_MVM_ESR_BLOCKED_FW = 0x8, | |
| 386 | − IWL_MVM_ESR_BLOCKED_NON_BSS = 0x10, | |
| 387 | − IWL_MVM_ESR_BLOCKED_ROC = 0x20, | |
| 388 | − IWL_MVM_ESR_BLOCKED_TMP_NON_BSS = 0x40, | |
| 389 | − IWL_MVM_ESR_EXIT_MISSED_BEACON = 0x10000, | |
| 390 | − IWL_MVM_ESR_EXIT_LOW_RSSI = 0x20000, | |
| 391 | − IWL_MVM_ESR_EXIT_COEX = 0x40000, | |
| 392 | − IWL_MVM_ESR_EXIT_BANDWIDTH = 0x80000, | |
| 393 | − IWL_MVM_ESR_EXIT_CSA = 0x100000, | |
| 394 | − IWL_MVM_ESR_EXIT_LINK_USAGE = 0x200000, | |
| 395 | −}; | |
| 396 | − | |
| 397 | −#define IWL_MVM_BLOCK_ESR_REASONS 0xffff | |
| 398 | − | |
| 399 | −const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state); | |
| 400 | − | |
| 401 | −/** | |
| 402 | − * struct iwl_mvm_esr_exit - details of the last exit from EMLSR mode. | |
| 403 | − * @reason: The reason for the last exit from EMLSR. | |
| 404 | − * &iwl_mvm_prevent_esr_reasons. Will be 0 before exiting EMLSR. | |
| 405 | − * @ts: the time stamp of the last time we existed EMLSR. | |
| 406 | − */ | |
| 407 | −struct iwl_mvm_esr_exit { | |
| 408 | − unsigned long ts; | |
| 409 | − enum iwl_mvm_esr_state reason; | |
| 410 | −}; | |
| 411 | − | |
| 412 | 350 | /** |
| 413 | 351 | * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context |
| 414 | 352 | * @mvm: pointer back to the mvm struct |
| @@ -443,7 +381,6 @@ struct iwl_mvm_esr_exit { · 28 unmodified lines | ||
| 443 | 381 | * @deflink: default link data for use in non-MLO |
| 444 | 382 | * @link: link data for each link in MLO |
| 445 | 383 | * @esr_active: indicates eSR mode is active |
| 446 | − * @esr_disable_reason: a bitmap of &enum iwl_mvm_esr_state | |
| 447 | 384 | * @pm_enabled: indicates powersave is enabled |
| 448 | 385 | * @link_selection_res: bitmap of active links as it was decided in the last |
| 449 | 386 | * link selection. Valid only for a MLO vif after assoc. 0 if there wasn't |
| @@ -451,15 +388,6 @@ struct iwl_mvm_esr_exit { · 1 unmodified line | ||
| 451 | 388 | * @link_selection_primary: primary link selected by link selection |
| 452 | 389 | * @primary_link: primary link in eSR. Valid only for an associated MLD vif, |
| 453 | 390 | * and in eSR mode. Valid only for a STA. |
| 454 | − * @last_esr_exit: Details of the last exit from EMLSR. | |
| 455 | − * @exit_same_reason_count: The number of times we exited due to the specified | |
| 456 | − * @last_esr_exit::reason, only counting exits due to | |
| 457 | − * &IWL_MVM_ESR_PREVENT_REASONS. | |
| 458 | − * @prevent_esr_done_wk: work that should be done when esr prevention ends. | |
| 459 | − * @mlo_int_scan_wk: work for the internal MLO scan. | |
| 460 | − * @unblock_esr_tpt_wk: work for unblocking EMLSR when tpt is high enough. | |
| 461 | − * @unblock_esr_tmp_non_bss_wk: work for removing the | |
| 462 | − * IWL_MVM_ESR_BLOCKED_TMP_NON_BSS blocking for EMLSR. | |
| 463 | 391 | * @roc_activity: currently running ROC activity for this vif (or |
| 464 | 392 | * ROC_NUM_ACTIVITIES if no activity is running). |
| 465 | 393 | * @session_prot_connection_loss: the connection was lost due to session |
| @@ -515,7 +443,6 @@ struct iwl_mvm_vif { · 49 unmodified lines | ||
| 515 | 443 | u8 authorized:1; |
| 516 | 444 | bool ps_disabled; |
| 517 | 445 | |
| 518 | − u32 esr_disable_reason; | |
| 519 | 446 | u32 ap_beacon_time; |
| 520 | 447 | bool bf_enabled; |
| 521 | 448 | bool ba_enabled; |
| @@ -591,12 +518,6 @@ struct iwl_mvm_vif { · 69 unmodified lines | ||
| 591 | 518 | u16 link_selection_res; |
| 592 | 519 | u8 link_selection_primary; |
| 593 | 520 | u8 primary_link; |
| 594 | − struct iwl_mvm_esr_exit last_esr_exit; | |
| 595 | − u8 exit_same_reason_count; | |
| 596 | − struct wiphy_delayed_work prevent_esr_done_wk; | |
| 597 | − struct wiphy_delayed_work mlo_int_scan_wk; | |
| 598 | − struct wiphy_work unblock_esr_tpt_wk; | |
| 599 | − struct wiphy_delayed_work unblock_esr_tmp_non_bss_wk; | |
| 600 | 521 | |
| 601 | 522 | struct iwl_mvm_vif_link_info deflink; |
| 602 | 523 | struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS]; |
| @@ -622,7 +543,6 @@ enum iwl_scan_status { · 19 unmodified lines | ||
| 622 | 543 | IWL_MVM_SCAN_REGULAR = BIT(0), |
| 623 | 544 | IWL_MVM_SCAN_SCHED = BIT(1), |
| 624 | 545 | IWL_MVM_SCAN_NETDETECT = BIT(2), |
| 625 | − IWL_MVM_SCAN_INT_MLO = BIT(3), | |
| 626 | 546 | |
| 627 | 547 | IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8), |
| 628 | 548 | IWL_MVM_SCAN_STOPPING_SCHED = BIT(9), |
| @@ -635,8 +555,6 @@ enum iwl_scan_status { · 6 unmodified lines | ||
| 635 | 555 | IWL_MVM_SCAN_STOPPING_SCHED, |
| 636 | 556 | IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT | |
| 637 | 557 | IWL_MVM_SCAN_STOPPING_NETDETECT, |
| 638 | − IWL_MVM_SCAN_INT_MLO_MASK = IWL_MVM_SCAN_INT_MLO | | |
| 639 | − IWL_MVM_SCAN_STOPPING_INT_MLO, | |
| 640 | 558 | |
| 641 | 559 | IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT, |
| 642 | 560 | IWL_MVM_SCAN_MASK = 0xff, |
| @@ -1017,8 +935,6 @@ struct iwl_mvm { · 374 unmodified lines | ||
| 1017 | 935 | /* For async rx handlers that require the wiphy lock */ |
| 1018 | 936 | struct wiphy_work async_handlers_wiphy_wk; |
| 1019 | 937 | |
| 1020 | − struct wiphy_work trig_link_selection_wk; | |
| 1021 | − | |
| 1022 | 938 | struct work_struct roc_done_wk; |
| 1023 | 939 | |
| 1024 | 940 | unsigned long init_status; |
| @@ -1203,20 +1119,13 @@ struct iwl_mvm { · 178 unmodified lines | ||
| 1203 | 1119 | u8 offload_tid; |
| 1204 | 1120 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 1205 | 1121 | bool d3_wake_sysassert; |
| 1206 | − bool d3_test_active; | |
| 1207 | − u32 d3_test_pme_ptr; | |
| 1208 | − struct ieee80211_vif *keep_vif; | |
| 1209 | 1122 | u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */ |
| 1210 | 1123 | #endif |
| 1211 | 1124 | #endif |
| 1212 | 1125 | |
| 1213 | 1126 | wait_queue_head_t rx_sync_waitq; |
| 1214 | 1127 | |
| 1215 | − /* BT-Coex - only one of those will be used */ | |
| 1216 | − union { | |
| 1217 | − struct iwl_bt_coex_prof_old_notif last_bt_notif; | |
| 1218 | − struct iwl_bt_coex_profile_notif last_bt_wifi_loss; | |
| 1219 | − }; | |
| 1128 | + struct iwl_bt_coex_prof_old_notif last_bt_notif; | |
| 1220 | 1129 | struct iwl_bt_coex_ci_cmd last_bt_ci_cmd; |
| 1221 | 1130 | |
| 1222 | 1131 | u8 bt_tx_prio; |
| @@ -2099,9 +2008,7 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 876 unmodified lines | ||
| 2099 | 2008 | int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 2100 | 2009 | struct ieee80211_bss_conf *link_conf); |
| 2101 | 2010 | |
| 2102 | −void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | |
| 2103 | 2011 | u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif); |
| 2104 | −u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id); | |
| 2105 | 2012 | |
| 2106 | 2013 | struct iwl_mvm_link_sel_data { |
| 2107 | 2014 | u8 link_id; |
| @@ -2111,13 +2018,6 @@ struct iwl_mvm_link_sel_data { · 3 unmodified lines | ||
| 2111 | 2018 | }; |
| 2112 | 2019 | |
| 2113 | 2020 | #if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS) |
| 2114 | −unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf); | |
| 2115 | −bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif, | |
| 2116 | − const struct iwl_mvm_link_sel_data *a, | |
| 2117 | − const struct iwl_mvm_link_sel_data *b); | |
| 2118 | − | |
| 2119 | −s8 iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif); | |
| 2120 | − | |
| 2121 | 2021 | extern const struct iwl_hcmd_arr iwl_mvm_groups[]; |
| 2122 | 2022 | extern const unsigned int iwl_mvm_groups_size; |
| 2123 | 2023 | #endif |
| @@ -2201,7 +2101,6 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); · 77 unmodified lines | ||
| 2201 | 2101 | int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); |
| 2202 | 2102 | void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); |
| 2203 | 2103 | void iwl_mvm_scan_timeout_wk(struct work_struct *work); |
| 2204 | −int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | |
| 2205 | 2104 | void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm, |
| 2206 | 2105 | struct iwl_rx_cmd_buffer *rxb); |
| 2207 | 2106 | |
| @@ -2327,8 +2226,6 @@ int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, · 119 unmodified lines | ||
| 2327 | 2226 | int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm); |
| 2328 | 2227 | void iwl_mvm_rx_bt_coex_old_notif(struct iwl_mvm *mvm, |
| 2329 | 2228 | struct iwl_rx_cmd_buffer *rxb); |
| 2330 | −void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, | |
| 2331 | − struct iwl_rx_cmd_buffer *rxb); | |
| 2332 | 2229 | void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 2333 | 2230 | enum ieee80211_rssi_event_data); |
| 2334 | 2231 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm); |
| @@ -2929,9 +2826,10 @@ void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, · 594 unmodified lines | ||
| 2929 | 2826 | int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw); |
| 2930 | 2827 | void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 2931 | 2828 | struct ieee80211_channel_switch *chsw); |
| 2932 | −int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm, | |
| 2933 | − struct ieee80211_vif *vif, | |
| 2934 | − struct ieee80211_channel_switch *chsw); | |
| 2829 | +int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw, | |
| 2830 | + struct ieee80211_vif *vif, | |
| 2831 | + struct ieee80211_channel_switch *chsw); | |
| 2832 | + | |
| 2935 | 2833 | void iwl_mvm_abort_channel_switch(struct ieee80211_hw *hw, |
| 2936 | 2834 | struct ieee80211_vif *vif, |
| 2937 | 2835 | struct ieee80211_bss_conf *link_conf); |
| @@ -2988,30 +2886,6 @@ int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm, · 50 unmodified lines | ||
| 2988 | 2886 | |
| 2989 | 2887 | /* EMLSR */ |
| 2990 | 2888 | bool iwl_mvm_vif_has_esr_cap(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
| 2991 | −void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 2992 | − enum iwl_mvm_esr_state reason, | |
| 2993 | − u8 link_to_keep); | |
| 2994 | −int iwl_mvm_block_esr_sync(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 2995 | − enum iwl_mvm_esr_state reason); | |
| 2996 | −void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 2997 | − enum iwl_mvm_esr_state reason); | |
| 2998 | −void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 2999 | − enum iwl_mvm_esr_state reason, | |
| 3000 | − u8 link_to_keep); | |
| 3001 | −s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm, | |
| 3002 | − const struct cfg80211_chan_def *chandef, | |
| 3003 | − bool low); | |
| 3004 | −void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm, | |
| 3005 | − struct ieee80211_vif *vif, | |
| 3006 | − int link_id); | |
| 3007 | −bool | |
| 3008 | −iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm, | |
| 3009 | − struct ieee80211_vif *vif, | |
| 3010 | − s32 link_rssi, | |
| 3011 | − bool primary); | |
| 3012 | −int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |
| 3013 | − unsigned int link_id, bool active); | |
| 3014 | − | |
| 3015 | 2889 | void |
| 3016 | 2890 | iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm, |
| 3017 | 2891 | struct ieee80211_vif *vif, |
| @@ -143,24 +143,6 @@ static void iwl_mvm_nic_config(struct iwl_op_mode *op_mode) · 142 unmodified lines | ||
| 143 | 143 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | −static void iwl_mvm_rx_esr_mode_notif(struct iwl_mvm *mvm, | |
| 147 | − struct iwl_rx_cmd_buffer *rxb) | |
| 148 | −{ | |
| 149 | − struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
| 150 | − struct iwl_esr_mode_notif *notif = (void *)pkt->data; | |
| 151 | − struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); | |
| 152 | − | |
| 153 | − /* FW recommendations is only for entering EMLSR */ | |
| 154 | − if (IS_ERR_OR_NULL(vif) || iwl_mvm_vif_from_mac80211(vif)->esr_active) | |
| 155 | − return; | |
| 156 | − | |
| 157 | − if (le32_to_cpu(notif->action) == ESR_RECOMMEND_ENTER) | |
| 158 | − iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW); | |
| 159 | − else | |
| 160 | − iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW, | |
| 161 | − iwl_mvm_get_primary_link(vif)); | |
| 162 | −} | |
| 163 | − | |
| 164 | 146 | static void iwl_mvm_rx_monitor_notif(struct iwl_mvm *mvm, |
| 165 | 147 | struct iwl_rx_cmd_buffer *rxb) |
| 166 | 148 | { |
| @@ -345,9 +327,6 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { · 178 unmodified lines | ||
| 345 | 327 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_old_notif, |
| 346 | 328 | RX_HANDLER_ASYNC_LOCKED_WIPHY, |
| 347 | 329 | struct iwl_bt_coex_prof_old_notif), |
| 348 | − RX_HANDLER_GRP(BT_COEX_GROUP, PROFILE_NOTIF, iwl_mvm_rx_bt_coex_notif, | |
| 349 | − RX_HANDLER_ASYNC_LOCKED_WIPHY, | |
| 350 | − struct iwl_bt_coex_profile_notif), | |
| 351 | 330 | RX_HANDLER_NO_SIZE(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, |
| 352 | 331 | RX_HANDLER_ASYNC_LOCKED), |
| 353 | 332 | RX_HANDLER_NO_SIZE(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, |
| @@ -457,11 +436,6 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { · 103 unmodified lines | ||
| 457 | 436 | RX_HANDLER_ASYNC_UNLOCKED, |
| 458 | 437 | struct iwl_channel_switch_error_notif), |
| 459 | 438 | |
| 460 | − RX_HANDLER_GRP(DATA_PATH_GROUP, ESR_MODE_NOTIF, | |
| 461 | − iwl_mvm_rx_esr_mode_notif, | |
| 462 | − RX_HANDLER_ASYNC_LOCKED_WIPHY, | |
| 463 | − struct iwl_esr_mode_notif), | |
| 464 | − | |
| 465 | 439 | RX_HANDLER_GRP(DATA_PATH_GROUP, MONITOR_NOTIF, |
| 466 | 440 | iwl_mvm_rx_monitor_notif, RX_HANDLER_ASYNC_LOCKED, |
| 467 | 441 | struct iwl_datapath_monitor_notif), |
| @@ -661,7 +635,6 @@ static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = { · 193 unmodified lines | ||
| 661 | 635 | HCMD_NAME(CHEST_COLLECTOR_FILTER_CONFIG_CMD), |
| 662 | 636 | HCMD_NAME(SCD_QUEUE_CONFIG_CMD), |
| 663 | 637 | HCMD_NAME(SEC_KEY_CMD), |
| 664 | − HCMD_NAME(ESR_MODE_NOTIF), | |
| 665 | 638 | HCMD_NAME(MONITOR_NOTIF), |
| 666 | 639 | HCMD_NAME(THERMAL_DUAL_CHAIN_REQUEST), |
| 667 | 640 | HCMD_NAME(BEACON_FILTER_IN_NOTIF), |
| @@ -1220,29 +1193,6 @@ static const struct iwl_mei_ops mei_ops = { · 552 unmodified lines | ||
| 1220 | 1193 | .nic_stolen = iwl_mvm_mei_nic_stolen, |
| 1221 | 1194 | }; |
| 1222 | 1195 | |
| 1223 | −static void iwl_mvm_find_link_selection_vif(void *_data, u8 *mac, | |
| 1224 | − struct ieee80211_vif *vif) | |
| 1225 | −{ | |
| 1226 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 1227 | − | |
| 1228 | − if (ieee80211_vif_is_mld(vif) && mvmvif->authorized) | |
| 1229 | − iwl_mvm_select_links(mvmvif->mvm, vif); | |
| 1230 | −} | |
| 1231 | − | |
| 1232 | −static void iwl_mvm_trig_link_selection(struct wiphy *wiphy, | |
| 1233 | − struct wiphy_work *wk) | |
| 1234 | −{ | |
| 1235 | − struct iwl_mvm *mvm = | |
| 1236 | − container_of(wk, struct iwl_mvm, trig_link_selection_wk); | |
| 1237 | − | |
| 1238 | − mutex_lock(&mvm->mutex); | |
| 1239 | − ieee80211_iterate_active_interfaces(mvm->hw, | |
| 1240 | − IEEE80211_IFACE_ITER_NORMAL, | |
| 1241 | − iwl_mvm_find_link_selection_vif, | |
| 1242 | − NULL); | |
| 1243 | − mutex_unlock(&mvm->mutex); | |
| 1244 | −} | |
| 1245 | − | |
| 1246 | 1196 | static struct iwl_op_mode * |
| 1247 | 1197 | iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, |
| 1248 | 1198 | const struct iwl_fw *fw, struct dentry *dbgfs_dir) |
| @@ -1411,9 +1361,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 162 unmodified lines | ||
| 1411 | 1361 | wiphy_work_init(&mvm->async_handlers_wiphy_wk, |
| 1412 | 1362 | iwl_mvm_async_handlers_wiphy_wk); |
| 1413 | 1363 | |
| 1414 | − wiphy_work_init(&mvm->trig_link_selection_wk, | |
| 1415 | − iwl_mvm_trig_link_selection); | |
| 1416 | − | |
| 1417 | 1364 | init_waitqueue_head(&mvm->rx_sync_waitq); |
| 1418 | 1365 | |
| 1419 | 1366 | mvm->queue_sync_state = 0; |
| @@ -563,7 +563,6 @@ static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, · 562 unmodified lines | ||
| 563 | 563 | int thold = bss_conf->cqm_rssi_thold; |
| 564 | 564 | int hyst = bss_conf->cqm_rssi_hyst; |
| 565 | 565 | int last_event; |
| 566 | − s8 exit_esr_thresh; | |
| 567 | 566 | |
| 568 | 567 | if (sig == 0) { |
| 569 | 568 | IWL_DEBUG_RX(mvm, "RSSI is 0 - skip signal based decision\n"); |
| @@ -619,27 +618,6 @@ static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, · 49 unmodified lines | ||
| 619 | 618 | sig, |
| 620 | 619 | GFP_KERNEL); |
| 621 | 620 | } |
| 622 | − | |
| 623 | − /* ESR recalculation */ | |
| 624 | − if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif)) | |
| 625 | − return; | |
| 626 | − | |
| 627 | − /* We're not in EMLSR and our signal is bad, try to switch link maybe */ | |
| 628 | − if (sig < IWL_MVM_LOW_RSSI_MLO_SCAN_THRESH && !mvmvif->esr_active) { | |
| 629 | − iwl_mvm_int_mlo_scan(mvm, vif); | |
| 630 | − return; | |
| 631 | − } | |
| 632 | − | |
| 633 | − /* We are in EMLSR, check if we need to exit */ | |
| 634 | − exit_esr_thresh = | |
| 635 | − iwl_mvm_get_esr_rssi_thresh(mvm, | |
| 636 | − &bss_conf->chanreq.oper, | |
| 637 | − true); | |
| 638 | − | |
| 639 | − if (sig < exit_esr_thresh) | |
| 640 | − iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_LOW_RSSI, | |
| 641 | − iwl_mvm_get_other_link(vif, | |
| 642 | − bss_conf->link_id)); | |
| 643 | 621 | } |
| 644 | 622 | |
| 645 | 623 | static void iwl_mvm_stat_iterator(void *_data, u8 *mac, |
| @@ -914,10 +892,6 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, · 268 unmodified lines | ||
| 914 | 892 | link_info->beacon_stats.avg_signal = |
| 915 | 893 | -le32_to_cpu(link_stats->beacon_average_energy); |
| 916 | 894 | |
| 917 | − if (link_info->phy_ctxt && | |
| 918 | − link_info->phy_ctxt->channel->band == NL80211_BAND_2GHZ) | |
| 919 | − iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id); | |
| 920 | − | |
| 921 | 895 | /* make sure that beacon statistics don't go backwards with TCM |
| 922 | 896 | * request to clear statistics |
| 923 | 897 | */ |
| @@ -956,111 +930,6 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, · 32 unmodified lines | ||
| 956 | 930 | } |
| 957 | 931 | } |
| 958 | 932 | |
| 959 | −#define SEC_LINK_MIN_PERC 10 | |
| 960 | −#define SEC_LINK_MIN_TX 3000 | |
| 961 | −#define SEC_LINK_MIN_RX 400 | |
| 962 | − | |
| 963 | −/* Accept a ~20% short window to avoid issues due to jitter */ | |
| 964 | −#define IWL_MVM_TPT_MIN_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ * 4 / 5) | |
| 965 | − | |
| 966 | −static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) | |
| 967 | −{ | |
| 968 | − struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); | |
| 969 | − struct iwl_mvm_vif *mvmvif; | |
| 970 | − struct iwl_mvm_sta *mvmsta; | |
| 971 | − unsigned long total_tx = 0, total_rx = 0; | |
| 972 | − unsigned long sec_link_tx = 0, sec_link_rx = 0; | |
| 973 | − u8 sec_link_tx_perc, sec_link_rx_perc; | |
| 974 | − u8 sec_link; | |
| 975 | − bool skip = false; | |
| 976 | − | |
| 977 | − lockdep_assert_held(&mvm->mutex); | |
| 978 | − | |
| 979 | − if (IS_ERR_OR_NULL(bss_vif)) | |
| 980 | − return; | |
| 981 | − | |
| 982 | − mvmvif = iwl_mvm_vif_from_mac80211(bss_vif); | |
| 983 | − | |
| 984 | − if (!mvmvif->esr_active || !mvmvif->ap_sta) | |
| 985 | − return; | |
| 986 | − | |
| 987 | − mvmsta = iwl_mvm_sta_from_mac80211(mvmvif->ap_sta); | |
| 988 | − /* We only count for the AP sta in a MLO connection */ | |
| 989 | − if (!mvmsta->mpdu_counters) | |
| 990 | − return; | |
| 991 | − | |
| 992 | − /* Get the FW ID of the secondary link */ | |
| 993 | − sec_link = iwl_mvm_get_other_link(bss_vif, | |
| 994 | − iwl_mvm_get_primary_link(bss_vif)); | |
| 995 | − if (WARN_ON(!mvmvif->link[sec_link])) | |
| 996 | − return; | |
| 997 | − sec_link = mvmvif->link[sec_link]->fw_link_id; | |
| 998 | − | |
| 999 | − /* Sum up RX and TX MPDUs from the different queues/links */ | |
| 1000 | − for (int q = 0; q < mvm->trans->info.num_rxqs; q++) { | |
| 1001 | − spin_lock_bh(&mvmsta->mpdu_counters[q].lock); | |
| 1002 | − | |
| 1003 | − /* The link IDs that doesn't exist will contain 0 */ | |
| 1004 | − for (int link = 0; link < IWL_FW_MAX_LINK_ID; link++) { | |
| 1005 | − total_tx += mvmsta->mpdu_counters[q].per_link[link].tx; | |
| 1006 | − total_rx += mvmsta->mpdu_counters[q].per_link[link].rx; | |
| 1007 | − } | |
| 1008 | − | |
| 1009 | − sec_link_tx += mvmsta->mpdu_counters[q].per_link[sec_link].tx; | |
| 1010 | − sec_link_rx += mvmsta->mpdu_counters[q].per_link[sec_link].rx; | |
| 1011 | − | |
| 1012 | − /* | |
| 1013 | − * In EMLSR we have statistics every 5 seconds, so we can reset | |
| 1014 | − * the counters upon every statistics notification. | |
| 1015 | − * The FW sends the notification regularly, but it will be | |
| 1016 | − * misaligned at the start. Skipping the measurement if it is | |
| 1017 | − * short will synchronize us. | |
| 1018 | − */ | |
| 1019 | − if (jiffies - mvmsta->mpdu_counters[q].window_start < | |
| 1020 | − IWL_MVM_TPT_MIN_COUNT_WINDOW) | |
| 1021 | − skip = true; | |
| 1022 | − mvmsta->mpdu_counters[q].window_start = jiffies; | |
| 1023 | − memset(mvmsta->mpdu_counters[q].per_link, 0, | |
| 1024 | − sizeof(mvmsta->mpdu_counters[q].per_link)); | |
| 1025 | − | |
| 1026 | − spin_unlock_bh(&mvmsta->mpdu_counters[q].lock); | |
| 1027 | − } | |
| 1028 | − | |
| 1029 | − if (skip) { | |
| 1030 | − IWL_DEBUG_INFO(mvm, "MPDU statistics window was short\n"); | |
| 1031 | − return; | |
| 1032 | − } | |
| 1033 | − | |
| 1034 | − IWL_DEBUG_INFO(mvm, "total Tx MPDUs: %ld. total Rx MPDUs: %ld\n", | |
| 1035 | − total_tx, total_rx); | |
| 1036 | − | |
| 1037 | − /* If we don't have enough MPDUs - exit EMLSR */ | |
| 1038 | − if (total_tx < IWL_MVM_ENTER_ESR_TPT_THRESH && | |
| 1039 | − total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH) { | |
| 1040 | − iwl_mvm_block_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_TPT, | |
| 1041 | − iwl_mvm_get_primary_link(bss_vif)); | |
| 1042 | − return; | |
| 1043 | − } | |
| 1044 | − | |
| 1045 | − IWL_DEBUG_INFO(mvm, "Secondary Link %d: Tx MPDUs: %ld. Rx MPDUs: %ld\n", | |
| 1046 | − sec_link, sec_link_tx, sec_link_rx); | |
| 1047 | − | |
| 1048 | − /* Calculate the percentage of the secondary link TX/RX */ | |
| 1049 | − sec_link_tx_perc = total_tx ? sec_link_tx * 100 / total_tx : 0; | |
| 1050 | − sec_link_rx_perc = total_rx ? sec_link_rx * 100 / total_rx : 0; | |
| 1051 | − | |
| 1052 | − /* | |
| 1053 | − * The TX/RX percentage is checked only if it exceeds the required | |
| 1054 | − * minimum. In addition, RX is checked only if the TX check failed. | |
| 1055 | − */ | |
| 1056 | − if ((total_tx > SEC_LINK_MIN_TX && | |
| 1057 | − sec_link_tx_perc < SEC_LINK_MIN_PERC) || | |
| 1058 | − (total_rx > SEC_LINK_MIN_RX && | |
| 1059 | − sec_link_rx_perc < SEC_LINK_MIN_PERC)) | |
| 1060 | − iwl_mvm_exit_esr(mvm, bss_vif, IWL_MVM_ESR_EXIT_LINK_USAGE, | |
| 1061 | − iwl_mvm_get_primary_link(bss_vif)); | |
| 1062 | −} | |
| 1063 | − | |
| 1064 | 933 | void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, |
| 1065 | 934 | struct iwl_rx_cmd_buffer *rxb) |
| 1066 | 935 | { |
| @@ -1088,8 +957,6 @@ void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, · 21 unmodified lines | ||
| 1088 | 957 | ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter, |
| 1089 | 958 | average_energy); |
| 1090 | 959 | iwl_mvm_handle_per_phy_stats(mvm, stats->per_phy); |
| 1091 | − | |
| 1092 | − iwl_mvm_update_esr_mode_tpt(mvm); | |
| 1093 | 960 | } |
| 1094 | 961 | |
| 1095 | 962 | void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm, |
| @@ -332,6 +332,7 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta, · 331 unmodified lines | ||
| 332 | 332 | struct ieee80211_key_conf *key; |
| 333 | 333 | u32 len = le16_to_cpu(desc->mpdu_len); |
| 334 | 334 | const u8 *frame = (void *)hdr; |
| 335 | + const u8 *mmie; | |
| 335 | 336 | |
| 336 | 337 | if ((status & IWL_RX_MPDU_STATUS_SEC_MASK) == IWL_RX_MPDU_STATUS_SEC_NONE) |
| 337 | 338 | return 0; |
| @@ -375,11 +376,15 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta, · 37 unmodified lines | ||
| 375 | 376 | goto report; |
| 376 | 377 | } |
| 377 | 378 | |
| 378 | − if (len < key->icv_len + IEEE80211_GMAC_PN_LEN + 2) | |
| 379 | + if (len < key->icv_len) | |
| 379 | 380 | goto report; |
| 380 | 381 | |
| 381 | 382 | /* get the real key ID */ |
| 382 | − keyid = frame[len - key->icv_len - IEEE80211_GMAC_PN_LEN - 2]; | |
| 383 | + mmie = frame + (len - key->icv_len); | |
| 384 | + | |
| 385 | + /* the position of the key_id in ieee80211_mmie_16 is the same */ | |
| 386 | + keyid = le16_to_cpu(((const struct ieee80211_mmie *) mmie)->key_id); | |
| 387 | + | |
| 383 | 388 | /* and if that's the other key, look it up */ |
| 384 | 389 | if (keyid != key->keyidx) { |
| 385 | 390 | /* |
| @@ -2099,7 +2104,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 1713 unmodified lines | ||
| 2099 | 2104 | struct ieee80211_sta *sta = NULL; |
| 2100 | 2105 | struct sk_buff *skb; |
| 2101 | 2106 | u8 crypt_len = 0; |
| 2102 | − u8 sta_id = le32_get_bits(desc->status, IWL_RX_MPDU_STATUS_STA_ID); | |
| 2103 | 2107 | size_t desc_size; |
| 2104 | 2108 | struct iwl_mvm_rx_phy_data phy_data = {}; |
| 2105 | 2109 | u32 format; |
| @@ -2246,6 +2250,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 140 unmodified lines | ||
| 2246 | 2250 | rcu_read_lock(); |
| 2247 | 2251 | |
| 2248 | 2252 | if (desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_SRC_STA_FOUND)) { |
| 2253 | + u8 sta_id = le32_get_bits(desc->status, | |
| 2254 | + IWL_RX_MPDU_STATUS_STA_ID); | |
| 2255 | + | |
| 2249 | 2256 | if (!WARN_ON_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations)) { |
| 2250 | 2257 | struct ieee80211_link_sta *link_sta; |
| 2251 | 2258 | |
| @@ -2373,16 +2380,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 121 unmodified lines | ||
| 2373 | 2380 | |
| 2374 | 2381 | iwl_mvm_agg_rx_received(mvm, reorder_data, baid); |
| 2375 | 2382 | } |
| 2376 | − | |
| 2377 | − if (ieee80211_is_data(hdr->frame_control)) { | |
| 2378 | − u8 sub_frame_idx = desc->amsdu_info & | |
| 2379 | − IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK; | |
| 2380 | − | |
| 2381 | − /* 0 means not an A-MSDU, and 1 means a new A-MSDU */ | |
| 2382 | − if (!sub_frame_idx || sub_frame_idx == 1) | |
| 2383 | − iwl_mvm_count_mpdu(mvmsta, sta_id, 1, false, | |
| 2384 | − queue); | |
| 2385 | − } | |
| 2386 | 2383 | } |
| 2387 | 2384 | |
| 2388 | 2385 | /* management stuff on default queue */ |
| @@ -1392,8 +1392,6 @@ static u32 iwl_mvm_scan_umac_ooc_priority(int type) · 1391 unmodified lines | ||
| 1392 | 1392 | { |
| 1393 | 1393 | if (type == IWL_MVM_SCAN_REGULAR) |
| 1394 | 1394 | return IWL_SCAN_PRIORITY_EXT_6; |
| 1395 | − if (type == IWL_MVM_SCAN_INT_MLO) | |
| 1396 | − return IWL_SCAN_PRIORITY_EXT_4; | |
| 1397 | 1395 | |
| 1398 | 1396 | return IWL_SCAN_PRIORITY_EXT_2; |
| 1399 | 1397 | } |
| @@ -3220,7 +3218,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 1820 unmodified lines | ||
| 3220 | 3218 | struct iwl_umac_scan_complete *notif = (void *)pkt->data; |
| 3221 | 3219 | u32 uid = __le32_to_cpu(notif->uid); |
| 3222 | 3220 | bool aborted = (notif->status == IWL_SCAN_OFFLOAD_ABORTED); |
| 3223 | − bool select_links = false; | |
| 3224 | 3221 | |
| 3225 | 3222 | mvm->mei_scan_filter.is_mei_limited_scan = false; |
| 3226 | 3223 | |
| @@ -3267,13 +3264,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 40 unmodified lines | ||
| 3267 | 3264 | } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { |
| 3268 | 3265 | ieee80211_sched_scan_stopped(mvm->hw); |
| 3269 | 3266 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; |
| 3270 | − } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_INT_MLO) { | |
| 3271 | − IWL_DEBUG_SCAN(mvm, "Internal MLO scan completed\n"); | |
| 3272 | − /* | |
| 3273 | − * Other scan types won't necessarily scan for the MLD links channels. | |
| 3274 | − * Therefore, only select links after successful internal scan. | |
| 3275 | − */ | |
| 3276 | − select_links = notif->status == IWL_SCAN_OFFLOAD_COMPLETED; | |
| 3277 | 3267 | } |
| 3278 | 3268 | |
| 3279 | 3269 | mvm->scan_status &= ~mvm->scan_uid_status[uid]; |
| @@ -3286,9 +3276,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 6 unmodified lines | ||
| 3286 | 3276 | mvm->last_ebs_successful = false; |
| 3287 | 3277 | |
| 3288 | 3278 | mvm->scan_uid_status[uid] = 0; |
| 3289 | − | |
| 3290 | − if (select_links) | |
| 3291 | − wiphy_work_queue(mvm->hw->wiphy, &mvm->trig_link_selection_wk); | |
| 3292 | 3279 | } |
| 3293 | 3280 | |
| 3294 | 3281 | void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, |
| @@ -3483,11 +3470,6 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) · 188 unmodified lines | ||
| 3483 | 3470 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; |
| 3484 | 3471 | mvm->scan_uid_status[uid] = 0; |
| 3485 | 3472 | } |
| 3486 | − uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_INT_MLO); | |
| 3487 | − if (uid >= 0) { | |
| 3488 | − IWL_DEBUG_SCAN(mvm, "Internal MLO scan aborted\n"); | |
| 3489 | − mvm->scan_uid_status[uid] = 0; | |
| 3490 | − } | |
| 3491 | 3473 | |
| 3492 | 3474 | uid = iwl_mvm_scan_uid_by_status(mvm, |
| 3493 | 3475 | IWL_MVM_SCAN_STOPPING_REGULAR); |
| @@ -3583,89 +3565,6 @@ out: · 89 unmodified lines | ||
| 3583 | 3565 | return ret; |
| 3584 | 3566 | } |
| 3585 | 3567 | |
| 3586 | −static int iwl_mvm_int_mlo_scan_start(struct iwl_mvm *mvm, | |
| 3587 | − struct ieee80211_vif *vif, | |
| 3588 | − struct ieee80211_channel **channels, | |
| 3589 | − size_t n_channels) | |
| 3590 | −{ | |
| 3591 | − struct cfg80211_scan_request *req = NULL; | |
| 3592 | − struct ieee80211_scan_ies ies = {}; | |
| 3593 | − size_t size, i; | |
| 3594 | − int ret; | |
| 3595 | − | |
| 3596 | − lockdep_assert_held(&mvm->mutex); | |
| 3597 | − | |
| 3598 | − IWL_DEBUG_SCAN(mvm, "Starting Internal MLO scan: n_channels=%zu\n", | |
| 3599 | − n_channels); | |
| 3600 | − | |
| 3601 | − if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif) || | |
| 3602 | − hweight16(vif->valid_links) == 1) | |
| 3603 | − return -EINVAL; | |
| 3604 | − | |
| 3605 | − size = struct_size(req, channels, n_channels); | |
| 3606 | − req = kzalloc(size, GFP_KERNEL); | |
| 3607 | − if (!req) | |
| 3608 | − return -ENOMEM; | |
| 3609 | − | |
| 3610 | − /* set the requested channels */ | |
| 3611 | − for (i = 0; i < n_channels; i++) | |
| 3612 | − req->channels[i] = channels[i]; | |
| 3613 | − | |
| 3614 | − req->n_channels = n_channels; | |
| 3615 | − | |
| 3616 | − /* set the rates */ | |
| 3617 | − for (i = 0; i < NUM_NL80211_BANDS; i++) | |
| 3618 | − if (mvm->hw->wiphy->bands[i]) | |
| 3619 | − req->rates[i] = | |
| 3620 | − (1 << mvm->hw->wiphy->bands[i]->n_bitrates) - 1; | |
| 3621 | − | |
| 3622 | − req->wdev = ieee80211_vif_to_wdev(vif); | |
| 3623 | − req->wiphy = mvm->hw->wiphy; | |
| 3624 | − req->scan_start = jiffies; | |
| 3625 | − req->tsf_report_link_id = -1; | |
| 3626 | − | |
| 3627 | − ret = _iwl_mvm_single_scan_start(mvm, vif, req, &ies, | |
| 3628 | − IWL_MVM_SCAN_INT_MLO); | |
| 3629 | − kfree(req); | |
| 3630 | − | |
| 3631 | − IWL_DEBUG_SCAN(mvm, "Internal MLO scan: ret=%d\n", ret); | |
| 3632 | − return ret; | |
| 3633 | −} | |
| 3634 | − | |
| 3635 | −int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |
| 3636 | −{ | |
| 3637 | − struct ieee80211_channel *channels[IEEE80211_MLD_MAX_NUM_LINKS]; | |
| 3638 | − unsigned long usable_links = ieee80211_vif_usable_links(vif); | |
| 3639 | − size_t n_channels = 0; | |
| 3640 | − u8 link_id; | |
| 3641 | − | |
| 3642 | − lockdep_assert_held(&mvm->mutex); | |
| 3643 | − | |
| 3644 | − if (mvm->scan_status & IWL_MVM_SCAN_INT_MLO) { | |
| 3645 | − IWL_DEBUG_SCAN(mvm, "Internal MLO scan is already running\n"); | |
| 3646 | − return -EBUSY; | |
| 3647 | − } | |
| 3648 | − | |
| 3649 | − rcu_read_lock(); | |
| 3650 | − | |
| 3651 | − for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { | |
| 3652 | − struct ieee80211_bss_conf *link_conf = | |
| 3653 | − rcu_dereference(vif->link_conf[link_id]); | |
| 3654 | − | |
| 3655 | − if (WARN_ON_ONCE(!link_conf)) | |
| 3656 | − continue; | |
| 3657 | − | |
| 3658 | − channels[n_channels++] = link_conf->chanreq.oper.chan; | |
| 3659 | − } | |
| 3660 | − | |
| 3661 | − rcu_read_unlock(); | |
| 3662 | − | |
| 3663 | − if (!n_channels) | |
| 3664 | − return -EINVAL; | |
| 3665 | − | |
| 3666 | − return iwl_mvm_int_mlo_scan_start(mvm, vif, channels, n_channels); | |
| 3667 | −} | |
| 3668 | − | |
| 3669 | 3568 | static int iwl_mvm_chanidx_from_phy(struct iwl_mvm *mvm, |
| 3670 | 3569 | enum nl80211_band band, |
| 3671 | 3570 | u16 phy_chan_num) |
| @@ -1835,18 +1835,6 @@ int iwl_mvm_sta_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 1834 unmodified lines | ||
| 1835 | 1835 | |
| 1836 | 1836 | iwl_mvm_toggle_tx_ant(mvm, &mvm_sta->tx_ant); |
| 1837 | 1837 | |
| 1838 | − /* MPDUs are counted only when EMLSR is possible */ | |
| 1839 | − if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | |
| 1840 | − !sta->tdls && ieee80211_vif_is_mld(vif)) { | |
| 1841 | − mvm_sta->mpdu_counters = | |
| 1842 | − kcalloc(mvm->trans->info.num_rxqs, | |
| 1843 | − sizeof(*mvm_sta->mpdu_counters), | |
| 1844 | − GFP_KERNEL); | |
| 1845 | − if (mvm_sta->mpdu_counters) | |
| 1846 | − for (int q = 0; q < mvm->trans->info.num_rxqs; q++) | |
| 1847 | − spin_lock_init(&mvm_sta->mpdu_counters[q].lock); | |
| 1848 | − } | |
| 1849 | − | |
| 1850 | 1838 | return 0; |
| 1851 | 1839 | } |
| 1852 | 1840 | |
| @@ -4328,80 +4316,3 @@ void iwl_mvm_cancel_channel_switch(struct iwl_mvm *mvm, · 2475 unmodified lines | ||
| 4328 | 4316 | if (ret) |
| 4329 | 4317 | IWL_ERR(mvm, "Failed to cancel the channel switch\n"); |
| 4330 | 4318 | } |
| 4331 | − | |
| 4332 | −static int iwl_mvm_fw_sta_id_to_fw_link_id(struct iwl_mvm_vif *mvmvif, | |
| 4333 | − u8 fw_sta_id) | |
| 4334 | −{ | |
| 4335 | − struct ieee80211_link_sta *link_sta = | |
| 4336 | − rcu_dereference(mvmvif->mvm->fw_id_to_link_sta[fw_sta_id]); | |
| 4337 | − struct iwl_mvm_vif_link_info *link; | |
| 4338 | − | |
| 4339 | − if (WARN_ON_ONCE(!link_sta)) | |
| 4340 | − return -EINVAL; | |
| 4341 | − | |
| 4342 | − link = mvmvif->link[link_sta->link_id]; | |
| 4343 | − | |
| 4344 | − if (WARN_ON_ONCE(!link)) | |
| 4345 | − return -EINVAL; | |
| 4346 | − | |
| 4347 | − return link->fw_link_id; | |
| 4348 | −} | |
| 4349 | − | |
| 4350 | −#define IWL_MVM_TPT_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ) | |
| 4351 | − | |
| 4352 | −void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count, | |
| 4353 | − bool tx, int queue) | |
| 4354 | −{ | |
| 4355 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvm_sta->vif); | |
| 4356 | − struct iwl_mvm *mvm = mvmvif->mvm; | |
| 4357 | − struct iwl_mvm_tpt_counter *queue_counter; | |
| 4358 | − struct iwl_mvm_mpdu_counter *link_counter; | |
| 4359 | − u32 total_mpdus = 0; | |
| 4360 | − int fw_link_id; | |
| 4361 | − | |
| 4362 | − /* Count only for a BSS sta, and only when EMLSR is possible */ | |
| 4363 | − if (!mvm_sta->mpdu_counters) | |
| 4364 | − return; | |
| 4365 | − | |
| 4366 | − /* Map sta id to link id */ | |
| 4367 | − fw_link_id = iwl_mvm_fw_sta_id_to_fw_link_id(mvmvif, fw_sta_id); | |
| 4368 | − if (fw_link_id < 0) | |
| 4369 | − return; | |
| 4370 | − | |
| 4371 | − queue_counter = &mvm_sta->mpdu_counters[queue]; | |
| 4372 | − link_counter = &queue_counter->per_link[fw_link_id]; | |
| 4373 | − | |
| 4374 | − spin_lock_bh(&queue_counter->lock); | |
| 4375 | − | |
| 4376 | − if (tx) | |
| 4377 | − link_counter->tx += count; | |
| 4378 | − else | |
| 4379 | − link_counter->rx += count; | |
| 4380 | − | |
| 4381 | − /* | |
| 4382 | − * When not in EMLSR, the window and the decision to enter EMLSR are | |
| 4383 | − * handled during counting, when in EMLSR - in the statistics flow | |
| 4384 | − */ | |
| 4385 | − if (mvmvif->esr_active) | |
| 4386 | − goto out; | |
| 4387 | − | |
| 4388 | − if (time_is_before_jiffies(queue_counter->window_start + | |
| 4389 | − IWL_MVM_TPT_COUNT_WINDOW)) { | |
| 4390 | − memset(queue_counter->per_link, 0, | |
| 4391 | − sizeof(queue_counter->per_link)); | |
| 4392 | − queue_counter->window_start = jiffies; | |
| 4393 | − | |
| 4394 | − IWL_DEBUG_INFO(mvm, "MPDU counters are cleared\n"); | |
| 4395 | − } | |
| 4396 | − | |
| 4397 | − for (int i = 0; i < IWL_FW_MAX_LINK_ID; i++) | |
| 4398 | − total_mpdus += tx ? queue_counter->per_link[i].tx : | |
| 4399 | − queue_counter->per_link[i].rx; | |
| 4400 | − | |
| 4401 | − if (total_mpdus > IWL_MVM_ENTER_ESR_TPT_THRESH) | |
| 4402 | − wiphy_work_queue(mvmvif->mvm->hw->wiphy, | |
| 4403 | − &mvmvif->unblock_esr_tpt_wk); | |
| 4404 | − | |
| 4405 | −out: | |
| 4406 | − spin_unlock_bh(&queue_counter->lock); | |
| 4407 | −} | |
| @@ -344,24 +344,6 @@ struct iwl_mvm_link_sta { · 343 unmodified lines | ||
| 344 | 344 | u8 avg_energy; |
| 345 | 345 | }; |
| 346 | 346 | |
| 347 | −struct iwl_mvm_mpdu_counter { | |
| 348 | − u32 tx; | |
| 349 | − u32 rx; | |
| 350 | −}; | |
| 351 | − | |
| 352 | −/** | |
| 353 | − * struct iwl_mvm_tpt_counter - per-queue MPDU counter | |
| 354 | − * | |
| 355 | − * @lock: Needed to protect the counters when modified from statistics. | |
| 356 | − * @per_link: per-link counters. | |
| 357 | − * @window_start: timestamp of the counting-window start | |
| 358 | − */ | |
| 359 | −struct iwl_mvm_tpt_counter { | |
| 360 | − spinlock_t lock; | |
| 361 | − struct iwl_mvm_mpdu_counter per_link[IWL_FW_MAX_LINK_ID]; | |
| 362 | − unsigned long window_start; | |
| 363 | −} ____cacheline_aligned_in_smp; | |
| 364 | − | |
| 365 | 347 | /** |
| 366 | 348 | * struct iwl_mvm_sta - representation of a station in the driver |
| 367 | 349 | * @vif: the interface the station belongs to |
| @@ -409,7 +391,6 @@ struct iwl_mvm_tpt_counter { · 41 unmodified lines | ||
| 409 | 391 | * @link: per link sta entries. For non-MLO only link[0] holds data. For MLO, |
| 410 | 392 | * link[0] points to deflink and link[link_id] is allocated when new link |
| 411 | 393 | * sta is added. |
| 412 | − * @mpdu_counters: RX/TX MPDUs counters for each queue. | |
| 413 | 394 | * |
| 414 | 395 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
| 415 | 396 | * in the structure for use by driver. This structure is placed in that |
| @@ -449,8 +430,6 @@ struct iwl_mvm_sta { · 33 unmodified lines | ||
| 449 | 430 | |
| 450 | 431 | struct iwl_mvm_link_sta deflink; |
| 451 | 432 | struct iwl_mvm_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; |
| 452 | − | |
| 453 | − struct iwl_mvm_tpt_counter *mpdu_counters; | |
| 454 | 433 | }; |
| 455 | 434 | |
| 456 | 435 | u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data); |
| @@ -533,9 +512,6 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, · 76 unmodified lines | ||
| 533 | 512 | void iwl_mvm_rx_eosp_notif(struct iwl_mvm *mvm, |
| 534 | 513 | struct iwl_rx_cmd_buffer *rxb); |
| 535 | 514 | |
| 536 | −void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count, | |
| 537 | − bool tx, int queue); | |
| 538 | − | |
| 539 | 515 | /* AMPDU */ |
| 540 | 516 | int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 541 | 517 | int tid, u16 ssn, bool start, u16 buf_size, u16 timeout); |
| @@ -1,3 +1,3 @@ | ||
| 1 | −iwlmvm-tests-y += module.o links.o hcmd.o | |
| 1 | +iwlmvm-tests-y += module.o hcmd.o | |
| 2 | 2 | |
| 3 | 3 | obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += iwlmvm-tests.o |
| @@ -1,433 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −/* | |
| 3 | − * KUnit tests for channel helper functions | |
| 4 | − * | |
| 5 | − * Copyright (C) 2024 Intel Corporation | |
| 6 | − */ | |
| 7 | −#include <net/mac80211.h> | |
| 8 | −#include "../mvm.h" | |
| 9 | −#include <kunit/test.h> | |
| 10 | − | |
| 11 | −MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); | |
| 12 | − | |
| 13 | −static struct wiphy wiphy = { | |
| 14 | − .mtx = __MUTEX_INITIALIZER(wiphy.mtx), | |
| 15 | −}; | |
| 16 | − | |
| 17 | −static struct ieee80211_hw hw = { | |
| 18 | − .wiphy = &wiphy, | |
| 19 | −}; | |
| 20 | − | |
| 21 | −static struct ieee80211_channel chan_5ghz = { | |
| 22 | − .band = NL80211_BAND_5GHZ, | |
| 23 | −}; | |
| 24 | − | |
| 25 | −static struct ieee80211_channel chan_6ghz = { | |
| 26 | − .band = NL80211_BAND_6GHZ, | |
| 27 | −}; | |
| 28 | − | |
| 29 | −static struct ieee80211_channel chan_2ghz = { | |
| 30 | − .band = NL80211_BAND_2GHZ, | |
| 31 | −}; | |
| 32 | − | |
| 33 | −static struct cfg80211_chan_def chandef_a = {}; | |
| 34 | − | |
| 35 | −static struct cfg80211_chan_def chandef_b = {}; | |
| 36 | − | |
| 37 | −static struct iwl_mvm_phy_ctxt ctx = {}; | |
| 38 | − | |
| 39 | −static struct iwl_mvm_vif_link_info mvm_link = { | |
| 40 | − .phy_ctxt = &ctx, | |
| 41 | − .active = true | |
| 42 | −}; | |
| 43 | − | |
| 44 | −static struct cfg80211_bss bss = {}; | |
| 45 | − | |
| 46 | −static struct ieee80211_bss_conf link_conf = {.bss = &bss}; | |
| 47 | − | |
| 48 | −static const struct iwl_fw_cmd_version entry = { | |
| 49 | − .group = LEGACY_GROUP, | |
| 50 | − .cmd = BT_PROFILE_NOTIFICATION, | |
| 51 | − .notif_ver = 4 | |
| 52 | −}; | |
| 53 | − | |
| 54 | −static struct iwl_fw fw = { | |
| 55 | − .ucode_capa = { | |
| 56 | − .n_cmd_versions = 1, | |
| 57 | − .cmd_versions = &entry, | |
| 58 | − }, | |
| 59 | −}; | |
| 60 | − | |
| 61 | −static struct iwl_mvm mvm = { | |
| 62 | − .hw = &hw, | |
| 63 | − .fw = &fw, | |
| 64 | −}; | |
| 65 | − | |
| 66 | −static const struct link_grading_case { | |
| 67 | − const char *desc; | |
| 68 | − const struct cfg80211_chan_def chandef; | |
| 69 | − s32 signal; | |
| 70 | − s16 channel_util; | |
| 71 | − int chan_load_by_us; | |
| 72 | − unsigned int grade; | |
| 73 | −} link_grading_cases[] = { | |
| 74 | − { | |
| 75 | − .desc = "UHB, RSSI below range, no factors", | |
| 76 | − .chandef = { | |
| 77 | − .chan = &chan_6ghz, | |
| 78 | − .width = NL80211_CHAN_WIDTH_20, | |
| 79 | − }, | |
| 80 | − .signal = -100, | |
| 81 | − .grade = 177, | |
| 82 | − }, | |
| 83 | − { | |
| 84 | − .desc = "LB, RSSI in range, no factors", | |
| 85 | − .chandef = { | |
| 86 | − .chan = &chan_2ghz, | |
| 87 | − .width = NL80211_CHAN_WIDTH_20, | |
| 88 | − }, | |
| 89 | − .signal = -84, | |
| 90 | − .grade = 344, | |
| 91 | − }, | |
| 92 | − { | |
| 93 | − .desc = "HB, RSSI above range, no factors", | |
| 94 | − .chandef = { | |
| 95 | − .chan = &chan_5ghz, | |
| 96 | − .width = NL80211_CHAN_WIDTH_20, | |
| 97 | − }, | |
| 98 | − .signal = -50, | |
| 99 | − .grade = 3442, | |
| 100 | − }, | |
| 101 | − { | |
| 102 | − .desc = "HB, BSS Load IE (20 percent), inactive link, no puncturing factor", | |
| 103 | − .chandef = { | |
| 104 | − .chan = &chan_5ghz, | |
| 105 | − .width = NL80211_CHAN_WIDTH_20, | |
| 106 | − }, | |
| 107 | − .signal = -66, | |
| 108 | − .channel_util = 51, | |
| 109 | − .grade = 1836, | |
| 110 | − }, | |
| 111 | − { | |
| 112 | − .desc = "LB, BSS Load IE (20 percent), active link, chan_load_by_us=10 percent. No puncturing factor", | |
| 113 | − .chandef = { | |
| 114 | − .chan = &chan_2ghz, | |
| 115 | − .width = NL80211_CHAN_WIDTH_20, | |
| 116 | − }, | |
| 117 | − .signal = -61, | |
| 118 | − .channel_util = 51, | |
| 119 | − .chan_load_by_us = 10, | |
| 120 | − .grade = 2061, | |
| 121 | − }, | |
| 122 | − { | |
| 123 | − .desc = "UHB, BSS Load IE (40 percent), active link, chan_load_by_us=50 (invalid) percent. No puncturing factor", | |
| 124 | − .chandef = { | |
| 125 | − .chan = &chan_6ghz, | |
| 126 | − .width = NL80211_CHAN_WIDTH_20, | |
| 127 | − }, | |
| 128 | − .signal = -66, | |
| 129 | − .channel_util = 102, | |
| 130 | − .chan_load_by_us = 50, | |
| 131 | − .grade = 1552, | |
| 132 | − }, | |
| 133 | − { .desc = "HB, 80 MHz, no channel load factor, punctured percentage 0", | |
| 134 | − .chandef = { | |
| 135 | − .chan = &chan_5ghz, | |
| 136 | − .width = NL80211_CHAN_WIDTH_80, | |
| 137 | − .punctured = 0x0000 | |
| 138 | − }, | |
| 139 | − .signal = -72, | |
| 140 | − .grade = 1750, | |
| 141 | − }, | |
| 142 | − { .desc = "HB, 160 MHz, no channel load factor, punctured percentage 25", | |
| 143 | − .chandef = { | |
| 144 | − .chan = &chan_5ghz, | |
| 145 | − .width = NL80211_CHAN_WIDTH_160, | |
| 146 | − .punctured = 0x3 | |
| 147 | − }, | |
| 148 | − .signal = -72, | |
| 149 | − .grade = 1312, | |
| 150 | − }, | |
| 151 | − { .desc = "UHB, 320 MHz, no channel load factor, punctured percentage 12.5 (2/16)", | |
| 152 | − .chandef = { | |
| 153 | − .chan = &chan_6ghz, | |
| 154 | − .width = NL80211_CHAN_WIDTH_320, | |
| 155 | − .punctured = 0x3 | |
| 156 | − }, | |
| 157 | − .signal = -72, | |
| 158 | − .grade = 1806, | |
| 159 | − }, | |
| 160 | − { .desc = "HB, 160 MHz, channel load 20, channel load by us 10, punctured percentage 25", | |
| 161 | − .chandef = { | |
| 162 | − .chan = &chan_5ghz, | |
| 163 | − .width = NL80211_CHAN_WIDTH_160, | |
| 164 | − .punctured = 0x3 | |
| 165 | − }, | |
| 166 | − .channel_util = 51, | |
| 167 | − .chan_load_by_us = 10, | |
| 168 | − .signal = -72, | |
| 169 | − .grade = 1179, | |
| 170 | − }, | |
| 171 | −}; | |
| 172 | − | |
| 173 | −KUNIT_ARRAY_PARAM_DESC(link_grading, link_grading_cases, desc) | |
| 174 | − | |
| 175 | −static void setup_link_conf(struct kunit *test) | |
| 176 | −{ | |
| 177 | − const struct link_grading_case *params = test->param_value; | |
| 178 | − size_t vif_size = sizeof(struct ieee80211_vif) + | |
| 179 | − sizeof(struct iwl_mvm_vif); | |
| 180 | − struct ieee80211_vif *vif = kunit_kzalloc(test, vif_size, GFP_KERNEL); | |
| 181 | − struct ieee80211_bss_load_elem *bss_load; | |
| 182 | − struct element *element; | |
| 183 | − size_t ies_size = sizeof(struct cfg80211_bss_ies) + sizeof(*bss_load) + sizeof(element); | |
| 184 | − struct cfg80211_bss_ies *ies; | |
| 185 | − struct iwl_mvm_vif *mvmvif; | |
| 186 | − | |
| 187 | − KUNIT_ASSERT_NOT_NULL(test, vif); | |
| 188 | − | |
| 189 | − mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 190 | − if (params->chan_load_by_us > 0) { | |
| 191 | − ctx.channel_load_by_us = params->chan_load_by_us; | |
| 192 | − mvmvif->link[0] = &mvm_link; | |
| 193 | − } | |
| 194 | − | |
| 195 | − link_conf.vif = vif; | |
| 196 | − link_conf.chanreq.oper = params->chandef; | |
| 197 | − bss.signal = DBM_TO_MBM(params->signal); | |
| 198 | − | |
| 199 | − ies = kunit_kzalloc(test, ies_size, GFP_KERNEL); | |
| 200 | − KUNIT_ASSERT_NOT_NULL(test, ies); | |
| 201 | − ies->len = sizeof(*bss_load) + sizeof(struct element); | |
| 202 | − | |
| 203 | − element = (void *)ies->data; | |
| 204 | − element->datalen = sizeof(*bss_load); | |
| 205 | − element->id = 11; | |
| 206 | − | |
| 207 | − bss_load = (void *)element->data; | |
| 208 | − bss_load->channel_util = params->channel_util; | |
| 209 | − | |
| 210 | − rcu_assign_pointer(bss.ies, ies); | |
| 211 | − rcu_assign_pointer(bss.beacon_ies, ies); | |
| 212 | −} | |
| 213 | − | |
| 214 | −static void test_link_grading(struct kunit *test) | |
| 215 | −{ | |
| 216 | − const struct link_grading_case *params = test->param_value; | |
| 217 | − unsigned int ret; | |
| 218 | − | |
| 219 | − setup_link_conf(test); | |
| 220 | − | |
| 221 | − rcu_read_lock(); | |
| 222 | − ret = iwl_mvm_get_link_grade(&link_conf); | |
| 223 | − rcu_read_unlock(); | |
| 224 | − | |
| 225 | − KUNIT_EXPECT_EQ(test, ret, params->grade); | |
| 226 | − | |
| 227 | − kunit_kfree(test, link_conf.vif); | |
| 228 | − RCU_INIT_POINTER(bss.ies, NULL); | |
| 229 | −} | |
| 230 | − | |
| 231 | −static struct kunit_case link_grading_test_cases[] = { | |
| 232 | − KUNIT_CASE_PARAM(test_link_grading, link_grading_gen_params), | |
| 233 | − {} | |
| 234 | −}; | |
| 235 | − | |
| 236 | −static struct kunit_suite link_grading = { | |
| 237 | − .name = "iwlmvm-link-grading", | |
| 238 | − .test_cases = link_grading_test_cases, | |
| 239 | −}; | |
| 240 | − | |
| 241 | −kunit_test_suite(link_grading); | |
| 242 | − | |
| 243 | −static const struct valid_link_pair_case { | |
| 244 | − const char *desc; | |
| 245 | − bool bt; | |
| 246 | − struct ieee80211_channel *chan_a; | |
| 247 | − struct ieee80211_channel *chan_b; | |
| 248 | − enum nl80211_chan_width cw_a; | |
| 249 | − enum nl80211_chan_width cw_b; | |
| 250 | − s32 sig_a; | |
| 251 | − s32 sig_b; | |
| 252 | − bool csa_a; | |
| 253 | − bool valid; | |
| 254 | −} valid_link_pair_cases[] = { | |
| 255 | − { | |
| 256 | − .desc = "HB + UHB, valid.", | |
| 257 | − .chan_a = &chan_6ghz, | |
| 258 | − .chan_b = &chan_5ghz, | |
| 259 | − .valid = true, | |
| 260 | − }, | |
| 261 | − { | |
| 262 | − .desc = "LB + HB, no BT.", | |
| 263 | − .chan_a = &chan_2ghz, | |
| 264 | − .chan_b = &chan_5ghz, | |
| 265 | − .valid = true, | |
| 266 | − }, | |
| 267 | − { | |
| 268 | − .desc = "LB + HB, with BT.", | |
| 269 | − .bt = true, | |
| 270 | − .chan_a = &chan_2ghz, | |
| 271 | − .chan_b = &chan_5ghz, | |
| 272 | − .valid = false, | |
| 273 | − }, | |
| 274 | − { | |
| 275 | − .desc = "Same band", | |
| 276 | − .chan_a = &chan_2ghz, | |
| 277 | − .chan_b = &chan_2ghz, | |
| 278 | − .valid = false, | |
| 279 | − }, | |
| 280 | − { | |
| 281 | − .desc = "RSSI: LB, 20 MHz, low", | |
| 282 | − .chan_a = &chan_2ghz, | |
| 283 | − .cw_a = NL80211_CHAN_WIDTH_20, | |
| 284 | − .sig_a = -68, | |
| 285 | − .chan_b = &chan_5ghz, | |
| 286 | − .valid = false, | |
| 287 | − }, | |
| 288 | − { | |
| 289 | − .desc = "RSSI: UHB, 20 MHz, high", | |
| 290 | − .chan_a = &chan_6ghz, | |
| 291 | − .cw_a = NL80211_CHAN_WIDTH_20, | |
| 292 | − .sig_a = -66, | |
| 293 | − .chan_b = &chan_5ghz, | |
| 294 | − .cw_b = NL80211_CHAN_WIDTH_20, | |
| 295 | − .valid = true, | |
| 296 | − }, | |
| 297 | − { | |
| 298 | − .desc = "RSSI: UHB, 40 MHz, low", | |
| 299 | − .chan_a = &chan_6ghz, | |
| 300 | − .cw_a = NL80211_CHAN_WIDTH_40, | |
| 301 | − .sig_a = -65, | |
| 302 | − .chan_b = &chan_5ghz, | |
| 303 | − .cw_b = NL80211_CHAN_WIDTH_40, | |
| 304 | − .valid = false, | |
| 305 | − }, | |
| 306 | − { | |
| 307 | − .desc = "RSSI: UHB, 40 MHz, high", | |
| 308 | − .chan_a = &chan_6ghz, | |
| 309 | − .cw_a = NL80211_CHAN_WIDTH_40, | |
| 310 | − .sig_a = -63, | |
| 311 | − .chan_b = &chan_5ghz, | |
| 312 | − .cw_b = NL80211_CHAN_WIDTH_40, | |
| 313 | − .valid = true, | |
| 314 | − }, | |
| 315 | − { | |
| 316 | − .desc = "RSSI: UHB, 80 MHz, low", | |
| 317 | − .chan_a = &chan_6ghz, | |
| 318 | − .cw_a = NL80211_CHAN_WIDTH_80, | |
| 319 | − .sig_a = -62, | |
| 320 | − .chan_b = &chan_5ghz, | |
| 321 | − .cw_b = NL80211_CHAN_WIDTH_80, | |
| 322 | − .valid = false, | |
| 323 | − }, | |
| 324 | − { | |
| 325 | − .desc = "RSSI: UHB, 80 MHz, high", | |
| 326 | − .chan_a = &chan_6ghz, | |
| 327 | − .cw_a = NL80211_CHAN_WIDTH_80, | |
| 328 | − .sig_a = -60, | |
| 329 | − .chan_b = &chan_5ghz, | |
| 330 | − .cw_b = NL80211_CHAN_WIDTH_80, | |
| 331 | − .valid = true, | |
| 332 | − }, | |
| 333 | − { | |
| 334 | − .desc = "RSSI: UHB, 160 MHz, low", | |
| 335 | − .chan_a = &chan_6ghz, | |
| 336 | − .cw_a = NL80211_CHAN_WIDTH_160, | |
| 337 | − .sig_a = -59, | |
| 338 | − .chan_b = &chan_5ghz, | |
| 339 | − .cw_b = NL80211_CHAN_WIDTH_160, | |
| 340 | − .valid = false, | |
| 341 | − }, | |
| 342 | − { | |
| 343 | − .desc = "RSSI: HB, 160 MHz, high", | |
| 344 | − .chan_a = &chan_6ghz, | |
| 345 | − .cw_a = NL80211_CHAN_WIDTH_160, | |
| 346 | − .sig_a = -5, | |
| 347 | − .chan_b = &chan_5ghz, | |
| 348 | − .cw_b = NL80211_CHAN_WIDTH_160, | |
| 349 | − .valid = true, | |
| 350 | − }, | |
| 351 | − { | |
| 352 | − .desc = "CSA active", | |
| 353 | − .chan_a = &chan_6ghz, | |
| 354 | − .cw_a = NL80211_CHAN_WIDTH_160, | |
| 355 | − .sig_a = -5, | |
| 356 | − .chan_b = &chan_5ghz, | |
| 357 | − .cw_b = NL80211_CHAN_WIDTH_160, | |
| 358 | − .valid = false, | |
| 359 | − /* same as previous entry with valid=true except for CSA */ | |
| 360 | − .csa_a = true, | |
| 361 | − }, | |
| 362 | −}; | |
| 363 | − | |
| 364 | −KUNIT_ARRAY_PARAM_DESC(valid_link_pair, valid_link_pair_cases, desc) | |
| 365 | − | |
| 366 | −static void test_valid_link_pair(struct kunit *test) | |
| 367 | −{ | |
| 368 | − const struct valid_link_pair_case *params = test->param_value; | |
| 369 | − size_t vif_size = sizeof(struct ieee80211_vif) + | |
| 370 | − sizeof(struct iwl_mvm_vif); | |
| 371 | − struct ieee80211_vif *vif = kunit_kzalloc(test, vif_size, GFP_KERNEL); | |
| 372 | − struct iwl_trans *trans = kunit_kzalloc(test, sizeof(struct iwl_trans), | |
| 373 | − GFP_KERNEL); | |
| 374 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 375 | − struct iwl_mvm_link_sel_data link_a = { | |
| 376 | − .chandef = &chandef_a, | |
| 377 | − .link_id = 1, | |
| 378 | − .signal = params->sig_a, | |
| 379 | − }; | |
| 380 | − struct iwl_mvm_link_sel_data link_b = { | |
| 381 | − .chandef = &chandef_b, | |
| 382 | − .link_id = 5, | |
| 383 | − .signal = params->sig_b, | |
| 384 | − }; | |
| 385 | − struct ieee80211_bss_conf *conf; | |
| 386 | − bool result; | |
| 387 | − | |
| 388 | − KUNIT_ASSERT_NOT_NULL(test, vif); | |
| 389 | − KUNIT_ASSERT_NOT_NULL(test, trans); | |
| 390 | − | |
| 391 | − chandef_a.chan = params->chan_a; | |
| 392 | − chandef_b.chan = params->chan_b; | |
| 393 | − | |
| 394 | − chandef_a.width = params->cw_a ?: NL80211_CHAN_WIDTH_20; | |
| 395 | − chandef_b.width = params->cw_b ?: NL80211_CHAN_WIDTH_20; | |
| 396 | − | |
| 397 | − mvm.trans = trans; | |
| 398 | − | |
| 399 | − mvm.last_bt_notif.wifi_loss_low_rssi = params->bt; | |
| 400 | − mvmvif->mvm = &mvm; | |
| 401 | − | |
| 402 | − conf = kunit_kzalloc(test, sizeof(*vif->link_conf[0]), GFP_KERNEL); | |
| 403 | − KUNIT_ASSERT_NOT_NULL(test, conf); | |
| 404 | − conf->chanreq.oper = chandef_a; | |
| 405 | − conf->csa_active = params->csa_a; | |
| 406 | − vif->link_conf[link_a.link_id] = (void __rcu *)conf; | |
| 407 | − | |
| 408 | − conf = kunit_kzalloc(test, sizeof(*vif->link_conf[0]), GFP_KERNEL); | |
| 409 | − KUNIT_ASSERT_NOT_NULL(test, conf); | |
| 410 | − conf->chanreq.oper = chandef_b; | |
| 411 | − vif->link_conf[link_b.link_id] = (void __rcu *)conf; | |
| 412 | − | |
| 413 | − wiphy_lock(&wiphy); | |
| 414 | − result = iwl_mvm_mld_valid_link_pair(vif, &link_a, &link_b); | |
| 415 | − wiphy_unlock(&wiphy); | |
| 416 | − | |
| 417 | − KUNIT_EXPECT_EQ(test, result, params->valid); | |
| 418 | − | |
| 419 | − kunit_kfree(test, vif); | |
| 420 | − kunit_kfree(test, trans); | |
| 421 | −} | |
| 422 | − | |
| 423 | −static struct kunit_case valid_link_pair_test_cases[] = { | |
| 424 | − KUNIT_CASE_PARAM(test_valid_link_pair, valid_link_pair_gen_params), | |
| 425 | − {}, | |
| 426 | −}; | |
| 427 | − | |
| 428 | −static struct kunit_suite valid_link_pair = { | |
| 429 | − .name = "iwlmvm-valid-link-pair", | |
| 430 | − .test_cases = valid_link_pair_test_cases, | |
| 431 | −}; | |
| 432 | − | |
| 433 | −kunit_test_suite(valid_link_pair); | |
| @@ -47,7 +47,6 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm) |
| 49 | 49 | { |
| 50 | − struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); | |
| 51 | 50 | struct ieee80211_vif *vif = mvm->p2p_device_vif; |
| 52 | 51 | |
| 53 | 52 | lockdep_assert_held(&mvm->mutex); |
| @@ -125,8 +124,6 @@ static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm) · 71 unmodified lines | ||
| 125 | 124 | iwl_mvm_rm_aux_sta(mvm); |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | − if (!IS_ERR_OR_NULL(bss_vif)) | |
| 129 | − iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_ROC); | |
| 130 | 127 | mutex_unlock(&mvm->mutex); |
| 131 | 128 | } |
| 132 | 129 | |
| @@ -1769,9 +1769,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 1768 unmodified lines | ||
| 1769 | 1769 | IWL_DEBUG_TX_REPLY(mvm, |
| 1770 | 1770 | "Next reclaimed packet:%d\n", |
| 1771 | 1771 | next_reclaimed); |
| 1772 | − if (tid < IWL_MAX_TID_COUNT) | |
| 1773 | − iwl_mvm_count_mpdu(mvmsta, sta_id, 1, | |
| 1774 | − true, 0); | |
| 1775 | 1772 | } else { |
| 1776 | 1773 | IWL_DEBUG_TX_REPLY(mvm, |
| 1777 | 1774 | "NDP - don't update next_reclaimed\n"); |
| @@ -2150,13 +2147,10 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) · 372 unmodified lines | ||
| 2150 | 2147 | ba_res->tx_rate, false); |
| 2151 | 2148 | } |
| 2152 | 2149 | |
| 2153 | − if (mvmsta) { | |
| 2150 | + if (mvmsta) | |
| 2154 | 2151 | iwl_mvm_tx_airtime(mvm, mvmsta, |
| 2155 | 2152 | le32_to_cpu(ba_res->wireless_time)); |
| 2156 | 2153 | |
| 2157 | − iwl_mvm_count_mpdu(mvmsta, sta_id, | |
| 2158 | − le16_to_cpu(ba_res->txed), true, 0); | |
| 2159 | − } | |
| 2160 | 2154 | rcu_read_unlock(); |
| 2161 | 2155 | return; |
| 2162 | 2156 | } |
| @@ -22,11 +22,6 @@ int iwl_mvm_send_cmd(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd) · 21 unmodified lines | ||
| 22 | 22 | { |
| 23 | 23 | int ret; |
| 24 | 24 | |
| 25 | −#if defined(CONFIG_IWLWIFI_DEBUGFS) && defined(CONFIG_PM_SLEEP) | |
| 26 | − if (WARN_ON(mvm->d3_test_active)) | |
| 27 | − return -EIO; | |
| 28 | −#endif | |
| 29 | − | |
| 30 | 25 | /* |
| 31 | 26 | * Synchronous commands from this op-mode must hold |
| 32 | 27 | * the mutex, this ensures we don't try to send two |
| @@ -79,11 +74,6 @@ int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, · 46 unmodified lines | ||
| 79 | 74 | |
| 80 | 75 | lockdep_assert_held(&mvm->mutex); |
| 81 | 76 | |
| 82 | −#if defined(CONFIG_IWLWIFI_DEBUGFS) && defined(CONFIG_PM_SLEEP) | |
| 83 | − if (WARN_ON(mvm->d3_test_active)) | |
| 84 | − return -EIO; | |
| 85 | −#endif | |
| 86 | − | |
| 87 | 77 | /* |
| 88 | 78 | * Only synchronous commands can wait for status, |
| 89 | 79 | * we use WANT_SKB so the caller can't. |
| @@ -1179,16 +1179,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1178 unmodified lines | ||
| 1179 | 1179 | static void iwl_pci_remove(struct pci_dev *pdev) |
| 1180 | 1180 | { |
| 1181 | 1181 | struct iwl_trans *trans = pci_get_drvdata(pdev); |
| 1182 | − struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 1183 | 1182 | |
| 1184 | 1183 | if (!trans) |
| 1185 | 1184 | return; |
| 1186 | 1185 | |
| 1187 | − cancel_delayed_work_sync(&trans_pcie->me_recheck_wk); | |
| 1188 | − | |
| 1189 | − iwl_drv_stop(trans->drv); | |
| 1190 | − | |
| 1191 | − iwl_trans_pcie_free(trans); | |
| 1186 | + iwl_pcie_gen1_2_remove(trans); | |
| 1192 | 1187 | } |
| 1193 | 1188 | |
| 1194 | 1189 | #ifdef CONFIG_PM_SLEEP |
| @@ -1260,7 +1255,7 @@ static int _iwl_pci_resume(struct device *device, bool restore) · 65 unmodified lines | ||
| 1260 | 1255 | * won't really know how to recover. |
| 1261 | 1256 | */ |
| 1262 | 1257 | iwl_pcie_prepare_card_hw(trans); |
| 1263 | − iwl_finish_nic_init(trans); | |
| 1258 | + iwl_trans_activate_nic(trans); | |
| 1264 | 1259 | iwl_op_mode_device_powered_off(trans->op_mode); |
| 1265 | 1260 | } |
| 1266 | 1261 | |
| @@ -400,6 +400,11 @@ struct iwl_pcie_txqs { · 399 unmodified lines | ||
| 400 | 400 | * @me_recheck_wk: worker to recheck WiAMT/CSME presence |
| 401 | 401 | * @invalid_tx_cmd: invalid TX command buffer |
| 402 | 402 | * @wait_command_queue: wait queue for sync commands |
| 403 | + * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. | |
| 404 | + * The user should use iwl_trans_{alloc,free}_tx_cmd. | |
| 405 | + * @dev_cmd_pool_name: name for the TX command allocation pool | |
| 406 | + * @pm_support: set to true in start_hw if link pm is supported | |
| 407 | + * @ltr_enabled: set to true if the LTR is enabled | |
| 403 | 408 | */ |
| 404 | 409 | struct iwl_trans_pcie { |
| 405 | 410 | struct iwl_rxq *rxq; |
| @@ -506,6 +511,12 @@ struct iwl_trans_pcie { · 100 unmodified lines | ||
| 506 | 511 | struct iwl_dma_ptr invalid_tx_cmd; |
| 507 | 512 | |
| 508 | 513 | wait_queue_head_t wait_command_queue; |
| 514 | + | |
| 515 | + struct kmem_cache *dev_cmd_pool; | |
| 516 | + char dev_cmd_pool_name[50]; | |
| 517 | + | |
| 518 | + bool pm_support; | |
| 519 | + bool ltr_enabled; | |
| 509 | 520 | }; |
| 510 | 521 | |
| 511 | 522 | static inline struct iwl_trans_pcie * |
| @@ -783,6 +794,23 @@ static inline u16 iwl_txq_gen1_tfd_tb_get_len(struct iwl_trans *trans, · 271 unmodified lines | ||
| 783 | 794 | return le16_to_cpu(tb->hi_n_len) >> 4; |
| 784 | 795 | } |
| 785 | 796 | |
| 797 | +static inline struct iwl_device_tx_cmd * | |
| 798 | +iwl_pcie_gen1_2_alloc_tx_cmd(struct iwl_trans *trans) | |
| 799 | +{ | |
| 800 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 801 | + | |
| 802 | + return kmem_cache_zalloc(trans_pcie->dev_cmd_pool, GFP_ATOMIC); | |
| 803 | +} | |
| 804 | + | |
| 805 | +static inline void | |
| 806 | +iwl_pcie_gen1_2_free_tx_cmd(struct iwl_trans *trans, | |
| 807 | + struct iwl_device_tx_cmd *dev_cmd) | |
| 808 | +{ | |
| 809 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 810 | + | |
| 811 | + kmem_cache_free(trans_pcie->dev_cmd_pool, dev_cmd); | |
| 812 | +} | |
| 813 | + | |
| 786 | 814 | void iwl_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, |
| 787 | 815 | struct sk_buff_head *skbs, bool is_flush); |
| 788 | 816 | void iwl_pcie_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr); |
| @@ -818,6 +846,8 @@ static inline void _iwl_disable_interrupts(struct iwl_trans *trans) · 29 unmodified lines | ||
| 818 | 846 | trans_pcie->fh_init_mask); |
| 819 | 847 | iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD, |
| 820 | 848 | trans_pcie->hw_init_mask); |
| 849 | + trans_pcie->fh_mask = 0; | |
| 850 | + trans_pcie->hw_mask = 0; | |
| 821 | 851 | } |
| 822 | 852 | IWL_DEBUG_ISR(trans, "Disabled interrupts\n"); |
| 823 | 853 | } |
| @@ -1000,6 +1030,7 @@ static inline void iwl_enable_rfkill_int(struct iwl_trans *trans) · 176 unmodified lines | ||
| 1000 | 1030 | } else { |
| 1001 | 1031 | iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD, |
| 1002 | 1032 | trans_pcie->fh_init_mask); |
| 1033 | + trans_pcie->fh_mask = 0; | |
| 1003 | 1034 | iwl_enable_hw_int_msk_msix(trans, |
| 1004 | 1035 | MSIX_HW_INT_CAUSES_REG_RF_KILL); |
| 1005 | 1036 | } |
| @@ -1047,7 +1078,7 @@ static inline void iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans) { } · 41 unmodified lines | ||
| 1047 | 1078 | void iwl_pcie_rx_allocator_work(struct work_struct *data); |
| 1048 | 1079 | |
| 1049 | 1080 | /* common trans ops for all generations transports */ |
| 1050 | −void iwl_trans_pcie_op_mode_enter(struct iwl_trans *trans); | |
| 1081 | +void iwl_pcie_gen1_2_op_mode_enter(struct iwl_trans *trans); | |
| 1051 | 1082 | int _iwl_trans_pcie_start_hw(struct iwl_trans *trans); |
| 1052 | 1083 | int iwl_trans_pcie_start_hw(struct iwl_trans *trans); |
| 1053 | 1084 | void iwl_trans_pcie_op_mode_leave(struct iwl_trans *trans); |
| @@ -1064,9 +1095,8 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask, · 10 unmodified lines | ||
| 1064 | 1095 | const struct iwl_dump_sanitize_ops *sanitize_ops, |
| 1065 | 1096 | void *sanitize_ctx); |
| 1066 | 1097 | int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, |
| 1067 | − enum iwl_d3_status *status, | |
| 1068 | − bool test, bool reset); | |
| 1069 | −int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset); | |
| 1098 | + bool reset); | |
| 1099 | +int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset); | |
| 1070 | 1100 | void iwl_trans_pci_interrupts(struct iwl_trans *trans, bool enable); |
| 1071 | 1101 | void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans); |
| 1072 | 1102 | void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg, |
| @@ -1081,6 +1111,7 @@ int iwl_pci_gen1_2_probe(struct pci_dev *pdev, · 8 unmodified lines | ||
| 1081 | 1111 | const struct pci_device_id *ent, |
| 1082 | 1112 | const struct iwl_mac_cfg *mac_cfg, |
| 1083 | 1113 | u8 __iomem *hw_base, u32 hw_rev); |
| 1114 | +void iwl_pcie_gen1_2_remove(struct iwl_trans *trans); | |
| 1084 | 1115 | |
| 1085 | 1116 | /* transport gen 1 exported functions */ |
| 1086 | 1117 | void iwl_trans_pcie_fw_alive(struct iwl_trans *trans); |
| @@ -1105,6 +1136,7 @@ int iwl_pcie_alloc_dma_ptr(struct iwl_trans *trans, · 18 unmodified lines | ||
| 1105 | 1136 | struct iwl_dma_ptr *ptr, size_t size); |
| 1106 | 1137 | void iwl_pcie_free_dma_ptr(struct iwl_trans *trans, struct iwl_dma_ptr *ptr); |
| 1107 | 1138 | void iwl_pcie_apply_destination(struct iwl_trans *trans); |
| 1139 | +int iwl_pcie_gen1_2_activate_nic(struct iwl_trans *trans); | |
| 1108 | 1140 | |
| 1109 | 1141 | /* transport gen 2 exported functions */ |
| 1110 | 1142 | int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, |
| @@ -1124,4 +1156,17 @@ int iwl_trans_pcie_copy_imr(struct iwl_trans *trans, · 13 unmodified lines | ||
| 1124 | 1156 | int iwl_trans_pcie_rxq_dma_data(struct iwl_trans *trans, int queue, |
| 1125 | 1157 | struct iwl_trans_rxq_dma_data *data); |
| 1126 | 1158 | |
| 1159 | +static inline bool iwl_pcie_gen1_is_pm_supported(struct iwl_trans *trans) | |
| 1160 | +{ | |
| 1161 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 1162 | + | |
| 1163 | + return trans_pcie->pm_support; | |
| 1164 | +} | |
| 1165 | + | |
| 1166 | +static inline bool iwl_pcie_gen1_2_is_ltr_enabled(struct iwl_trans *trans) | |
| 1167 | +{ | |
| 1168 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 1169 | + | |
| 1170 | + return trans_pcie->ltr_enabled; | |
| 1171 | +} | |
| 1127 | 1172 | #endif /* __iwl_trans_int_pcie_h__ */ |
| @@ -47,7 +47,7 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans) · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | iwl_pcie_apm_config(trans); |
| 49 | 49 | |
| 50 | − ret = iwl_finish_nic_init(trans); | |
| 50 | + ret = iwl_trans_activate_nic(trans); | |
| 51 | 51 | if (ret) |
| 52 | 52 | return ret; |
| 53 | 53 | |
| @@ -25,13 +25,52 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "fw/dbg.h" |
| 26 | 26 | #include "fw/api/tx.h" |
| 27 | 27 | #include "fw/acpi.h" |
| 28 | −#include "fw/api/tx.h" | |
| 29 | 28 | #include "mei/iwl-mei.h" |
| 30 | 29 | #include "internal.h" |
| 31 | 30 | #include "iwl-fh.h" |
| 32 | 31 | #include "pcie/iwl-context-info-v2.h" |
| 33 | 32 | #include "pcie/utils.h" |
| 34 | 33 | |
| 34 | +#define IWL_HOST_MON_BLOCK_PEMON 0x00 | |
| 35 | +#define IWL_HOST_MON_BLOCK_HIPM 0x22 | |
| 36 | + | |
| 37 | +#define IWL_HOST_MON_BLOCK_PEMON_VEC0 0x00 | |
| 38 | +#define IWL_HOST_MON_BLOCK_PEMON_VEC1 0x01 | |
| 39 | +#define IWL_HOST_MON_BLOCK_PEMON_WFPM 0x06 | |
| 40 | + | |
| 41 | +static void iwl_dump_host_monitor_block(struct iwl_trans *trans, | |
| 42 | + u32 block, u32 vec, u32 iter) | |
| 43 | +{ | |
| 44 | + int i; | |
| 45 | + | |
| 46 | + IWL_ERR(trans, "Host monitor block 0x%x vector 0x%x\n", block, vec); | |
| 47 | + iwl_write32(trans, CSR_MONITOR_CFG_REG, (block << 8) | vec); | |
| 48 | + for (i = 0; i < iter; i++) | |
| 49 | + IWL_ERR(trans, " value [iter %d]: 0x%08x\n", | |
| 50 | + i, iwl_read32(trans, CSR_MONITOR_STATUS_REG)); | |
| 51 | +} | |
| 52 | + | |
| 53 | +static void iwl_pcie_dump_host_monitor(struct iwl_trans *trans) | |
| 54 | +{ | |
| 55 | + switch (trans->mac_cfg->device_family) { | |
| 56 | + case IWL_DEVICE_FAMILY_22000: | |
| 57 | + case IWL_DEVICE_FAMILY_AX210: | |
| 58 | + IWL_ERR(trans, "CSR_RESET = 0x%x\n", | |
| 59 | + iwl_read32(trans, CSR_RESET)); | |
| 60 | + iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 61 | + IWL_HOST_MON_BLOCK_PEMON_VEC0, 15); | |
| 62 | + iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 63 | + IWL_HOST_MON_BLOCK_PEMON_VEC1, 15); | |
| 64 | + iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON, | |
| 65 | + IWL_HOST_MON_BLOCK_PEMON_WFPM, 15); | |
| 66 | + iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_HIPM, | |
| 67 | + IWL_HOST_MON_BLOCK_PEMON_VEC0, 1); | |
| 68 | + break; | |
| 69 | + default: | |
| 70 | + return; | |
| 71 | + } | |
| 72 | +} | |
| 73 | + | |
| 35 | 74 | /* extended range in FW SRAM */ |
| 36 | 75 | #define IWL_FW_MEM_EXTENDED_START 0x40000 |
| 37 | 76 | #define IWL_FW_MEM_EXTENDED_END 0x57FFF |
| @@ -175,13 +214,13 @@ void iwl_pcie_apm_config(struct iwl_trans *trans) · 137 unmodified lines | ||
| 175 | 214 | iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_DISABLED); |
| 176 | 215 | |
| 177 | 216 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); |
| 178 | − trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); | |
| 217 | + trans_pcie->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); | |
| 179 | 218 | |
| 180 | 219 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap); |
| 181 | − trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN; | |
| 220 | + trans_pcie->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN; | |
| 182 | 221 | IWL_DEBUG_POWER(trans, "L1 %sabled - LTR %sabled\n", |
| 183 | 222 | (lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis", |
| 184 | − trans->ltr_enabled ? "En" : "Dis"); | |
| 223 | + trans_pcie->ltr_enabled ? "En" : "Dis"); | |
| 185 | 224 | } |
| 186 | 225 | |
| 187 | 226 | /* |
| @@ -228,7 +267,7 @@ static int iwl_pcie_apm_init(struct iwl_trans *trans) · 40 unmodified lines | ||
| 228 | 267 | if (trans->mac_cfg->base->pll_cfg) |
| 229 | 268 | iwl_set_bit(trans, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL); |
| 230 | 269 | |
| 231 | − ret = iwl_finish_nic_init(trans); | |
| 270 | + ret = iwl_trans_activate_nic(trans); | |
| 232 | 271 | if (ret) |
| 233 | 272 | return ret; |
| 234 | 273 | |
| @@ -301,7 +340,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans) · 66 unmodified lines | ||
| 301 | 340 | ret = iwl_trans_pcie_sw_reset(trans, true); |
| 302 | 341 | |
| 303 | 342 | if (!ret) |
| 304 | − ret = iwl_finish_nic_init(trans); | |
| 343 | + ret = iwl_trans_activate_nic(trans); | |
| 305 | 344 | |
| 306 | 345 | if (WARN_ON(ret)) { |
| 307 | 346 | /* Release XTAL ON request */ |
| @@ -1397,17 +1436,10 @@ void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state, bool from_irq) · 1089 unmodified lines | ||
| 1397 | 1436 | } |
| 1398 | 1437 | |
| 1399 | 1438 | static void iwl_pcie_d3_complete_suspend(struct iwl_trans *trans, |
| 1400 | − bool test, bool reset) | |
| 1439 | + bool reset) | |
| 1401 | 1440 | { |
| 1402 | 1441 | iwl_disable_interrupts(trans); |
| 1403 | 1442 | |
| 1404 | − /* | |
| 1405 | − * in testing mode, the host stays awake and the | |
| 1406 | − * hardware won't be reset (not even partially) | |
| 1407 | − */ | |
| 1408 | − if (test) | |
| 1409 | − return; | |
| 1410 | − | |
| 1411 | 1443 | iwl_pcie_disable_ict(trans); |
| 1412 | 1444 | |
| 1413 | 1445 | iwl_pcie_synchronize_irqs(trans); |
| @@ -1478,7 +1510,7 @@ static int iwl_pcie_d3_handshake(struct iwl_trans *trans, bool suspend) · 64 unmodified lines | ||
| 1478 | 1510 | return ret; |
| 1479 | 1511 | } |
| 1480 | 1512 | |
| 1481 | −int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset) | |
| 1513 | +int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset) | |
| 1482 | 1514 | { |
| 1483 | 1515 | int ret; |
| 1484 | 1516 | |
| @@ -1491,26 +1523,18 @@ int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset) · 6 unmodified lines | ||
| 1491 | 1523 | if (ret) |
| 1492 | 1524 | return ret; |
| 1493 | 1525 | |
| 1494 | − iwl_pcie_d3_complete_suspend(trans, test, reset); | |
| 1526 | + iwl_pcie_d3_complete_suspend(trans, reset); | |
| 1495 | 1527 | |
| 1496 | 1528 | return 0; |
| 1497 | 1529 | } |
| 1498 | 1530 | |
| 1499 | 1531 | int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, |
| 1500 | − enum iwl_d3_status *status, | |
| 1501 | − bool test, bool reset) | |
| 1532 | + bool reset) | |
| 1502 | 1533 | { |
| 1503 | 1534 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
| 1504 | 1535 | u32 val; |
| 1505 | 1536 | int ret; |
| 1506 | 1537 | |
| 1507 | − if (test) { | |
| 1508 | − iwl_enable_interrupts(trans); | |
| 1509 | − *status = IWL_D3_STATUS_ALIVE; | |
| 1510 | − ret = 0; | |
| 1511 | − goto out; | |
| 1512 | − } | |
| 1513 | − | |
| 1514 | 1538 | if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) |
| 1515 | 1539 | iwl_set_bit(trans, CSR_GP_CNTRL, |
| 1516 | 1540 | CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ); |
| @@ -1518,9 +1542,12 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, · 1 unmodified line | ||
| 1518 | 1542 | iwl_set_bit(trans, CSR_GP_CNTRL, |
| 1519 | 1543 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
| 1520 | 1544 | |
| 1521 | − ret = iwl_finish_nic_init(trans); | |
| 1522 | − if (ret) | |
| 1545 | + ret = iwl_trans_activate_nic(trans); | |
| 1546 | + if (ret) { | |
| 1547 | + IWL_ERR(trans, "Failed to init nic upon resume. err = %d\n", | |
| 1548 | + ret); | |
| 1523 | 1549 | return ret; |
| 1550 | + } | |
| 1524 | 1551 | |
| 1525 | 1552 | /* |
| 1526 | 1553 | * Reconfigure IVAR table in case of MSIX or reset ict table in |
| @@ -1554,18 +1581,13 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, · 27 unmodified lines | ||
| 1554 | 1581 | iwl_read_umac_prph(trans, WFPM_GP2)); |
| 1555 | 1582 | |
| 1556 | 1583 | val = iwl_read32(trans, CSR_RESET); |
| 1557 | − if (val & CSR_RESET_REG_FLAG_NEVO_RESET) | |
| 1558 | − *status = IWL_D3_STATUS_RESET; | |
| 1559 | − else | |
| 1560 | − *status = IWL_D3_STATUS_ALIVE; | |
| 1561 | − | |
| 1562 | −out: | |
| 1563 | − if (*status == IWL_D3_STATUS_ALIVE) | |
| 1564 | − ret = iwl_pcie_d3_handshake(trans, false); | |
| 1565 | − else | |
| 1584 | + if (val & CSR_RESET_REG_FLAG_NEVO_RESET) { | |
| 1585 | + IWL_INFO(trans, "Device was reset during suspend\n"); | |
| 1566 | 1586 | trans->state = IWL_TRANS_NO_FW; |
| 1587 | + return -ENOENT; | |
| 1588 | + } | |
| 1567 | 1589 | |
| 1568 | − return ret; | |
| 1590 | + return iwl_pcie_d3_handshake(trans, false); | |
| 1569 | 1591 | } |
| 1570 | 1592 | |
| 1571 | 1593 | static void |
| @@ -1744,7 +1766,7 @@ static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) · 172 unmodified lines | ||
| 1744 | 1766 | { |
| 1745 | 1767 | int ret; |
| 1746 | 1768 | |
| 1747 | − ret = iwl_finish_nic_init(trans); | |
| 1769 | + ret = iwl_trans_activate_nic(trans); | |
| 1748 | 1770 | if (ret < 0) |
| 1749 | 1771 | return ret; |
| 1750 | 1772 | |
| @@ -1882,7 +1904,7 @@ void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr, u32 val) · 131 unmodified lines | ||
| 1882 | 1904 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val); |
| 1883 | 1905 | } |
| 1884 | 1906 | |
| 1885 | −void iwl_trans_pcie_op_mode_enter(struct iwl_trans *trans) | |
| 1907 | +void iwl_pcie_gen1_2_op_mode_enter(struct iwl_trans *trans) | |
| 1886 | 1908 | { |
| 1887 | 1909 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
| 1888 | 1910 | |
| @@ -2000,6 +2022,7 @@ void iwl_trans_pcie_free(struct iwl_trans *trans) · 111 unmodified lines | ||
| 2000 | 2022 | free_percpu(trans_pcie->txqs.tso_hdr_page); |
| 2001 | 2023 | } |
| 2002 | 2024 | |
| 2025 | + kmem_cache_destroy(trans_pcie->dev_cmd_pool); | |
| 2003 | 2026 | iwl_trans_free(trans); |
| 2004 | 2027 | } |
| 2005 | 2028 | |
| @@ -3516,7 +3539,7 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask, · 1510 unmodified lines | ||
| 3516 | 3539 | struct iwl_trans_dump_data *dump_data; |
| 3517 | 3540 | u32 len, num_rbs = 0, monitor_len = 0; |
| 3518 | 3541 | int i, ptr; |
| 3519 | − bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) && | |
| 3542 | + bool dump_rbs = iwl_trans_is_fw_error(trans) && | |
| 3520 | 3543 | !trans->mac_cfg->mq_rx_supported && |
| 3521 | 3544 | dump_mask & BIT(IWL_FW_ERROR_DUMP_RB); |
| 3522 | 3545 | |
| @@ -3684,28 +3707,40 @@ void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans) · 161 unmodified lines | ||
| 3684 | 3707 | iwl_trans_sync_nmi_with_addr(trans, inta_addr, sw_err_bit); |
| 3685 | 3708 | } |
| 3686 | 3709 | |
| 3687 | −static int iwl_trans_pcie_set_txcmd_info(const struct iwl_mac_cfg *mac_cfg, | |
| 3688 | − unsigned int *txcmd_size, | |
| 3689 | − unsigned int *txcmd_align) | |
| 3710 | +static int iwl_trans_pcie_alloc_txcmd_pool(struct iwl_trans *trans) | |
| 3690 | 3711 | { |
| 3691 | − if (!mac_cfg->gen2) { | |
| 3692 | − *txcmd_size = sizeof(struct iwl_tx_cmd_v6); | |
| 3693 | − *txcmd_align = sizeof(void *); | |
| 3694 | − } else if (mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) { | |
| 3695 | − *txcmd_size = sizeof(struct iwl_tx_cmd_v9); | |
| 3696 | − *txcmd_align = 64; | |
| 3712 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 3713 | + unsigned int txcmd_size, txcmd_align; | |
| 3714 | + | |
| 3715 | + if (!trans->mac_cfg->gen2) { | |
| 3716 | + txcmd_size = sizeof(struct iwl_tx_cmd_v6); | |
| 3717 | + txcmd_align = sizeof(void *); | |
| 3718 | + } else if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) { | |
| 3719 | + txcmd_size = sizeof(struct iwl_tx_cmd_v9); | |
| 3720 | + txcmd_align = 64; | |
| 3697 | 3721 | } else { |
| 3698 | − *txcmd_size = sizeof(struct iwl_tx_cmd); | |
| 3699 | − *txcmd_align = 128; | |
| 3722 | + txcmd_size = sizeof(struct iwl_tx_cmd); | |
| 3723 | + txcmd_align = 128; | |
| 3700 | 3724 | } |
| 3701 | 3725 | |
| 3702 | − *txcmd_size += sizeof(struct iwl_cmd_header); | |
| 3703 | − *txcmd_size += 36; /* biggest possible 802.11 header */ | |
| 3726 | + txcmd_size += sizeof(struct iwl_cmd_header); | |
| 3727 | + txcmd_size += 36; /* biggest possible 802.11 header */ | |
| 3704 | 3728 | |
| 3705 | 3729 | /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */ |
| 3706 | − if (WARN_ON((mac_cfg->gen2 && *txcmd_size >= *txcmd_align))) | |
| 3730 | + if (WARN_ON((trans->mac_cfg->gen2 && txcmd_size >= txcmd_align))) | |
| 3707 | 3731 | return -EINVAL; |
| 3708 | 3732 | |
| 3733 | + snprintf(trans_pcie->dev_cmd_pool_name, | |
| 3734 | + sizeof(trans_pcie->dev_cmd_pool_name), | |
| 3735 | + "iwl_cmd_pool:%s", dev_name(trans->dev)); | |
| 3736 | + | |
| 3737 | + trans_pcie->dev_cmd_pool = | |
| 3738 | + kmem_cache_create(trans_pcie->dev_cmd_pool_name, | |
| 3739 | + txcmd_size, txcmd_align, | |
| 3740 | + SLAB_HWCACHE_ALIGN, NULL); | |
| 3741 | + if (!trans_pcie->dev_cmd_pool) | |
| 3742 | + return -ENOMEM; | |
| 3743 | + | |
| 3709 | 3744 | return 0; |
| 3710 | 3745 | } |
| 3711 | 3746 | |
| @@ -3715,18 +3750,12 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 3 unmodified lines | ||
| 3715 | 3750 | struct iwl_trans_info *info, u8 __iomem *hw_base) |
| 3716 | 3751 | { |
| 3717 | 3752 | struct iwl_trans_pcie *trans_pcie, **priv; |
| 3718 | − unsigned int txcmd_size, txcmd_align; | |
| 3719 | 3753 | struct iwl_trans *trans; |
| 3720 | 3754 | unsigned int bc_tbl_n_entries; |
| 3721 | 3755 | int ret, addr_size; |
| 3722 | 3756 | |
| 3723 | − ret = iwl_trans_pcie_set_txcmd_info(mac_cfg, &txcmd_size, | |
| 3724 | − &txcmd_align); | |
| 3725 | − if (ret) | |
| 3726 | − return ERR_PTR(ret); | |
| 3727 | − | |
| 3728 | 3757 | trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), &pdev->dev, |
| 3729 | − mac_cfg, txcmd_size, txcmd_align); | |
| 3758 | + mac_cfg); | |
| 3730 | 3759 | if (!trans) |
| 3731 | 3760 | return ERR_PTR(-ENOMEM); |
| 3732 | 3761 | |
| @@ -3737,6 +3766,10 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 4 unmodified lines | ||
| 3737 | 3766 | /* Initialize the wait queue for commands */ |
| 3738 | 3767 | init_waitqueue_head(&trans_pcie->wait_command_queue); |
| 3739 | 3768 | |
| 3769 | + ret = iwl_trans_pcie_alloc_txcmd_pool(trans); | |
| 3770 | + if (ret) | |
| 3771 | + goto out_free_trans; | |
| 3772 | + | |
| 3740 | 3773 | if (trans->mac_cfg->gen2) { |
| 3741 | 3774 | trans_pcie->txqs.tfd.addr_size = 64; |
| 3742 | 3775 | trans_pcie->txqs.tfd.max_tbs = IWL_TFH_NUM_TBS; |
| @@ -3756,7 +3789,7 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 13 unmodified lines | ||
| 3756 | 3789 | trans_pcie->txqs.tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page); |
| 3757 | 3790 | if (!trans_pcie->txqs.tso_hdr_page) { |
| 3758 | 3791 | ret = -ENOMEM; |
| 3759 | − goto out_free_trans; | |
| 3792 | + goto out_free_txcmd_pool; | |
| 3760 | 3793 | } |
| 3761 | 3794 | |
| 3762 | 3795 | if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) |
| @@ -3906,6 +3939,8 @@ out_free_ndev: · 143 unmodified lines | ||
| 3906 | 3939 | free_netdev(trans_pcie->napi_dev); |
| 3907 | 3940 | out_free_tso: |
| 3908 | 3941 | free_percpu(trans_pcie->txqs.tso_hdr_page); |
| 3942 | +out_free_txcmd_pool: | |
| 3943 | + kmem_cache_destroy(trans_pcie->dev_cmd_pool); | |
| 3909 | 3944 | out_free_trans: |
| 3910 | 3945 | iwl_trans_free(trans); |
| 3911 | 3946 | return ERR_PTR(ret); |
| @@ -3999,6 +4034,7 @@ static void get_crf_id(struct iwl_trans *iwl_trans, · 87 unmodified lines | ||
| 3999 | 4034 | |
| 4000 | 4035 | /* Read cdb info (also contains the jacket info if needed in the future */ |
| 4001 | 4036 | hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_OTP_CFG1_ADDR); |
| 4037 | + | |
| 4002 | 4038 | IWL_INFO(iwl_trans, "Detected crf-id 0x%x, cnv-id 0x%x wfpm id 0x%x\n", |
| 4003 | 4039 | info->hw_crf_id, info->hw_cnv_id, hw_wfpm_id); |
| 4004 | 4040 | } |
| @@ -4014,10 +4050,8 @@ static int map_crf_id(struct iwl_trans *iwl_trans, · 9 unmodified lines | ||
| 4014 | 4050 | u32 val = info->hw_crf_id; |
| 4015 | 4051 | u32 step_id = REG_CRF_ID_STEP(val); |
| 4016 | 4052 | u32 slave_id = REG_CRF_ID_SLAVE(val); |
| 4017 | − u32 jacket_id_cnv = REG_CRF_ID_SLAVE(info->hw_cnv_id); | |
| 4018 | 4053 | u32 hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, |
| 4019 | 4054 | WFPM_OTP_CFG1_ADDR); |
| 4020 | − u32 jacket_id_wfpm = WFPM_OTP_CFG1_IS_JACKET(hw_wfpm_id); | |
| 4021 | 4055 | u32 cdb_id_wfpm = WFPM_OTP_CFG1_IS_CDB(hw_wfpm_id); |
| 4022 | 4056 | |
| 4023 | 4057 | /* Map between crf id to rf id */ |
| @@ -4066,21 +4100,12 @@ static int map_crf_id(struct iwl_trans *iwl_trans, · 42 unmodified lines | ||
| 4066 | 4100 | IWL_INFO(iwl_trans, "Adding cdb to rf id\n"); |
| 4067 | 4101 | } |
| 4068 | 4102 | |
| 4069 | − /* Set Jacket capabilities */ | |
| 4070 | − if (jacket_id_wfpm || jacket_id_cnv) { | |
| 4071 | − info->hw_rf_id += BIT(29); | |
| 4072 | − IWL_INFO(iwl_trans, "Adding jacket to rf id\n"); | |
| 4073 | − } | |
| 4074 | − | |
| 4075 | 4103 | IWL_INFO(iwl_trans, |
| 4076 | 4104 | "Detected rf-type 0x%x step-id 0x%x slave-id 0x%x from crf id 0x%x\n", |
| 4077 | 4105 | REG_CRF_ID_TYPE(val), step_id, slave_id, info->hw_rf_id); |
| 4078 | 4106 | IWL_INFO(iwl_trans, |
| 4079 | − "Detected cdb-id 0x%x jacket-id 0x%x from wfpm id 0x%x\n", | |
| 4080 | − cdb_id_wfpm, jacket_id_wfpm, hw_wfpm_id); | |
| 4081 | − IWL_INFO(iwl_trans, "Detected jacket-id 0x%x from cnvi id 0x%x\n", | |
| 4082 | − jacket_id_cnv, info->hw_cnv_id); | |
| 4083 | − | |
| 4107 | + "Detected cdb-id 0x%x from wfpm id 0x%x\n", | |
| 4108 | + cdb_id_wfpm, hw_wfpm_id); | |
| 4084 | 4109 | out: |
| 4085 | 4110 | return ret; |
| 4086 | 4111 | } |
| @@ -4163,7 +4188,7 @@ int iwl_pci_gen1_2_probe(struct pci_dev *pdev, · 76 unmodified lines | ||
| 4163 | 4188 | */ |
| 4164 | 4189 | ret = iwl_pcie_prepare_card_hw(iwl_trans); |
| 4165 | 4190 | if (!ret) { |
| 4166 | − ret = iwl_finish_nic_init(iwl_trans); | |
| 4191 | + ret = iwl_trans_activate_nic(iwl_trans); | |
| 4167 | 4192 | if (ret) |
| 4168 | 4193 | goto out_free_trans; |
| 4169 | 4194 | if (iwl_trans_grab_nic_access(iwl_trans)) { |
| @@ -4271,3 +4296,63 @@ out_free_trans: · 101 unmodified lines | ||
| 4271 | 4296 | iwl_trans_pcie_free(iwl_trans); |
| 4272 | 4297 | return ret; |
| 4273 | 4298 | } |
| 4299 | + | |
| 4300 | +void iwl_pcie_gen1_2_remove(struct iwl_trans *trans) | |
| 4301 | +{ | |
| 4302 | + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | |
| 4303 | + | |
| 4304 | + cancel_delayed_work_sync(&trans_pcie->me_recheck_wk); | |
| 4305 | + | |
| 4306 | + iwl_drv_stop(trans->drv); | |
| 4307 | + | |
| 4308 | + iwl_trans_pcie_free(trans); | |
| 4309 | +} | |
| 4310 | + | |
| 4311 | +int iwl_pcie_gen1_2_activate_nic(struct iwl_trans *trans) | |
| 4312 | +{ | |
| 4313 | + const struct iwl_mac_cfg *mac_cfg = trans->mac_cfg; | |
| 4314 | + u32 poll_ready; | |
| 4315 | + int err; | |
| 4316 | + | |
| 4317 | + if (mac_cfg->bisr_workaround) { | |
| 4318 | + /* ensure the TOP FSM isn't still in previous reset */ | |
| 4319 | + mdelay(2); | |
| 4320 | + } | |
| 4321 | + | |
| 4322 | + /* | |
| 4323 | + * Set "initialization complete" bit to move adapter from | |
| 4324 | + * D0U* --> D0A* (powered-up active) state. | |
| 4325 | + */ | |
| 4326 | + if (mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) { | |
| 4327 | + iwl_set_bit(trans, CSR_GP_CNTRL, | |
| 4328 | + CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ | | |
| 4329 | + CSR_GP_CNTRL_REG_FLAG_MAC_INIT); | |
| 4330 | + poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_STATUS; | |
| 4331 | + } else { | |
| 4332 | + iwl_set_bit(trans, CSR_GP_CNTRL, | |
| 4333 | + CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | |
| 4334 | + poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY; | |
| 4335 | + } | |
| 4336 | + | |
| 4337 | + if (mac_cfg->device_family == IWL_DEVICE_FAMILY_8000) | |
| 4338 | + udelay(2); | |
| 4339 | + | |
| 4340 | + /* | |
| 4341 | + * Wait for clock stabilization; once stabilized, access to | |
| 4342 | + * device-internal resources is supported, e.g. iwl_write_prph() | |
| 4343 | + * and accesses to uCode SRAM. | |
| 4344 | + */ | |
| 4345 | + err = iwl_poll_bits(trans, CSR_GP_CNTRL, poll_ready, 25000); | |
| 4346 | + if (err < 0) { | |
| 4347 | + IWL_DEBUG_INFO(trans, "Failed to wake NIC\n"); | |
| 4348 | + | |
| 4349 | + iwl_pcie_dump_host_monitor(trans); | |
| 4350 | + } | |
| 4351 | + | |
| 4352 | + if (mac_cfg->bisr_workaround) { | |
| 4353 | + /* ensure BISR shift has finished */ | |
| 4354 | + udelay(200); | |
| 4355 | + } | |
| 4356 | + | |
| 4357 | + return err; | |
| 4358 | +} | |
| @@ -2602,8 +2602,9 @@ static int iwl_trans_pcie_send_hcmd_sync(struct iwl_trans *trans, · 2601 unmodified lines | ||
| 2602 | 2602 | } |
| 2603 | 2603 | |
| 2604 | 2604 | if (test_bit(STATUS_FW_ERROR, &trans->status)) { |
| 2605 | − if (!test_and_clear_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, | |
| 2606 | − &trans->status)) { | |
| 2605 | + if (trans->suppress_cmd_error_once) { | |
| 2606 | + trans->suppress_cmd_error_once = false; | |
| 2607 | + } else { | |
| 2607 | 2608 | IWL_ERR(trans, "FW error in SYNC CMD %s\n", cmd_str); |
| 2608 | 2609 | dump_stack(); |
| 2609 | 2610 | } |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause |
| 2 | 2 | |
| 3 | −iwlwifi-tests-y += module.o devinfo.o utils.o | |
| 3 | +iwlwifi-tests-y += module.o devinfo.o utils.o nvm_parse.o | |
| 4 | 4 | |
| 5 | 5 | ccflags-y += -I$(src)/../ |
| 6 | 6 | |
| @@ -0,0 +1,72 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +/* | |
| 3 | + * KUnit tests for NVM parse | |
| 4 | + * | |
| 5 | + * Copyright (C) 2025 Intel Corporation | |
| 6 | + */ | |
| 7 | +#include <kunit/static_stub.h> | |
| 8 | +#include <kunit/test.h> | |
| 9 | +#include <iwl-nvm-parse.h> | |
| 10 | + | |
| 11 | +MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); | |
| 12 | + | |
| 13 | +static const struct nvm_flag_case { | |
| 14 | + const char *desc; | |
| 15 | + u16 nvm_flags; | |
| 16 | + u32 reg_rule_flags; | |
| 17 | + u32 set_reg_rule_flags; | |
| 18 | + u32 clear_reg_rule_flags; | |
| 19 | +} nvm_flag_cases[] = { | |
| 20 | + { | |
| 21 | + .desc = "Restricting VLP client and AP access", | |
| 22 | + .nvm_flags = 0, | |
| 23 | + .set_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT, | |
| 24 | + .clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP, | |
| 25 | + }, | |
| 26 | + { | |
| 27 | + .desc = "Allow VLP client and AP access", | |
| 28 | + .nvm_flags = NVM_CHANNEL_VLP, | |
| 29 | + .set_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP, | |
| 30 | + .clear_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT, | |
| 31 | + }, | |
| 32 | + { | |
| 33 | + .desc = "Allow VLP client access, while restricting AP access", | |
| 34 | + .nvm_flags = NVM_CHANNEL_VLP | NVM_CHANNEL_VLP_AP_NOT_ALLOWED, | |
| 35 | + .set_reg_rule_flags = 0, | |
| 36 | + .clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP | | |
| 37 | + NL80211_RRF_NO_6GHZ_VLP_CLIENT, | |
| 38 | + }, | |
| 39 | +}; | |
| 40 | + | |
| 41 | +KUNIT_ARRAY_PARAM_DESC(nvm_flag, nvm_flag_cases, desc) | |
| 42 | + | |
| 43 | +static void test_nvm_flags(struct kunit *test) | |
| 44 | +{ | |
| 45 | + const struct nvm_flag_case *params = test->param_value; | |
| 46 | + struct iwl_reg_capa reg_capa = {}; | |
| 47 | + u32 flags = 0; | |
| 48 | + | |
| 49 | + flags = iwl_nvm_get_regdom_bw_flags(NULL, 0, params->nvm_flags, | |
| 50 | + reg_capa); | |
| 51 | + | |
| 52 | + if ((params->set_reg_rule_flags & flags) != params->set_reg_rule_flags) | |
| 53 | + KUNIT_FAIL(test, "Expected set bits:0x%08x flags:0x%08x\n", | |
| 54 | + params->set_reg_rule_flags, flags); | |
| 55 | + | |
| 56 | + if (params->clear_reg_rule_flags & flags) | |
| 57 | + KUNIT_FAIL(test, "Expected clear bits:0x%08x flags:0x%08x\n", | |
| 58 | + params->clear_reg_rule_flags, flags); | |
| 59 | +} | |
| 60 | + | |
| 61 | +static struct kunit_case nvm_flags_test_cases[] = { | |
| 62 | + KUNIT_CASE_PARAM(test_nvm_flags, | |
| 63 | + nvm_flag_gen_params), | |
| 64 | + {}, | |
| 65 | +}; | |
| 66 | + | |
| 67 | +static struct kunit_suite nvm_flags_suite = { | |
| 68 | + .name = "iwlwifi-nvm_flags", | |
| 69 | + .test_cases = nvm_flags_test_cases, | |
| 70 | +}; | |
| 71 | + | |
| 72 | +kunit_test_suite(nvm_flags_suite); | |
| @@ -317,7 +317,7 @@ static void p54_pspoll_workaround(struct p54_common *priv, struct sk_buff *skb) · 316 unmodified lines | ||
| 317 | 317 | tim_len = tim[1]; |
| 318 | 318 | tim_ie = (struct ieee80211_tim_ie *) &tim[2]; |
| 319 | 319 | |
| 320 | − new_psm = ieee80211_check_tim(tim_ie, tim_len, priv->aid); | |
| 320 | + new_psm = ieee80211_check_tim(tim_ie, tim_len, priv->aid, false); | |
| 321 | 321 | if (new_psm != priv->powersave_override) { |
| 322 | 322 | priv->powersave_override = new_psm; |
| 323 | 323 | p54_set_ps(priv); |
| @@ -686,10 +686,9 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy, · 685 unmodified lines | ||
| 686 | 686 | return; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | − /* Don't send world or same regdom info to firmware */ | |
| 690 | − if (strncmp(request->alpha2, "00", 2) && | |
| 691 | − strncmp(request->alpha2, adapter->country_code, | |
| 692 | − sizeof(request->alpha2))) { | |
| 689 | + /* Don't send same regdom info to firmware */ | |
| 690 | + if (strncmp(request->alpha2, adapter->country_code, | |
| 691 | + sizeof(request->alpha2)) != 0) { | |
| 693 | 692 | memcpy(adapter->country_code, request->alpha2, |
| 694 | 693 | sizeof(request->alpha2)); |
| 695 | 694 | mwifiex_send_domain_info_cmd_fw(wiphy); |
| @@ -494,6 +494,11 @@ static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) · 493 unmodified lines | ||
| 494 | 494 | return; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | + if (adapter->rgpower_data) { | |
| 498 | + release_firmware(adapter->rgpower_data); | |
| 499 | + adapter->rgpower_data = NULL; | |
| 500 | + } | |
| 501 | + | |
| 497 | 502 | mwifiex_unregister(adapter); |
| 498 | 503 | pr_debug("info: %s: free adapter\n", __func__); |
| 499 | 504 | } |
| @@ -982,6 +982,7 @@ struct mwifiex_adapter { · 981 unmodified lines | ||
| 982 | 982 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; |
| 983 | 983 | u16 max_mgmt_ie_index; |
| 984 | 984 | const struct firmware *cal_data; |
| 985 | + const struct firmware *rgpower_data; | |
| 985 | 986 | struct device_node *dt_node; |
| 986 | 987 | |
| 987 | 988 | /* 11AC */ |
| @@ -1579,6 +1580,8 @@ int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv); · 591 unmodified lines | ||
| 1579 | 1580 | int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, |
| 1580 | 1581 | struct device_node *node, const char *prefix); |
| 1581 | 1582 | void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv); |
| 1583 | +int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data, | |
| 1584 | + const size_t size); | |
| 1582 | 1585 | |
| 1583 | 1586 | extern const struct ethtool_ops mwifiex_ethtool_ops; |
| 1584 | 1587 | |
| @@ -1483,6 +1483,119 @@ int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, · 1482 unmodified lines | ||
| 1483 | 1483 | return 0; |
| 1484 | 1484 | } |
| 1485 | 1485 | |
| 1486 | +static int mwifiex_rgpower_table_advance_to_content(u8 **pos, const u8 *data, | |
| 1487 | + const size_t size) | |
| 1488 | +{ | |
| 1489 | + while (*pos - data < size) { | |
| 1490 | + /* skip spaces, tabs and empty lines */ | |
| 1491 | + if (**pos == '\r' || **pos == '\n' || **pos == '\0' || | |
| 1492 | + isspace(**pos)) { | |
| 1493 | + (*pos)++; | |
| 1494 | + continue; | |
| 1495 | + } | |
| 1496 | + /* skip line comments */ | |
| 1497 | + if (**pos == '#') { | |
| 1498 | + *pos = strchr(*pos, '\n'); | |
| 1499 | + if (!*pos) | |
| 1500 | + return -EINVAL; | |
| 1501 | + (*pos)++; | |
| 1502 | + continue; | |
| 1503 | + } | |
| 1504 | + return 0; | |
| 1505 | + } | |
| 1506 | + return 0; | |
| 1507 | +} | |
| 1508 | + | |
| 1509 | +int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data, | |
| 1510 | + const size_t size) | |
| 1511 | +{ | |
| 1512 | + int ret = 0; | |
| 1513 | + bool start_raw = false; | |
| 1514 | + u8 *ptr, *token, *pos = NULL; | |
| 1515 | + u8 *_data __free(kfree) = NULL; | |
| 1516 | + struct mwifiex_adapter *adapter = priv->adapter; | |
| 1517 | + struct mwifiex_ds_misc_cmd *hostcmd __free(kfree) = NULL; | |
| 1518 | + | |
| 1519 | + hostcmd = kzalloc(sizeof(*hostcmd), GFP_KERNEL); | |
| 1520 | + if (!hostcmd) | |
| 1521 | + return -ENOMEM; | |
| 1522 | + | |
| 1523 | + _data = kmemdup(data, size, GFP_KERNEL); | |
| 1524 | + if (!_data) | |
| 1525 | + return -ENOMEM; | |
| 1526 | + | |
| 1527 | + pos = _data; | |
| 1528 | + ptr = hostcmd->cmd; | |
| 1529 | + while ((pos - _data) < size) { | |
| 1530 | + ret = mwifiex_rgpower_table_advance_to_content(&pos, _data, size); | |
| 1531 | + if (ret) { | |
| 1532 | + mwifiex_dbg( | |
| 1533 | + adapter, ERROR, | |
| 1534 | + "%s: failed to advance to content in rgpower table\n", | |
| 1535 | + __func__); | |
| 1536 | + return ret; | |
| 1537 | + } | |
| 1538 | + | |
| 1539 | + if (*pos == '}' && start_raw) { | |
| 1540 | + hostcmd->len = get_unaligned_le16(&hostcmd->cmd[2]); | |
| 1541 | + ret = mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, false); | |
| 1542 | + if (ret) { | |
| 1543 | + mwifiex_dbg(adapter, ERROR, | |
| 1544 | + "%s: failed to send hostcmd %d\n", | |
| 1545 | + __func__, ret); | |
| 1546 | + return ret; | |
| 1547 | + } | |
| 1548 | + | |
| 1549 | + memset(hostcmd->cmd, 0, MWIFIEX_SIZE_OF_CMD_BUFFER); | |
| 1550 | + ptr = hostcmd->cmd; | |
| 1551 | + start_raw = false; | |
| 1552 | + pos++; | |
| 1553 | + continue; | |
| 1554 | + } | |
| 1555 | + | |
| 1556 | + if (!start_raw) { | |
| 1557 | + pos = strchr(pos, '='); | |
| 1558 | + if (pos) { | |
| 1559 | + pos = strchr(pos, '{'); | |
| 1560 | + if (pos) { | |
| 1561 | + start_raw = true; | |
| 1562 | + pos++; | |
| 1563 | + continue; | |
| 1564 | + } | |
| 1565 | + } | |
| 1566 | + mwifiex_dbg(adapter, ERROR, | |
| 1567 | + "%s: syntax error in hostcmd\n", __func__); | |
| 1568 | + return -EINVAL; | |
| 1569 | + } | |
| 1570 | + | |
| 1571 | + if (start_raw) { | |
| 1572 | + while ((*pos != '\r' && *pos != '\n') && | |
| 1573 | + (token = strsep((char **)&pos, " "))) { | |
| 1574 | + if (ptr - hostcmd->cmd >= | |
| 1575 | + MWIFIEX_SIZE_OF_CMD_BUFFER) { | |
| 1576 | + mwifiex_dbg( | |
| 1577 | + adapter, ERROR, | |
| 1578 | + "%s: hostcmd is larger than %d, aborting\n", | |
| 1579 | + __func__, MWIFIEX_SIZE_OF_CMD_BUFFER); | |
| 1580 | + return -ENOMEM; | |
| 1581 | + } | |
| 1582 | + | |
| 1583 | + ret = kstrtou8(token, 16, ptr); | |
| 1584 | + if (ret < 0) { | |
| 1585 | + mwifiex_dbg( | |
| 1586 | + adapter, ERROR, | |
| 1587 | + "%s: failed to parse hostcmd %d token: %s\n", | |
| 1588 | + __func__, ret, token); | |
| 1589 | + return ret; | |
| 1590 | + } | |
| 1591 | + ptr++; | |
| 1592 | + } | |
| 1593 | + } | |
| 1594 | + } | |
| 1595 | + | |
| 1596 | + return ret; | |
| 1597 | +} | |
| 1598 | + | |
| 1486 | 1599 | /* This function prepares command of set_cfg_data. */ |
| 1487 | 1600 | static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv, |
| 1488 | 1601 | struct host_cmd_ds_command *cmd, void *data_buf) |
| @@ -180,7 +180,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, · 179 unmodified lines | ||
| 180 | 180 | return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | −void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) | |
| 183 | +static void mwifiex_dnld_dt_txpwr_table(struct mwifiex_private *priv) | |
| 184 | 184 | { |
| 185 | 185 | if (priv->adapter->dt_node) { |
| 186 | 186 | char txpwr[] = {"marvell,00_txpwrlimit"}; |
| @@ -190,6 +190,62 @@ void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) · 3 unmodified lines | ||
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | +static int mwifiex_request_rgpower_table(struct mwifiex_private *priv) | |
| 194 | +{ | |
| 195 | + struct mwifiex_802_11d_domain_reg *domain_info = &priv->adapter->domain_reg; | |
| 196 | + struct mwifiex_adapter *adapter = priv->adapter; | |
| 197 | + char rgpower_table_name[30]; | |
| 198 | + char country_code[3]; | |
| 199 | + | |
| 200 | + strscpy(country_code, domain_info->country_code, sizeof(country_code)); | |
| 201 | + | |
| 202 | + /* World regulatory domain "00" has WW as country code */ | |
| 203 | + if (strncmp(country_code, "00", 2) == 0) | |
| 204 | + strscpy(country_code, "WW", sizeof(country_code)); | |
| 205 | + | |
| 206 | + snprintf(rgpower_table_name, sizeof(rgpower_table_name), | |
| 207 | + "nxp/rgpower_%s.bin", country_code); | |
| 208 | + | |
| 209 | + mwifiex_dbg(adapter, INFO, "info: %s: requesting regulatory power table %s\n", | |
| 210 | + __func__, rgpower_table_name); | |
| 211 | + | |
| 212 | + if (adapter->rgpower_data) { | |
| 213 | + release_firmware(adapter->rgpower_data); | |
| 214 | + adapter->rgpower_data = NULL; | |
| 215 | + } | |
| 216 | + | |
| 217 | + if ((request_firmware(&adapter->rgpower_data, rgpower_table_name, | |
| 218 | + adapter->dev))) { | |
| 219 | + mwifiex_dbg( | |
| 220 | + adapter, INFO, | |
| 221 | + "info: %s: failed to request regulatory power table\n", | |
| 222 | + __func__); | |
| 223 | + return -EIO; | |
| 224 | + } | |
| 225 | + | |
| 226 | + return 0; | |
| 227 | +} | |
| 228 | + | |
| 229 | +static int mwifiex_dnld_rgpower_table(struct mwifiex_private *priv) | |
| 230 | +{ | |
| 231 | + int ret; | |
| 232 | + | |
| 233 | + ret = mwifiex_request_rgpower_table(priv); | |
| 234 | + if (ret) | |
| 235 | + return ret; | |
| 236 | + | |
| 237 | + return mwifiex_send_rgpower_table(priv, priv->adapter->rgpower_data->data, | |
| 238 | + priv->adapter->rgpower_data->size); | |
| 239 | +} | |
| 240 | + | |
| 241 | +void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) | |
| 242 | +{ | |
| 243 | + if (mwifiex_dnld_rgpower_table(priv) == 0) | |
| 244 | + return; | |
| 245 | + | |
| 246 | + mwifiex_dnld_dt_txpwr_table(priv); | |
| 247 | +} | |
| 248 | + | |
| 193 | 249 | static int mwifiex_process_country_ie(struct mwifiex_private *priv, |
| 194 | 250 | struct cfg80211_bss *bss) |
| 195 | 251 | { |
| @@ -794,12 +794,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, · 793 unmodified lines | ||
| 794 | 794 | return 0; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | −static int change_bss(struct wiphy *wiphy, struct net_device *dev, | |
| 798 | − struct bss_parameters *params) | |
| 799 | −{ | |
| 800 | − return 0; | |
| 801 | −} | |
| 802 | − | |
| 803 | 797 | static int set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed) |
| 804 | 798 | { |
| 805 | 799 | int ret = -EINVAL; |
| @@ -1709,7 +1703,6 @@ static const struct cfg80211_ops wilc_cfg80211_ops = { · 903 unmodified lines | ||
| 1709 | 1703 | .change_station = change_station, |
| 1710 | 1704 | .get_station = get_station, |
| 1711 | 1705 | .dump_station = dump_station, |
| 1712 | − .change_bss = change_bss, | |
| 1713 | 1706 | .set_wiphy_params = set_wiphy_params, |
| 1714 | 1707 | |
| 1715 | 1708 | .external_auth = external_auth, |
| @@ -679,7 +679,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, · 678 unmodified lines | ||
| 679 | 679 | /* Check whenever the PHY can be turned off again. */ |
| 680 | 680 | |
| 681 | 681 | /* 1. What about buffered unicast traffic for our AID? */ |
| 682 | − cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid); | |
| 682 | + cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid, false); | |
| 683 | 683 | |
| 684 | 684 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ |
| 685 | 685 | cam |= (tim_ie->bitmap_ctrl & 0x01); |
| @@ -519,7 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) · 518 unmodified lines | ||
| 519 | 519 | |
| 520 | 520 | /* 1. What about buffered unicast traffic for our AID? */ |
| 521 | 521 | u_buffed = ieee80211_check_tim(tim_ie, tim_len, |
| 522 | − rtlpriv->mac80211.assoc_id); | |
| 522 | + rtlpriv->mac80211.assoc_id, false); | |
| 523 | 523 | |
| 524 | 524 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ |
| 525 | 525 | m_buffed = tim_ie->bitmap_ctrl & 0x01; |
| @@ -2441,13 +2441,6 @@ exit: · 2440 unmodified lines | ||
| 2441 | 2441 | return ret; |
| 2442 | 2442 | } |
| 2443 | 2443 | |
| 2444 | −static int cfg80211_rtw_change_bss(struct wiphy *wiphy, | |
| 2445 | − struct net_device *ndev, | |
| 2446 | − struct bss_parameters *params) | |
| 2447 | −{ | |
| 2448 | − return 0; | |
| 2449 | −} | |
| 2450 | − | |
| 2451 | 2444 | void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char *msg) |
| 2452 | 2445 | { |
| 2453 | 2446 | s32 freq; |
| @@ -2704,7 +2697,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { · 250 unmodified lines | ||
| 2704 | 2697 | .del_station = cfg80211_rtw_del_station, |
| 2705 | 2698 | .change_station = cfg80211_rtw_change_station, |
| 2706 | 2699 | .dump_station = cfg80211_rtw_dump_station, |
| 2707 | − .change_bss = cfg80211_rtw_change_bss, | |
| 2708 | 2700 | |
| 2709 | 2701 | .mgmt_tx = cfg80211_rtw_mgmt_tx, |
| 2710 | 2702 | }; |
| @@ -220,6 +220,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) · 219 unmodified lines | ||
| 220 | 220 | #define IEEE80211_MAX_AID_S1G 8191 |
| 221 | 221 | #define IEEE80211_MAX_TIM_LEN 251 |
| 222 | 222 | #define IEEE80211_MAX_MESH_PEERINGS 63 |
| 223 | + | |
| 224 | +/* S1G encoding types */ | |
| 225 | +#define IEEE80211_S1G_TIM_ENC_MODE_BLOCK 0 | |
| 226 | +#define IEEE80211_S1G_TIM_ENC_MODE_SINGLE 1 | |
| 227 | +#define IEEE80211_S1G_TIM_ENC_MODE_OLB 2 | |
| 228 | + | |
| 223 | 229 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
| 224 | 230 | 6.2.1.1.2. |
| 225 | 231 | |
| @@ -4757,15 +4763,8 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu) · 4531 unmodified lines | ||
| 4757 | 4763 | return 1024 * tu; |
| 4758 | 4764 | } |
| 4759 | 4765 | |
| 4760 | −/** | |
| 4761 | − * ieee80211_check_tim - check if AID bit is set in TIM | |
| 4762 | − * @tim: the TIM IE | |
| 4763 | − * @tim_len: length of the TIM IE | |
| 4764 | − * @aid: the AID to look for | |
| 4765 | − * Return: whether or not traffic is indicated in the TIM for the given AID | |
| 4766 | − */ | |
| 4767 | −static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, | |
| 4768 | − u8 tim_len, u16 aid) | |
| 4766 | +static inline bool __ieee80211_check_tim(const struct ieee80211_tim_ie *tim, | |
| 4767 | + u8 tim_len, u16 aid) | |
| 4769 | 4768 | { |
| 4770 | 4769 | u8 mask; |
| 4771 | 4770 | u8 index, indexn1, indexn2; |
| @@ -4788,6 +4787,254 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, · 16 unmodified lines | ||
| 4788 | 4787 | return !!(tim->virtual_map[index] & mask); |
| 4789 | 4788 | } |
| 4790 | 4789 | |
| 4790 | +struct s1g_tim_aid { | |
| 4791 | + u16 aid; | |
| 4792 | + u8 target_blk; /* Target block index */ | |
| 4793 | + u8 target_subblk; /* Target subblock index */ | |
| 4794 | + u8 target_subblk_bit; /* Target subblock bit */ | |
| 4795 | +}; | |
| 4796 | + | |
| 4797 | +struct s1g_tim_enc_block { | |
| 4798 | + u8 enc_mode; | |
| 4799 | + bool inverse; | |
| 4800 | + const u8 *ptr; | |
| 4801 | + u8 len; | |
| 4802 | + | |
| 4803 | + /* | |
| 4804 | + * For an OLB encoded block that spans multiple blocks, this | |
| 4805 | + * is the offset into the span described by that encoded block. | |
| 4806 | + */ | |
| 4807 | + u8 olb_blk_offset; | |
| 4808 | +}; | |
| 4809 | + | |
| 4810 | +/* | |
| 4811 | + * Helper routines to quickly extract the length of an encoded block. Validation | |
| 4812 | + * is also performed to ensure the length extracted lies within the TIM. | |
| 4813 | + */ | |
| 4814 | + | |
| 4815 | +static inline int ieee80211_s1g_len_bitmap(const u8 *ptr, const u8 *end) | |
| 4816 | +{ | |
| 4817 | + u8 blkmap; | |
| 4818 | + u8 n_subblks; | |
| 4819 | + | |
| 4820 | + if (ptr >= end) | |
| 4821 | + return -EINVAL; | |
| 4822 | + | |
| 4823 | + blkmap = *ptr; | |
| 4824 | + n_subblks = hweight8(blkmap); | |
| 4825 | + | |
| 4826 | + if (ptr + 1 + n_subblks > end) | |
| 4827 | + return -EINVAL; | |
| 4828 | + | |
| 4829 | + return 1 + n_subblks; | |
| 4830 | +} | |
| 4831 | + | |
| 4832 | +static inline int ieee80211_s1g_len_single(const u8 *ptr, const u8 *end) | |
| 4833 | +{ | |
| 4834 | + return (ptr + 1 > end) ? -EINVAL : 1; | |
| 4835 | +} | |
| 4836 | + | |
| 4837 | +static inline int ieee80211_s1g_len_olb(const u8 *ptr, const u8 *end) | |
| 4838 | +{ | |
| 4839 | + if (ptr >= end) | |
| 4840 | + return -EINVAL; | |
| 4841 | + | |
| 4842 | + return (ptr + 1 + *ptr > end) ? -EINVAL : 1 + *ptr; | |
| 4843 | +} | |
| 4844 | + | |
| 4845 | +/* | |
| 4846 | + * Enumerate all encoded blocks until we find the encoded block that describes | |
| 4847 | + * our target AID. OLB is a special case as a single encoded block can describe | |
| 4848 | + * multiple blocks as a single encoded block. | |
| 4849 | + */ | |
| 4850 | +static inline int ieee80211_s1g_find_target_block(struct s1g_tim_enc_block *enc, | |
| 4851 | + const struct s1g_tim_aid *aid, | |
| 4852 | + const u8 *ptr, const u8 *end) | |
| 4853 | +{ | |
| 4854 | + /* need at least block-control octet */ | |
| 4855 | + while (ptr + 1 <= end) { | |
| 4856 | + u8 ctrl = *ptr++; | |
| 4857 | + u8 mode = ctrl & 0x03; | |
| 4858 | + bool contains, inverse = ctrl & BIT(2); | |
| 4859 | + u8 span, blk_off = ctrl >> 3; | |
| 4860 | + int len; | |
| 4861 | + | |
| 4862 | + switch (mode) { | |
| 4863 | + case IEEE80211_S1G_TIM_ENC_MODE_BLOCK: | |
| 4864 | + len = ieee80211_s1g_len_bitmap(ptr, end); | |
| 4865 | + contains = blk_off == aid->target_blk; | |
| 4866 | + break; | |
| 4867 | + case IEEE80211_S1G_TIM_ENC_MODE_SINGLE: | |
| 4868 | + len = ieee80211_s1g_len_single(ptr, end); | |
| 4869 | + contains = blk_off == aid->target_blk; | |
| 4870 | + break; | |
| 4871 | + case IEEE80211_S1G_TIM_ENC_MODE_OLB: | |
| 4872 | + len = ieee80211_s1g_len_olb(ptr, end); | |
| 4873 | + /* | |
| 4874 | + * An OLB encoded block can describe more then one | |
| 4875 | + * block, meaning an encoded OLB block can span more | |
| 4876 | + * then a single block. | |
| 4877 | + */ | |
| 4878 | + if (len > 0) { | |
| 4879 | + /* Minus one for the length octet */ | |
| 4880 | + span = DIV_ROUND_UP(len - 1, 8); | |
| 4881 | + /* | |
| 4882 | + * Check if our target block lies within the | |
| 4883 | + * block span described by this encoded block. | |
| 4884 | + */ | |
| 4885 | + contains = (aid->target_blk >= blk_off) && | |
| 4886 | + (aid->target_blk < blk_off + span); | |
| 4887 | + } | |
| 4888 | + break; | |
| 4889 | + default: | |
| 4890 | + return -EOPNOTSUPP; | |
| 4891 | + } | |
| 4892 | + | |
| 4893 | + if (len < 0) | |
| 4894 | + return len; | |
| 4895 | + | |
| 4896 | + if (contains) { | |
| 4897 | + enc->enc_mode = mode; | |
| 4898 | + enc->inverse = inverse; | |
| 4899 | + enc->ptr = ptr; | |
| 4900 | + enc->len = (u8)len; | |
| 4901 | + enc->olb_blk_offset = blk_off; | |
| 4902 | + return 0; | |
| 4903 | + } | |
| 4904 | + | |
| 4905 | + ptr += len; | |
| 4906 | + } | |
| 4907 | + | |
| 4908 | + return -ENOENT; | |
| 4909 | +} | |
| 4910 | + | |
| 4911 | +static inline bool ieee80211_s1g_parse_bitmap(struct s1g_tim_enc_block *enc, | |
| 4912 | + struct s1g_tim_aid *aid) | |
| 4913 | +{ | |
| 4914 | + const u8 *ptr = enc->ptr; | |
| 4915 | + u8 blkmap = *ptr++; | |
| 4916 | + | |
| 4917 | + /* | |
| 4918 | + * If our block bitmap does not contain a set bit that corresponds | |
| 4919 | + * to our AID, it could mean a variety of things depending on if | |
| 4920 | + * the encoding mode is inverted or not. | |
| 4921 | + * | |
| 4922 | + * 1. If inverted, it means the entire subblock is present and hence | |
| 4923 | + * our AID has been set. | |
| 4924 | + * 2. If not inverted, it means our subblock is not present and hence | |
| 4925 | + * it is all zero meaning our AID is not set. | |
| 4926 | + */ | |
| 4927 | + if (!(blkmap & BIT(aid->target_subblk))) | |
| 4928 | + return enc->inverse; | |
| 4929 | + | |
| 4930 | + /* | |
| 4931 | + * Increment ptr by the number of set subblocks that appear before our | |
| 4932 | + * target subblock. If our target subblock is 0, do nothing as ptr | |
| 4933 | + * already points to our target subblock. | |
| 4934 | + */ | |
| 4935 | + if (aid->target_subblk) | |
| 4936 | + ptr += hweight8(blkmap & GENMASK(aid->target_subblk - 1, 0)); | |
| 4937 | + | |
| 4938 | + return !!(*ptr & BIT(aid->target_subblk_bit)) ^ enc->inverse; | |
| 4939 | +} | |
| 4940 | + | |
| 4941 | +static inline bool ieee80211_s1g_parse_single(struct s1g_tim_enc_block *enc, | |
| 4942 | + struct s1g_tim_aid *aid) | |
| 4943 | +{ | |
| 4944 | + /* | |
| 4945 | + * Single AID mode describes, as the name suggests, a single AID | |
| 4946 | + * within the block described by the encoded block. The octet | |
| 4947 | + * contains the 6 LSBs of the AID described in the block. The other | |
| 4948 | + * 2 bits are reserved. When inversed, every single AID described | |
| 4949 | + * by the current block have buffered traffic except for the AID | |
| 4950 | + * described in the single AID octet. | |
| 4951 | + */ | |
| 4952 | + return ((*enc->ptr & 0x3f) == (aid->aid & 0x3f)) ^ enc->inverse; | |
| 4953 | +} | |
| 4954 | + | |
| 4955 | +static inline bool ieee80211_s1g_parse_olb(struct s1g_tim_enc_block *enc, | |
| 4956 | + struct s1g_tim_aid *aid) | |
| 4957 | +{ | |
| 4958 | + const u8 *ptr = enc->ptr; | |
| 4959 | + u8 blk_len = *ptr++; | |
| 4960 | + /* | |
| 4961 | + * Given an OLB encoded block that describes multiple blocks, | |
| 4962 | + * calculate the offset into the span. Then calculate the | |
| 4963 | + * subblock location normally. | |
| 4964 | + */ | |
| 4965 | + u16 span_offset = aid->target_blk - enc->olb_blk_offset; | |
| 4966 | + u16 subblk_idx = span_offset * 8 + aid->target_subblk; | |
| 4967 | + | |
| 4968 | + if (subblk_idx >= blk_len) | |
| 4969 | + return enc->inverse; | |
| 4970 | + | |
| 4971 | + return !!(ptr[subblk_idx] & BIT(aid->target_subblk_bit)) ^ enc->inverse; | |
| 4972 | +} | |
| 4973 | + | |
| 4974 | +/* | |
| 4975 | + * An S1G PVB has 3 non optional encoding types, each that can be inverted. | |
| 4976 | + * An S1G PVB is constructed with zero or more encoded block subfields. Each | |
| 4977 | + * encoded block represents a single "block" of AIDs (64), and each encoded | |
| 4978 | + * block can contain one of the 3 encoding types alongside a single bit for | |
| 4979 | + * whether the bits should be inverted. | |
| 4980 | + * | |
| 4981 | + * As the standard makes no guarantee about the ordering of encoded blocks, | |
| 4982 | + * we must parse every encoded block in the worst case scenario given an | |
| 4983 | + * AID that lies within the last block. | |
| 4984 | + */ | |
| 4985 | +static inline bool ieee80211_s1g_check_tim(const struct ieee80211_tim_ie *tim, | |
| 4986 | + u8 tim_len, u16 aid) | |
| 4987 | +{ | |
| 4988 | + int err; | |
| 4989 | + struct s1g_tim_aid target_aid; | |
| 4990 | + struct s1g_tim_enc_block enc_blk; | |
| 4991 | + | |
| 4992 | + if (tim_len < 3) | |
| 4993 | + return false; | |
| 4994 | + | |
| 4995 | + target_aid.aid = aid; | |
| 4996 | + target_aid.target_blk = (aid >> 6) & 0x1f; | |
| 4997 | + target_aid.target_subblk = (aid >> 3) & 0x7; | |
| 4998 | + target_aid.target_subblk_bit = aid & 0x7; | |
| 4999 | + | |
| 5000 | + /* | |
| 5001 | + * Find our AIDs target encoded block and fill &enc_blk with the | |
| 5002 | + * encoded blocks information. If no entry is found or an error | |
| 5003 | + * occurs return false. | |
| 5004 | + */ | |
| 5005 | + err = ieee80211_s1g_find_target_block(&enc_blk, &target_aid, | |
| 5006 | + tim->virtual_map, | |
| 5007 | + (const u8 *)tim + tim_len + 2); | |
| 5008 | + if (err) | |
| 5009 | + return false; | |
| 5010 | + | |
| 5011 | + switch (enc_blk.enc_mode) { | |
| 5012 | + case IEEE80211_S1G_TIM_ENC_MODE_BLOCK: | |
| 5013 | + return ieee80211_s1g_parse_bitmap(&enc_blk, &target_aid); | |
| 5014 | + case IEEE80211_S1G_TIM_ENC_MODE_SINGLE: | |
| 5015 | + return ieee80211_s1g_parse_single(&enc_blk, &target_aid); | |
| 5016 | + case IEEE80211_S1G_TIM_ENC_MODE_OLB: | |
| 5017 | + return ieee80211_s1g_parse_olb(&enc_blk, &target_aid); | |
| 5018 | + default: | |
| 5019 | + return false; | |
| 5020 | + } | |
| 5021 | +} | |
| 5022 | + | |
| 5023 | +/** | |
| 5024 | + * ieee80211_check_tim - check if AID bit is set in TIM | |
| 5025 | + * @tim: the TIM IE | |
| 5026 | + * @tim_len: length of the TIM IE | |
| 5027 | + * @aid: the AID to look for | |
| 5028 | + * @s1g: whether the TIM is from an S1G PPDU | |
| 5029 | + * Return: whether or not traffic is indicated in the TIM for the given AID | |
| 5030 | + */ | |
| 5031 | +static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, | |
| 5032 | + u8 tim_len, u16 aid, bool s1g) | |
| 5033 | +{ | |
| 5034 | + return s1g ? ieee80211_s1g_check_tim(tim, tim_len, aid) : | |
| 5035 | + __ieee80211_check_tim(tim, tim_len, aid); | |
| 5036 | +} | |
| 5037 | + | |
| 4791 | 5038 | /** |
| 4792 | 5039 | * ieee80211_get_tdls_action - get TDLS action code |
| 4793 | 5040 | * @skb: the skb containing the frame, length will not be checked |
| @@ -77,7 +77,7 @@ · 76 unmodified lines | ||
| 77 | 77 | #define SDIO_DEVICE_ID_BROADCOM_43439 0xa9af |
| 78 | 78 | #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf |
| 79 | 79 | #define SDIO_DEVICE_ID_BROADCOM_43751 0xaae7 |
| 80 | −#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752 0xaae8 | |
| 80 | +#define SDIO_DEVICE_ID_BROADCOM_43752 0xaae8 | |
| 81 | 81 | |
| 82 | 82 | #define SDIO_VENDOR_ID_CYPRESS 0x04b4 |
| 83 | 83 | #define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439 0xbd3d |
| @@ -841,9 +841,12 @@ struct cfg80211_bitrate_mask { · 840 unmodified lines | ||
| 841 | 841 | u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; |
| 842 | 842 | u16 vht_mcs[NL80211_VHT_NSS_MAX]; |
| 843 | 843 | u16 he_mcs[NL80211_HE_NSS_MAX]; |
| 844 | + u16 eht_mcs[NL80211_EHT_NSS_MAX]; | |
| 844 | 845 | enum nl80211_txrate_gi gi; |
| 845 | 846 | enum nl80211_he_gi he_gi; |
| 847 | + enum nl80211_eht_gi eht_gi; | |
| 846 | 848 | enum nl80211_he_ltf he_ltf; |
| 849 | + enum nl80211_eht_ltf eht_ltf; | |
| 847 | 850 | } control[NUM_NL80211_BANDS]; |
| 848 | 851 | }; |
| 849 | 852 | |
| @@ -2456,6 +2459,29 @@ struct mpath_info { · 1606 unmodified lines | ||
| 2456 | 2459 | int generation; |
| 2457 | 2460 | }; |
| 2458 | 2461 | |
| 2462 | +/** | |
| 2463 | + * enum wiphy_bss_param_flags - bit positions for supported bss parameters. | |
| 2464 | + * | |
| 2465 | + * @WIPHY_BSS_PARAM_CTS_PROT: support changing CTS protection. | |
| 2466 | + * @WIPHY_BSS_PARAM_SHORT_PREAMBLE: support changing short preamble usage. | |
| 2467 | + * @WIPHY_BSS_PARAM_SHORT_SLOT_TIME: support changing short slot time usage. | |
| 2468 | + * @WIPHY_BSS_PARAM_BASIC_RATES: support reconfiguring basic rates. | |
| 2469 | + * @WIPHY_BSS_PARAM_AP_ISOLATE: support changing AP isolation. | |
| 2470 | + * @WIPHY_BSS_PARAM_HT_OPMODE: support changing HT operating mode. | |
| 2471 | + * @WIPHY_BSS_PARAM_P2P_CTWINDOW: support reconfiguring ctwindow. | |
| 2472 | + * @WIPHY_BSS_PARAM_P2P_OPPPS: support changing P2P opportunistic power-save. | |
| 2473 | + */ | |
| 2474 | +enum wiphy_bss_param_flags { | |
| 2475 | + WIPHY_BSS_PARAM_CTS_PROT = BIT(0), | |
| 2476 | + WIPHY_BSS_PARAM_SHORT_PREAMBLE = BIT(1), | |
| 2477 | + WIPHY_BSS_PARAM_SHORT_SLOT_TIME = BIT(2), | |
| 2478 | + WIPHY_BSS_PARAM_BASIC_RATES = BIT(3), | |
| 2479 | + WIPHY_BSS_PARAM_AP_ISOLATE = BIT(4), | |
| 2480 | + WIPHY_BSS_PARAM_HT_OPMODE = BIT(5), | |
| 2481 | + WIPHY_BSS_PARAM_P2P_CTWINDOW = BIT(6), | |
| 2482 | + WIPHY_BSS_PARAM_P2P_OPPPS = BIT(7), | |
| 2483 | +}; | |
| 2484 | + | |
| 2459 | 2485 | /** |
| 2460 | 2486 | * struct bss_parameters - BSS parameters |
| 2461 | 2487 | * |
| @@ -5782,6 +5808,11 @@ struct wiphy_radio { · 3320 unmodified lines | ||
| 5782 | 5808 | * and probe responses. This value should be set if the driver |
| 5783 | 5809 | * wishes to limit the number of csa counters. Default (0) means |
| 5784 | 5810 | * infinite. |
| 5811 | + * @bss_param_support: bitmask indicating which bss_parameters as defined in | |
| 5812 | + * &struct bss_parameters the driver can actually handle in the | |
| 5813 | + * .change_bss() callback. The bit positions are defined in &enum | |
| 5814 | + * wiphy_bss_param_flags. | |
| 5815 | + * | |
| 5785 | 5816 | * @bss_select_support: bitmask indicating the BSS selection criteria supported |
| 5786 | 5817 | * by the driver in the .connect() callback. The bit position maps to the |
| 5787 | 5818 | * attribute indices defined in &enum nl80211_bss_select_attr. |
| @@ -5967,6 +5998,7 @@ struct wiphy { · 179 unmodified lines | ||
| 5967 | 5998 | |
| 5968 | 5999 | u8 max_num_csa_counters; |
| 5969 | 6000 | |
| 6001 | + u32 bss_param_support; | |
| 5970 | 6002 | u32 bss_select_support; |
| 5971 | 6003 | |
| 5972 | 6004 | u8 nan_supported_bands; |
| @@ -9548,7 +9580,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 3575 unmodified lines | ||
| 9548 | 9580 | * @wiphy: the wiphy |
| 9549 | 9581 | * @chan: channel for which the supported radio index is required |
| 9550 | 9582 | * |
| 9551 | − * Return: radio index on success or a negative error code | |
| 9583 | + * Return: radio index on success or -EINVAL otherwise | |
| 9552 | 9584 | */ |
| 9553 | 9585 | int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy, |
| 9554 | 9586 | const struct ieee80211_channel *chan); |
| @@ -1943,8 +1943,9 @@ enum nl80211_commands { · 1942 unmodified lines | ||
| 1943 | 1943 | * The driver must also specify support for this with the extended |
| 1944 | 1944 | * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, |
| 1945 | 1945 | * NL80211_EXT_FEATURE_BEACON_RATE_HT, |
| 1946 | − * NL80211_EXT_FEATURE_BEACON_RATE_VHT and | |
| 1947 | − * NL80211_EXT_FEATURE_BEACON_RATE_HE. | |
| 1946 | + * NL80211_EXT_FEATURE_BEACON_RATE_VHT, | |
| 1947 | + * NL80211_EXT_FEATURE_BEACON_RATE_HE and | |
| 1948 | + * NL80211_EXT_FEATURE_BEACON_RATE_EHT. | |
| 1948 | 1949 | * |
| 1949 | 1950 | * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain |
| 1950 | 1951 | * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. |
| @@ -2283,7 +2284,8 @@ enum nl80211_commands { · 332 unmodified lines | ||
| 2283 | 2284 | * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16). |
| 2284 | 2285 | * This is similar to @NL80211_ATTR_STA_AID but with a difference of being |
| 2285 | 2286 | * allowed to be used with the first @NL80211_CMD_SET_STATION command to |
| 2286 | − * update a TDLS peer STA entry. | |
| 2287 | + * update a TDLS peer STA entry. For S1G interfaces, this is limited to | |
| 2288 | + * 1600 for the current mac80211 implementation. | |
| 2287 | 2289 | * |
| 2288 | 2290 | * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information. |
| 2289 | 2291 | * |
| @@ -2928,6 +2930,12 @@ enum nl80211_commands { · 638 unmodified lines | ||
| 2928 | 2930 | * required alongside this attribute. Refer to |
| 2929 | 2931 | * @enum nl80211_s1g_short_beacon_attrs for the attribute definitions. |
| 2930 | 2932 | * |
| 2933 | + * @NL80211_ATTR_BSS_PARAM: nested attribute used with %NL80211_CMD_GET_WIPHY | |
| 2934 | + * which indicates which BSS parameters can be modified. The attribute can | |
| 2935 | + * also be used as flag attribute by user-space in %NL80211_CMD_SET_BSS to | |
| 2936 | + * indicate that it wants strict checking on the BSS parameters to be | |
| 2937 | + * modified. | |
| 2938 | + * | |
| 2931 | 2939 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 2932 | 2940 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 2933 | 2941 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -3489,6 +3497,7 @@ enum nl80211_attrs { · 555 unmodified lines | ||
| 3489 | 3497 | |
| 3490 | 3498 | NL80211_ATTR_S1G_LONG_BEACON_PERIOD, |
| 3491 | 3499 | NL80211_ATTR_S1G_SHORT_BEACON, |
| 3500 | + NL80211_ATTR_BSS_PARAM, | |
| 3492 | 3501 | |
| 3493 | 3502 | /* add attributes here, update the policy in nl80211.c */ |
| 3494 | 3503 | |
| @@ -3735,6 +3744,22 @@ enum nl80211_eht_gi { · 240 unmodified lines | ||
| 3735 | 3744 | NL80211_RATE_INFO_EHT_GI_3_2, |
| 3736 | 3745 | }; |
| 3737 | 3746 | |
| 3747 | +/** | |
| 3748 | + * enum nl80211_eht_ltf - EHT long training field | |
| 3749 | + * @NL80211_RATE_INFO_EHT_1XLTF: 3.2 usec | |
| 3750 | + * @NL80211_RATE_INFO_EHT_2XLTF: 6.4 usec | |
| 3751 | + * @NL80211_RATE_INFO_EHT_4XLTF: 12.8 usec | |
| 3752 | + * @NL80211_RATE_INFO_EHT_6XLTF: 19.2 usec | |
| 3753 | + * @NL80211_RATE_INFO_EHT_8XLTF: 25.6 usec | |
| 3754 | + */ | |
| 3755 | +enum nl80211_eht_ltf { | |
| 3756 | + NL80211_RATE_INFO_EHT_1XLTF, | |
| 3757 | + NL80211_RATE_INFO_EHT_2XLTF, | |
| 3758 | + NL80211_RATE_INFO_EHT_4XLTF, | |
| 3759 | + NL80211_RATE_INFO_EHT_6XLTF, | |
| 3760 | + NL80211_RATE_INFO_EHT_8XLTF, | |
| 3761 | +}; | |
| 3762 | + | |
| 3738 | 3763 | /** |
| 3739 | 3764 | * enum nl80211_eht_ru_alloc - EHT RU allocation values |
| 3740 | 3765 | * @NL80211_RATE_INFO_EHT_RU_ALLOC_26: 26-tone RU allocation |
| @@ -5481,6 +5506,10 @@ enum nl80211_key_attributes { · 1740 unmodified lines | ||
| 5481 | 5506 | * see &struct nl80211_txrate_he |
| 5482 | 5507 | * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us. |
| 5483 | 5508 | * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF. |
| 5509 | + * @NL80211_TXRATE_EHT: EHT rates allowed for TX rate selection, | |
| 5510 | + * see &struct nl80211_txrate_eht | |
| 5511 | + * @NL80211_TXRATE_EHT_GI: configure EHT GI, (u8, see &enum nl80211_eht_gi) | |
| 5512 | + * @NL80211_TXRATE_EHT_LTF: configure EHT LTF, (u8, see &enum nl80211_eht_ltf) | |
| 5484 | 5513 | * @__NL80211_TXRATE_AFTER_LAST: internal |
| 5485 | 5514 | * @NL80211_TXRATE_MAX: highest TX rate attribute |
| 5486 | 5515 | */ |
| @@ -5493,6 +5522,9 @@ enum nl80211_tx_rate_attributes { · 6 unmodified lines | ||
| 5493 | 5522 | NL80211_TXRATE_HE, |
| 5494 | 5523 | NL80211_TXRATE_HE_GI, |
| 5495 | 5524 | NL80211_TXRATE_HE_LTF, |
| 5525 | + NL80211_TXRATE_EHT, | |
| 5526 | + NL80211_TXRATE_EHT_GI, | |
| 5527 | + NL80211_TXRATE_EHT_LTF, | |
| 5496 | 5528 | |
| 5497 | 5529 | /* keep last */ |
| 5498 | 5530 | __NL80211_TXRATE_AFTER_LAST, |
| @@ -5525,6 +5557,15 @@ enum nl80211_txrate_gi { · 26 unmodified lines | ||
| 5525 | 5557 | NL80211_TXRATE_FORCE_LGI, |
| 5526 | 5558 | }; |
| 5527 | 5559 | |
| 5560 | +#define NL80211_EHT_NSS_MAX 16 | |
| 5561 | +/** | |
| 5562 | + * struct nl80211_txrate_eht - EHT MCS/NSS txrate bitmap | |
| 5563 | + * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.) | |
| 5564 | + */ | |
| 5565 | +struct nl80211_txrate_eht { | |
| 5566 | + __u16 mcs[NL80211_EHT_NSS_MAX]; | |
| 5567 | +}; | |
| 5568 | + | |
| 5528 | 5569 | /** |
| 5529 | 5570 | * enum nl80211_band - Frequency band |
| 5530 | 5571 | * @NL80211_BAND_2GHZ: 2.4 GHz ISM band |
| @@ -6649,6 +6690,9 @@ enum nl80211_feature_flags { · 1118 unmodified lines | ||
| 6649 | 6690 | * (signaling and payload protected) A-MSDUs and this shall be advertised |
| 6650 | 6691 | * in the RSNXE. |
| 6651 | 6692 | * |
| 6693 | + * @NL80211_EXT_FEATURE_BEACON_RATE_EHT: Driver supports beacon rate | |
| 6694 | + * configuration (AP/mesh) with EHT rates. | |
| 6695 | + * | |
| 6652 | 6696 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
| 6653 | 6697 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
| 6654 | 6698 | */ |
| @@ -6724,6 +6768,7 @@ enum nl80211_ext_feature_index { · 69 unmodified lines | ||
| 6724 | 6768 | NL80211_EXT_FEATURE_OWE_OFFLOAD_AP, |
| 6725 | 6769 | NL80211_EXT_FEATURE_DFS_CONCURRENT, |
| 6726 | 6770 | NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT, |
| 6771 | + NL80211_EXT_FEATURE_BEACON_RATE_EHT, | |
| 6727 | 6772 | |
| 6728 | 6773 | /* add new features before the definition below */ |
| 6729 | 6774 | NUM_NL80211_EXT_FEATURES, |
| @@ -2171,10 +2171,16 @@ static int sta_apply_parameters(struct ieee80211_local *local, · 2170 unmodified lines | ||
| 2171 | 2171 | |
| 2172 | 2172 | /* |
| 2173 | 2173 | * cfg80211 validates this (1-2007) and allows setting the AID |
| 2174 | − * only when creating a new station entry | |
| 2174 | + * only when creating a new station entry. For S1G APs, the current | |
| 2175 | + * implementation supports a maximum of 1600 AIDs. | |
| 2175 | 2176 | */ |
| 2176 | − if (params->aid) | |
| 2177 | + if (params->aid) { | |
| 2178 | + if (sdata->vif.cfg.s1g && | |
| 2179 | + params->aid > IEEE80211_MAX_SUPPORTED_S1G_AID) | |
| 2180 | + return -EINVAL; | |
| 2181 | + | |
| 2177 | 2182 | sta->sta.aid = params->aid; |
| 2183 | + } | |
| 2178 | 2184 | |
| 2179 | 2185 | /* |
| 2180 | 2186 | * Some of the following updates would be racy if called on an |
| @@ -3001,6 +3007,9 @@ static int ieee80211_scan(struct wiphy *wiphy, · 820 unmodified lines | ||
| 3001 | 3007 | struct cfg80211_scan_request *req) |
| 3002 | 3008 | { |
| 3003 | 3009 | struct ieee80211_sub_if_data *sdata; |
| 3010 | + struct ieee80211_link_data *link; | |
| 3011 | + struct ieee80211_channel *chan; | |
| 3012 | + int radio_idx; | |
| 3004 | 3013 | |
| 3005 | 3014 | sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev); |
| 3006 | 3015 | |
| @@ -3028,10 +3037,20 @@ static int ieee80211_scan(struct wiphy *wiphy, · 21 unmodified lines | ||
| 3028 | 3037 | * the frames sent while scanning on other channel will be |
| 3029 | 3038 | * lost) |
| 3030 | 3039 | */ |
| 3031 | − if (ieee80211_num_beaconing_links(sdata) && | |
| 3032 | − (!(wiphy->features & NL80211_FEATURE_AP_SCAN) || | |
| 3033 | − !(req->flags & NL80211_SCAN_FLAG_AP))) | |
| 3034 | − return -EOPNOTSUPP; | |
| 3040 | + for_each_link_data(sdata, link) { | |
| 3041 | + /* if the link is not beaconing, ignore it */ | |
| 3042 | + if (!sdata_dereference(link->u.ap.beacon, sdata)) | |
| 3043 | + continue; | |
| 3044 | + | |
| 3045 | + chan = link->conf->chanreq.oper.chan; | |
| 3046 | + radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan); | |
| 3047 | + | |
| 3048 | + if (ieee80211_is_radio_idx_in_scan_req(wiphy, req, | |
| 3049 | + radio_idx) && | |
| 3050 | + (!(wiphy->features & NL80211_FEATURE_AP_SCAN) || | |
| 3051 | + !(req->flags & NL80211_SCAN_FLAG_AP))) | |
| 3052 | + return -EOPNOTSUPP; | |
| 3053 | + } | |
| 3035 | 3054 | break; |
| 3036 | 3055 | case NL80211_IFTYPE_NAN: |
| 3037 | 3056 | default: |
| @@ -3677,12 +3696,7 @@ static bool ieee80211_is_scan_ongoing(struct wiphy *wiphy, · 639 unmodified lines | ||
| 3677 | 3696 | if (list_empty(&local->roc_list) && !local->scanning) |
| 3678 | 3697 | return false; |
| 3679 | 3698 | |
| 3680 | − if (wiphy->n_radio < 2) | |
| 3681 | − return true; | |
| 3682 | − | |
| 3683 | 3699 | req_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chandef->chan); |
| 3684 | − if (req_radio_idx < 0) | |
| 3685 | − return true; | |
| 3686 | 3700 | |
| 3687 | 3701 | if (local->scanning) { |
| 3688 | 3702 | scan_req = wiphy_dereference(wiphy, local->scan_req); |
| @@ -3701,14 +3715,6 @@ static bool ieee80211_is_scan_ongoing(struct wiphy *wiphy, · 12 unmodified lines | ||
| 3701 | 3715 | list_for_each_entry(roc, &local->roc_list, list) { |
| 3702 | 3716 | chan_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, |
| 3703 | 3717 | roc->chan); |
| 3704 | − /* | |
| 3705 | − * The roc work is added but chan_radio_idx is invalid. | |
| 3706 | − * Should not happen but if it does, let's not take | |
| 3707 | − * risk and return true. | |
| 3708 | − */ | |
| 3709 | − if (chan_radio_idx < 0) | |
| 3710 | − return true; | |
| 3711 | − | |
| 3712 | 3718 | if (chan_radio_idx == req_radio_idx) |
| 3713 | 3719 | return true; |
| 3714 | 3720 | } |
| @@ -659,19 +659,8 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local, · 658 unmodified lines | ||
| 659 | 659 | |
| 660 | 660 | for_each_sdata_link(local, link) { |
| 661 | 661 | if (link->radar_required) { |
| 662 | − if (wiphy->n_radio < 2) | |
| 663 | − return true; | |
| 664 | − | |
| 665 | 662 | chan = link->conf->chanreq.oper.chan; |
| 666 | 663 | radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan); |
| 667 | − /* | |
| 668 | − * The radio index (radio_idx) is expected to be valid, | |
| 669 | − * as it's derived from a channel tied to a link. If | |
| 670 | − * it's invalid (i.e., negative), return true to avoid | |
| 671 | − * potential issues with radar-sensitive operations. | |
| 672 | − */ | |
| 673 | − if (radio_idx < 0) | |
| 674 | − return true; | |
| 675 | 664 | |
| 676 | 665 | if (ieee80211_is_radio_idx_in_scan_req(wiphy, req, |
| 677 | 666 | radio_idx)) |
| @@ -48,8 +48,8 @@ static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = { · 47 unmodified lines | ||
| 48 | 48 | "rx_duplicates", "rx_fragments", "rx_dropped", |
| 49 | 49 | "tx_packets", "tx_bytes", |
| 50 | 50 | "tx_filtered", "tx_retry_failed", "tx_retries", |
| 51 | − "sta_state", "txrate", "rxrate", "signal", | |
| 52 | − "channel", "noise", "ch_time", "ch_time_busy", | |
| 51 | + "tx_handlers_drop", "sta_state", "txrate", "rxrate", | |
| 52 | + "signal", "channel", "noise", "ch_time", "ch_time_busy", | |
| 53 | 53 | "ch_time_ext_busy", "ch_time_rx", "ch_time_tx" |
| 54 | 54 | }; |
| 55 | 55 | #define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats) |
| @@ -120,6 +120,7 @@ static void ieee80211_get_stats(struct net_device *dev, · 64 unmodified lines | ||
| 120 | 120 | i = 0; |
| 121 | 121 | ADD_STA_STATS(&sta->deflink); |
| 122 | 122 | |
| 123 | + data[i++] = sdata->tx_handlers_drop; | |
| 123 | 124 | data[i++] = sta->sta_state; |
| 124 | 125 | |
| 125 | 126 | |
| @@ -145,6 +146,7 @@ static void ieee80211_get_stats(struct net_device *dev, · 19 unmodified lines | ||
| 145 | 146 | sta_set_sinfo(sta, &sinfo, false); |
| 146 | 147 | i = 0; |
| 147 | 148 | ADD_STA_STATS(&sta->deflink); |
| 149 | + data[i++] = sdata->tx_handlers_drop; | |
| 148 | 150 | } |
| 149 | 151 | } |
| 150 | 152 | |
| @@ -86,6 +86,14 @@ extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS]; · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | #define IEEE80211_MAX_NAN_INSTANCE_ID 255 |
| 88 | 88 | |
| 89 | +/* | |
| 90 | + * Current mac80211 implementation supports a maximum of 1600 AIDS | |
| 91 | + * for S1G interfaces. With regards to an S1G TIM, this covers 25 blocks | |
| 92 | + * as each block is 64 AIDs. | |
| 93 | + */ | |
| 94 | +#define IEEE80211_MAX_SUPPORTED_S1G_AID 1600 | |
| 95 | +#define IEEE80211_MAX_SUPPORTED_S1G_TIM_BLOCKS 25 | |
| 96 | + | |
| 89 | 97 | enum ieee80211_status_data { |
| 90 | 98 | IEEE80211_STATUS_TYPE_MASK = 0x00f, |
| 91 | 99 | IEEE80211_STATUS_TYPE_INVALID = 0, |
| @@ -1210,6 +1218,7 @@ struct ieee80211_sub_if_data { · 1118 unmodified lines | ||
| 1210 | 1218 | } debugfs; |
| 1211 | 1219 | #endif |
| 1212 | 1220 | |
| 1221 | + u32 tx_handlers_drop; | |
| 1213 | 1222 | /* must be last, dynamically sized area in this! */ |
| 1214 | 1223 | struct ieee80211_vif vif; |
| 1215 | 1224 | }; |
| @@ -862,6 +862,14 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, · 861 unmodified lines | ||
| 862 | 862 | if (emulate_chanctx || ops->remain_on_channel) |
| 863 | 863 | wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; |
| 864 | 864 | |
| 865 | + wiphy->bss_param_support = WIPHY_BSS_PARAM_CTS_PROT | | |
| 866 | + WIPHY_BSS_PARAM_SHORT_PREAMBLE | | |
| 867 | + WIPHY_BSS_PARAM_SHORT_SLOT_TIME | | |
| 868 | + WIPHY_BSS_PARAM_BASIC_RATES | | |
| 869 | + WIPHY_BSS_PARAM_AP_ISOLATE | | |
| 870 | + WIPHY_BSS_PARAM_HT_OPMODE | | |
| 871 | + WIPHY_BSS_PARAM_P2P_CTWINDOW | | |
| 872 | + WIPHY_BSS_PARAM_P2P_OPPPS; | |
| 865 | 873 | wiphy->features |= NL80211_FEATURE_SK_TX_STATUS | |
| 866 | 874 | NL80211_FEATURE_SAE | |
| 867 | 875 | NL80211_FEATURE_HT_IBSS | |
| @@ -1164,9 +1172,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 296 unmodified lines | ||
| 1164 | 1172 | if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE))) |
| 1165 | 1173 | return -EINVAL; |
| 1166 | 1174 | |
| 1167 | − if (WARN_ON(!ieee80211_hw_check(hw, CONNECTION_MONITOR))) | |
| 1168 | − return -EINVAL; | |
| 1169 | − | |
| 1170 | 1175 | if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC))) |
| 1171 | 1176 | return -EINVAL; |
| 1172 | 1177 | |
| @@ -624,6 +624,9 @@ int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata, · 623 unmodified lines | ||
| 624 | 624 | if (!sband) |
| 625 | 625 | return -EINVAL; |
| 626 | 626 | |
| 627 | + if (sband->band != NL80211_BAND_6GHZ) | |
| 628 | + return 0; | |
| 629 | + | |
| 627 | 630 | iftd = ieee80211_get_sband_iftype_data(sband, |
| 628 | 631 | NL80211_IFTYPE_MESH_POINT); |
| 629 | 632 | /* The device doesn't support HE in mesh mode or at all */ |
| @@ -586,7 +586,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, · 585 unmodified lines | ||
| 586 | 586 | |
| 587 | 587 | if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) |
| 588 | 588 | has_buffered = ieee80211_check_tim(elems->tim, elems->tim_len, |
| 589 | − sta->mesh->aid); | |
| 589 | + sta->mesh->aid, false); | |
| 590 | 590 | |
| 591 | 591 | if (has_buffered) |
| 592 | 592 | mps_dbg(sta->sdata, "%pM indicates buffered frames\n", |
| @@ -1850,7 +1850,8 @@ ieee80211_add_link_elems(struct ieee80211_sub_if_data *sdata, · 1849 unmodified lines | ||
| 1850 | 1850 | ieee80211_put_he_cap(skb, sdata, sband, |
| 1851 | 1851 | &assoc_data->link[link_id].conn); |
| 1852 | 1852 | ADD_PRESENT_EXT_ELEM(WLAN_EID_EXT_HE_CAPABILITY); |
| 1853 | − ieee80211_put_he_6ghz_cap(skb, sdata, smps_mode); | |
| 1853 | + if (sband->band == NL80211_BAND_6GHZ) | |
| 1854 | + ieee80211_put_he_6ghz_cap(skb, sdata, smps_mode); | |
| 1854 | 1855 | } |
| 1855 | 1856 | |
| 1856 | 1857 | /* |
| @@ -2112,8 +2113,11 @@ ieee80211_link_common_elems_size(struct ieee80211_sub_if_data *sdata, · 255 unmodified lines | ||
| 2112 | 2113 | sizeof(struct ieee80211_he_mcs_nss_supp) + |
| 2113 | 2114 | IEEE80211_HE_PPE_THRES_MAX_LEN; |
| 2114 | 2115 | |
| 2115 | − if (sband->band == NL80211_BAND_6GHZ) | |
| 2116 | + if (sband->band == NL80211_BAND_6GHZ) { | |
| 2116 | 2117 | size += 2 + 1 + sizeof(struct ieee80211_he_6ghz_capa); |
| 2118 | + /* reg connection */ | |
| 2119 | + size += 4; | |
| 2120 | + } | |
| 2117 | 2121 | |
| 2118 | 2122 | size += 2 + 1 + sizeof(struct ieee80211_eht_cap_elem) + |
| 2119 | 2123 | sizeof(struct ieee80211_eht_mcs_nss_supp) + |
| @@ -2187,11 +2191,7 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 67 unmodified lines | ||
| 2187 | 2191 | 2 + /* ext capa & op */ |
| 2188 | 2192 | 2; /* EML capa */ |
| 2189 | 2193 | |
| 2190 | − /* | |
| 2191 | − * The capability elements were already considered above; | |
| 2192 | − * note this over-estimates a bit because there's no | |
| 2193 | − * STA profile for the assoc link. | |
| 2194 | − */ | |
| 2194 | + /* The capability elements were already considered above */ | |
| 2195 | 2195 | size += (n_links - 1) * |
| 2196 | 2196 | (1 + 1 + /* subelement ID/length */ |
| 2197 | 2197 | 2 + /* STA control */ |
| @@ -5729,7 +5729,7 @@ static u8 ieee80211_max_rx_chains(struct ieee80211_link_data *link, · 3531 unmodified lines | ||
| 5729 | 5729 | he_cap_elem = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_CAPABILITY, |
| 5730 | 5730 | ies->data, ies->len); |
| 5731 | 5731 | |
| 5732 | − if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap)) | |
| 5732 | + if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap) + 1) | |
| 5733 | 5733 | return chains; |
| 5734 | 5734 | |
| 5735 | 5735 | /* skip one byte ext_tag_id */ |
| @@ -6356,6 +6356,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 620 unmodified lines | ||
| 6356 | 6356 | }; |
| 6357 | 6357 | u8 ap_mld_addr[ETH_ALEN] __aligned(2); |
| 6358 | 6358 | unsigned int link_id; |
| 6359 | + u16 max_aid = IEEE80211_MAX_AID; | |
| 6359 | 6360 | |
| 6360 | 6361 | lockdep_assert_wiphy(sdata->local->hw.wiphy); |
| 6361 | 6362 | |
| @@ -6382,10 +6383,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 20 unmodified lines | ||
| 6382 | 6383 | reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); |
| 6383 | 6384 | capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); |
| 6384 | 6385 | status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); |
| 6385 | − if (assoc_data->s1g) | |
| 6386 | + if (assoc_data->s1g) { | |
| 6386 | 6387 | elem_start = mgmt->u.s1g_assoc_resp.variable; |
| 6387 | − else | |
| 6388 | + max_aid = IEEE80211_MAX_SUPPORTED_S1G_AID; | |
| 6389 | + } else { | |
| 6388 | 6390 | elem_start = mgmt->u.assoc_resp.variable; |
| 6391 | + } | |
| 6389 | 6392 | |
| 6390 | 6393 | /* |
| 6391 | 6394 | * Note: this may not be perfect, AP might misbehave - if |
| @@ -6409,16 +6412,15 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 17 unmodified lines | ||
| 6409 | 6412 | |
| 6410 | 6413 | if (elems->aid_resp) |
| 6411 | 6414 | aid = le16_to_cpu(elems->aid_resp->aid); |
| 6412 | − else if (assoc_data->s1g) | |
| 6413 | − aid = 0; /* TODO */ | |
| 6414 | 6415 | else |
| 6415 | 6416 | aid = le16_to_cpu(mgmt->u.assoc_resp.aid); |
| 6416 | 6417 | |
| 6417 | 6418 | /* |
| 6418 | − * The 5 MSB of the AID field are reserved | |
| 6419 | − * (802.11-2016 9.4.1.8 AID field) | |
| 6419 | + * The 5 MSB of the AID field are reserved for a non-S1G STA. For | |
| 6420 | + * an S1G STA the 3 MSBs are reserved. | |
| 6421 | + * (802.11-2016 9.4.1.8 AID field). | |
| 6420 | 6422 | */ |
| 6421 | − aid &= 0x7ff; | |
| 6423 | + aid &= assoc_data->s1g ? 0x1fff : 0x7ff; | |
| 6422 | 6424 | |
| 6423 | 6425 | sdata_info(sdata, |
| 6424 | 6426 | "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n", |
| @@ -6455,7 +6457,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 30 unmodified lines | ||
| 6455 | 6457 | event.u.mlme.reason = status_code; |
| 6456 | 6458 | drv_event_callback(sdata->local, sdata, &event); |
| 6457 | 6459 | } else { |
| 6458 | − if (aid == 0 || aid > IEEE80211_MAX_AID) { | |
| 6460 | + if (aid == 0 || aid > max_aid) { | |
| 6459 | 6461 | sdata_info(sdata, |
| 6460 | 6462 | "invalid AID value %d (out of range), turn off PS\n", |
| 6461 | 6463 | aid); |
| @@ -6493,6 +6495,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 31 unmodified lines | ||
| 6493 | 6495 | } |
| 6494 | 6496 | |
| 6495 | 6497 | sdata->vif.cfg.aid = aid; |
| 6498 | + sdata->vif.cfg.s1g = assoc_data->s1g; | |
| 6496 | 6499 | |
| 6497 | 6500 | if (!ieee80211_assoc_success(sdata, mgmt, elems, |
| 6498 | 6501 | elem_start, elem_len)) { |
| @@ -7440,7 +7443,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, · 941 unmodified lines | ||
| 7440 | 7443 | ncrc = elems->crc; |
| 7441 | 7444 | |
| 7442 | 7445 | if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && |
| 7443 | − ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid)) { | |
| 7446 | + ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid, | |
| 7447 | + vif_cfg->s1g)) { | |
| 7444 | 7448 | if (local->hw.conf.dynamic_ps_timeout > 0) { |
| 7445 | 7449 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
| 7446 | 7450 | local->hw.conf.flags &= ~IEEE80211_CONF_PS; |
| @@ -2962,7 +2962,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, · 2961 unmodified lines | ||
| 2962 | 2962 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
| 2963 | 2963 | struct ieee80211_local *local = sdata->local; |
| 2964 | 2964 | u32 thr = 0; |
| 2965 | − int i, ac, cpu, link_id; | |
| 2965 | + int i, ac, cpu; | |
| 2966 | 2966 | struct ieee80211_sta_rx_stats *last_rxstats; |
| 2967 | 2967 | |
| 2968 | 2968 | last_rxstats = sta_get_last_rx_stats(sta, -1); |
| @@ -3204,18 +3204,23 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, · 235 unmodified lines | ||
| 3204 | 3204 | if (sta->sta.valid_links) { |
| 3205 | 3205 | struct ieee80211_link_data *link; |
| 3206 | 3206 | struct link_sta_info *link_sta; |
| 3207 | + int link_id; | |
| 3207 | 3208 | |
| 3208 | 3209 | ether_addr_copy(sinfo->mld_addr, sta->addr); |
| 3210 | + | |
| 3211 | + /* assign valid links first for iteration */ | |
| 3212 | + sinfo->valid_links = sta->sta.valid_links; | |
| 3213 | + | |
| 3209 | 3214 | for_each_valid_link(sinfo, link_id) { |
| 3210 | 3215 | link_sta = wiphy_dereference(sta->local->hw.wiphy, |
| 3211 | 3216 | sta->link[link_id]); |
| 3212 | 3217 | link = wiphy_dereference(sdata->local->hw.wiphy, |
| 3213 | 3218 | sdata->link[link_id]); |
| 3214 | 3219 | |
| 3215 | − if (!link_sta || !sinfo->links[link_id] || !link) | |
| 3220 | + if (!link_sta || !sinfo->links[link_id] || !link) { | |
| 3221 | + sinfo->valid_links &= ~BIT(link_id); | |
| 3216 | 3222 | continue; |
| 3217 | − | |
| 3218 | − sinfo->valid_links = sta->sta.valid_links; | |
| 3223 | + } | |
| 3219 | 3224 | sta_set_link_sinfo(sta, sinfo->links[link_id], |
| 3220 | 3225 | link, tidstats); |
| 3221 | 3226 | } |
| @@ -1,3 +1,3 @@ | ||
| 1 | −mac80211-tests-y += module.o util.o elems.o mfp.o tpe.o chan-mode.o | |
| 1 | +mac80211-tests-y += module.o util.o elems.o mfp.o tpe.o chan-mode.o s1g_tim.o | |
| 2 | 2 | |
| 3 | 3 | obj-$(CONFIG_MAC80211_KUNIT_TEST) += mac80211-tests.o |
| @@ -0,0 +1,356 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +/* | |
| 3 | + * KUnit tests for S1G TIM PVB decoding. This test suite covers | |
| 4 | + * IEEE80211-2024 Annex L figures 8, 9, 10, 12, 13, 14. ADE mode | |
| 5 | + * is not covered as it is an optional encoding format and is not | |
| 6 | + * currently supported by mac80211. | |
| 7 | + * | |
| 8 | + * Copyright (C) 2025 Morse Micro | |
| 9 | + */ | |
| 10 | +#include <linux/ieee80211.h> | |
| 11 | +#include <kunit/test.h> | |
| 12 | +#include <kunit/test-bug.h> | |
| 13 | + | |
| 14 | +#define MAX_AID 128 | |
| 15 | + | |
| 16 | +#define BC(enc_mode, inverse, blk_off) \ | |
| 17 | + ((((blk_off) & 0x1f) << 3) | ((inverse) ? BIT(2) : 0) | \ | |
| 18 | + ((enc_mode) & 0x3)) | |
| 19 | + | |
| 20 | +static void byte_to_bitstr(u8 v, char *out) | |
| 21 | +{ | |
| 22 | + for (int b = 7; b >= 0; b--) | |
| 23 | + *out++ = (v & BIT(b)) ? '1' : '0'; | |
| 24 | + *out = '\0'; | |
| 25 | +} | |
| 26 | + | |
| 27 | +static void dump_tim_bits(struct kunit *test, | |
| 28 | + const struct ieee80211_tim_ie *tim, u8 tim_len) | |
| 29 | +{ | |
| 30 | + const u8 *ptr = tim->virtual_map; | |
| 31 | + const u8 *end = (const u8 *)tim + tim_len; | |
| 32 | + unsigned int oct = 1; | |
| 33 | + unsigned int blk = 0; | |
| 34 | + char bits[9]; | |
| 35 | + | |
| 36 | + while (ptr < end) { | |
| 37 | + u8 ctrl = *ptr++; | |
| 38 | + u8 mode = ctrl & 0x03; | |
| 39 | + bool inverse = ctrl & BIT(2); | |
| 40 | + u8 blk_off = ctrl >> 3; | |
| 41 | + | |
| 42 | + kunit_info( | |
| 43 | + test, "Block %u (ENC=%s, blk_off=%u, inverse=%u)", blk, | |
| 44 | + (mode == IEEE80211_S1G_TIM_ENC_MODE_BLOCK) ? "BLOCK" : | |
| 45 | + (mode == IEEE80211_S1G_TIM_ENC_MODE_SINGLE) ? "SINGLE" : | |
| 46 | + "OLB", | |
| 47 | + blk_off, inverse); | |
| 48 | + | |
| 49 | + byte_to_bitstr(ctrl, bits); | |
| 50 | + kunit_info(test, " octet %2u (ctrl) : %s (0x%02x)", oct, | |
| 51 | + bits, ctrl); | |
| 52 | + ++oct; | |
| 53 | + | |
| 54 | + switch (mode) { | |
| 55 | + case IEEE80211_S1G_TIM_ENC_MODE_BLOCK: { | |
| 56 | + u8 blkmap = *ptr++; | |
| 57 | + | |
| 58 | + byte_to_bitstr(blkmap, bits); | |
| 59 | + kunit_info(test, " octet %2u (blk-map) : %s (0x%02x)", | |
| 60 | + oct, bits, blkmap); | |
| 61 | + ++oct; | |
| 62 | + | |
| 63 | + for (u8 sb = 0; sb < 8; sb++) { | |
| 64 | + if (!(blkmap & BIT(sb))) | |
| 65 | + continue; | |
| 66 | + u8 sub = *ptr++; | |
| 67 | + | |
| 68 | + byte_to_bitstr(sub, bits); | |
| 69 | + kunit_info( | |
| 70 | + test, | |
| 71 | + " octet %2u (SB %2u) : %s (0x%02x)", | |
| 72 | + oct, sb, bits, sub); | |
| 73 | + ++oct; | |
| 74 | + } | |
| 75 | + break; | |
| 76 | + } | |
| 77 | + case IEEE80211_S1G_TIM_ENC_MODE_SINGLE: { | |
| 78 | + u8 single = *ptr++; | |
| 79 | + | |
| 80 | + byte_to_bitstr(single, bits); | |
| 81 | + kunit_info(test, " octet %2u (single) : %s (0x%02x)", | |
| 82 | + oct, bits, single); | |
| 83 | + ++oct; | |
| 84 | + break; | |
| 85 | + } | |
| 86 | + case IEEE80211_S1G_TIM_ENC_MODE_OLB: { | |
| 87 | + u8 len = *ptr++; | |
| 88 | + | |
| 89 | + byte_to_bitstr(len, bits); | |
| 90 | + kunit_info(test, " octet %2u (len=%2u) : %s (0x%02x)", | |
| 91 | + oct, len, bits, len); | |
| 92 | + ++oct; | |
| 93 | + | |
| 94 | + for (u8 i = 0; i < len && ptr < end; i++) { | |
| 95 | + u8 sub = *ptr++; | |
| 96 | + | |
| 97 | + byte_to_bitstr(sub, bits); | |
| 98 | + kunit_info( | |
| 99 | + test, | |
| 100 | + " octet %2u (SB %2u) : %s (0x%02x)", | |
| 101 | + oct, i, bits, sub); | |
| 102 | + ++oct; | |
| 103 | + } | |
| 104 | + break; | |
| 105 | + } | |
| 106 | + default: | |
| 107 | + kunit_info(test, " ** unknown encoding 0x%x **", mode); | |
| 108 | + return; | |
| 109 | + } | |
| 110 | + blk++; | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |
| 114 | +static void tim_push(u8 **p, u8 v) | |
| 115 | +{ | |
| 116 | + *(*p)++ = v; | |
| 117 | +} | |
| 118 | + | |
| 119 | +static void tim_begin(struct ieee80211_tim_ie *tim, u8 **p) | |
| 120 | +{ | |
| 121 | + tim->dtim_count = 0; | |
| 122 | + tim->dtim_period = 1; | |
| 123 | + tim->bitmap_ctrl = 0; | |
| 124 | + *p = tim->virtual_map; | |
| 125 | +} | |
| 126 | + | |
| 127 | +static u8 tim_end(struct ieee80211_tim_ie *tim, u8 *tail) | |
| 128 | +{ | |
| 129 | + return tail - (u8 *)tim; | |
| 130 | +} | |
| 131 | + | |
| 132 | +static void pvb_add_block_bitmap(u8 **p, u8 blk_off, bool inverse, u8 blk_bmap, | |
| 133 | + const u8 *subblocks) | |
| 134 | +{ | |
| 135 | + u8 enc = IEEE80211_S1G_TIM_ENC_MODE_BLOCK; | |
| 136 | + u8 n = hweight8(blk_bmap); | |
| 137 | + | |
| 138 | + tim_push(p, BC(enc, inverse, blk_off)); | |
| 139 | + tim_push(p, blk_bmap); | |
| 140 | + | |
| 141 | + for (u8 i = 0; i < n; i++) | |
| 142 | + tim_push(p, subblocks[i]); | |
| 143 | +} | |
| 144 | + | |
| 145 | +static void pvb_add_single_aid(u8 **p, u8 blk_off, bool inverse, u8 single6) | |
| 146 | +{ | |
| 147 | + u8 enc = IEEE80211_S1G_TIM_ENC_MODE_SINGLE; | |
| 148 | + | |
| 149 | + tim_push(p, BC(enc, inverse, blk_off)); | |
| 150 | + tim_push(p, single6 & GENMASK(5, 0)); | |
| 151 | +} | |
| 152 | + | |
| 153 | +static void pvb_add_olb(u8 **p, u8 blk_off, bool inverse, const u8 *subblocks, | |
| 154 | + u8 len) | |
| 155 | +{ | |
| 156 | + u8 enc = IEEE80211_S1G_TIM_ENC_MODE_OLB; | |
| 157 | + | |
| 158 | + tim_push(p, BC(enc, inverse, blk_off)); | |
| 159 | + tim_push(p, len); | |
| 160 | + for (u8 i = 0; i < len; i++) | |
| 161 | + tim_push(p, subblocks[i]); | |
| 162 | +} | |
| 163 | + | |
| 164 | +static void check_all_aids(struct kunit *test, | |
| 165 | + const struct ieee80211_tim_ie *tim, u8 tim_len, | |
| 166 | + const unsigned long *expected) | |
| 167 | +{ | |
| 168 | + for (u16 aid = 1; aid <= MAX_AID; aid++) { | |
| 169 | + bool want = test_bit(aid, expected); | |
| 170 | + bool got = ieee80211_s1g_check_tim(tim, tim_len, aid); | |
| 171 | + | |
| 172 | + KUNIT_ASSERT_EQ_MSG(test, got, want, | |
| 173 | + "AID %u mismatch (got=%d want=%d)", aid, | |
| 174 | + got, want); | |
| 175 | + } | |
| 176 | +} | |
| 177 | + | |
| 178 | +static void fill_bitmap(unsigned long *bm, const u16 *list, size_t n) | |
| 179 | +{ | |
| 180 | + size_t i; | |
| 181 | + | |
| 182 | + bitmap_zero(bm, MAX_AID + 1); | |
| 183 | + for (i = 0; i < n; i++) | |
| 184 | + __set_bit(list[i], bm); | |
| 185 | +} | |
| 186 | + | |
| 187 | +static void fill_bitmap_inverse(unsigned long *bm, u16 max_aid, | |
| 188 | + const u16 *except, size_t n_except) | |
| 189 | +{ | |
| 190 | + bitmap_zero(bm, MAX_AID + 1); | |
| 191 | + for (u16 aid = 1; aid <= max_aid; aid++) | |
| 192 | + __set_bit(aid, bm); | |
| 193 | + | |
| 194 | + for (size_t i = 0; i < n_except; i++) | |
| 195 | + if (except[i] <= max_aid) | |
| 196 | + __clear_bit(except[i], bm); | |
| 197 | +} | |
| 198 | + | |
| 199 | +static void s1g_tim_block_test(struct kunit *test) | |
| 200 | +{ | |
| 201 | + u8 buf[256] = {}; | |
| 202 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 203 | + u8 *p, tim_len; | |
| 204 | + static const u8 subblocks[] = { | |
| 205 | + 0x42, /* SB m=0: AIDs 1,6 */ | |
| 206 | + 0xA0, /* SB m=2: AIDs 21,23 */ | |
| 207 | + }; | |
| 208 | + u8 blk_bmap = 0x05; /* bits 0 and 2 set */ | |
| 209 | + bool inverse = false; | |
| 210 | + static const u16 set_list[] = { 1, 6, 21, 23 }; | |
| 211 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 212 | + | |
| 213 | + tim_begin(tim, &p); | |
| 214 | + pvb_add_block_bitmap(&p, 0, inverse, blk_bmap, subblocks); | |
| 215 | + tim_len = tim_end(tim, p); | |
| 216 | + | |
| 217 | + fill_bitmap(exp, set_list, ARRAY_SIZE(set_list)); | |
| 218 | + | |
| 219 | + dump_tim_bits(test, tim, tim_len); | |
| 220 | + check_all_aids(test, tim, tim_len, exp); | |
| 221 | +} | |
| 222 | + | |
| 223 | +static void s1g_tim_single_test(struct kunit *test) | |
| 224 | +{ | |
| 225 | + u8 buf[256] = {}; | |
| 226 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 227 | + u8 *p, tim_len; | |
| 228 | + bool inverse = false; | |
| 229 | + u8 blk_off = 0; | |
| 230 | + u8 single6 = 0x1f; /* 31 */ | |
| 231 | + static const u16 set_list[] = { 31 }; | |
| 232 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 233 | + | |
| 234 | + tim_begin(tim, &p); | |
| 235 | + pvb_add_single_aid(&p, blk_off, inverse, single6); | |
| 236 | + tim_len = tim_end(tim, p); | |
| 237 | + | |
| 238 | + fill_bitmap(exp, set_list, ARRAY_SIZE(set_list)); | |
| 239 | + | |
| 240 | + dump_tim_bits(test, tim, tim_len); | |
| 241 | + check_all_aids(test, tim, tim_len, exp); | |
| 242 | +} | |
| 243 | + | |
| 244 | +static void s1g_tim_olb_test(struct kunit *test) | |
| 245 | +{ | |
| 246 | + u8 buf[256] = {}; | |
| 247 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 248 | + u8 *p, tim_len; | |
| 249 | + bool inverse = false; | |
| 250 | + u8 blk_off = 0; | |
| 251 | + static const u16 set_list[] = { 1, 6, 13, 15, 17, 22, 29, 31, 33, | |
| 252 | + 38, 45, 47, 49, 54, 61, 63, 65, 70 }; | |
| 253 | + static const u8 subblocks[] = { 0x42, 0xA0, 0x42, 0xA0, 0x42, | |
| 254 | + 0xA0, 0x42, 0xA0, 0x42 }; | |
| 255 | + u8 len = ARRAY_SIZE(subblocks); | |
| 256 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 257 | + | |
| 258 | + tim_begin(tim, &p); | |
| 259 | + pvb_add_olb(&p, blk_off, inverse, subblocks, len); | |
| 260 | + tim_len = tim_end(tim, p); | |
| 261 | + | |
| 262 | + fill_bitmap(exp, set_list, ARRAY_SIZE(set_list)); | |
| 263 | + | |
| 264 | + dump_tim_bits(test, tim, tim_len); | |
| 265 | + check_all_aids(test, tim, tim_len, exp); | |
| 266 | +} | |
| 267 | + | |
| 268 | +static void s1g_tim_inverse_block_test(struct kunit *test) | |
| 269 | +{ | |
| 270 | + u8 buf[256] = {}; | |
| 271 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 272 | + u8 *p, tim_len; | |
| 273 | + /* Same sub-block content as Figure L-8, but inverse = true */ | |
| 274 | + static const u8 subblocks[] = { | |
| 275 | + 0x42, /* SB m=0: AIDs 1,6 */ | |
| 276 | + 0xA0, /* SB m=2: AIDs 21,23 */ | |
| 277 | + }; | |
| 278 | + u8 blk_bmap = 0x05; | |
| 279 | + bool inverse = true; | |
| 280 | + /* All AIDs except 1,6,21,23 are set */ | |
| 281 | + static const u16 except[] = { 1, 6, 21, 23 }; | |
| 282 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 283 | + | |
| 284 | + tim_begin(tim, &p); | |
| 285 | + pvb_add_block_bitmap(&p, 0, inverse, blk_bmap, subblocks); | |
| 286 | + tim_len = tim_end(tim, p); | |
| 287 | + | |
| 288 | + fill_bitmap_inverse(exp, 63, except, ARRAY_SIZE(except)); | |
| 289 | + | |
| 290 | + dump_tim_bits(test, tim, tim_len); | |
| 291 | + check_all_aids(test, tim, tim_len, exp); | |
| 292 | +} | |
| 293 | + | |
| 294 | +static void s1g_tim_inverse_single_test(struct kunit *test) | |
| 295 | +{ | |
| 296 | + u8 buf[256] = {}; | |
| 297 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 298 | + u8 *p, tim_len; | |
| 299 | + bool inverse = true; | |
| 300 | + u8 blk_off = 0; | |
| 301 | + u8 single6 = 0x1f; /* 31 */ | |
| 302 | + /* All AIDs except 31 are set */ | |
| 303 | + static const u16 except[] = { 31 }; | |
| 304 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 305 | + | |
| 306 | + tim_begin(tim, &p); | |
| 307 | + pvb_add_single_aid(&p, blk_off, inverse, single6); | |
| 308 | + tim_len = tim_end(tim, p); | |
| 309 | + | |
| 310 | + fill_bitmap_inverse(exp, 63, except, ARRAY_SIZE(except)); | |
| 311 | + | |
| 312 | + dump_tim_bits(test, tim, tim_len); | |
| 313 | + check_all_aids(test, tim, tim_len, exp); | |
| 314 | +} | |
| 315 | + | |
| 316 | +static void s1g_tim_inverse_olb_test(struct kunit *test) | |
| 317 | +{ | |
| 318 | + u8 buf[256] = {}; | |
| 319 | + struct ieee80211_tim_ie *tim = (void *)buf; | |
| 320 | + u8 *p, tim_len; | |
| 321 | + bool inverse = true; | |
| 322 | + u8 blk_off = 0, len; | |
| 323 | + /* All AIDs except the list below are set */ | |
| 324 | + static const u16 except[] = { 1, 6, 13, 15, 17, 22, 29, 31, 33, | |
| 325 | + 38, 45, 47, 49, 54, 61, 63, 65, 70 }; | |
| 326 | + static const u8 subblocks[] = { 0x42, 0xA0, 0x42, 0xA0, 0x42, | |
| 327 | + 0xA0, 0x42, 0xA0, 0x42 }; | |
| 328 | + len = ARRAY_SIZE(subblocks); | |
| 329 | + DECLARE_BITMAP(exp, MAX_AID + 1); | |
| 330 | + | |
| 331 | + tim_begin(tim, &p); | |
| 332 | + pvb_add_olb(&p, blk_off, inverse, subblocks, len); | |
| 333 | + tim_len = tim_end(tim, p); | |
| 334 | + | |
| 335 | + fill_bitmap_inverse(exp, 127, except, ARRAY_SIZE(except)); | |
| 336 | + | |
| 337 | + dump_tim_bits(test, tim, tim_len); | |
| 338 | + check_all_aids(test, tim, tim_len, exp); | |
| 339 | +} | |
| 340 | + | |
| 341 | +static struct kunit_case s1g_tim_test_cases[] = { | |
| 342 | + KUNIT_CASE(s1g_tim_block_test), | |
| 343 | + KUNIT_CASE(s1g_tim_single_test), | |
| 344 | + KUNIT_CASE(s1g_tim_olb_test), | |
| 345 | + KUNIT_CASE(s1g_tim_inverse_block_test), | |
| 346 | + KUNIT_CASE(s1g_tim_inverse_single_test), | |
| 347 | + KUNIT_CASE(s1g_tim_inverse_olb_test), | |
| 348 | + {} | |
| 349 | +}; | |
| 350 | + | |
| 351 | +static struct kunit_suite s1g_tim = { | |
| 352 | + .name = "mac80211-s1g-tim", | |
| 353 | + .test_cases = s1g_tim_test_cases, | |
| 354 | +}; | |
| 355 | + | |
| 356 | +kunit_test_suite(s1g_tim); | |
| @@ -1814,6 +1814,7 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx) · 1813 unmodified lines | ||
| 1814 | 1814 | |
| 1815 | 1815 | txh_done: |
| 1816 | 1816 | if (unlikely(res == TX_DROP)) { |
| 1817 | + tx->sdata->tx_handlers_drop++; | |
| 1817 | 1818 | I802_DEBUG_INC(tx->local->tx_handlers_drop); |
| 1818 | 1819 | if (tx->skb) |
| 1819 | 1820 | ieee80211_free_txskb(&tx->local->hw, tx->skb); |
| @@ -1858,6 +1859,7 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) · 38 unmodified lines | ||
| 1858 | 1859 | |
| 1859 | 1860 | txh_done: |
| 1860 | 1861 | if (unlikely(res == TX_DROP)) { |
| 1862 | + tx->sdata->tx_handlers_drop++; | |
| 1861 | 1863 | I802_DEBUG_INC(tx->local->tx_handlers_drop); |
| 1862 | 1864 | if (tx->skb) |
| 1863 | 1865 | ieee80211_free_txskb(&tx->local->hw, tx->skb); |
| @@ -1942,6 +1944,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 78 unmodified lines | ||
| 1942 | 1944 | |
| 1943 | 1945 | if (unlikely(res_prepare == TX_DROP)) { |
| 1944 | 1946 | ieee80211_free_txskb(&local->hw, skb); |
| 1947 | + tx.sdata->tx_handlers_drop++; | |
| 1945 | 1948 | return true; |
| 1946 | 1949 | } else if (unlikely(res_prepare == TX_QUEUED)) { |
| 1947 | 1950 | return true; |
| @@ -3728,8 +3731,10 @@ void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 1780 unmodified lines | ||
| 3728 | 3731 | r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, |
| 3729 | 3732 | fast_tx->key, &tx); |
| 3730 | 3733 | tx.skb = NULL; |
| 3731 | − if (r == TX_DROP) | |
| 3734 | + if (r == TX_DROP) { | |
| 3735 | + tx.sdata->tx_handlers_drop++; | |
| 3732 | 3736 | goto free; |
| 3737 | + } | |
| 3733 | 3738 | |
| 3734 | 3739 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
| 3735 | 3740 | sdata = container_of(sdata->bss, |
| @@ -4882,15 +4887,114 @@ void ieee80211_tx_pending(struct tasklet_struct *t) · 1146 unmodified lines | ||
| 4882 | 4887 | |
| 4883 | 4888 | /* functions for drivers to get certain frames */ |
| 4884 | 4889 | |
| 4890 | +static void ieee80211_beacon_add_tim_pvb(struct ps_data *ps, | |
| 4891 | + struct sk_buff *skb, | |
| 4892 | + bool mcast_traffic) | |
| 4893 | +{ | |
| 4894 | + int i, n1 = 0, n2; | |
| 4895 | + | |
| 4896 | + /* | |
| 4897 | + * Find largest even number N1 so that bits numbered 1 through | |
| 4898 | + * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits | |
| 4899 | + * (N2 + 1) x 8 through 2007 are 0. | |
| 4900 | + */ | |
| 4901 | + for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) { | |
| 4902 | + if (ps->tim[i]) { | |
| 4903 | + n1 = i & 0xfe; | |
| 4904 | + break; | |
| 4905 | + } | |
| 4906 | + } | |
| 4907 | + n2 = n1; | |
| 4908 | + for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) { | |
| 4909 | + if (ps->tim[i]) { | |
| 4910 | + n2 = i; | |
| 4911 | + break; | |
| 4912 | + } | |
| 4913 | + } | |
| 4914 | + | |
| 4915 | + /* Bitmap control */ | |
| 4916 | + skb_put_u8(skb, n1 | mcast_traffic); | |
| 4917 | + /* Part Virt Bitmap */ | |
| 4918 | + skb_put_data(skb, ps->tim + n1, n2 - n1 + 1); | |
| 4919 | +} | |
| 4920 | + | |
| 4921 | +/* | |
| 4922 | + * mac80211 currently supports encoding using block bitmap mode, non | |
| 4923 | + * inversed. The current implementation supports up to 1600 AIDs. | |
| 4924 | + * | |
| 4925 | + * Block bitmap encoding breaks down the AID bitmap into blocks of 64 | |
| 4926 | + * AIDs. Each block contains between 0 and 8 subblocks. Each subblock | |
| 4927 | + * describes 8 AIDs and the presence of a subblock is determined by | |
| 4928 | + * the block bitmap. | |
| 4929 | + */ | |
| 4930 | +static void ieee80211_s1g_beacon_add_tim_pvb(struct ps_data *ps, | |
| 4931 | + struct sk_buff *skb, | |
| 4932 | + bool mcast_traffic) | |
| 4933 | +{ | |
| 4934 | + int blk; | |
| 4935 | + | |
| 4936 | + /* | |
| 4937 | + * Emit a bitmap control block with a page slice number of 31 and a | |
| 4938 | + * page index of 0 which indicates as per IEEE80211-2024 9.4.2.5.1 | |
| 4939 | + * that the entire page (2048 bits) indicated by the page index | |
| 4940 | + * is encoded in the partial virtual bitmap. | |
| 4941 | + */ | |
| 4942 | + skb_put_u8(skb, mcast_traffic | (31 << 1)); | |
| 4943 | + | |
| 4944 | + /* Emit an encoded block for each non-zero sub-block */ | |
| 4945 | + for (blk = 0; blk < IEEE80211_MAX_SUPPORTED_S1G_TIM_BLOCKS; blk++) { | |
| 4946 | + u8 blk_bmap = 0; | |
| 4947 | + int sblk; | |
| 4948 | + | |
| 4949 | + for (sblk = 0; sblk < 8; sblk++) { | |
| 4950 | + int sblk_idx = blk * 8 + sblk; | |
| 4951 | + | |
| 4952 | + /* | |
| 4953 | + * If the current subblock is non-zero, increase the | |
| 4954 | + * number of subblocks to emit for the current block. | |
| 4955 | + */ | |
| 4956 | + if (ps->tim[sblk_idx]) | |
| 4957 | + blk_bmap |= BIT(sblk); | |
| 4958 | + } | |
| 4959 | + | |
| 4960 | + /* If the current block contains no non-zero sublocks */ | |
| 4961 | + if (!blk_bmap) | |
| 4962 | + continue; | |
| 4963 | + | |
| 4964 | + /* | |
| 4965 | + * Emit a block control byte for the current encoded block | |
| 4966 | + * with an encoding mode of block bitmap (0x0), not inverse | |
| 4967 | + * (0x0) and the current block offset (5 bits) | |
| 4968 | + */ | |
| 4969 | + skb_put_u8(skb, blk << 3); | |
| 4970 | + | |
| 4971 | + /* | |
| 4972 | + * Emit the block bitmap for the current encoded block which | |
| 4973 | + * contains the present subblocks. | |
| 4974 | + */ | |
| 4975 | + skb_put_u8(skb, blk_bmap); | |
| 4976 | + | |
| 4977 | + /* Emit the present subblocks */ | |
| 4978 | + for (sblk = 0; sblk < 8; sblk++) { | |
| 4979 | + int sblk_idx = blk * 8 + sblk; | |
| 4980 | + | |
| 4981 | + if (!(blk_bmap & BIT(sblk))) | |
| 4982 | + continue; | |
| 4983 | + | |
| 4984 | + skb_put_u8(skb, ps->tim[sblk_idx]); | |
| 4985 | + } | |
| 4986 | + } | |
| 4987 | +} | |
| 4988 | + | |
| 4885 | 4989 | static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, |
| 4886 | 4990 | struct ieee80211_link_data *link, |
| 4887 | 4991 | struct ps_data *ps, struct sk_buff *skb, |
| 4888 | 4992 | bool is_template) |
| 4889 | 4993 | { |
| 4890 | − u8 *pos, *tim; | |
| 4891 | − int aid0 = 0; | |
| 4892 | − int i, have_bits = 0, n1, n2; | |
| 4994 | + struct element *tim; | |
| 4995 | + bool mcast_traffic = false, have_bits = false; | |
| 4893 | 4996 | struct ieee80211_bss_conf *link_conf = link->conf; |
| 4997 | + bool s1g = ieee80211_get_link_sband(link)->band == NL80211_BAND_S1GHZ; | |
| 4894 | 4998 | |
| 4895 | 4999 | /* Generate bitmap for TIM only if there are any STAs in power save |
| 4896 | 5000 | * mode. */ |
| @@ -4898,7 +5002,8 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, · 1 unmodified line | ||
| 4898 | 5002 | /* in the hope that this is faster than |
| 4899 | 5003 | * checking byte-for-byte */ |
| 4900 | 5004 | have_bits = !bitmap_empty((unsigned long *)ps->tim, |
| 4901 | − IEEE80211_MAX_AID+1); | |
| 5005 | + IEEE80211_MAX_AID + 1); | |
| 5006 | + | |
| 4902 | 5007 | if (!is_template) { |
| 4903 | 5008 | if (ps->dtim_count == 0) |
| 4904 | 5009 | ps->dtim_count = link_conf->dtim_period - 1; |
| @@ -4906,51 +5011,39 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, · 1 unmodified line | ||
| 4906 | 5011 | ps->dtim_count--; |
| 4907 | 5012 | } |
| 4908 | 5013 | |
| 4909 | − tim = pos = skb_put(skb, 5); | |
| 4910 | − *pos++ = WLAN_EID_TIM; | |
| 4911 | − *pos++ = 3; | |
| 4912 | − *pos++ = ps->dtim_count; | |
| 4913 | − *pos++ = link_conf->dtim_period; | |
| 5014 | + /* Length is set after parsing the AID bitmap */ | |
| 5015 | + tim = skb_put(skb, sizeof(struct element)); | |
| 5016 | + tim->id = WLAN_EID_TIM; | |
| 5017 | + skb_put_u8(skb, ps->dtim_count); | |
| 5018 | + skb_put_u8(skb, link_conf->dtim_period); | |
| 4914 | 5019 | |
| 4915 | 5020 | if (ps->dtim_count == 0 && !skb_queue_empty(&ps->bc_buf)) |
| 4916 | − aid0 = 1; | |
| 5021 | + mcast_traffic = true; | |
| 4917 | 5022 | |
| 4918 | − ps->dtim_bc_mc = aid0 == 1; | |
| 5023 | + ps->dtim_bc_mc = mcast_traffic; | |
| 4919 | 5024 | |
| 4920 | 5025 | if (have_bits) { |
| 4921 | − /* Find largest even number N1 so that bits numbered 1 through | |
| 4922 | − * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits | |
| 4923 | − * (N2 + 1) x 8 through 2007 are 0. */ | |
| 4924 | − n1 = 0; | |
| 4925 | − for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) { | |
| 4926 | − if (ps->tim[i]) { | |
| 4927 | − n1 = i & 0xfe; | |
| 4928 | − break; | |
| 4929 | − } | |
| 4930 | − } | |
| 4931 | − n2 = n1; | |
| 4932 | − for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) { | |
| 4933 | − if (ps->tim[i]) { | |
| 4934 | − n2 = i; | |
| 4935 | − break; | |
| 4936 | − } | |
| 4937 | − } | |
| 4938 | − | |
| 4939 | − /* Bitmap control */ | |
| 4940 | − *pos++ = n1 | aid0; | |
| 4941 | − /* Part Virt Bitmap */ | |
| 4942 | − skb_put_data(skb, ps->tim + n1, n2 - n1 + 1); | |
| 4943 | − | |
| 4944 | − tim[1] = n2 - n1 + 4; | |
| 5026 | + if (s1g) | |
| 5027 | + ieee80211_s1g_beacon_add_tim_pvb(ps, skb, | |
| 5028 | + mcast_traffic); | |
| 5029 | + else | |
| 5030 | + ieee80211_beacon_add_tim_pvb(ps, skb, mcast_traffic); | |
| 4945 | 5031 | } else { |
| 4946 | − *pos++ = aid0; /* Bitmap control */ | |
| 4947 | − | |
| 4948 | − if (ieee80211_get_link_sband(link)->band != NL80211_BAND_S1GHZ) { | |
| 4949 | − tim[1] = 4; | |
| 5032 | + /* | |
| 5033 | + * If there is no buffered unicast traffic for an S1G | |
| 5034 | + * interface, we can exclude the bitmap control. This is in | |
| 5035 | + * contrast to other phy types as they do include the bitmap | |
| 5036 | + * control and pvb even when there is no buffered traffic. | |
| 5037 | + */ | |
| 5038 | + if (!s1g) { | |
| 5039 | + /* Bitmap control */ | |
| 5040 | + skb_put_u8(skb, mcast_traffic); | |
| 4950 | 5041 | /* Part Virt Bitmap */ |
| 4951 | 5042 | skb_put_u8(skb, 0); |
| 4952 | 5043 | } |
| 4953 | 5044 | } |
| 5045 | + | |
| 5046 | + tim->datalen = skb_tail_pointer(skb) - tim->data; | |
| 4954 | 5047 | } |
| 4955 | 5048 | |
| 4956 | 5049 | static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, |
| @@ -1756,7 +1756,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 1755 unmodified lines | ||
| 1756 | 1756 | bool sched_scan_stopped = false; |
| 1757 | 1757 | bool suspended = local->suspended; |
| 1758 | 1758 | bool in_reconfig = false; |
| 1759 | − u32 rts_threshold; | |
| 1760 | 1759 | |
| 1761 | 1760 | lockdep_assert_wiphy(local->hw.wiphy); |
| 1762 | 1761 | |
| @@ -1832,7 +1831,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 69 unmodified lines | ||
| 1832 | 1831 | /* setup RTS threshold */ |
| 1833 | 1832 | if (hw->wiphy->n_radio > 0) { |
| 1834 | 1833 | for (i = 0; i < hw->wiphy->n_radio; i++) { |
| 1835 | − rts_threshold = hw->wiphy->radio_cfg[i].rts_threshold; | |
| 1834 | + u32 rts_threshold = | |
| 1835 | + hw->wiphy->radio_cfg[i].rts_threshold; | |
| 1836 | + | |
| 1836 | 1837 | drv_set_rts_threshold(local, i, rts_threshold); |
| 1837 | 1838 | } |
| 1838 | 1839 | } else { |
| @@ -4022,16 +4023,13 @@ bool ieee80211_is_radio_idx_in_scan_req(struct wiphy *wiphy, · 2183 unmodified lines | ||
| 4022 | 4023 | for (i = 0; i < scan_req->n_channels; i++) { |
| 4023 | 4024 | chan = scan_req->channels[i]; |
| 4024 | 4025 | chan_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan); |
| 4025 | − /* | |
| 4026 | − * The chan_radio_idx should be valid since it's taken from a | |
| 4027 | − * valid scan request. | |
| 4028 | − * However, if chan_radio_idx is unexpectedly invalid (negative), | |
| 4029 | − * we take a conservative approach and assume the scan request | |
| 4030 | − * might use the specified radio_idx. Hence, return true. | |
| 4031 | − */ | |
| 4032 | − if (WARN_ON(chan_radio_idx < 0)) | |
| 4033 | − return true; | |
| 4034 | 4026 | |
| 4027 | + /* The radio index either matched successfully, or an error | |
| 4028 | + * occurred. For example, if radio-level information is | |
| 4029 | + * missing, the same error value is returned. This | |
| 4030 | + * typically implies a single-radio setup, in which case | |
| 4031 | + * the operation should not be allowed. | |
| 4032 | + */ | |
| 4035 | 4033 | if (chan_radio_idx == radio_idx) |
| 4036 | 4034 | return true; |
| 4037 | 4035 | } |
| @@ -1018,6 +1018,15 @@ int wiphy_register(struct wiphy *wiphy) · 1017 unmodified lines | ||
| 1018 | 1018 | |
| 1019 | 1019 | rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH; |
| 1020 | 1020 | |
| 1021 | + if (rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_CTWINDOW) | |
| 1022 | + rdev->wiphy.features |= NL80211_FEATURE_P2P_GO_CTWIN; | |
| 1023 | + else if (rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN) | |
| 1024 | + rdev->wiphy.bss_param_support |= WIPHY_BSS_PARAM_P2P_CTWINDOW; | |
| 1025 | + if (rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS) | |
| 1026 | + rdev->wiphy.features |= NL80211_FEATURE_P2P_GO_OPPPS; | |
| 1027 | + else if (rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS) | |
| 1028 | + rdev->wiphy.bss_param_support |= WIPHY_BSS_PARAM_P2P_OPPPS; | |
| 1029 | + | |
| 1021 | 1030 | rtnl_lock(); |
| 1022 | 1031 | wiphy_lock(&rdev->wiphy); |
| 1023 | 1032 | res = device_add(&rdev->wiphy.dev); |
| @@ -23,7 +23,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) · 22 unmodified lines | ||
| 23 | 23 | else |
| 24 | 24 | strscpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
| 25 | 25 | |
| 26 | − strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), | |
| 26 | + strscpy(info->bus_info, dev_name(pdev), | |
| 27 | 27 | sizeof(info->bus_info)); |
| 28 | 28 | } |
| 29 | 29 | EXPORT_SYMBOL(cfg80211_get_drvinfo); |
| @@ -411,6 +411,14 @@ static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { · 410 unmodified lines | ||
| 411 | 411 | [NL80211_TXRATE_HE_LTF] = NLA_POLICY_RANGE(NLA_U8, |
| 412 | 412 | NL80211_RATE_INFO_HE_1XLTF, |
| 413 | 413 | NL80211_RATE_INFO_HE_4XLTF), |
| 414 | + [NL80211_TXRATE_EHT] = NLA_POLICY_EXACT_LEN(sizeof(struct nl80211_txrate_eht)), | |
| 415 | + [NL80211_TXRATE_EHT_GI] = NLA_POLICY_RANGE(NLA_U8, | |
| 416 | + NL80211_RATE_INFO_EHT_GI_0_8, | |
| 417 | + NL80211_RATE_INFO_EHT_GI_3_2), | |
| 418 | + [NL80211_TXRATE_EHT_LTF] = NLA_POLICY_RANGE(NLA_U8, | |
| 419 | + NL80211_RATE_INFO_EHT_1XLTF, | |
| 420 | + NL80211_RATE_INFO_EHT_8XLTF), | |
| 421 | + | |
| 414 | 422 | }; |
| 415 | 423 | |
| 416 | 424 | static const struct nla_policy |
| @@ -871,6 +879,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 454 unmodified lines | ||
| 871 | 879 | [NL80211_ATTR_S1G_LONG_BEACON_PERIOD] = NLA_POLICY_MIN(NLA_U8, 2), |
| 872 | 880 | [NL80211_ATTR_S1G_SHORT_BEACON] = |
| 873 | 881 | NLA_POLICY_NESTED(nl80211_s1g_short_beacon), |
| 882 | + [NL80211_ATTR_BSS_PARAM] = { .type = NLA_FLAG }, | |
| 874 | 883 | }; |
| 875 | 884 | |
| 876 | 885 | /* policy for the key attributes */ |
| @@ -3019,6 +3028,40 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 2142 unmodified lines | ||
| 3019 | 3028 | rdev->wiphy.ext_features)) |
| 3020 | 3029 | goto nla_put_failure; |
| 3021 | 3030 | |
| 3031 | + if (rdev->wiphy.bss_param_support) { | |
| 3032 | + struct nlattr *nested; | |
| 3033 | + u32 parsup = rdev->wiphy.bss_param_support; | |
| 3034 | + | |
| 3035 | + nested = nla_nest_start(msg, NL80211_ATTR_BSS_PARAM); | |
| 3036 | + if (!nested) | |
| 3037 | + goto nla_put_failure; | |
| 3038 | + | |
| 3039 | + if ((parsup & WIPHY_BSS_PARAM_CTS_PROT) && | |
| 3040 | + nla_put_flag(msg, NL80211_ATTR_BSS_CTS_PROT)) | |
| 3041 | + goto nla_put_failure; | |
| 3042 | + if ((parsup & WIPHY_BSS_PARAM_SHORT_PREAMBLE) && | |
| 3043 | + nla_put_flag(msg, NL80211_ATTR_BSS_SHORT_PREAMBLE)) | |
| 3044 | + goto nla_put_failure; | |
| 3045 | + if ((parsup & WIPHY_BSS_PARAM_SHORT_SLOT_TIME) && | |
| 3046 | + nla_put_flag(msg, NL80211_ATTR_BSS_SHORT_SLOT_TIME)) | |
| 3047 | + goto nla_put_failure; | |
| 3048 | + if ((parsup & WIPHY_BSS_PARAM_BASIC_RATES) && | |
| 3049 | + nla_put_flag(msg, NL80211_ATTR_BSS_BASIC_RATES)) | |
| 3050 | + goto nla_put_failure; | |
| 3051 | + if ((parsup & WIPHY_BSS_PARAM_AP_ISOLATE) && | |
| 3052 | + nla_put_flag(msg, NL80211_ATTR_AP_ISOLATE)) | |
| 3053 | + goto nla_put_failure; | |
| 3054 | + if ((parsup & WIPHY_BSS_PARAM_HT_OPMODE) && | |
| 3055 | + nla_put_flag(msg, NL80211_ATTR_BSS_HT_OPMODE)) | |
| 3056 | + goto nla_put_failure; | |
| 3057 | + if ((parsup & WIPHY_BSS_PARAM_P2P_CTWINDOW) && | |
| 3058 | + nla_put_flag(msg, NL80211_ATTR_P2P_CTWINDOW)) | |
| 3059 | + goto nla_put_failure; | |
| 3060 | + if ((parsup & WIPHY_BSS_PARAM_P2P_OPPPS) && | |
| 3061 | + nla_put_flag(msg, NL80211_ATTR_P2P_OPPPS)) | |
| 3062 | + goto nla_put_failure; | |
| 3063 | + nla_nest_end(msg, nested); | |
| 3064 | + } | |
| 3022 | 3065 | if (rdev->wiphy.bss_select_support) { |
| 3023 | 3066 | struct nlattr *nested; |
| 3024 | 3067 | u32 bss_select_support = rdev->wiphy.bss_select_support; |
| @@ -5393,6 +5436,164 @@ static bool he_set_mcs_mask(struct genl_info *info, · 2368 unmodified lines | ||
| 5393 | 5436 | return true; |
| 5394 | 5437 | } |
| 5395 | 5438 | |
| 5439 | +static void eht_build_mcs_mask(struct genl_info *info, | |
| 5440 | + const struct ieee80211_sta_eht_cap *eht_cap, | |
| 5441 | + u8 mcs_nss_len, u16 *mcs_mask) | |
| 5442 | +{ | |
| 5443 | + struct net_device *dev = info->user_ptr[1]; | |
| 5444 | + struct wireless_dev *wdev = dev->ieee80211_ptr; | |
| 5445 | + u8 nss, mcs_7 = 0, mcs_9 = 0, mcs_11 = 0, mcs_13 = 0; | |
| 5446 | + unsigned int link_id = nl80211_link_id(info->attrs); | |
| 5447 | + | |
| 5448 | + if (mcs_nss_len == 4) { | |
| 5449 | + const struct ieee80211_eht_mcs_nss_supp_20mhz_only *mcs = | |
| 5450 | + &eht_cap->eht_mcs_nss_supp.only_20mhz; | |
| 5451 | + | |
| 5452 | + mcs_7 = u8_get_bits(mcs->rx_tx_mcs7_max_nss, | |
| 5453 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5454 | + mcs_9 = u8_get_bits(mcs->rx_tx_mcs9_max_nss, | |
| 5455 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5456 | + mcs_11 = u8_get_bits(mcs->rx_tx_mcs11_max_nss, | |
| 5457 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5458 | + mcs_13 = u8_get_bits(mcs->rx_tx_mcs13_max_nss, | |
| 5459 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5460 | + | |
| 5461 | + } else { | |
| 5462 | + const struct ieee80211_eht_mcs_nss_supp_bw *mcs; | |
| 5463 | + enum nl80211_chan_width width; | |
| 5464 | + | |
| 5465 | + switch (wdev->iftype) { | |
| 5466 | + case NL80211_IFTYPE_ADHOC: | |
| 5467 | + width = wdev->u.ibss.chandef.width; | |
| 5468 | + break; | |
| 5469 | + case NL80211_IFTYPE_MESH_POINT: | |
| 5470 | + width = wdev->u.mesh.chandef.width; | |
| 5471 | + break; | |
| 5472 | + case NL80211_IFTYPE_OCB: | |
| 5473 | + width = wdev->u.ocb.chandef.width; | |
| 5474 | + break; | |
| 5475 | + default: | |
| 5476 | + if (wdev->valid_links) | |
| 5477 | + width = wdev->links[link_id].ap.chandef.width; | |
| 5478 | + else | |
| 5479 | + width = wdev->u.ap.preset_chandef.width; | |
| 5480 | + break; | |
| 5481 | + } | |
| 5482 | + | |
| 5483 | + switch (width) { | |
| 5484 | + case NL80211_CHAN_WIDTH_320: | |
| 5485 | + mcs = &eht_cap->eht_mcs_nss_supp.bw._320; | |
| 5486 | + break; | |
| 5487 | + case NL80211_CHAN_WIDTH_160: | |
| 5488 | + mcs = &eht_cap->eht_mcs_nss_supp.bw._160; | |
| 5489 | + break; | |
| 5490 | + default: | |
| 5491 | + mcs = &eht_cap->eht_mcs_nss_supp.bw._80; | |
| 5492 | + break; | |
| 5493 | + } | |
| 5494 | + | |
| 5495 | + mcs_7 = u8_get_bits(mcs->rx_tx_mcs9_max_nss, | |
| 5496 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5497 | + mcs_9 = u8_get_bits(mcs->rx_tx_mcs9_max_nss, | |
| 5498 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5499 | + mcs_11 = u8_get_bits(mcs->rx_tx_mcs11_max_nss, | |
| 5500 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5501 | + mcs_13 = u8_get_bits(mcs->rx_tx_mcs13_max_nss, | |
| 5502 | + IEEE80211_EHT_MCS_NSS_TX); | |
| 5503 | + } | |
| 5504 | + | |
| 5505 | + /* Enable MCS 14 for NSS 0 */ | |
| 5506 | + if (eht_cap->eht_cap_elem.phy_cap_info[6] & | |
| 5507 | + IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP) | |
| 5508 | + mcs_mask[0] |= 0x4000; | |
| 5509 | + | |
| 5510 | + /* Enable MCS 15 for NSS 0 */ | |
| 5511 | + mcs_mask[0] |= 0x8000; | |
| 5512 | + | |
| 5513 | + for (nss = 0; nss < NL80211_EHT_NSS_MAX; nss++) { | |
| 5514 | + if (!mcs_7) | |
| 5515 | + continue; | |
| 5516 | + mcs_mask[nss] |= 0x00FF; | |
| 5517 | + mcs_7--; | |
| 5518 | + | |
| 5519 | + if (!mcs_9) | |
| 5520 | + continue; | |
| 5521 | + mcs_mask[nss] |= 0x0300; | |
| 5522 | + mcs_9--; | |
| 5523 | + | |
| 5524 | + if (!mcs_11) | |
| 5525 | + continue; | |
| 5526 | + mcs_mask[nss] |= 0x0C00; | |
| 5527 | + mcs_11--; | |
| 5528 | + | |
| 5529 | + if (!mcs_13) | |
| 5530 | + continue; | |
| 5531 | + mcs_mask[nss] |= 0x3000; | |
| 5532 | + mcs_13--; | |
| 5533 | + } | |
| 5534 | +} | |
| 5535 | + | |
| 5536 | +static bool eht_set_mcs_mask(struct genl_info *info, struct wireless_dev *wdev, | |
| 5537 | + struct ieee80211_supported_band *sband, | |
| 5538 | + struct nl80211_txrate_eht *txrate, | |
| 5539 | + u16 mcs[NL80211_EHT_NSS_MAX]) | |
| 5540 | +{ | |
| 5541 | + const struct ieee80211_sta_he_cap *he_cap; | |
| 5542 | + const struct ieee80211_sta_eht_cap *eht_cap; | |
| 5543 | + u16 tx_mcs_mask[NL80211_EHT_NSS_MAX] = { 0 }; | |
| 5544 | + u8 i, mcs_nss_len; | |
| 5545 | + | |
| 5546 | + he_cap = ieee80211_get_he_iftype_cap(sband, wdev->iftype); | |
| 5547 | + if (!he_cap) | |
| 5548 | + return false; | |
| 5549 | + | |
| 5550 | + eht_cap = ieee80211_get_eht_iftype_cap(sband, wdev->iftype); | |
| 5551 | + if (!eht_cap) | |
| 5552 | + return false; | |
| 5553 | + | |
| 5554 | + /* Checks for MCS 14 */ | |
| 5555 | + if (txrate->mcs[0] & 0x4000) { | |
| 5556 | + if (sband->band != NL80211_BAND_6GHZ) | |
| 5557 | + return false; | |
| 5558 | + | |
| 5559 | + if (!(eht_cap->eht_cap_elem.phy_cap_info[6] & | |
| 5560 | + IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP)) | |
| 5561 | + return false; | |
| 5562 | + } | |
| 5563 | + | |
| 5564 | + mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, | |
| 5565 | + &eht_cap->eht_cap_elem, | |
| 5566 | + wdev->iftype == | |
| 5567 | + NL80211_IFTYPE_STATION); | |
| 5568 | + | |
| 5569 | + if (mcs_nss_len == 3) { | |
| 5570 | + /* Supported iftypes for setting non-20 MHZ only EHT MCS */ | |
| 5571 | + switch (wdev->iftype) { | |
| 5572 | + case NL80211_IFTYPE_ADHOC: | |
| 5573 | + case NL80211_IFTYPE_AP: | |
| 5574 | + case NL80211_IFTYPE_P2P_GO: | |
| 5575 | + case NL80211_IFTYPE_MESH_POINT: | |
| 5576 | + case NL80211_IFTYPE_OCB: | |
| 5577 | + break; | |
| 5578 | + default: | |
| 5579 | + return false; | |
| 5580 | + } | |
| 5581 | + } | |
| 5582 | + | |
| 5583 | + /* Build eht_mcs_mask from EHT and HE capabilities */ | |
| 5584 | + eht_build_mcs_mask(info, eht_cap, mcs_nss_len, tx_mcs_mask); | |
| 5585 | + | |
| 5586 | + memset(mcs, 0, sizeof(u16) * NL80211_EHT_NSS_MAX); | |
| 5587 | + for (i = 0; i < NL80211_EHT_NSS_MAX; i++) { | |
| 5588 | + if ((tx_mcs_mask[i] & txrate->mcs[i]) == txrate->mcs[i]) | |
| 5589 | + mcs[i] = txrate->mcs[i]; | |
| 5590 | + else | |
| 5591 | + return false; | |
| 5592 | + } | |
| 5593 | + | |
| 5594 | + return true; | |
| 5595 | +} | |
| 5596 | + | |
| 5396 | 5597 | static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, |
| 5397 | 5598 | struct nlattr *attrs[], |
| 5398 | 5599 | enum nl80211_attrs attr, |
| @@ -5413,6 +5614,8 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 14 unmodified lines | ||
| 5413 | 5614 | /* Default to all rates enabled */ |
| 5414 | 5615 | for (i = 0; i < NUM_NL80211_BANDS; i++) { |
| 5415 | 5616 | const struct ieee80211_sta_he_cap *he_cap; |
| 5617 | + const struct ieee80211_sta_eht_cap *eht_cap; | |
| 5618 | + u8 mcs_nss_len; | |
| 5416 | 5619 | |
| 5417 | 5620 | if (!default_all_enabled) |
| 5418 | 5621 | break; |
| @@ -5441,6 +5644,21 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 22 unmodified lines | ||
| 5441 | 5644 | |
| 5442 | 5645 | mask->control[i].he_gi = 0xFF; |
| 5443 | 5646 | mask->control[i].he_ltf = 0xFF; |
| 5647 | + | |
| 5648 | + eht_cap = ieee80211_get_eht_iftype_cap(sband, wdev->iftype); | |
| 5649 | + if (!eht_cap) | |
| 5650 | + continue; | |
| 5651 | + | |
| 5652 | + mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, | |
| 5653 | + &eht_cap->eht_cap_elem, | |
| 5654 | + wdev->iftype == | |
| 5655 | + NL80211_IFTYPE_STATION); | |
| 5656 | + | |
| 5657 | + eht_build_mcs_mask(info, eht_cap, mcs_nss_len, | |
| 5658 | + mask->control[i].eht_mcs); | |
| 5659 | + | |
| 5660 | + mask->control[i].eht_gi = 0xFF; | |
| 5661 | + mask->control[i].eht_ltf = 0xFF; | |
| 5444 | 5662 | } |
| 5445 | 5663 | |
| 5446 | 5664 | /* if no rates are given set it back to the defaults */ |
| @@ -5512,13 +5730,27 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 65 unmodified lines | ||
| 5512 | 5730 | mask->control[band].he_ltf = |
| 5513 | 5731 | nla_get_u8(tb[NL80211_TXRATE_HE_LTF]); |
| 5514 | 5732 | |
| 5733 | + if (tb[NL80211_TXRATE_EHT] && | |
| 5734 | + !eht_set_mcs_mask(info, wdev, sband, | |
| 5735 | + nla_data(tb[NL80211_TXRATE_EHT]), | |
| 5736 | + mask->control[band].eht_mcs)) | |
| 5737 | + return -EINVAL; | |
| 5738 | + | |
| 5739 | + if (tb[NL80211_TXRATE_EHT_GI]) | |
| 5740 | + mask->control[band].eht_gi = | |
| 5741 | + nla_get_u8(tb[NL80211_TXRATE_EHT_GI]); | |
| 5742 | + if (tb[NL80211_TXRATE_EHT_LTF]) | |
| 5743 | + mask->control[band].eht_ltf = | |
| 5744 | + nla_get_u8(tb[NL80211_TXRATE_EHT_LTF]); | |
| 5745 | + | |
| 5515 | 5746 | if (mask->control[band].legacy == 0) { |
| 5516 | − /* don't allow empty legacy rates if HT, VHT or HE | |
| 5747 | + /* don't allow empty legacy rates if HT, VHT, HE or EHT | |
| 5517 | 5748 | * are not even supported. |
| 5518 | 5749 | */ |
| 5519 | 5750 | if (!(rdev->wiphy.bands[band]->ht_cap.ht_supported || |
| 5520 | 5751 | rdev->wiphy.bands[band]->vht_cap.vht_supported || |
| 5521 | − ieee80211_get_he_iftype_cap(sband, wdev->iftype))) | |
| 5752 | + ieee80211_get_he_iftype_cap(sband, wdev->iftype) || | |
| 5753 | + ieee80211_get_eht_iftype_cap(sband, wdev->iftype))) | |
| 5522 | 5754 | return -EINVAL; |
| 5523 | 5755 | |
| 5524 | 5756 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) |
| @@ -5533,6 +5765,10 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 8 unmodified lines | ||
| 5533 | 5765 | if (mask->control[band].he_mcs[i]) |
| 5534 | 5766 | goto out; |
| 5535 | 5767 | |
| 5768 | + for (i = 0; i < NL80211_EHT_NSS_MAX; i++) | |
| 5769 | + if (mask->control[band].eht_mcs[i]) | |
| 5770 | + goto out; | |
| 5771 | + | |
| 5536 | 5772 | /* legacy and mcs rates may not be both empty */ |
| 5537 | 5773 | return -EINVAL; |
| 5538 | 5774 | } |
| @@ -5546,7 +5782,7 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 7 unmodified lines | ||
| 5546 | 5782 | enum nl80211_band band, |
| 5547 | 5783 | struct cfg80211_bitrate_mask *beacon_rate) |
| 5548 | 5784 | { |
| 5549 | − u32 count_ht, count_vht, count_he, i; | |
| 5785 | + u32 count_ht, count_vht, count_he, count_eht, i; | |
| 5550 | 5786 | u32 rate = beacon_rate->control[band].legacy; |
| 5551 | 5787 | |
| 5552 | 5788 | /* Allow only one rate */ |
| @@ -5592,8 +5828,21 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 39 unmodified lines | ||
| 5592 | 5828 | return -EINVAL; |
| 5593 | 5829 | } |
| 5594 | 5830 | |
| 5595 | − if ((count_ht && count_vht && count_he) || | |
| 5596 | − (!rate && !count_ht && !count_vht && !count_he)) | |
| 5831 | + count_eht = 0; | |
| 5832 | + for (i = 0; i < NL80211_EHT_NSS_MAX; i++) { | |
| 5833 | + if (hweight16(beacon_rate->control[band].eht_mcs[i]) > 1) { | |
| 5834 | + return -EINVAL; | |
| 5835 | + } else if (beacon_rate->control[band].eht_mcs[i]) { | |
| 5836 | + count_eht++; | |
| 5837 | + if (count_eht > 1) | |
| 5838 | + return -EINVAL; | |
| 5839 | + } | |
| 5840 | + if (count_eht && rate) | |
| 5841 | + return -EINVAL; | |
| 5842 | + } | |
| 5843 | + | |
| 5844 | + if ((count_ht && count_vht && count_he && count_eht) || | |
| 5845 | + (!rate && !count_ht && !count_vht && !count_he && !count_eht)) | |
| 5597 | 5846 | return -EINVAL; |
| 5598 | 5847 | |
| 5599 | 5848 | if (rate && |
| @@ -5613,6 +5862,11 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 13 unmodified lines | ||
| 5613 | 5862 | NL80211_EXT_FEATURE_BEACON_RATE_HE)) |
| 5614 | 5863 | return -EINVAL; |
| 5615 | 5864 | |
| 5865 | + if (count_eht && | |
| 5866 | + !wiphy_ext_feature_isset(&rdev->wiphy, | |
| 5867 | + NL80211_EXT_FEATURE_BEACON_RATE_EHT)) | |
| 5868 | + return -EINVAL; | |
| 5869 | + | |
| 5616 | 5870 | return 0; |
| 5617 | 5871 | } |
| 5618 | 5872 | |
| @@ -8830,6 +9084,9 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 3211 unmodified lines | ||
| 8830 | 9084 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
| 8831 | 9085 | struct net_device *dev = info->user_ptr[1]; |
| 8832 | 9086 | struct bss_parameters params; |
| 9087 | + u32 bss_param_support = rdev->wiphy.bss_param_support; | |
| 9088 | + u32 changed = 0; | |
| 9089 | + bool strict; | |
| 8833 | 9090 | |
| 8834 | 9091 | memset(¶ms, 0, sizeof(params)); |
| 8835 | 9092 | params.link_id = nl80211_link_id_or_invalid(info->attrs); |
| @@ -8842,26 +9099,54 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 6 unmodified lines | ||
| 8842 | 9099 | params.p2p_ctwindow = -1; |
| 8843 | 9100 | params.p2p_opp_ps = -1; |
| 8844 | 9101 | |
| 8845 | − if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) | |
| 9102 | + strict = nla_get_flag(info->attrs[NL80211_ATTR_BSS_PARAM]); | |
| 9103 | + if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) { | |
| 9104 | + if (strict && !(bss_param_support & WIPHY_BSS_PARAM_CTS_PROT)) | |
| 9105 | + return -EINVAL; | |
| 8846 | 9106 | params.use_cts_prot = |
| 8847 | 9107 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]); |
| 8848 | − if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) | |
| 9108 | + changed |= WIPHY_BSS_PARAM_CTS_PROT; | |
| 9109 | + } | |
| 9110 | + if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) { | |
| 9111 | + if (strict && | |
| 9112 | + !(bss_param_support & WIPHY_BSS_PARAM_SHORT_PREAMBLE)) | |
| 9113 | + return -EINVAL; | |
| 8849 | 9114 | params.use_short_preamble = |
| 8850 | 9115 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]); |
| 8851 | − if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) | |
| 9116 | + changed |= WIPHY_BSS_PARAM_SHORT_PREAMBLE; | |
| 9117 | + } | |
| 9118 | + if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) { | |
| 9119 | + if (strict && | |
| 9120 | + !(bss_param_support & WIPHY_BSS_PARAM_SHORT_SLOT_TIME)) | |
| 9121 | + return -EINVAL; | |
| 8852 | 9122 | params.use_short_slot_time = |
| 8853 | 9123 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); |
| 9124 | + changed |= WIPHY_BSS_PARAM_SHORT_SLOT_TIME; | |
| 9125 | + } | |
| 8854 | 9126 | if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { |
| 9127 | + if (strict && | |
| 9128 | + !(bss_param_support & WIPHY_BSS_PARAM_BASIC_RATES)) | |
| 9129 | + return -EINVAL; | |
| 8855 | 9130 | params.basic_rates = |
| 8856 | 9131 | nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); |
| 8857 | 9132 | params.basic_rates_len = |
| 8858 | 9133 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); |
| 9134 | + changed |= WIPHY_BSS_PARAM_BASIC_RATES; | |
| 9135 | + } | |
| 9136 | + if (info->attrs[NL80211_ATTR_AP_ISOLATE]) { | |
| 9137 | + if (strict && !(bss_param_support & WIPHY_BSS_PARAM_AP_ISOLATE)) | |
| 9138 | + return -EINVAL; | |
| 9139 | + params.ap_isolate = | |
| 9140 | + !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); | |
| 9141 | + changed |= WIPHY_BSS_PARAM_AP_ISOLATE; | |
| 8859 | 9142 | } |
| 8860 | − if (info->attrs[NL80211_ATTR_AP_ISOLATE]) | |
| 8861 | − params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); | |
| 8862 | − if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) | |
| 9143 | + if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) { | |
| 9144 | + if (strict && !(bss_param_support & WIPHY_BSS_PARAM_HT_OPMODE)) | |
| 9145 | + return -EINVAL; | |
| 8863 | 9146 | params.ht_opmode = |
| 8864 | 9147 | nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); |
| 9148 | + changed |= WIPHY_BSS_PARAM_HT_OPMODE; | |
| 9149 | + } | |
| 8865 | 9150 | |
| 8866 | 9151 | if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { |
| 8867 | 9152 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) |
| @@ -8869,8 +9154,9 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 1 unmodified line | ||
| 8869 | 9154 | params.p2p_ctwindow = |
| 8870 | 9155 | nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]); |
| 8871 | 9156 | if (params.p2p_ctwindow != 0 && |
| 8872 | − !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) | |
| 9157 | + !(bss_param_support & WIPHY_BSS_PARAM_P2P_CTWINDOW)) | |
| 8873 | 9158 | return -EINVAL; |
| 9159 | + changed |= WIPHY_BSS_PARAM_P2P_CTWINDOW; | |
| 8874 | 9160 | } |
| 8875 | 9161 | |
| 8876 | 9162 | if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { |
| @@ -8879,9 +9165,11 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 2 unmodified lines | ||
| 8879 | 9165 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) |
| 8880 | 9166 | return -EINVAL; |
| 8881 | 9167 | tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]); |
| 9168 | + if (tmp && !(bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS)) | |
| 9169 | + return -EINVAL; | |
| 8882 | 9170 | params.p2p_opp_ps = tmp; |
| 8883 | 9171 | if (params.p2p_opp_ps && |
| 8884 | − !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) | |
| 9172 | + !(rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS)) | |
| 8885 | 9173 | return -EINVAL; |
| 8886 | 9174 | } |
| 8887 | 9175 | |
| @@ -8892,6 +9180,10 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 4 unmodified lines | ||
| 8892 | 9180 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) |
| 8893 | 9181 | return -EOPNOTSUPP; |
| 8894 | 9182 | |
| 9183 | + changed &= rdev->wiphy.bss_param_support; | |
| 9184 | + if (!changed) | |
| 9185 | + return 0; | |
| 9186 | + | |
| 8895 | 9187 | return rdev_change_bss(rdev, dev, ¶ms); |
| 8896 | 9188 | } |
| 8897 | 9189 | |
| @@ -1816,6 +1816,9 @@ static void cfg80211_update_hidden_bsses(struct cfg80211_internal_bss *known, · 1815 unmodified lines | ||
| 1816 | 1816 | WARN_ON(ies != old_ies); |
| 1817 | 1817 | |
| 1818 | 1818 | rcu_assign_pointer(bss->pub.beacon_ies, new_ies); |
| 1819 | + | |
| 1820 | + bss->ts = known->ts; | |
| 1821 | + bss->pub.ts_boottime = known->pub.ts_boottime; | |
| 1819 | 1822 | } |
| 1820 | 1823 | } |
| 1821 | 1824 | |
| @@ -1882,6 +1885,10 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, · 60 unmodified lines | ||
| 1882 | 1885 | { |
| 1883 | 1886 | lockdep_assert_held(&rdev->bss_lock); |
| 1884 | 1887 | |
| 1888 | + /* Update time stamps */ | |
| 1889 | + known->ts = new->ts; | |
| 1890 | + known->pub.ts_boottime = new->pub.ts_boottime; | |
| 1891 | + | |
| 1885 | 1892 | /* Update IEs */ |
| 1886 | 1893 | if (rcu_access_pointer(new->pub.proberesp_ies)) { |
| 1887 | 1894 | const struct cfg80211_bss_ies *old; |
| @@ -1945,8 +1952,6 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, · 57 unmodified lines | ||
| 1945 | 1952 | if (signal_valid) |
| 1946 | 1953 | known->pub.signal = new->pub.signal; |
| 1947 | 1954 | known->pub.capability = new->pub.capability; |
| 1948 | − known->ts = new->ts; | |
| 1949 | − known->pub.ts_boottime = new->pub.ts_boottime; | |
| 1950 | 1955 | known->parent_tsf = new->parent_tsf; |
| 1951 | 1956 | known->pub.chains = new->pub.chains; |
| 1952 | 1957 | memcpy(known->pub.chain_signal, new->pub.chain_signal, |
| @@ -3137,23 +3137,6 @@ DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_notify_new_peer_candidate, · 3136 unmodified lines | ||
| 3137 | 3137 | TP_ARGS(netdev, macaddr) |
| 3138 | 3138 | ); |
| 3139 | 3139 | |
| 3140 | −DECLARE_EVENT_CLASS(netdev_evt_only, | |
| 3141 | − TP_PROTO(struct net_device *netdev), | |
| 3142 | − TP_ARGS(netdev), | |
| 3143 | − TP_STRUCT__entry( | |
| 3144 | − NETDEV_ENTRY | |
| 3145 | − ), | |
| 3146 | − TP_fast_assign( | |
| 3147 | − NETDEV_ASSIGN; | |
| 3148 | − ), | |
| 3149 | − TP_printk(NETDEV_PR_FMT , NETDEV_PR_ARG) | |
| 3150 | −); | |
| 3151 | − | |
| 3152 | −DEFINE_EVENT(netdev_evt_only, cfg80211_send_rx_auth, | |
| 3153 | − TP_PROTO(struct net_device *netdev), | |
| 3154 | − TP_ARGS(netdev) | |
| 3155 | −); | |
| 3156 | − | |
| 3157 | 3140 | TRACE_EVENT(cfg80211_send_rx_assoc, |
| 3158 | 3141 | TP_PROTO(struct net_device *netdev, |
| 3159 | 3142 | const struct cfg80211_rx_assoc_resp_data *data), |
| @@ -3480,21 +3463,6 @@ TRACE_EVENT(cfg80211_reg_can_beacon, · 320 unmodified lines | ||
| 3480 | 3463 | __entry->prohibited_flags, __entry->permitting_flags) |
| 3481 | 3464 | ); |
| 3482 | 3465 | |
| 3483 | −TRACE_EVENT(cfg80211_chandef_dfs_required, | |
| 3484 | − TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), | |
| 3485 | − TP_ARGS(wiphy, chandef), | |
| 3486 | − TP_STRUCT__entry( | |
| 3487 | − WIPHY_ENTRY | |
| 3488 | − CHAN_DEF_ENTRY | |
| 3489 | − ), | |
| 3490 | − TP_fast_assign( | |
| 3491 | − WIPHY_ASSIGN; | |
| 3492 | − CHAN_DEF_ASSIGN(chandef); | |
| 3493 | − ), | |
| 3494 | − TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, | |
| 3495 | − WIPHY_PR_ARG, CHAN_DEF_PR_ARG) | |
| 3496 | −); | |
| 3497 | − | |
| 3498 | 3466 | TRACE_EVENT(cfg80211_ch_switch_notify, |
| 3499 | 3467 | TP_PROTO(struct net_device *netdev, |
| 3500 | 3468 | struct cfg80211_chan_def *chandef, |
| @@ -3862,30 +3830,6 @@ DEFINE_EVENT(cfg80211_bss_evt, cfg80211_return_bss, · 361 unmodified lines | ||
| 3862 | 3830 | TP_ARGS(pub) |
| 3863 | 3831 | ); |
| 3864 | 3832 | |
| 3865 | −TRACE_EVENT(cfg80211_return_uint, | |
| 3866 | − TP_PROTO(unsigned int ret), | |
| 3867 | − TP_ARGS(ret), | |
| 3868 | − TP_STRUCT__entry( | |
| 3869 | − __field(unsigned int, ret) | |
| 3870 | − ), | |
| 3871 | − TP_fast_assign( | |
| 3872 | − __entry->ret = ret; | |
| 3873 | − ), | |
| 3874 | − TP_printk("ret: %d", __entry->ret) | |
| 3875 | −); | |
| 3876 | − | |
| 3877 | −TRACE_EVENT(cfg80211_return_u32, | |
| 3878 | − TP_PROTO(u32 ret), | |
| 3879 | − TP_ARGS(ret), | |
| 3880 | − TP_STRUCT__entry( | |
| 3881 | − __field(u32, ret) | |
| 3882 | − ), | |
| 3883 | − TP_fast_assign( | |
| 3884 | − __entry->ret = ret; | |
| 3885 | − ), | |
| 3886 | − TP_printk("ret: %u", __entry->ret) | |
| 3887 | −); | |
| 3888 | − | |
| 3889 | 3833 | TRACE_EVENT(cfg80211_report_wowlan_wakeup, |
| 3890 | 3834 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 3891 | 3835 | struct cfg80211_wowlan_wakeup *wakeup), |
| @@ -2584,7 +2584,7 @@ int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy, · 2583 unmodified lines | ||
| 2584 | 2584 | } |
| 2585 | 2585 | } |
| 2586 | 2586 | |
| 2587 | − return -ENOENT; | |
| 2587 | + return -EINVAL; | |
| 2588 | 2588 | } |
| 2589 | 2589 | EXPORT_SYMBOL(cfg80211_get_radio_idx_by_chan); |
| 2590 | 2590 | |