mt76: backport fixes from coolsnowwolf

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-02-25 13:28:01 +08:00
parent e4682b37f9
commit 0d4c9bde61
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
10 changed files with 2170 additions and 27 deletions

View File

@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -3443,6 +3443,16 @@ int ath10k_core_register(struct ath10k *
@@ -3383,6 +3383,16 @@ int ath10k_core_register(struct ath10k *
queue_work(ar->workqueue, &ar->register_work);

View File

@ -124,7 +124,7 @@ v13:
WCN36XX=
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -26,6 +26,7 @@
@@ -25,6 +25,7 @@
#include "testmode.h"
#include "wmi-ops.h"
#include "coredump.h"
@ -132,7 +132,7 @@ v13:
unsigned int ath10k_debug_mask;
EXPORT_SYMBOL(ath10k_debug_mask);
@@ -65,6 +66,7 @@ static const struct ath10k_hw_params ath
@@ -64,6 +65,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA988X_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca988x hw2.0",
@ -140,7 +140,7 @@ v13:
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -138,6 +140,7 @@ static const struct ath10k_hw_params ath
@@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9887_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9887 hw1.0",
@ -148,7 +148,7 @@ v13:
.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -355,6 +358,7 @@ static const struct ath10k_hw_params ath
@@ -354,6 +357,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA99X0_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca99x0 hw2.0",
@ -156,7 +156,7 @@ v13:
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x00000700,
@@ -397,6 +401,7 @@ static const struct ath10k_hw_params ath
@@ -396,6 +400,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9984_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9984/qca9994 hw1.0",
@ -164,7 +164,7 @@ v13:
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -446,6 +451,7 @@ static const struct ath10k_hw_params ath
@@ -445,6 +450,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9888_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9888 hw2.0",
@ -172,7 +172,7 @@ v13:
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -3158,6 +3164,10 @@ int ath10k_core_start(struct ath10k *ar,
@@ -3098,6 +3104,10 @@ int ath10k_core_start(struct ath10k *ar,
goto err_hif_stop;
}
@ -183,7 +183,7 @@ v13:
return 0;
err_hif_stop:
@@ -3416,9 +3426,18 @@ static void ath10k_core_register_work(st
@@ -3356,9 +3366,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
@ -202,7 +202,7 @@ v13:
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
@@ -3464,6 +3483,8 @@ void ath10k_core_unregister(struct ath10
@@ -3404,6 +3423,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;
@ -221,7 +221,7 @@ v13:
#include "htt.h"
#include "htc.h"
@@ -1256,6 +1257,13 @@ struct ath10k {
@@ -1250,6 +1251,13 @@ struct ath10k {
} testmode;
struct {

View File

@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin <dev@kresin.me>
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1312,6 +1312,10 @@ struct ath10k {
@@ -1306,6 +1306,10 @@ struct ath10k {
s32 tx_power_2g_limit;
s32 tx_power_5g_limit;

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4718,6 +4718,7 @@ static void ath10k_mac_setup_ht_vht_cap(
@@ -5032,6 +5032,7 @@ static void ath10k_mac_setup_ht_vht_cap(
if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
band = &ar->mac.sbands[NL80211_BAND_2GHZ];
band->ht_cap = ht_cap;

View File

@ -111,7 +111,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
#define TXCTL_CREDITS 2
static void pkt_align(struct sk_buff *p, int len, int align)
@@ -4140,7 +4144,7 @@ int brcmf_sdio_get_fwname(struct device
@@ -4141,7 +4145,7 @@ int brcmf_sdio_get_fwname(struct device
fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev,
brcmf_sdio_fwnames,
@ -120,7 +120,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
fwnames, ARRAY_SIZE(fwnames));
if (!fwreq)
return -ENOMEM;
@@ -4196,6 +4200,9 @@ static const struct brcmf_bus_ops brcmf_
@@ -4197,6 +4201,9 @@ static const struct brcmf_bus_ops brcmf_
#define BRCMF_SDIO_FW_CODE 0
#define BRCMF_SDIO_FW_NVRAM 1
@ -130,7 +130,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
static void brcmf_sdio_firmware_callback(struct device *dev, int err,
struct brcmf_fw_request *fwreq)
{
@@ -4211,6 +4218,22 @@ static void brcmf_sdio_firmware_callback
@@ -4212,6 +4219,22 @@ static void brcmf_sdio_firmware_callback
brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
@ -153,7 +153,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
if (err)
goto fail;
@@ -4419,7 +4442,7 @@ brcmf_sdio_prepare_fw_request(struct brc
@@ -4420,7 +4443,7 @@ brcmf_sdio_prepare_fw_request(struct brc
fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev,
brcmf_sdio_fwnames,
@ -162,7 +162,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
fwnames, ARRAY_SIZE(fwnames));
if (!fwreq)
return NULL;
@@ -4437,6 +4460,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
@@ -4438,6 +4461,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
struct brcmf_sdio *bus;
struct workqueue_struct *wq;
struct brcmf_fw_request *fwreq;
@ -172,7 +172,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
brcmf_dbg(TRACE, "Enter\n");
@@ -4519,6 +4545,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
@@ -4520,6 +4546,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
brcmf_dbg(INFO, "completed!!\n");

View File

@ -12,7 +12,7 @@
have_80mhz = true;
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1769,7 +1769,8 @@ static int ieee80211_build_preq_ies_band
@@ -1925,7 +1925,8 @@ static int ieee80211_build_preq_ies_band
/* Check if any channel in this sband supports at least 80 MHz */
for (i = 0; i < sband->n_channels; i++) {
if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
@ -24,7 +24,7 @@
have_80mhz = true;
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4824,7 +4824,8 @@ static int ieee80211_prep_channel(struct
@@ -5122,7 +5122,8 @@ static int ieee80211_prep_channel(struct
have_80mhz = false;
for (i = 0; i < sband->n_channels; i++) {
if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |

View File

@ -0,0 +1,314 @@
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -702,6 +702,8 @@ struct ieee80211_bss_conf {
u32 unsol_bcast_probe_resp_interval;
bool s1g;
struct cfg80211_bitrate_mask beacon_tx_rate;
+
+ bool csa_active;
};
/**
@@ -1672,6 +1674,46 @@ enum ieee80211_offload_flags {
};
/**
+ * struct ieee80211_vif_cfg - interface configuration
+ * @assoc: association status
+ * @ibss_joined: indicates whether this station is part of an IBSS or not
+ * @ibss_creator: indicates if a new IBSS network is being created
+ * @ps: power-save mode (STA only). This flag is NOT affected by
+ * offchannel/dynamic_ps operations.
+ * @aid: association ID number, valid only when @assoc is true
+ * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
+ * may filter ARP queries targeted for other addresses than listed here.
+ * The driver must allow ARP queries targeted for all address listed here
+ * to pass through. An empty list implies no ARP queries need to pass.
+ * @arp_addr_cnt: Number of addresses currently on the list. Note that this
+ * may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
+ * array size), it's up to the driver what to do in that case.
+ * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
+ * @ssid_len: Length of SSID given in @ssid.
+ * @s1g: BSS is S1G BSS (affects Association Request format).
+ * @idle: This interface is idle. There's also a global idle flag in the
+ * hardware config which may be more appropriate depending on what
+ * your driver/device needs to do.
+ * @ap_addr: AP MLD address, or BSSID for non-MLO connections
+ * (station mode only)
+ */
+struct ieee80211_vif_cfg {
+ /* association related data */
+ bool assoc, ibss_joined;
+ bool ibss_creator;
+ bool ps;
+ u16 aid;
+
+ __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
+ int arp_addr_cnt;
+ u8 ssid[IEEE80211_MAX_SSID_LEN];
+ size_t ssid_len;
+ bool s1g;
+ bool idle;
+ u8 ap_addr[ETH_ALEN] __aligned(2);
+};
+
+/**
* struct ieee80211_vif - per-interface data
*
* Data in this structure is continually present for driver
@@ -1725,6 +1767,7 @@ enum ieee80211_offload_flags {
*/
struct ieee80211_vif {
enum nl80211_iftype type;
+ struct ieee80211_vif_cfg cfg;
struct ieee80211_bss_conf bss_conf;
u8 addr[ETH_ALEN] __aligned(2);
bool p2p;
@@ -2045,6 +2088,80 @@ struct ieee80211_sta_txpwr {
};
/**
+ * struct ieee80211_sta_aggregates - info that is aggregated from active links
+ *
+ * Used for any per-link data that needs to be aggregated and updated in the
+ * main &struct ieee80211_sta when updated or the active links change.
+ *
+ * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes.
+ * This field is always valid for packets with a VHT preamble.
+ * For packets with a HT preamble, additional limits apply:
+ *
+ * * If the skb is transmitted as part of a BA agreement, the
+ * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
+ * * If the skb is not part of a BA agreement, the A-MSDU maximal
+ * size is min(max_amsdu_len, 7935) bytes.
+ *
+ * Both additional HT limits must be enforced by the low level
+ * driver. This is defined by the spec (IEEE 802.11-2012 section
+ * 8.3.2.2 NOTE 2).
+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
+ * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
+ */
+struct ieee80211_sta_aggregates {
+ u16 max_amsdu_len;
+
+ u16 max_rc_amsdu_len;
+ u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
+};
+
+/**
+ * struct ieee80211_link_sta - station Link specific info
+ * All link specific info for a STA link for a non MLD STA(single)
+ * or a MLD STA(multiple entries) are stored here.
+ *
+ * @sta: reference to owning STA
+ * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr
+ * in ieee80211_sta. For MLO Link STA this addr can be same or different
+ * from addr in ieee80211_sta (representing MLD STA addr)
+ * @link_id: the link ID for this link STA (0 for deflink)
+ * @smps_mode: current SMPS mode (off, static or dynamic)
+ * @supp_rates: Bitmap of supported rates
+ * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
+ * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
+ * @he_cap: HE capabilities of this STA
+ * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
+ * @eht_cap: EHT capabilities of this STA
+ * @bandwidth: current bandwidth the station can receive with
+ * @rx_nss: in HT/VHT, the maximum number of spatial streams the
+ * station can receive at the moment, changed by operating mode
+ * notifications and capabilities. The value is only valid after
+ * the station moves to associated state.
+ * @txpwr: the station tx power configuration
+ *
+ */
+struct ieee80211_link_sta {
+ struct ieee80211_sta *sta;
+
+ u8 addr[ETH_ALEN];
+ u8 link_id;
+ enum ieee80211_smps_mode smps_mode;
+
+ u32 supp_rates[NUM_NL80211_BANDS];
+ struct ieee80211_sta_ht_cap ht_cap;
+ struct ieee80211_sta_vht_cap vht_cap;
+ struct ieee80211_sta_he_cap he_cap;
+ struct ieee80211_he_6ghz_capa he_6ghz_capa;
+ struct ieee80211_sta_eht_cap eht_cap;
+
+ struct ieee80211_sta_aggregates agg;
+
+ u8 rx_nss;
+ enum ieee80211_sta_rx_bandwidth bandwidth;
+ struct ieee80211_sta_txpwr txpwr;
+};
+
+/**
* struct ieee80211_sta - station table entry
*
* A station table entry represents a station we are possibly
@@ -2136,6 +2253,10 @@ struct ieee80211_sta {
struct ieee80211_sta_txpwr txpwr;
struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
+
+ u16 valid_links;
+ struct ieee80211_link_sta deflink;
+ struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
/* must be last */
u8 drv_priv[] __aligned(sizeof(void *));
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1916,6 +1916,73 @@ struct ieee80211_he_mu_edca_param_ac_rec
} __packed;
/**
+ * struct ieee80211_eht_mcs_nss_supp_20mhz_only - EHT 20MHz only station max
+ * supported NSS for per MCS.
+ *
+ * For each field below, bits 0 - 3 indicate the maximal number of spatial
+ * streams for Rx, and bits 4 - 7 indicate the maximal number of spatial streams
+ * for Tx.
+ *
+ * @rx_tx_mcs7_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 0 - 7.
+ * @rx_tx_mcs9_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 8 - 9.
+ * @rx_tx_mcs11_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 10 - 11.
+ * @rx_tx_mcs13_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 12 - 13.
+ */
+struct ieee80211_eht_mcs_nss_supp_20mhz_only {
+ u8 rx_tx_mcs7_max_nss;
+ u8 rx_tx_mcs9_max_nss;
+ u8 rx_tx_mcs11_max_nss;
+ u8 rx_tx_mcs13_max_nss;
+};
+
+/**
+ * struct ieee80211_eht_mcs_nss_supp_bw - EHT max supported NSS per MCS (except
+ * 20MHz only stations).
+ *
+ * For each field below, bits 0 - 3 indicate the maximal number of spatial
+ * streams for Rx, and bits 4 - 7 indicate the maximal number of spatial streams
+ * for Tx.
+ *
+ * @rx_tx_mcs9_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 0 - 9.
+ * @rx_tx_mcs11_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 10 - 11.
+ * @rx_tx_mcs13_max_nss: indicates the maximum number of spatial streams
+ * supported for reception and the maximum number of spatial streams
+ * supported for transmission for MCS 12 - 13.
+ */
+struct ieee80211_eht_mcs_nss_supp_bw {
+ u8 rx_tx_mcs9_max_nss;
+ u8 rx_tx_mcs11_max_nss;
+ u8 rx_tx_mcs13_max_nss;
+};
+
+/**
+ * struct ieee80211_eht_cap_elem_fixed - EHT capabilities fixed data
+ *
+ * This structure is the "EHT Capabilities element" fixed fields as
+ * described in P802.11be_D2.0 section 9.4.2.313.
+ *
+ * @mac_cap_info: MAC capabilities, see IEEE80211_EHT_MAC_CAP*
+ * @phy_cap_info: PHY capabilities, see IEEE80211_EHT_PHY_CAP*
+ */
+struct ieee80211_eht_cap_elem_fixed {
+ u8 mac_cap_info[2];
+ u8 phy_cap_info[9];
+} __packed;
+
+
+/**
* struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element
*
* This structure is the "MU EDCA Parameter Set element" fields as
@@ -2228,6 +2295,12 @@ int ieee80211_get_vht_max_nss(struct iee
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US 0x80
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_RESERVED 0xc0
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_MASK 0xc0
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x0
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x1
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x3
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 6
+#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0xc0
#define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x01
@@ -3982,4 +4055,7 @@ enum ieee80211_range_params_max_total_lt
IEEE80211_RANGE_PARAMS_MAX_TOTAL_LTF_UNSPECIFIED,
};
+/* multi-link device */
+#define IEEE80211_MLD_MAX_NUM_LINKS 15
+
#endif /* LINUX_IEEE80211_H */
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -348,6 +348,31 @@ struct ieee80211_sta_vht_cap {
#define IEEE80211_HE_PPE_THRES_MAX_LEN 25
/**
+ * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
+ *
+ * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
+ * and NSS Set field"
+ *
+ * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
+ * @bw: MCS/NSS support for 80, 160 and 320 MHz
+ * @bw._80: MCS/NSS support for BW <= 80 MHz
+ * @bw._160: MCS/NSS support for BW = 160 MHz
+ * @bw._320: MCS/NSS support for BW = 320 MHz
+ */
+struct ieee80211_eht_mcs_nss_supp {
+ union {
+ struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
+ struct {
+ struct ieee80211_eht_mcs_nss_supp_bw _80;
+ struct ieee80211_eht_mcs_nss_supp_bw _160;
+ struct ieee80211_eht_mcs_nss_supp_bw _320;
+ } __packed bw;
+ } __packed;
+} __packed;
+
+#define IEEE80211_EHT_PPE_THRES_MAX_LEN 32
+
+/**
* struct ieee80211_sta_he_cap - STA's HE capabilities
*
* This structure describes most essential parameters needed
@@ -366,6 +391,24 @@ struct ieee80211_sta_he_cap {
};
/**
+ * struct ieee80211_sta_eht_cap - STA's EHT capabilities
+ *
+ * This structure describes most essential parameters needed
+ * to describe 802.11be EHT capabilities for a STA.
+ *
+ * @has_eht: true iff EHT data is valid.
+ * @eht_cap_elem: Fixed portion of the eht capabilities element.
+ * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
+ * @eht_ppe_thres: Holds the PPE Thresholds data.
+ */
+struct ieee80211_sta_eht_cap {
+ bool has_eht;
+ struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
+ struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
+ u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
+};
+
+/**
* struct ieee80211_sband_iftype_data - sband data per interface type
*
* This structure encapsulates sband data that is relevant for the

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
From dab03e40b8c614d18dfeec054767275de25ff8ab Mon Sep 17 00:00:00 2001
From: coolsnowwolf <coolsnowwolf@gmail.com>
Date: Tue, 20 Dec 2022 23:01:27 +0800
Subject: [PATCH 2/2] Revert "wifi: mt76: mt7921: introduce chanctx support"
This reverts commit 2575de3aea332837a0784629b11146efa1c55e58.
---
mt7921/init.c | 33 +++-----------
mt7921/mac.c | 8 ++++
mt7921/main.c | 111 ++----------------------------------------------
mt7921/mt7921.h | 1 -
mt7921/pci.c | 7 ---
mt7921/sdio.c | 7 ---
mt7921/usb.c | 7 ---
7 files changed, 17 insertions(+), 157 deletions(-)
--- a/mt7921/init.c
+++ b/mt7921/init.c
@@ -26,27 +26,6 @@ static const struct ieee80211_iface_comb
.max_interfaces = MT7921_MAX_INTERFACES,
.num_different_channels = 1,
.beacon_int_infra_match = true,
- },
-};
-
-static const struct ieee80211_iface_limit if_limits_chanctx[] = {
- {
- .max = 2,
- .types = BIT(NL80211_IFTYPE_STATION),
- },
- {
- .max = 1,
- .types = BIT(NL80211_IFTYPE_AP),
- }
-};
-
-static const struct ieee80211_iface_combination if_comb_chanctx[] = {
- {
- .limits = if_limits_chanctx,
- .n_limits = ARRAY_SIZE(if_limits_chanctx),
- .max_interfaces = 2,
- .num_different_channels = 2,
- .beacon_int_infra_match = false,
}
};
@@ -88,19 +67,17 @@ mt7921_init_wiphy(struct ieee80211_hw *h
hw->sta_data_size = sizeof(struct mt7921_sta);
hw->vif_data_size = sizeof(struct mt7921_vif);
- if (dev->fw_features & MT7921_FW_CAP_CNM) {
+ if (dev->fw_features & MT7921_FW_CAP_CNM)
wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb_chanctx;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
- } else {
+ else
wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
- }
+
+ wiphy->iface_combinations = if_comb;
wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
WIPHY_FLAG_4ADDR_STATION);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_AP);
+ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
wiphy->max_remain_on_channel_duration = 5000;
wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
wiphy->max_scan_ssids = 4;
--- a/mt7921/mac.c
+++ b/mt7921/mac.c
@@ -168,6 +168,14 @@ static void
mt7921_get_status_freq_info(struct mt7921_dev *dev, struct mt76_phy *mphy,
struct mt76_rx_status *status, u8 chfreq)
{
+ if (!test_bit(MT76_HW_SCANNING, &mphy->state) &&
+ !test_bit(MT76_HW_SCHED_SCANNING, &mphy->state) &&
+ !test_bit(MT76_STATE_ROC, &mphy->state)) {
+ status->freq = mphy->chandef.chan->center_freq;
+ status->band = mphy->chandef.chan->band;
+ return;
+ }
+
if (chfreq > 180) {
status->band = NL80211_BAND_6GHZ;
chfreq = (chfreq - 181) * 4 + 1;
--- a/mt7921/main.c
+++ b/mt7921/main.c
@@ -851,7 +851,7 @@ void mt7921_mac_sta_assoc(struct mt76_de
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid,
- true, mvif->ctx);
+ true, NULL);
mt7921_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -884,7 +884,7 @@ void mt7921_mac_sta_remove(struct mt76_d
if (!sta->tdls)
mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
&mvif->sta.wcid, false,
- mvif->ctx);
+ NULL);
}
spin_lock_bh(&dev->sta_poll_lock);
@@ -1644,7 +1644,7 @@ mt7921_start_ap(struct ieee80211_hw *hw,
mt7921_mutex_acquire(dev);
err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid,
- true, mvif->ctx);
+ true, NULL);
if (err)
goto out;
@@ -1676,105 +1676,12 @@ mt7921_stop_ap(struct ieee80211_hw *hw,
goto out;
mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false,
- mvif->ctx);
+ NULL);
out:
mt7921_mutex_release(dev);
}
-static int
-mt7921_add_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx)
-{
- return 0;
-}
-
-static void
-mt7921_remove_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx)
-{
-}
-
-static void mt7921_ctx_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct ieee80211_chanctx_conf *ctx = priv;
-
- if (ctx != mvif->ctx)
- return;
-
- mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->mt76, ctx);
-}
-
-static void
-mt7921_change_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx,
- u32 changed)
-{
- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-
- mt7921_mutex_acquire(phy->dev);
- ieee80211_iterate_active_interfaces(phy->mt76->hw,
- IEEE80211_IFACE_ITER_ACTIVE,
- mt7921_ctx_iter, ctx);
- mt7921_mutex_release(phy->dev);
-}
-
-static int
-mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_chanctx_conf *ctx)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-
- mutex_lock(&dev->mt76.mutex);
- mvif->ctx = ctx;
- mutex_unlock(&dev->mt76.mutex);
-
- return 0;
-}
-
-static void
-mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_chanctx_conf *ctx)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-
- mutex_lock(&dev->mt76.mutex);
- mvif->ctx = NULL;
- mutex_unlock(&dev->mt76.mutex);
-}
-
-static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
- u16 duration = info->duration ? info->duration :
- jiffies_to_msecs(HZ);
-
- mt7921_mutex_acquire(dev);
- mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration,
- MT7921_ROC_REQ_JOIN);
- mt7921_mutex_release(dev);
-}
-
-static void mt7921_mgd_complete_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-
- mt7921_abort_roc(mvif->phy, mvif);
-}
-
const struct ieee80211_ops mt7921_ops = {
.tx = mt7921_tx,
.start = mt7921_start,
@@ -1827,13 +1734,6 @@ const struct ieee80211_ops mt7921_ops =
.set_sar_specs = mt7921_set_sar_specs,
.remain_on_channel = mt7921_remain_on_channel,
.cancel_remain_on_channel = mt7921_cancel_remain_on_channel,
- .add_chanctx = mt7921_add_chanctx,
- .remove_chanctx = mt7921_remove_chanctx,
- .change_chanctx = mt7921_change_chanctx,
- .assign_vif_chanctx = mt7921_assign_vif_chanctx,
- .unassign_vif_chanctx = mt7921_unassign_vif_chanctx,
- .mgd_prepare_tx = mt7921_mgd_prepare_tx,
- .mgd_complete_tx = mt7921_mgd_complete_tx,
};
EXPORT_SYMBOL_GPL(mt7921_ops);
--- a/mt7921/mt7921.h
+++ b/mt7921/mt7921.h
@@ -171,7 +171,6 @@ struct mt7921_vif {
struct ewma_rssi rssi;
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
- struct ieee80211_chanctx_conf *ctx;
};
struct mib_stats {
--- a/mt7921/pci.c
+++ b/mt7921/pci.c
@@ -297,13 +297,6 @@ static int mt7921_pci_probe(struct pci_d
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), ops, &drv_ops);
--- a/mt7921/sdio.c
+++ b/mt7921/sdio.c
@@ -140,13 +140,6 @@ static int mt7921s_probe(struct sdio_fun
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
mdev = mt76_alloc_device(&func->dev, sizeof(*dev), ops, &drv_ops);
--- a/mt7921/usb.c
+++ b/mt7921/usb.c
@@ -218,13 +218,6 @@ static int mt7921u_probe(struct usb_inte
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
ops->stop = mt7921u_stop;

View File

@ -10,11 +10,9 @@ Signed-off-by: DENG Qingfang <dqfext@gmail.com>
mac80211.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mac80211.c b/mac80211.c
index 30c1bc56..125bcff5 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -275,7 +275,7 @@ static void mt76_init_stream_cap(struct mt76_phy *phy,
@@ -281,7 +281,7 @@ static void mt76_init_stream_cap(struct
void mt76_set_stream_caps(struct mt76_phy *phy, bool vht)
{
if (phy->cap.has_2ghz)
@ -23,7 +21,7 @@ index 30c1bc56..125bcff5 100644
if (phy->cap.has_5ghz)
mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht);
if (phy->cap.has_6ghz)
@@ -342,13 +342,13 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband,
@@ -348,13 +348,13 @@ mt76_init_sband(struct mt76_phy *phy, st
static int
mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates,
@ -39,7 +37,7 @@ index 30c1bc56..125bcff5 100644
}
static int
@@ -500,7 +500,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht,
@@ -506,7 +506,7 @@ int mt76_register_phy(struct mt76_phy *p
return ret;
if (phy->cap.has_2ghz) {
@ -48,7 +46,7 @@ index 30c1bc56..125bcff5 100644
if (ret)
return ret;
}
@@ -625,7 +625,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
@@ -644,7 +644,7 @@ int mt76_register_device(struct mt76_dev
return ret;
if (phy->cap.has_2ghz) {