wifi: mt76: mt7996: move radio ctrl commands to proper functions
Subsystems (2)
Shayne Chen
reviewerPATCH v3 1/10 wifi: mt76: mt7996: move radio ctrl commands to proper functions
Move radio enable/disable commands into functions for configuring per-phy radio.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +6 -5
@@ -43,6 +43,10 @@ int mt7996_run(struct ieee80211_hw *hw)if (ret) goto out; + ret =mt7996_mcu_set_radio_en (phy, true); +if (ret) + goto out; + ret =mt7996_mcu_set_chan_info (phy,UNI_CHANNEL_RX_PATH );if (ret) goto out;
@@ -82,6 +86,8 @@ static void mt7996_stop(struct ieee80211_hw *hw)mutex_lock (&dev->mt76.mutex); +mt7996_mcu_set_radio_en (phy, false); +clear_bit (MT76_STATE_RUNNING , &phy->mt76->state);mutex_unlock (&dev->mt76.mutex);
@@ -190,10 +196,6 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,if (ret) goto out; - ret =mt7996_mcu_set_radio_en (phy, true); -if (ret) - goto out; - dev->mt76.vif_mask |=BIT_ULL (mvif->mt76.idx); phy->omac_mask |=BIT_ULL (mvif->mt76.omac_idx);
@@ -253,7 +255,6 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, phy->monitor_vif =NULL ;mt7996_mcu_add_dev_info (phy, vif, false); -mt7996_mcu_set_radio_en (phy, false);rcu_assign_pointer (dev->mt76.wcid[idx],NULL );
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 2/10 wifi: mt76: connac: add support for dsp firmware download
From: Peter Chiu <[email protected]>
Add FW_START_WORKING_PDA_DSP for the indication of starting DSP firmware download, which is for phy-related control.
The firmware is transparent to the driver, but it's necessary for the firmware download process.
---
v2:
- merge two commits
- move main load ram code to a regular function
v3:
- remove all macros to directly call __mt7996_load_ram()
- add back missing code which records fw_version to wiphy
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7996/mcu.c | 67 +++++++++---------- .../wireless/mediatek/mt76/mt7996/mt7996.h | 7 ++ .../net/wireless/mediatek/mt76/mt7996/pci.c | 1 + 4 files changed, 42 insertions(+), 34 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -22,6 +22,7 @@#define FW_START_OVERRIDE BIT(0)#define FW_START_WORKING_PDA_CR4 BIT(2) +#define FW_START_WORKING_PDA_DSP BIT(3)#define PATCH_SEC_NOT_SUPPORT GENMASK(31, 0)#define PATCH_SEC_TYPE_MASK GENMASK(15, 0)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +33 -34
110 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +7 -0
@@ -29,6 +29,7 @@#define MT7996_FIRMWARE_WA "mediatek/mt7996/mt7996_wa.bin"#define MT7996_FIRMWARE_WM "mediatek/mt7996/mt7996_wm.bin" +#define MT7996_FIRMWARE_DSP "mediatek/mt7996/mt7996_dsp.bin"#define MT7996_ROM_PATCH "mediatek/mt7996/mt7996_rom_patch.bin"#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"
@@ -52,6 +53,12 @@ struct mt7996_sta;struct mt7996_dfs_pulse ;struct mt7996_dfs_pattern ; +enum mt7996_ram_type { +MT7996_RAM_TYPE_WM , +MT7996_RAM_TYPE_WA , +MT7996_RAM_TYPE_DSP , +}; +enum mt7996_txq_id {MT7996_TXQ_FWDL =16 ,MT7996_TXQ_MCU_WM ,
drivers/net/wireless/mediatek/mt76/mt7996/pci.c +1 -0
@@ -219,4 +219,5 @@ MODULE_DEVICE_TABLE(pci, mt7996_pci_device_table);MODULE_DEVICE_TABLE (pci, mt7996_hif_device_table);MODULE_FIRMWARE (MT7996_FIRMWARE_WA );MODULE_FIRMWARE (MT7996_FIRMWARE_WM ); +MODULE_FIRMWARE (MT7996_FIRMWARE_DSP );MODULE_FIRMWARE (MT7996_ROM_PATCH );
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 3/10 wifi: mt76: mt7996: fix bss wlan_idx when sending bss_info command
In reply to Shayne ChenFrom: Peter Chiu <[email protected]>
The bmc_tx_wlan_idx should be the wlan_idx of the current bss rather than peer AP's wlan_idx, otherwise there will appear some frame decryption problems on station mode.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +3 -2
@@ -712,6 +712,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,struct cfg80211_chan_def *chandef = &phy->chandef;struct mt76_connac_bss_basic_tlv *bss;u32 type =CONNECTION_INFRA_AP ; +u16 sta_wlan_idx = wlan_idx;struct tlv *tlv;int idx;
@@ -731,7 +732,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,struct mt76_wcid *wcid; wcid = (struct mt76_wcid *)sta->drv_priv; - wlan_idx = wcid->idx; + sta_wlan_idx = wcid->idx; }rcu_read_unlock (); }
@@ -751,7 +752,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, bss->bcn_interval =cpu_to_le16 (vif->bss_conf.beacon_int); bss->dtim_period = vif->bss_conf.dtim_period; bss->bmc_tx_wlan_idx =cpu_to_le16 (wlan_idx); - bss->sta_idx =cpu_to_le16 (wlan_idx); + bss->sta_idx =cpu_to_le16 (sta_wlan_idx); bss->conn_type =cpu_to_le32 (type); bss->omac_idx = mvif->omac_idx; bss->band_idx = mvif->band_idx;
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 4/10 wifi: mt76: mt7996: init he and eht cap for AP_VLAN
In reply to Shayne ChenFrom: Peter Chiu <[email protected]>
Init he and eht capabilities for AP_VLAN type. Without this patch, the BA response from AP_VLAN will not include the ADDBA extension tag.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +1 -0
@@ -808,6 +808,7 @@ __mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy,switch (i) {case NL80211_IFTYPE_STATION :case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_AP_VLAN :#ifdef CONFIG_MAC80211_MESH case NL80211_IFTYPE_MESH_POINT :#endif
Signature · 1 line
2.39.2
Felix Fietkau
maintainerRe: [PATCH v3 04/10] wifi: mt76: mt7996: init he and eht cap for AP_VLAN
Quoted 4 lines · Shayne Chen
From: Peter Chiu <[email protected]>
Init he and eht capabilities for
AP_VLANtype. Without this patch, the BA response fromAP_VLANwill not include the ADDBA extension tag.
If that's the case, then I think this is something that needs to be fixed in mac80211 instead. Since interfaces with the AP_VLAN iftype are not exposed to the driver, I don't see why the driver should register capabilities for that type.
- Felix
Shayne Chen
reviewerPATCH v3 5/10 wifi: mt76: mt7996: enable VHT extended NSS BW feature
In reply to Shayne ChenFrom: Peter Chiu <[email protected]>
Set SUPPORTS_VHT_EXT_NSS_BW to let the max BW capability correctly be parsed by different devices.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +2 -0
@@ -217,6 +217,8 @@ mt7996_init_wiphy(struct ieee80211_hw *hw)IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ; phy->mt76->sband_5g.sband.ht_cap.ampdu_density =IEEE80211_HT_MPDU_DENSITY_1 ; + +ieee80211_hw_set (hw,SUPPORTS_VHT_EXT_NSS_BW ); }mt76_set_stream_caps (phy->mt76, true);
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 6/10 wifi: mt76: connac: add support to set ifs time by mcu command
In reply to Shayne ChenFrom: Peter Chiu <[email protected]>
There's a race between driver and fw on some tx/rx control registers when setting ifs, which will cause accidental hw queue pause problems. Avoid this by setting ifs time with bss_info mcu command.
---
v2:
- merge two commits
- wifi: mt76: connac: add a new bss_info tag for setting ifs time
- wifi: mt76: mt7996: set ifs time by mcu command
- change bool a_band to use is_2ghz
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7996/mac.c | 27 +---------- .../net/wireless/mediatek/mt76/mt7996/main.c | 5 +- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 46 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7996/mcu.h | 17 +++++++ .../wireless/mediatek/mt76/mt7996/mt7996.h | 3 +- 6 files changed, 70 insertions(+), 29 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -1288,6 +1288,7 @@ enum {UNI_BSS_INFO_UAPSD =19 ,UNI_BSS_INFO_PS =21 ,UNI_BSS_INFO_BCNFT =22 , +UNI_BSS_INFO_IFS_TIME =23 ,UNI_BSS_INFO_OFFLOAD =25 , UNI_BSS_INFO_MLD = 26, };
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +2 -25
@@ -1604,20 +1604,19 @@ void mt7996_mac_reset_counters(struct mt7996_phy *phy)mt7996_mcu_get_chan_mib_info (phy, true); } -void mt7996_mac_set_timing (struct mt7996_phy *phy) +void mt7996_mac_set_coverage_class (struct mt7996_phy *phy) {s16 coverage_class = phy->coverage_class;struct mt7996_dev *dev = phy->dev;struct mt7996_phy *phy2 =mt7996_phy2 (dev);struct mt7996_phy *phy3 =mt7996_phy3 (dev); -u32 val, reg_offset; +u32 reg_offset;u32 cck =FIELD_PREP (MT_TIMEOUT_VAL_PLCP ,231 ) |FIELD_PREP (MT_TIMEOUT_VAL_CCA ,48 );u32 ofdm =FIELD_PREP (MT_TIMEOUT_VAL_PLCP ,60 ) |FIELD_PREP (MT_TIMEOUT_VAL_CCA ,28 );u8 band_idx = phy->mt76->band_idx;int offset; -bool a_band = !(phy->mt76->chandef.chan->band ==NL80211_BAND_2GHZ );if (!test_bit (MT76_STATE_RUNNING , &phy->mt76->state))return ;
@@ -1630,34 +1629,12 @@ void mt7996_mac_set_timing(struct mt7996_phy *phy) coverage_class =max_t (s16, coverage_class, phy3->coverage_class); -mt76_set (dev,MT_ARB_SCR (band_idx), -MT_ARB_SCR_TX_DISABLE |MT_ARB_SCR_RX_DISABLE ); -udelay (1 ); - offset =3 * coverage_class; reg_offset =FIELD_PREP (MT_TIMEOUT_VAL_PLCP , offset) |FIELD_PREP (MT_TIMEOUT_VAL_CCA , offset);mt76_wr (dev,MT_TMAC_CDTR (band_idx), cck + reg_offset);mt76_wr (dev,MT_TMAC_ODTR (band_idx), ofdm + reg_offset); -mt76_wr (dev,MT_TMAC_ICR0 (band_idx), -FIELD_PREP (MT_IFS_EIFS_OFDM , a_band ?84 :78 ) | -FIELD_PREP (MT_IFS_RIFS ,2 ) | -FIELD_PREP (MT_IFS_SIFS ,10 ) | -FIELD_PREP (MT_IFS_SLOT , phy->slottime)); - -if (!a_band) -mt76_wr (dev,MT_TMAC_ICR1 (band_idx), -FIELD_PREP (MT_IFS_EIFS_CCK ,314 )); - -if (phy->slottime <20 || a_band) - val =MT7996_CFEND_RATE_DEFAULT ; -else - val =MT7996_CFEND_RATE_11B ; - -mt76_rmw_field (dev,MT_RATE_HRCR0 (band_idx),MT_RATE_HRCR0_CFEND_RATE , val); -mt76_clear (dev,MT_ARB_SCR (band_idx), -MT_ARB_SCR_TX_DISABLE |MT_ARB_SCR_RX_DISABLE ); }void mt7996_mac_enable_nf (struct mt7996_dev *dev,u8 band)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +2 -3
@@ -287,7 +287,6 @@ int mt7996_set_channel(struct mt7996_phy *phy)if (ret) goto out; -mt7996_mac_set_timing (phy); ret =mt7996_dfs_init_radar_detector (phy);mt7996_mac_cca_stats_reset (phy);
@@ -565,7 +564,7 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,if (slottime != phy->slottime) { phy->slottime = slottime; -mt7996_mac_set_timing (phy); +mt7996_mcu_set_timing (phy, vif); } }
@@ -905,7 +904,7 @@ mt7996_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)mutex_lock (&dev->mt76.mutex); phy->coverage_class =max_t (s16, coverage_class,0 ); -mt7996_mac_set_timing (phy); +mt7996_mac_set_coverage_class (phy);mutex_unlock (&dev->mt76.mutex); }
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +46 -0
64 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7996/mcu.h +17 -0
@@ -317,6 +317,22 @@ struct bss_sec_tlv {u8 __rsv2[1 ]; } __packed; +struct bss_ifs_time_tlv { +__le16 tag; +__le16 len; +u8 slot_valid; +u8 sifs_valid; +u8 rifs_valid; +u8 eifs_valid; +__le16 slot_time; +__le16 sifs_time; +__le16 rifs_time; +__le16 eifs_time; +u8 eifs_cck_valid; +u8 rsv; +__le16 eifs_cck_time; +} __packed; +struct bss_power_save {__le16 tag;__le16 len;
@@ -552,6 +568,7 @@ enum { sizeof(struct bss_txcmd_tlv) + \ sizeof(struct bss_power_save) + \ sizeof(struct bss_sec_tlv) + \ + sizeof(struct bss_ifs_time_tlv) + \ sizeof(struct bss_mld_tlv))#define MT7996_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +2 -1
@@ -463,6 +463,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index, const struct mt7996_dfs_pattern *pattern);int mt7996_mcu_set_radio_en (struct mt7996_phy *phy,bool enable);int mt7996_mcu_set_rts_thresh (struct mt7996_phy *phy,u32 val); +int mt7996_mcu_set_timing (struct mt7996_phy *phy,struct ieee80211_vif *vif);int mt7996_mcu_get_chan_mib_info (struct mt7996_phy *phy,bool chan_switch);int mt7996_mcu_rdd_cmd (struct mt7996_dev *dev,int cmd,u8 index,u8 rx_sel,u8 val);
@@ -526,7 +527,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_key_conf *key, int pid, enum mt76_txq_id qid, u32 changed); -void mt7996_mac_set_timing (struct mt7996_phy *phy); +void mt7996_mac_set_coverage_class (struct mt7996_phy *phy);int mt7996_mac_sta_add (struct mt76_dev *mdev,struct ieee80211_vif *vif,struct ieee80211_sta *sta); void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 7/10 wifi: mt76: mt7996: use correct phy for background radar event
In reply to Shayne ChenFrom: StanleyYP Wang <[email protected]>
If driver directly uses the band_idx reported from the radar event to access mt76_phy array, it will get the wrong phy for background radar. Fix this by adjusting the statement.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +5 -1
@@ -339,7 +339,11 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)if (r->band_idx >=ARRAY_SIZE (dev->mt76.phys))return ; - mphy = dev->mt76.phys[r->band_idx]; +if (dev->rdd2_phy && r->band_idx ==MT_RX_SEL2 ) + mphy = dev->rdd2_phy->mt76; +else + mphy = dev->mt76.phys[r->band_idx]; +if (!mphy)return ;
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 8/10 wifi: mt76: mt7996: fix WA event ring size
In reply to Shayne ChenFrom: StanleyYP Wang <[email protected]>
Fix rx ring size of WA event to get rid of event loss and queue overflow problems.
--- drivers/net/wireless/mediatek/mt76/mt7996/dma.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/dma.c +1 -1
@@ -293,7 +293,7 @@ int mt7996_dma_init(struct mt7996_dev *dev)/* event from WA */ ret =mt76_queue_alloc (dev, &dev->mt76.q_rx[MT_RXQ_MCU_WA ],MT_RXQ_ID (MT_RXQ_MCU_WA ), -MT7996_RX_MCU_RING_SIZE , +MT7996_RX_MCU_RING_SIZE_WA ,MT_RX_BUF_SIZE ,MT_RXQ_RING_BASE (MT_RXQ_MCU_WA ));if (ret)
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +1 -0
@@ -26,6 +26,7 @@#define MT7996_RX_RING_SIZE 1536#define MT7996_RX_MCU_RING_SIZE 512 +#define MT7996_RX_MCU_RING_SIZE_WA 1024#define MT7996_FIRMWARE_WA "mediatek/mt7996/mt7996_wa.bin"#define MT7996_FIRMWARE_WM "mediatek/mt7996/mt7996_wm.bin"
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 9/10 wifi: mt76: mt7996: add muru support
In reply to Shayne ChenFrom: MeiChia Chiu <[email protected]>
Add sta_rec_muru() fw command to support MU-MIMO and OFDMA features.
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 3 +- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 56 ++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +2 -1
@@ -519,7 +519,8 @@ struct sta_rec_muru {u8 uo_ra;u8 he_2x996_tone;u8 rx_t_frame_11ac; -u8 rsv[3 ]; +u8 rx_ctrl_frame_to_mbss; +u8 rsv[2 ]; } ofdma_ul;struct {
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +55 -1
68 lines not on this page · raw message
Signature · 1 line
2.39.2
Shayne Chen
reviewerPATCH v3 10/10 wifi: mt76: mt7996: increase tx token size
In reply to Shayne ChenFrom: Howard Hsu <[email protected]>
Align tx token size to proprietary driver, which can improve peak throughput under MU performance tests.
--- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +1 -1
@@ -36,7 +36,7 @@#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"#define MT7996_EEPROM_SIZE 7680#define MT7996_EEPROM_BLOCK_SIZE 16 -#define MT7996_TOKEN_SIZE 8192 +#define MT7996_TOKEN_SIZE 16384#define MT7996_CFEND_RATE_DEFAULT 0x49/* OFDM 24M */ #define MT7996_CFEND_RATE_11B 0x03/* 11B LP, 11M */
Signature · 1 line
2.39.2