Skip to contentSkip to conversation

wifi: rtw88: WARN only once in rtw_phy_get_tx_power_limit()

PATCH In review Bitterblue Smith 2 participants 4 messages Feb 6 – Mar 26 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: rtw88: WARN only once in rtw_phy_get_tx_power_limit()

This function WARNs when the wifi band, channel number, channel width, rate, or RF path are invalid. Two or three people have reported that it floods the kernel log with warnings because they try to switch to invalid channel numbers, like 130.

One warning is probably enough, so turn WARN into WARN_ONCE.

---
 drivers/net/wireless/realtek/rtw88/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +2 -2
index e2ac5c6fd500..2a3929561664 100644
@@ -2210,8 +2210,8 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
 	return power_limit;
 
 err:
-	WARN(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
-	     band, bw, rf_path, rate, channel);
+	WARN_ONCE(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
+		  band, bw, rf_path, rate, channel);
 	return (s8)rtwdev->chip->max_power_index;
 }
 
Signature · 1 line
2.52.0
maintainer
#1 lore raw
Quoted 8 lines · Bitterblue Smith

This function WARNs when the wifi band, channel number, channel width, rate, or RF path are invalid. Two or three people have reported that it floods the kernel log with warnings because they try to switch to invalid channel numbers, like 130.

One warning is probably enough, so turn WARN into WARN_ONCE.

As the issue says "invalid arguments, band=1, bw=2, path=1, rate=83, ch=130", I think it operates on bandwidth 80MHz and primary channel 130. But I don't see 20MHz primary channel, for example [1].

Can we stop using this channel at set_channel() ahead to avoid this error?

[1] https://en.wikipedia.org/wiki/List_of_WLAN_channels

Quoted 10 lines
---
 drivers/net/wireless/realtek/rtw88/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +0 -0
index e2ac5c6fd500..2a3929561664 100644

drivers/net/wireless/realtek/rtw88/phy.c static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band, · line 2215

Quoted 8 lines
drivers/net/wireless/realtek/rtw88/phy.c +2 -2
@@ -2210,8 +2210,8 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
        return power_limit;
 
 err:
-       WARN(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
-            band, bw, rf_path, rate, channel);
+       WARN_ONCE(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
+                 band, bw, rf_path, rate, channel);
        return (s8)rtwdev->chip->max_power_index;

I feel this will be a problem if max_power_index is adopted. The power is too high.

Quoted 4 lines
drivers/net/wireless/realtek/rtw88/phy.c +0 -1
 }
 
--

2.52.0

#2 lore raw
Quoted 10 lines · Ping-Ke Shih
Quoted 8 lines · Bitterblue Smith

This function WARNs when the wifi band, channel number, channel width, rate, or RF path are invalid. Two or three people have reported that it floods the kernel log with warnings because they try to switch to invalid channel numbers, like 130.

One warning is probably enough, so turn WARN into WARN_ONCE.

Quoted 8 lines

As the issue says "invalid arguments, band=1, bw=2, path=1, rate=83, ch=130", I think it operates on bandwidth 80MHz and primary channel 130. But I don't see 20MHz primary channel, for example [1].

Can we stop using this channel at set_channel() ahead to avoid this error?

[1] https://en.wikipedia.org/wiki/List_of_WLAN_channels

Is there a standard which says what channels are allowed?

Six weeks ago I asked people to test another patch which adds a check in rtw_set_channel() like you said, but no one replied. I guess I will send it as v2.

By the way, there is another patch related to this problem:

https://lore.kernel.org/linux-wireless/[email protected]/

Quoted 13 lines
Quoted 13 lines
---
 drivers/net/wireless/realtek/rtw88/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +0 -0
index e2ac5c6fd500..2a3929561664 100644
@@ -2210,8 +2210,8 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
        return power_limit;
 
Quoted 10 lines

drivers/net/wireless/realtek/rtw88/phy.c static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band, · line 2215

Quoted 6 lines
drivers/net/wireless/realtek/rtw88/phy.c +2 -2
 err:
-       WARN(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
-            band, bw, rf_path, rate, channel);
+       WARN_ONCE(1, "invalid arguments, band=%d, bw=%d, path=%d, rate=%d, ch=%d\n",
+                 band, bw, rf_path, rate, channel);
        return (s8)rtwdev->chip->max_power_index;

I feel this will be a problem if max_power_index is adopted. The power is too high.

I agree, it's a strange default. But I didn't touch that. :)

Quoted 5 lines
Quoted 4 lines
drivers/net/wireless/realtek/rtw88/phy.c +0 -1
 }
 
--

2.52.0

maintainer
#3 lore raw
Quoted 18 lines · Bitterblue Smith
Quoted 16 lines · Ping-Ke Shih
Quoted 8 lines · Bitterblue Smith

This function WARNs when the wifi band, channel number, channel width, rate, or RF path are invalid. Two or three people have reported that it floods the kernel log with warnings because they try to switch to invalid channel numbers, like 130.

One warning is probably enough, so turn WARN into WARN_ONCE.

As the issue says "invalid arguments, band=1, bw=2, path=1, rate=83, ch=130", I think it operates on bandwidth 80MHz and primary channel 130. But I don't see 20MHz primary channel, for example [1].

Can we stop using this channel at set_channel() ahead to avoid this error?

Quoted 8 lines
Quoted 2 lines

[1] https://en.wikipedia.org/wiki/List_of_WLAN_channels

Is there a standard which says what channels are allowed?

Six weeks ago I asked people to test another patch which adds a check in rtw_set_channel() like you said, but no one replied. I guess I will send it as v2.

We are working on a patch to stop this kind of channels. I'd send a RFC in coming week.

Quoted 6 lines

By the way, there is another patch related to this problem:

https://lore.kernel.org/linux-wireless/20260306-rtw88_channel130-v1-1-ff25a5
[email protected]/

I see.

Ping-Ke