diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_tx.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_tx.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c index 00af065c77c2..75f532706332 100644 --- a/drivers/net/wireless/wl12xx/wl1271_tx.c +++ b/drivers/net/wireless/wl12xx/wl1271_tx.c | |||
@@ -121,6 +121,11 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
121 | pad = pad - skb->len; | 121 | pad = pad - skb->len; |
122 | tx_attr |= pad << TX_HW_ATTR_OFST_LAST_WORD_PAD; | 122 | tx_attr |= pad << TX_HW_ATTR_OFST_LAST_WORD_PAD; |
123 | 123 | ||
124 | /* if the packets are destined for AP (have a STA entry) send them | ||
125 | with AP rate policies, otherwise use default basic rates */ | ||
126 | if (control->control.sta) | ||
127 | tx_attr |= ACX_TX_AP_FULL_RATE << TX_HW_ATTR_OFST_RATE_POLICY; | ||
128 | |||
124 | desc->tx_attr = cpu_to_le16(tx_attr); | 129 | desc->tx_attr = cpu_to_le16(tx_attr); |
125 | 130 | ||
126 | wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad); | 131 | wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad); |
@@ -214,18 +219,50 @@ static int wl1271_tx_frame(struct wl1271 *wl, struct sk_buff *skb) | |||
214 | return ret; | 219 | return ret; |
215 | } | 220 | } |
216 | 221 | ||
222 | static u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set) | ||
223 | { | ||
224 | struct ieee80211_supported_band *band; | ||
225 | u32 enabled_rates = 0; | ||
226 | int bit; | ||
227 | |||
228 | band = wl->hw->wiphy->bands[wl->band]; | ||
229 | for (bit = 0; bit < band->n_bitrates; bit++) { | ||
230 | if (rate_set & 0x1) | ||
231 | enabled_rates |= band->bitrates[bit].hw_value; | ||
232 | rate_set >>= 1; | ||
233 | } | ||
234 | |||
235 | return enabled_rates; | ||
236 | } | ||
237 | |||
217 | void wl1271_tx_work(struct work_struct *work) | 238 | void wl1271_tx_work(struct work_struct *work) |
218 | { | 239 | { |
219 | struct wl1271 *wl = container_of(work, struct wl1271, tx_work); | 240 | struct wl1271 *wl = container_of(work, struct wl1271, tx_work); |
220 | struct sk_buff *skb; | 241 | struct sk_buff *skb; |
221 | bool woken_up = false; | 242 | bool woken_up = false; |
243 | u32 sta_rates = 0; | ||
222 | int ret; | 244 | int ret; |
223 | 245 | ||
246 | /* check if the rates supported by the AP have changed */ | ||
247 | if (unlikely(test_and_clear_bit(WL1271_FLAG_STA_RATES_CHANGED, | ||
248 | &wl->flags))) { | ||
249 | unsigned long flags; | ||
250 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
251 | sta_rates = wl->sta_rate_set; | ||
252 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
253 | } | ||
254 | |||
224 | mutex_lock(&wl->mutex); | 255 | mutex_lock(&wl->mutex); |
225 | 256 | ||
226 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 257 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
227 | goto out; | 258 | goto out; |
228 | 259 | ||
260 | /* if rates have changed, re-configure the rate policy */ | ||
261 | if (unlikely(sta_rates)) { | ||
262 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, sta_rates); | ||
263 | wl1271_acx_rate_policies(wl); | ||
264 | } | ||
265 | |||
229 | while ((skb = skb_dequeue(&wl->tx_queue))) { | 266 | while ((skb = skb_dequeue(&wl->tx_queue))) { |
230 | if (!woken_up) { | 267 | if (!woken_up) { |
231 | ret = wl1271_ps_elp_wakeup(wl, false); | 268 | ret = wl1271_ps_elp_wakeup(wl, false); |