public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7915: prevent unexpected nss setting from eeprom
@ 2022-10-11  2:03 Ryder Lee
  2022-10-11  7:35 ` Lorenzo Bianconi
  0 siblings, 1 reply; 2+ messages in thread
From: Ryder Lee @ 2022-10-11  2:03 UTC (permalink / raw)
  To: Felix Fietkau, linux-wireless
  Cc: Lorenzo Bianconi, Shayne Chen, Evelyn Tsai, linux-mediatek,
	Ryder Lee

Add a check to prevent unexpected nss configuration from eeprom.

Fixes: 4d8053df67c5 ("wifi: mt76: mt7915: rework eeprom tx paths and streams init")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
index e2482c65d639..6c5155223087 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
@@ -191,7 +191,6 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
 		path = 4;
 
 	/* read tx/rx stream */
-	nss = path;
 	if (dev->dbdc_support) {
 		if (is_mt7915(&dev->mt76)) {
 			nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0,
@@ -206,6 +205,11 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
 
 		if (!is_mt7986(&dev->mt76))
 			nss_max = 2;
+
+		if (!nss)
+			nss = nss_max;
+	} else {
+		nss = path;
 	}
 
 	nss = min_t(u8, min_t(u8, nss_max, nss), path);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: mt76: mt7915: prevent unexpected nss setting from eeprom
  2022-10-11  2:03 [PATCH] wifi: mt76: mt7915: prevent unexpected nss setting from eeprom Ryder Lee
@ 2022-10-11  7:35 ` Lorenzo Bianconi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2022-10-11  7:35 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Felix Fietkau, linux-wireless, Lorenzo Bianconi, Shayne Chen,
	Evelyn Tsai, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

> Add a check to prevent unexpected nss configuration from eeprom.

I am wondering why we need to add a check for this particular field. Is it a
well-known problem?

Regards,
Lorenzo

> 
> Fixes: 4d8053df67c5 ("wifi: mt76: mt7915: rework eeprom tx paths and streams init")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> index e2482c65d639..6c5155223087 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> @@ -191,7 +191,6 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
>  		path = 4;
>  
>  	/* read tx/rx stream */
> -	nss = path;
>  	if (dev->dbdc_support) {
>  		if (is_mt7915(&dev->mt76)) {
>  			nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0,
> @@ -206,6 +205,11 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
>  
>  		if (!is_mt7986(&dev->mt76))
>  			nss_max = 2;
> +
> +		if (!nss)
> +			nss = nss_max;
> +	} else {
> +		nss = path;
>  	}
>  
>  	nss = min_t(u8, min_t(u8, nss_max, nss), path);
> -- 
> 2.36.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-11  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11  2:03 [PATCH] wifi: mt76: mt7915: prevent unexpected nss setting from eeprom Ryder Lee
2022-10-11  7:35 ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox