Skip to contentSkip to conversation

mac80211: correct legacy rates check in ieee80211_calc_rx_airtime

PATCH In review MeiChia Chiu 2 participants 2 messages Mar 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: correct legacy rates check in ieee80211_calc_rx_airtime

There are no legacy rates on 60GHz or sub-1Ghz band, so modify the check.

---
 net/mac80211/airtime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/airtime.c +3 -1
index 26d2f8ba7029..c0e58eb7c7fb 100644
@@ -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];
Signature · 1 line
2.18.0
#1 lore raw
Quoted 1 line · MeiChia Chiu

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

Quoted 12 lines
---
  net/mac80211/airtime.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/airtime.c +0 -0
index 26d2f8ba7029..c0e58eb7c7fb 100644

net/mac80211/airtime.c u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, · line 485

Quoted 10 lines
net/mac80211/airtime.c +3 -1
@@ -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];

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek