kernel: add missing config symbols for 4.9
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch
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
6 Makes the code a bit more efficient
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/tx.c
12 +++ b/net/mac80211/tx.c
13 @@ -63,6 +63,10 @@ static __le16 ieee80211_duration(struct
14 struct ieee80211_chanctx_conf *chanctx_conf;
15 u32 rate_flags = 0;
16
17 + /* assume HW handles this */
18 + if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
19 + return 0;
20 +
21 rcu_read_lock();
22 chanctx_conf = rcu_dereference(tx->sdata->vif.chanctx_conf);
23 if (chanctx_conf) {
24 @@ -71,10 +75,6 @@ static __le16 ieee80211_duration(struct
25 }
26 rcu_read_unlock();
27
28 - /* assume HW handles this */
29 - if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
30 - return 0;
31 -
32 /* uh huh? */
33 if (WARN_ON_ONCE(tx->rate.idx < 0))
34 return 0;