337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch 919 B

12345678910111213141516171819202122232425262728293031323334
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 14 Dec 2016 20:12:25 +0100
  3. Subject: [PATCH] mac80211: check for MCS in ieee80211_duration before fetching
  4. chanctx
  5. Makes the code a bit more efficient
  6. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7. ---
  8. --- a/net/mac80211/tx.c
  9. +++ b/net/mac80211/tx.c
  10. @@ -63,6 +63,10 @@ static __le16 ieee80211_duration(struct
  11. struct ieee80211_chanctx_conf *chanctx_conf;
  12. u32 rate_flags = 0;
  13. + /* assume HW handles this */
  14. + if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
  15. + return 0;
  16. +
  17. rcu_read_lock();
  18. chanctx_conf = rcu_dereference(tx->sdata->vif.chanctx_conf);
  19. if (chanctx_conf) {
  20. @@ -71,10 +75,6 @@ static __le16 ieee80211_duration(struct
  21. }
  22. rcu_read_unlock();
  23. - /* assume HW handles this */
  24. - if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
  25. - return 0;
  26. -
  27. /* uh huh? */
  28. if (WARN_ON_ONCE(tx->rate.idx < 0))
  29. return 0;