Skip to content

Commit 699cb58

Browse files
committed
mac80211: manage RX BA session offload without SKB queue
Instead of using the SKB queue with the fake pkt_type for the offloaded RX BA session management, also handle this with the normal aggregation state machine worker. This also makes the use of this more reliable since it gets rid of the allocation of the fake skb. Combined with the previous patch, this finally allows us to get rid of the pkt_type hack entirely, so do that as well. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a43e618 commit 699cb58

File tree

7 files changed

+46
-77
lines changed

7 files changed

+46
-77
lines changed

include/net/mac80211.h

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5452,6 +5452,9 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
54525452
*/
54535453
void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
54545454

5455+
void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, const u8 *addr,
5456+
unsigned int bit);
5457+
54555458
/**
54565459
* ieee80211_start_rx_ba_session_offl - start a Rx BA session
54575460
*
@@ -5466,8 +5469,13 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
54665469
* @addr: station mac address
54675470
* @tid: the rx tid
54685471
*/
5469-
void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
5470-
const u8 *addr, u16 tid);
5472+
static inline void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
5473+
const u8 *addr, u16 tid)
5474+
{
5475+
if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
5476+
return;
5477+
ieee80211_manage_rx_ba_offl(vif, addr, tid);
5478+
}
54715479

54725480
/**
54735481
* ieee80211_stop_rx_ba_session_offl - stop a Rx BA session
@@ -5483,8 +5491,13 @@ void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
54835491
* @addr: station mac address
54845492
* @tid: the rx tid
54855493
*/
5486-
void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
5487-
const u8 *addr, u16 tid);
5494+
static inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
5495+
const u8 *addr, u16 tid)
5496+
{
5497+
if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
5498+
return;
5499+
ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS);
5500+
}
54885501

54895502
/* Rate control API */
54905503

net/mac80211/agg-rx.c

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -449,44 +449,21 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
449449
buf_size, true, false);
450450
}
451451

452-
void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
453-
const u8 *addr, u16 tid)
452+
void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif,
453+
const u8 *addr, unsigned int bit)
454454
{
455455
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
456456
struct ieee80211_local *local = sdata->local;
457-
struct ieee80211_rx_agg *rx_agg;
458-
struct sk_buff *skb = dev_alloc_skb(0);
459-
460-
if (unlikely(!skb))
461-
return;
462-
463-
rx_agg = (struct ieee80211_rx_agg *) &skb->cb;
464-
memcpy(&rx_agg->addr, addr, ETH_ALEN);
465-
rx_agg->tid = tid;
466-
467-
skb->pkt_type = IEEE80211_SDATA_QUEUE_RX_AGG_START;
468-
skb_queue_tail(&sdata->skb_queue, skb);
469-
ieee80211_queue_work(&local->hw, &sdata->work);
470-
}
471-
EXPORT_SYMBOL(ieee80211_start_rx_ba_session_offl);
472-
473-
void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
474-
const u8 *addr, u16 tid)
475-
{
476-
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
477-
struct ieee80211_local *local = sdata->local;
478-
struct ieee80211_rx_agg *rx_agg;
479-
struct sk_buff *skb = dev_alloc_skb(0);
480-
481-
if (unlikely(!skb))
482-
return;
457+
struct sta_info *sta;
483458

484-
rx_agg = (struct ieee80211_rx_agg *) &skb->cb;
485-
memcpy(&rx_agg->addr, addr, ETH_ALEN);
486-
rx_agg->tid = tid;
459+
rcu_read_lock();
460+
sta = sta_info_get_bss(sdata, addr);
461+
if (!sta)
462+
goto unlock;
487463

488-
skb->pkt_type = IEEE80211_SDATA_QUEUE_RX_AGG_STOP;
489-
skb_queue_tail(&sdata->skb_queue, skb);
490-
ieee80211_queue_work(&local->hw, &sdata->work);
464+
set_bit(bit, sta->ampdu_mlme.tid_rx_manage_offl);
465+
ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
466+
unlock:
467+
rcu_read_unlock();
491468
}
492-
EXPORT_SYMBOL(ieee80211_stop_rx_ba_session_offl);
469+
EXPORT_SYMBOL(ieee80211_manage_rx_ba_offl);

net/mac80211/ht.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,18 @@ void ieee80211_ba_session_work(struct work_struct *work)
331331
sta, tid, WLAN_BACK_RECIPIENT,
332332
WLAN_REASON_UNSPECIFIED, true);
333333

334+
if (test_and_clear_bit(tid,
335+
sta->ampdu_mlme.tid_rx_manage_offl))
336+
__ieee80211_start_rx_ba_session(sta, 0, 0, 0, 1, tid,
337+
IEEE80211_MAX_AMPDU_BUF,
338+
false, true);
339+
340+
if (test_and_clear_bit(tid + IEEE80211_NUM_TIDS,
341+
sta->ampdu_mlme.tid_rx_manage_offl))
342+
___ieee80211_stop_rx_ba_session(
343+
sta, tid, WLAN_BACK_RECIPIENT,
344+
0, false);
345+
334346
spin_lock_bh(&sta->lock);
335347

336348
tid_tx = sta->ampdu_mlme.tid_start_tx[tid];

net/mac80211/ieee80211_i.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,6 @@ ieee80211_vif_get_shift(struct ieee80211_vif *vif)
10311031
return shift;
10321032
}
10331033

1034-
struct ieee80211_rx_agg {
1035-
u8 addr[ETH_ALEN];
1036-
u16 tid;
1037-
};
1038-
1039-
enum sdata_queue_type {
1040-
IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0,
1041-
IEEE80211_SDATA_QUEUE_RX_AGG_START = 3,
1042-
IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4,
1043-
};
1044-
10451034
enum {
10461035
IEEE80211_RX_MSG = 1,
10471036
IEEE80211_TX_STATUS_MSG = 2,

net/mac80211/iface.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,6 @@ static void ieee80211_iface_work(struct work_struct *work)
12371237
struct ieee80211_local *local = sdata->local;
12381238
struct sk_buff *skb;
12391239
struct sta_info *sta;
1240-
struct ieee80211_rx_agg *rx_agg;
12411240

12421241
if (!ieee80211_sdata_running(sdata))
12431242
return;
@@ -1252,28 +1251,8 @@ static void ieee80211_iface_work(struct work_struct *work)
12521251
while ((skb = skb_dequeue(&sdata->skb_queue))) {
12531252
struct ieee80211_mgmt *mgmt = (void *)skb->data;
12541253

1255-
if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
1256-
rx_agg = (void *)&skb->cb;
1257-
mutex_lock(&local->sta_mtx);
1258-
sta = sta_info_get_bss(sdata, rx_agg->addr);
1259-
if (sta)
1260-
__ieee80211_start_rx_ba_session(sta,
1261-
0, 0, 0, 1, rx_agg->tid,
1262-
IEEE80211_MAX_AMPDU_BUF,
1263-
false, true);
1264-
mutex_unlock(&local->sta_mtx);
1265-
} else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
1266-
rx_agg = (void *)&skb->cb;
1267-
mutex_lock(&local->sta_mtx);
1268-
sta = sta_info_get_bss(sdata, rx_agg->addr);
1269-
if (sta)
1270-
__ieee80211_stop_rx_ba_session(sta,
1271-
rx_agg->tid,
1272-
WLAN_BACK_RECIPIENT, 0,
1273-
false);
1274-
mutex_unlock(&local->sta_mtx);
1275-
} else if (ieee80211_is_action(mgmt->frame_control) &&
1276-
mgmt->u.action.category == WLAN_CATEGORY_BACK) {
1254+
if (ieee80211_is_action(mgmt->frame_control) &&
1255+
mgmt->u.action.category == WLAN_CATEGORY_BACK) {
12771256
int len = skb->len;
12781257

12791258
mutex_lock(&local->sta_mtx);

net/mac80211/rx.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,
237237
if (!skb)
238238
return;
239239

240-
skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
241240
skb_queue_tail(&sdata->skb_queue, skb);
242241
ieee80211_queue_work(&sdata->local->hw, &sdata->work);
243242
}
@@ -1217,7 +1216,6 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
12171216
/* if this mpdu is fragmented - terminate rx aggregation session */
12181217
sc = le16_to_cpu(hdr->seq_ctrl);
12191218
if (sc & IEEE80211_SCTL_FRAG) {
1220-
skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
12211219
skb_queue_tail(&rx->sdata->skb_queue, skb);
12221220
ieee80211_queue_work(&local->hw, &rx->sdata->work);
12231221
return;
@@ -3100,7 +3098,6 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
31003098
return RX_QUEUED;
31013099

31023100
queue:
3103-
rx->skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
31043101
skb_queue_tail(&sdata->skb_queue, rx->skb);
31053102
ieee80211_queue_work(&local->hw, &sdata->work);
31063103
if (rx->sta)
@@ -3246,7 +3243,6 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
32463243
}
32473244

32483245
/* queue up frame and kick off work to process it */
3249-
rx->skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
32503246
skb_queue_tail(&sdata->skb_queue, rx->skb);
32513247
ieee80211_queue_work(&rx->local->hw, &sdata->work);
32523248
if (rx->sta)

net/mac80211/sta_info.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ struct tid_ampdu_rx {
233233
* RX timer expired until the work for it runs
234234
* @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
235235
* driver requested to close until the work for it runs
236+
* @tid_rx_manage_offl: bitmap indicating which BA sessions were requested
237+
* to be treated as started/stopped due to offloading
236238
* @agg_session_valid: bitmap indicating which TID has a rx BA session open on
237239
* @unexpected_agg: bitmap indicating which TID already sent a delBA due to
238240
* unexpected aggregation related frames outside a session
@@ -250,6 +252,7 @@ struct sta_ampdu_mlme {
250252
u8 tid_rx_token[IEEE80211_NUM_TIDS];
251253
unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
252254
unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
255+
unsigned long tid_rx_manage_offl[BITS_TO_LONGS(2 * IEEE80211_NUM_TIDS)];
253256
unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
254257
unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
255258
/* tx */

0 commit comments

Comments
 (0)