104
104
spin_unlock_bh(&ar->tx_stats_lock);
107
/* needs rcu_read_lock */
108
static struct ieee80211_sta *__carl9170_get_tx_sta(struct ar9170 *ar,
111
struct _carl9170_tx_superframe *super = (void *) skb->data;
112
struct ieee80211_hdr *hdr = (void *) super->frame_data;
113
struct ieee80211_vif *vif;
116
vif_id = (super->s.misc & CARL9170_TX_SUPER_MISC_VIF_ID) >>
117
CARL9170_TX_SUPER_MISC_VIF_ID_S;
119
if (WARN_ON_ONCE(vif_id >= AR9170_MAX_VIRTUAL_MAC))
122
vif = rcu_dereference(ar->vif_priv[vif_id].vif);
127
* Normally we should use wrappers like ieee80211_get_DA to get
128
* the correct peer ieee80211_sta.
130
* But there is a problem with indirect traffic (broadcasts, or
131
* data which is designated for other stations) in station mode.
132
* The frame will be directed to the AP for distribution and not
133
* to the actual destination.
136
return ieee80211_find_sta(vif, hdr->addr1);
139
static void carl9170_tx_ps_unblock(struct ar9170 *ar, struct sk_buff *skb)
141
struct ieee80211_sta *sta;
142
struct carl9170_sta_info *sta_info;
145
sta = __carl9170_get_tx_sta(ar, skb);
149
sta_info = (struct carl9170_sta_info *) sta->drv_priv;
150
if (atomic_dec_return(&sta_info->pending_frames) == 0)
151
ieee80211_sta_block_awake(ar->hw, sta, false);
107
157
static void carl9170_tx_accounting_free(struct ar9170 *ar, struct sk_buff *skb)
109
struct ieee80211_tx_info *txinfo;
112
txinfo = IEEE80211_SKB_CB(skb);
113
161
queue = skb_get_queue_mapping(skb);
115
163
spin_lock_bh(&ar->tx_stats_lock);
330
379
struct _carl9170_tx_superframe *super = (void *) skb->data;
331
380
struct ieee80211_hdr *hdr = (void *) super->frame_data;
332
struct ieee80211_tx_info *tx_info;
333
struct carl9170_tx_info *ar_info;
381
struct ieee80211_sta *sta;
334
382
struct carl9170_sta_info *sta_info;
335
struct ieee80211_sta *sta;
336
383
struct carl9170_sta_tid *tid_info;
337
struct ieee80211_vif *vif;
341
386
if (!(txinfo->flags & IEEE80211_TX_CTL_AMPDU) ||
343
388
(!(super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_AGGR))))
346
tx_info = IEEE80211_SKB_CB(skb);
347
ar_info = (void *) tx_info->rate_driver_data;
349
vif_id = (super->s.misc & CARL9170_TX_SUPER_MISC_VIF_ID) >>
350
CARL9170_TX_SUPER_MISC_VIF_ID_S;
352
if (WARN_ON_ONCE(vif_id >= AR9170_MAX_VIRTUAL_MAC))
356
vif = rcu_dereference(ar->vif_priv[vif_id].vif);
361
* Normally we should use wrappers like ieee80211_get_DA to get
362
* the correct peer ieee80211_sta.
364
* But there is a problem with indirect traffic (broadcasts, or
365
* data which is designated for other stations) in station mode.
366
* The frame will be directed to the AP for distribution and not
367
* to the actual destination.
369
sta = ieee80211_find_sta(vif, hdr->addr1);
392
sta = __carl9170_get_tx_sta(ar, skb);
370
393
if (unlikely(!sta))
427
450
if (txinfo->flags & IEEE80211_TX_CTL_AMPDU)
428
451
carl9170_tx_status_process_ampdu(ar, skb, txinfo);
453
carl9170_tx_ps_unblock(ar, skb);
430
454
carl9170_tx_put_skb(skb);
540
564
struct sk_buff *skb;
541
565
struct ieee80211_tx_info *txinfo;
542
566
struct carl9170_tx_info *arinfo;
543
struct _carl9170_tx_superframe *super;
544
567
struct ieee80211_sta *sta;
545
struct ieee80211_vif *vif;
546
struct ieee80211_hdr *hdr;
550
570
list_for_each_entry_rcu(iter, &ar->tx_ampdu_list, list) {
562
582
msecs_to_jiffies(CARL9170_QUEUE_TIMEOUT)))
565
super = (void *) skb->data;
566
hdr = (void *) super->frame_data;
568
vif_id = (super->s.misc & CARL9170_TX_SUPER_MISC_VIF_ID) >>
569
CARL9170_TX_SUPER_MISC_VIF_ID_S;
571
if (WARN_ON(vif_id >= AR9170_MAX_VIRTUAL_MAC))
574
vif = rcu_dereference(ar->vif_priv[vif_id].vif);
578
sta = ieee80211_find_sta(vif, hdr->addr1);
585
sta = __carl9170_get_tx_sta(ar, skb);
579
586
if (WARN_ON(!sta))
1199
1204
arinfo = (void *) info->rate_driver_data;
1201
1206
arinfo->timeout = jiffies;
1204
* increase ref count to "2".
1205
* Ref counting is the easiest way to solve the race between
1206
* the the urb's completion routine: carl9170_tx_callback and
1207
* wlan tx status functions: carl9170_tx_status/janitor.
1209
carl9170_tx_get_skb(skb);
1228
1224
__carl9170_tx_process_status(ar, super->s.cookie, q);
1227
static bool carl9170_tx_ps_drop(struct ar9170 *ar, struct sk_buff *skb)
1229
struct ieee80211_sta *sta;
1230
struct carl9170_sta_info *sta_info;
1233
sta = __carl9170_get_tx_sta(ar, skb);
1237
sta_info = (void *) sta->drv_priv;
1238
if (unlikely(sta_info->sleeping)) {
1239
struct ieee80211_tx_info *tx_info;
1243
tx_info = IEEE80211_SKB_CB(skb);
1244
if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
1245
atomic_dec(&ar->tx_ampdu_upload);
1247
tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
1248
carl9170_tx_status(ar, skb, false);
1231
1257
static void carl9170_tx(struct ar9170 *ar)
1233
1259
struct sk_buff *skb;
1257
1286
skb_queue_tail(&ar->tx_status[q], skb);
1289
* increase ref count to "2".
1290
* Ref counting is the easiest way to solve the
1291
* race between the urb's completion routine:
1292
* carl9170_tx_callback
1293
* and wlan tx status functions:
1294
* carl9170_tx_status/janitor.
1296
carl9170_tx_get_skb(skb);
1259
1298
carl9170_usb_tx(ar, skb);
1260
1299
schedule_garbagecollector = true;
1368
1405
* all ressouces which are associated with the frame.
1409
struct carl9170_sta_info *stai = (void *) sta->drv_priv;
1410
atomic_inc(&stai->pending_frames);
1371
1413
if (info->flags & IEEE80211_TX_CTL_AMPDU) {
1372
1414
run = carl9170_tx_ampdu_queue(ar, sta, skb);