wifi: mt76: mt7996: fix RRO EMU configuration
Subsystems (2)
Shayne Chen
reviewerPATCH 1/6 wifi: mt76: mt7996: fix RRO EMU configuration
From: Peter Chiu <[email protected]>
Use the correct helper to update specific bitfields instead of overwriting the entire register.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 3 +-- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +1 -2
@@ -873,8 +873,7 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev) } }else {/* set emul 3.0 function */ -mt76_wr (dev,MT_RRO_3_0_EMU_CONF , -MT_RRO_3_0_EMU_CONF_EN_MASK ); +mt76_set (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK );mt76_wr (dev,MT_RRO_ADDR_ARRAY_BASE0 , dev->wed_rro.addr_elem[0 ].phy_addr);
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1 -1
@@ -2559,7 +2559,7 @@ void mt7996_mac_reset_work(struct work_struct *work)mt7996_dma_start (dev, false, false);if (!is_mt7996 (&dev->mt76) && dev->mt76.hwrro_mode ==MT76_HWRRO_V3 ) -mt76_wr (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK ); +mt76_set (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK );if (mtk_wed_device_active (&dev->mt76.mmio.wed)) { u32 wed_irq_mask = MT_INT_TX_DONE_BAND2 |
Signature · 1 line
2.51.0
Shayne Chen
reviewerPATCH 2/6 wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets
From: Howard Hsu <[email protected]>
For MT7990 chipsets, critical packet mode must be enabled. Without this, some higher priority packets may be placed in the wrong AC queue.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +1 -1
@@ -56,7 +56,7 @@ static int mt7996_start(struct ieee80211_hw *hw)mutex_lock (&dev->mt76.mutex); ret =mt7996_mcu_set_hdr_trans (dev, true); -if (!ret &&is_mt7992 (&dev->mt76)) { +if (!ret && !is_mt7996 (&dev->mt76)) {u8 queue =mt76_connac_lmac_mapping (IEEE80211_AC_VI ); ret =mt7996_mcu_cp_support (dev, queue);
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerRe: [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets
Quoted 7 lines
From: Howard Hsu <[email protected]>
For MT7990 chipsets, critical packet mode must be enabled. Without this, some higher priority packets may be placed in the wrong AC queue.
Signed-off-by Howard Hsu <[email protected]>Signed-off-by Shayne Chen <[email protected]>
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
Quoted 20 lines
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/mediatek/mt76/mt7996/main.c +1
-1@@ -56,7 +56,7 @@ static int mt7996_start(struct ieee80211_hw *hw)mutex_lock (&dev->mt76.mutex); ret =mt7996_mcu_set_hdr_trans (dev, true); -if (!ret &&is_mt7992 (&dev->mt76)) { +if (!ret && !is_mt7996 (&dev->mt76)) {u8 queue =mt76_connac_lmac_mapping (IEEE80211_AC_VI ); ret =mt7996_mcu_cp_support (dev, queue);Signature · 1 line
2.51.0
Shayne Chen
reviewerPATCH 3/6 wifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets
In reply to Shayne ChenFrom: Peter Chiu <[email protected]>
Skip WFSYS reset during bootup for MT7990 chipsets; only reset if L0.5 recovery is triggered.
Without this fix, the following kernel error may occur:
Internal error: synchronous external abort.
--- .../net/wireless/mediatek/mt76/mt7996/init.c | 29 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7996/regs.h | 8 +++++ 2 files changed, 34 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +26 -3
@@ -791,11 +791,34 @@ static void mt7996_init_work(struct work_struct *work)void mt7996_wfsys_reset (struct mt7996_dev *dev) { -mt76_set (dev,MT_WF_SUBSYS_RST ,0x1 ); -msleep (20 ); +if (!is_mt7990 (&dev->mt76)) { +mt76_set (dev,MT_WF_SUBSYS_RST ,0x1 ); +msleep (20 ); + +mt76_clear (dev,MT_WF_SUBSYS_RST ,0x1 ); +msleep (20 ); + +return ; + } -mt76_clear (dev,MT_WF_SUBSYS_RST ,0x1 ); +if (!dev->recovery.hw_full_reset) +return ; + +mt76_set (dev,MT_WF_SUBSYS_RST , +MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT | +MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT | +MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT ); +mt76_rmw (dev,MT_WF_SUBSYS_RST , +MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE , +u32_encode_bits (0x20 ,MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE )); +mt76_clear (dev,MT_WF_L05_RST ,MT_WF_L05_RST_WF_RST_MASK ); +mt76_set (dev,MT_WF_SUBSYS_RST ,MT_WF_SUBSYS_RST_WHOLE_PATH_RST );msleep (20 ); + +if (mt76_poll (dev,MT_WF_L05_RST ,MT_WF_L05_RST_WF_RST_MASK ,0x1a ,1000 )) +return ; + +dev_err (dev->mt76.dev,"wfsys reset fail\n" ); }static void mt7996_rro_hw_init_v3 (struct mt7996_dev *dev)
drivers/net/wireless/mediatek/mt76/mt7996/regs.h +8 -0
@@ -736,7 +736,15 @@ enum offs_rev {#define MT_HW_REV 0x70010204#define MT_HW_REV1 0x8a00 +#define MT_WF_L05_RST 0x70028550 +#define MT_WF_L05_RST_WF_RST_MASK GENMASK(4, 0) +#define MT_WF_SUBSYS_RST 0x70028600 +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST BIT(0) +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT BIT(5) +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT BIT(6) +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT BIT(16) +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE GENMASK(15, 8)/* PCIE MAC */ #define MT_PCIE_MAC_BASE 0x74030000
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerRe: [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets
Quoted 6 lines
From: Peter Chiu <[email protected]>
Skip WFSYS reset during bootup for MT7990 chipsets; only reset if L0.5 recovery is triggered.
Without this fix, the following kernel error may occur:Internal error: synchronous external abort.
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
Quoted 73 lines
Signed-off-by Peter Chiu <[email protected]>Signed-off-by Shayne Chen <[email protected]>--- .../net/wireless/mediatek/mt76/mt7996/init.c | 29 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7996/regs.h | 8 +++++ 2 files changed, 34 insertions(+), 3 deletions(-)drivers/net/wireless/mediatek/mt76/mt7996/init.c +26
-3@@ -791,11 +791,34 @@ static void mt7996_init_work(struct work_struct *work)void mt7996_wfsys_reset (struct mt7996_dev *dev) { -mt76_set (dev,MT_WF_SUBSYS_RST ,0x1 ); -msleep (20 ); +if (!is_mt7990 (&dev->mt76)) { +mt76_set (dev,MT_WF_SUBSYS_RST ,0x1 ); +msleep (20 ); + +mt76_clear (dev,MT_WF_SUBSYS_RST ,0x1 ); +msleep (20 ); + +return ; + } -mt76_clear (dev,MT_WF_SUBSYS_RST ,0x1 ); +if (!dev->recovery.hw_full_reset) +return ; + +mt76_set (dev,MT_WF_SUBSYS_RST , +MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT | +MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT | +MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT ); +mt76_rmw (dev,MT_WF_SUBSYS_RST , +MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE , +u32_encode_bits (0x20 ,MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE )); +mt76_clear (dev,MT_WF_L05_RST ,MT_WF_L05_RST_WF_RST_MASK ); +mt76_set (dev,MT_WF_SUBSYS_RST ,MT_WF_SUBSYS_RST_WHOLE_PATH_RST );msleep (20 ); + +if (mt76_poll (dev,MT_WF_L05_RST ,MT_WF_L05_RST_WF_RST_MASK ,0x1a ,1000 )) +return ; + +dev_err (dev->mt76.dev,"wfsys reset fail\n" ); }static void mt7996_rro_hw_init_v3 (struct mt7996_dev *dev)drivers/net/wireless/mediatek/mt76/mt7996/regs.h +8
-0@@ -736,7 +736,15 @@ enum offs_rev {#define MT_HW_REV 0x70010204#define MT_HW_REV1 0x8a00 +#define MT_WF_L05_RST 0x70028550 +#define MT_WF_L05_RST_WF_RST_MASK GENMASK(4, 0) +#define MT_WF_SUBSYS_RST 0x70028600 +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST BIT(0) +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT BIT(5) +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT BIT(6) +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT BIT(16) +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE GENMASK(15, 8)/* PCIE MAC */ #define MT_PCIE_MAC_BASE 0x74030000Signature · 1 line
2.51.0
Shayne Chen
reviewerPATCH 4/6 wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands
In reply to Shayne ChenFrom: Rex Lu <[email protected]>
Align the vendor driver by adjusting the timeout values for the MCU_UNI_CMD_EFUSE_CTRL and MCU_UNI_CMD_EXT_EEPROM_CTRL commands. Without this adjustment, false positive command timeout errors may occur, especially on some iPA variants.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +2 -1
@@ -271,7 +271,8 @@ mt7996_mcu_set_timeout(struct mt76_dev *mdev, int cmd) mdev->mcu.timeout =2 *HZ ;return ;case MCU_UNI_CMD_EFUSE_CTRL : - mdev->mcu.timeout =20 *HZ ; +case MCU_UNI_CMD_EXT_EEPROM_CTRL : + mdev->mcu.timeout =30 *HZ ;return ;default :break ;
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerRe: [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands
Quoted 6 lines
From: Rex Lu <[email protected]>
Align the vendor driver by adjusting the timeout values for the
MCU_UNI_CMD_EFUSE_CTRLandMCU_UNI_CMD_EXT_EEPROM_CTRLcommands. Without this adjustment, false positive command timeout errors may occur, especially on some iPA variants.
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
Quoted 24 lines
Signed-off-by Rex Lu <[email protected]>Signed-off-by Shayne Chen <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +2
-1@@ -271,7 +271,8 @@ mt7996_mcu_set_timeout(struct mt76_dev *mdev, int cmd) mdev->mcu.timeout =2 *HZ ;return ;case MCU_UNI_CMD_EFUSE_CTRL : - mdev->mcu.timeout =20 *HZ ; +case MCU_UNI_CMD_EXT_EEPROM_CTRL : + mdev->mcu.timeout =30 *HZ ;return ;default :break ;Signature · 1 line
2.51.0
Shayne Chen
reviewerPATCH 5/6 wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
In reply to Shayne ChenFrom: StanleyYP Wang <[email protected]>
Move the declaration of buf[] outside the for loop.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +2 -1
@@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) }for (band =0 ; band < __MT_MAX_BAND; band++) { +u8 buf[MT7996_EEPROM_BLOCK_SIZE ];const struct cal_free_data *cal;u16 prev_block_idx =-1 ;u16 adie_base;
@@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)u16 eep_offset = cal[i].eep_offs;u16 block_idx = adie_offset /MT7996_EEPROM_BLOCK_SIZE ;u16 offset = adie_offset %MT7996_EEPROM_BLOCK_SIZE ; -u8 buf[MT7996_EEPROM_BLOCK_SIZE ];if (is_mt7996 (&dev->mt76) && band ==MT_BAND1 && dev->var.type ==MT7996_VAR_TYPE_444 ) eep_offset -=MT_EE_7977BN_OFFSET ;if (prev_block_idx != block_idx) { +memset (buf,0 ,sizeof (buf)); ret =mt7996_mcu_get_eeprom (dev, adie_offset, buf,MT7996_EEPROM_BLOCK_SIZE ,EEPROM_MODE_EFUSE );
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerRe: [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
Quoted 16 lines
From: StanleyYP Wang <[email protected]>
Move the declaration of buf[] outside the for loop.
Fixes 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-free data from OTP")Signed-off-by StanleyYP Wang <[email protected]>Signed-off-by Shayne Chen <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +0
-0
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) · line 4107
Quoted 4 lines
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1
-0@@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) }for (band =0 ; band < __MT_MAX_BAND; band++) { +u8 buf[MT7996_EEPROM_BLOCK_SIZE ];
why are you moving buf here? It is only used in the inner block.
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) · line 4129
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +0
-1const struct cal_free_data *cal;u16 prev_block_idx =-1 ;u16 adie_base;@@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)u16 eep_offset = cal[i].eep_offs;u16 block_idx = adie_offset /MT7996_EEPROM_BLOCK_SIZE ;u16 offset = adie_offset %MT7996_EEPROM_BLOCK_SIZE ; -u8 buf[MT7996_EEPROM_BLOCK_SIZE ];
I think we should always define and initialize buf array here, otherwise we could use it with uninitialized values. Something like:
u8 buf[MT7996_EEPROM_BLOCK_SIZE] = {};Regards,
Lorenzo
Quoted 13 lines
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1
-0if (is_mt7996 (&dev->mt76) && band ==MT_BAND1 && dev->var.type ==MT7996_VAR_TYPE_444 ) eep_offset -=MT_EE_7977BN_OFFSET ;if (prev_block_idx != block_idx) { +memset (buf,0 ,sizeof (buf)); ret =mt7996_mcu_get_eeprom (dev, adie_offset, buf,MT7996_EEPROM_BLOCK_SIZE ,EEPROM_MODE_EFUSE );Signature · 1 line
2.51.0
Shayne Chen (陳軒丞)
reviewerRe: [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
Quoted 42 lines · Lorenzo Bianconi
Quoted 22 lines
From: StanleyYP Wang <[email protected]>
Move the declaration of buf[] outside the for loop.
Fixes 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-freedata from OTP")
Signed-off-by StanleyYP Wang <[email protected]>Signed-off-by Shayne Chen <[email protected]>---
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +0
-0@@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) }
for (band = 0; band <__MT_MAX_BAND; band++) {drivers/net/wireless/mediatek/mt76/mt7996/mcu.c mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) · line 4107
Quoted 1 line
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1
-0+u8 buf[MT7996_EEPROM_BLOCK_SIZE ];why are you moving buf here? It is only used in the inner block.
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) · line 4129
Quoted 11 lines
const struct
cal_free_data*cal;
u16prev_block_idx= -1;
u16adie_base;drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +0
-0@@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) u16 eep_offset = cal[i].eep_offs;u16
block_idx=adie_offset/MT7996_EEPROM_BLOCK_SIZE;
u16 offset =adie_offset%MT7996_EEPROM_BLOCK_SIZE;drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +0
-1-u8 buf[MT7996_EEPROM_BLOCK_SIZE ];I think we should always define and initialize buf array here, otherwise we
could use it with uninitialized values. Something like:
Quoted 2 lines
u8 buf[MT7996_EEPROM_BLOCK_SIZE] = {};Hi Lorenzo,
The buf array is updated only if the next offset is in a different block. For example, offsets 0x4c and 0x4d have the same block index, so 0x4d will use the same buf data read by 0x4c, instead of reading it via MCU command again.
So we need to preserve the values in the buf array, otherwise, it will cause undefined behavior.
Thanks,
Shayne
Quoted 20 lines
Regards,
LorenzoQuoted 17 lines
if (is_mt7996(&dev->mt76)&& band ==MT_BAND1&&
dev->var.type==MT7996_VAR_TYPE_444)eep_offset-=MT_EE_7977BN_OFFSET;
if (prev_block_idx!=block_idx) {drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1
-0+memset (buf,0 ,sizeof (buf));ret = mt7996_mcu_get_eeprom(dev,
adie_offset, buf,MT7996_EEPROM_BLOCK_SIZE,EEPROM_MODE_EFUSE);Signature · 1 line
2.51.0
Shayne Chen
reviewerPATCH 6/6 wifi: mt76: mt7996: fix issues with manually triggered radar detection
In reply to Shayne ChenFrom: StanleyYP Wang <[email protected]>
Disallow triggering radar detection on non-DFS channels to prevent paused TX queues from failing to resume, as a channel switch is not performed in this case.
--- .../wireless/mediatek/mt76/mt7996/debugfs.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +18 -4
@@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)#define RADAR_BACKGROUND 2struct mt7996_dev *dev = data;struct mt7996_phy *phy =mt7996_band_phy (dev,NL80211_BAND_5GHZ ); -int rdd_idx; +struct cfg80211_chan_def *chandef; +int rdd_idx, ret;if (!phy || !val || val >RADAR_BACKGROUND )return -EINVAL ; -if (val ==RADAR_BACKGROUND && !dev->rdd2_phy) { -dev_err (dev->mt76.dev,"Background radar is not enabled\n" ); -return -EINVAL ; +if (test_bit (MT76_SCANNING , &phy->mt76->state)) +return -EBUSY ; + +if (val ==RADAR_BACKGROUND ) { +if (!dev->rdd2_phy || !cfg80211_chandef_valid (&dev->rdd2_chandef)) { +dev_err (dev->mt76.dev,"Background radar is not enabled\n" ); +return -EINVAL ; + } + chandef = &dev->rdd2_chandef; + }else { + chandef = &phy->mt76->chandef; } rdd_idx =mt7996_get_rdd_idx (phy, val ==RADAR_BACKGROUND );
@@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)return -EINVAL ; } + ret =cfg80211_chandef_dfs_required (dev->mt76.hw->wiphy, chandef, +NL80211_IFTYPE_AP ); +if (ret <=0 ) +return ret; +return mt7996_mcu_rdd_cmd (dev,RDD_RADAR_EMULATE , rdd_idx,0 ); }
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerRe: [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection
Quoted 5 lines
From: StanleyYP Wang <[email protected]>
Disallow triggering radar detection on non-DFS channels to prevent paused TX queues from failing to resume, as a channel switch is not performed in this case.
I guess we are missing a Fixes tag here.
Quoted 21 lines
Signed-off-by StanleyYP Wang <[email protected]>Signed-off-by Shayne Chen <[email protected]>--- .../wireless/mediatek/mt76/mt7996/debugfs.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +2
-1@@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)#define RADAR_BACKGROUND 2struct mt7996_dev *dev = data;struct mt7996_phy *phy =mt7996_band_phy (dev,NL80211_BAND_5GHZ ); -int rdd_idx; +struct cfg80211_chan_def *chandef; +int rdd_idx, ret;if (!phy || !val || val >RADAR_BACKGROUND )return -EINVAL ;
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c mt7996_radar_trigger(void *data, u64 val) · line 240
Quoted 10 lines
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +6
-3-if (val ==RADAR_BACKGROUND && !dev->rdd2_phy) { -dev_err (dev->mt76.dev,"Background radar is not enabled\n" ); -return -EINVAL ; +if (test_bit (MT76_SCANNING , &phy->mt76->state)) +return -EBUSY ; + +if (val ==RADAR_BACKGROUND ) { +if (!dev->rdd2_phy || !cfg80211_chandef_valid (&dev->rdd2_chandef)) { +dev_err (dev->mt76.dev,"Background radar is not enabled\n" );
nit: I guess it is better to specify a different error message if rdd2_chandef is invalid.
Regards,
Lorenzo
Quoted 23 lines
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +10
-0+return -EINVAL ; + } + chandef = &dev->rdd2_chandef; + }else { + chandef = &phy->mt76->chandef; } rdd_idx =mt7996_get_rdd_idx (phy, val ==RADAR_BACKGROUND );@@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)return -EINVAL ; } + ret =cfg80211_chandef_dfs_required (dev->mt76.hw->wiphy, chandef, +NL80211_IFTYPE_AP ); +if (ret <=0 ) +return ret; +return mt7996_mcu_rdd_cmd (dev,RDD_RADAR_EMULATE , rdd_idx,0 ); }Signature · 1 line
2.51.0
Shayne Chen
reviewerRe: [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection
Quoted 43 lines · Lorenzo Bianconi
Quoted 7 lines
From: StanleyYP Wang <[email protected]>
Disallow triggering radar detection on non-DFS channels to prevent paused
TX queues from failing to resume, as a channel switch is not performed in
this case.I guess we are missing a Fixes tag here.
Quoted 33 lines
Signed-off-by StanleyYP Wang <[email protected]>Signed-off-by Shayne Chen <[email protected]>---
.../wireless/mediatek/mt76/mt7996/debugfs.c | 22
+++++++++++++++----1 file changed, 18 insertions(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +2
-1@@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val) #define RADAR_BACKGROUND 2 struct mt7996_dev *dev = data; struct mt7996_phy *phy = mt7996_band_phy(dev,NL80211_BAND_5GHZ ); -int rdd_idx; +struct cfg80211_chan_def *chandef; +int rdd_idx, ret;
if (!phy || !val || val >RADAR_BACKGROUND) return-EINVAL;drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +0
-2-if (val ==RADAR_BACKGROUND && !dev->rdd2_phy) { - dev_err(dev->mt76.dev, "Background radar is notenabled\n");
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +4
-1-return -EINVAL ; +if (test_bit (MT76_SCANNING , &phy->mt76->state)) +return -EBUSY ; + +if (val ==RADAR_BACKGROUND ) {
Quoted 9 lines
Quoted 4 lines
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +1
-0+ if (!dev->rdd2_phy ||!cfg80211_chandef_valid(&dev->rdd2_chandef)) {
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +1
-0+ dev_err(dev->mt76.dev, "Background radaris not enabled\n");
nit: I guess it is better to specify a different error message if
rdd2_chandef
is invalid.
Will split the error message in v2.
Thanks,
Shayne
Quoted 29 lines
Regards,
LorenzoQuoted 26 lines
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +5
-0+return -EINVAL ; + } + chandef = &dev->rdd2_chandef; + }else { + chandef = &phy->mt76->chandef;}
rdd_idx= mt7996_get_rdd_idx(phy, val ==RADAR_BACKGROUND);drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +0
-0@@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val) return -EINVAL; }drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +1
-0+ ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy,chandef,
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +4
-0+ NL80211_IFTYPE_AP); +if (ret <=0 ) +return ret; +return
mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx, 0);
}Signature · 1 line
2.51.0
Quoted 8 lines
From: Peter Chiu <[email protected]>
Use the correct helper to update specific bitfields instead of overwriting the entire register.
Fixes eedb427eb260 ("wifi: mt76: mt7996: Enable HW RRO for MT7992 chipset")Signed-off-by Peter Chiu <[email protected]>Signed-off-by Shayne Chen <[email protected]>
Quoted 35 lines
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 3 +-- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)drivers/net/wireless/mediatek/mt76/mt7996/init.c +1
-2@@ -873,8 +873,7 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev) } }else {/* set emul 3.0 function */ -mt76_wr (dev,MT_RRO_3_0_EMU_CONF , -MT_RRO_3_0_EMU_CONF_EN_MASK ); +mt76_set (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK );mt76_wr (dev,MT_RRO_ADDR_ARRAY_BASE0 , dev->wed_rro.addr_elem[0 ].phy_addr);drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1
-1@@ -2559,7 +2559,7 @@ void mt7996_mac_reset_work(struct work_struct *work)mt7996_dma_start (dev, false, false);if (!is_mt7996 (&dev->mt76) && dev->mt76.hwrro_mode ==MT76_HWRRO_V3 ) -mt76_wr (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK ); +mt76_set (dev,MT_RRO_3_0_EMU_CONF ,MT_RRO_3_0_EMU_CONF_EN_MASK );if (mtk_wed_device_active (&dev->mt76.mmio.wed)) { u32 wed_irq_mask = MT_INT_TX_DONE_BAND2 |Signature · 1 line
2.51.0