summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-12-14 22:46:57 +0300
committerJohannes Berg <johannes.berg@intel.com>2016-12-15 13:07:52 +0300
commit95cd470c75a8822d35fa82a1b276d47da37229d1 (patch)
treed26a2e506e850d38e913c05d5ad437f52ca6e3fc /net
parent70550df2d354f13ae0544f12aa14b79f094f0de2 (diff)
downloadlinux-95cd470c75a8822d35fa82a1b276d47da37229d1.tar.xz
mac80211: check for MCS in ieee80211_duration before fetching chanctx
Makes the code a bit more efficient Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/tx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 058652d000d9..4dea18be385c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -64,6 +64,10 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
struct ieee80211_chanctx_conf *chanctx_conf;
u32 rate_flags = 0;
+ /* assume HW handles this */
+ if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
+ return 0;
+
rcu_read_lock();
chanctx_conf = rcu_dereference(tx->sdata->vif.chanctx_conf);
if (chanctx_conf) {
@@ -72,10 +76,6 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
}
rcu_read_unlock();
- /* assume HW handles this */
- if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
- return 0;
-
/* uh huh? */
if (WARN_ON_ONCE(tx->rate.idx < 0))
return 0;