diff options
Diffstat (limited to 'net/mac80211/rc80211_simple.c')
-rw-r--r-- | net/mac80211/rc80211_simple.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index bcc541d4b95c..4f72fdca7f12 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c | |||
@@ -40,7 +40,7 @@ static void rate_control_rate_inc(struct ieee80211_local *local, | |||
40 | int i = sta->txrate_idx; | 40 | int i = sta->txrate_idx; |
41 | int maxrate; | 41 | int maxrate; |
42 | 42 | ||
43 | sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); | 43 | sdata = sta->sdata; |
44 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { | 44 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { |
45 | /* forced unicast rate - do not change STA rate */ | 45 | /* forced unicast rate - do not change STA rate */ |
46 | return; | 46 | return; |
@@ -70,7 +70,7 @@ static void rate_control_rate_dec(struct ieee80211_local *local, | |||
70 | struct ieee80211_supported_band *sband; | 70 | struct ieee80211_supported_band *sband; |
71 | int i = sta->txrate_idx; | 71 | int i = sta->txrate_idx; |
72 | 72 | ||
73 | sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); | 73 | sdata = sta->sdata; |
74 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { | 74 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { |
75 | /* forced unicast rate - do not change STA rate */ | 75 | /* forced unicast rate - do not change STA rate */ |
76 | return; | 76 | return; |
@@ -118,10 +118,12 @@ static void rate_control_simple_tx_status(void *priv, struct net_device *dev, | |||
118 | struct sta_info *sta; | 118 | struct sta_info *sta; |
119 | struct sta_rate_control *srctrl; | 119 | struct sta_rate_control *srctrl; |
120 | 120 | ||
121 | rcu_read_lock(); | ||
122 | |||
121 | sta = sta_info_get(local, hdr->addr1); | 123 | sta = sta_info_get(local, hdr->addr1); |
122 | 124 | ||
123 | if (!sta) | 125 | if (!sta) |
124 | return; | 126 | goto unlock; |
125 | 127 | ||
126 | srctrl = sta->rate_ctrl_priv; | 128 | srctrl = sta->rate_ctrl_priv; |
127 | srctrl->tx_num_xmit++; | 129 | srctrl->tx_num_xmit++; |
@@ -191,7 +193,8 @@ static void rate_control_simple_tx_status(void *priv, struct net_device *dev, | |||
191 | } | 193 | } |
192 | } | 194 | } |
193 | 195 | ||
194 | sta_info_put(sta); | 196 | unlock: |
197 | rcu_read_unlock(); | ||
195 | } | 198 | } |
196 | 199 | ||
197 | 200 | ||
@@ -208,6 +211,8 @@ rate_control_simple_get_rate(void *priv, struct net_device *dev, | |||
208 | int rateidx; | 211 | int rateidx; |
209 | u16 fc; | 212 | u16 fc; |
210 | 213 | ||
214 | rcu_read_lock(); | ||
215 | |||
211 | sta = sta_info_get(local, hdr->addr1); | 216 | sta = sta_info_get(local, hdr->addr1); |
212 | 217 | ||
213 | /* Send management frames and broadcast/multicast data using lowest | 218 | /* Send management frames and broadcast/multicast data using lowest |
@@ -216,8 +221,7 @@ rate_control_simple_get_rate(void *priv, struct net_device *dev, | |||
216 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | 221 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || |
217 | is_multicast_ether_addr(hdr->addr1) || !sta) { | 222 | is_multicast_ether_addr(hdr->addr1) || !sta) { |
218 | sel->rate = rate_lowest(local, sband, sta); | 223 | sel->rate = rate_lowest(local, sband, sta); |
219 | if (sta) | 224 | rcu_read_unlock(); |
220 | sta_info_put(sta); | ||
221 | return; | 225 | return; |
222 | } | 226 | } |
223 | 227 | ||
@@ -233,7 +237,7 @@ rate_control_simple_get_rate(void *priv, struct net_device *dev, | |||
233 | 237 | ||
234 | sta->last_txrate_idx = rateidx; | 238 | sta->last_txrate_idx = rateidx; |
235 | 239 | ||
236 | sta_info_put(sta); | 240 | rcu_read_unlock(); |
237 | 241 | ||
238 | sel->rate = &sband->bitrates[rateidx]; | 242 | sel->rate = &sband->bitrates[rateidx]; |
239 | } | 243 | } |