Skip to content

Commit 08a46c6

Browse files
nbd168jmberg-intel
authored andcommitted
mac80211: move A-MPDU session check from minstrel_ht to mac80211
This avoids calling back into tx handlers from within the rate control module. Preparation for deferring rate control until tx dequeue Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://lore.kernel.org/r/20210617163113.75815-1-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 358ae88 commit 08a46c6

File tree

3 files changed

+33
-27
lines changed

3 files changed

+33
-27
lines changed

include/net/mac80211.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6184,6 +6184,11 @@ enum rate_control_capabilities {
61846184
* otherwise the NSS difference doesn't bother us.
61856185
*/
61866186
RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0),
6187+
/**
6188+
* @RATE_CTRL_CAPA_AMPDU_TRIGGER:
6189+
* mac80211 should start A-MPDU sessions on tx
6190+
*/
6191+
RATE_CTRL_CAPA_AMPDU_TRIGGER = BIT(1),
61876192
};
61886193

61896194
struct rate_control_ops {

net/mac80211/rc80211_minstrel_ht.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,29 +1175,6 @@ minstrel_downgrade_rate(struct minstrel_ht_sta *mi, u16 *idx, bool primary)
11751175
}
11761176
}
11771177

1178-
static void
1179-
minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb)
1180-
{
1181-
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1182-
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
1183-
u16 tid;
1184-
1185-
if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO)
1186-
return;
1187-
1188-
if (unlikely(!ieee80211_is_data_qos(hdr->frame_control)))
1189-
return;
1190-
1191-
if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)))
1192-
return;
1193-
1194-
tid = ieee80211_get_tid(hdr);
1195-
if (likely(sta->ampdu_mlme.tid_tx[tid]))
1196-
return;
1197-
1198-
ieee80211_start_tx_ba_session(pubsta, tid, 0);
1199-
}
1200-
12011178
static void
12021179
minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband,
12031180
void *priv_sta, struct ieee80211_tx_status *st)
@@ -1502,10 +1479,6 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
15021479
struct minstrel_priv *mp = priv;
15031480
u16 sample_idx;
15041481

1505-
if (!(info->flags & IEEE80211_TX_CTL_AMPDU) &&
1506-
!minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_prob_rate)))
1507-
minstrel_aggr_check(sta, txrc->skb);
1508-
15091482
info->flags |= mi->tx_flags;
15101483

15111484
#ifdef CONFIG_MAC80211_DEBUGFS
@@ -1911,6 +1884,7 @@ static u32 minstrel_ht_get_expected_throughput(void *priv_sta)
19111884

19121885
static const struct rate_control_ops mac80211_minstrel_ht = {
19131886
.name = "minstrel_ht",
1887+
.capa = RATE_CTRL_CAPA_AMPDU_TRIGGER,
19141888
.tx_status_ext = minstrel_ht_tx_status,
19151889
.get_rate = minstrel_ht_get_rate,
19161890
.rate_init = minstrel_ht_rate_init,

net/mac80211/tx.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3949,6 +3949,29 @@ void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
39493949
}
39503950
EXPORT_SYMBOL(ieee80211_txq_schedule_start);
39513951

3952+
static void
3953+
ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
3954+
struct sta_info *sta,
3955+
struct sk_buff *skb)
3956+
{
3957+
struct rate_control_ref *ref = sdata->local->rate_ctrl;
3958+
u16 tid;
3959+
3960+
if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER))
3961+
return;
3962+
3963+
if (!sta || !sta->sta.ht_cap.ht_supported ||
3964+
!sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO ||
3965+
skb->protocol == sdata->control_port_protocol)
3966+
return;
3967+
3968+
tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
3969+
if (likely(sta->ampdu_mlme.tid_tx[tid]))
3970+
return;
3971+
3972+
ieee80211_start_tx_ba_session(&sta->sta, tid, 0);
3973+
}
3974+
39523975
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
39533976
struct net_device *dev,
39543977
u32 info_flags,
@@ -3979,6 +4002,8 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
39794002
skb_get_hash(skb);
39804003
}
39814004

4005+
ieee80211_aggr_check(sdata, sta, skb);
4006+
39824007
if (sta) {
39834008
struct ieee80211_fast_tx *fast_tx;
39844009

@@ -4242,6 +4267,8 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
42424267

42434268
memset(info, 0, sizeof(*info));
42444269

4270+
ieee80211_aggr_check(sdata, sta, skb);
4271+
42454272
tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
42464273
tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
42474274
if (tid_tx) {

0 commit comments

Comments
 (0)