diff mbox series

mac80211: correct legacy rates check in ieee80211_calc_rx_airtime

Message ID 20220308021645.16272-1-MeiChia.Chiu@mediatek.com
State New
Headers show
Series mac80211: correct legacy rates check in ieee80211_calc_rx_airtime | expand

Commit Message

MeiChia Chiu March 8, 2022, 2:16 a.m. UTC
There are no legacy rates on 60GHz or sub-1Ghz band, so modify the check.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
---
 net/mac80211/airtime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jeff Johnson March 8, 2022, 11:59 p.m. UTC | #1
On 3/7/2022 6:16 PM, MeiChia Chiu wrote:
> There are no legacy rates on 60GHz or sub-1Ghz band, so modify the check.

nit: s/Ghz/GHz/ here and in the code comment

> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
> ---
>   net/mac80211/airtime.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c
> index 26d2f8ba7029..c0e58eb7c7fb 100644
> --- a/net/mac80211/airtime.c
> +++ b/net/mac80211/airtime.c
> @@ -477,7 +477,9 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
>   		bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
>   		bool cck;
>   
> -		if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
> +		/* on 60GHz or sub-1Ghz band, there are no legacy rates */
> +		if (WARN_ON_ONCE(status->band == NL80211_BAND_60GHZ ||
> +				 status->band == NL80211_BAND_S1GHZ))
>   			return 0;
>   
>   		sband = hw->wiphy->bands[status->band];
diff mbox series

Patch

diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c
index 26d2f8ba7029..c0e58eb7c7fb 100644
--- a/net/mac80211/airtime.c
+++ b/net/mac80211/airtime.c
@@ -477,7 +477,9 @@  u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
 		bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
 		bool cck;
 
-		if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
+		/* on 60GHz or sub-1Ghz band, there are no legacy rates */
+		if (WARN_ON_ONCE(status->band == NL80211_BAND_60GHZ ||
+				 status->band == NL80211_BAND_S1GHZ))
 			return 0;
 
 		sband = hw->wiphy->bands[status->band];