1 From: Ryder Lee <ryder.lee@mediatek.com>
2 Date: Fri, 28 May 2021 14:05:41 +0800
3 Subject: [PATCH] mac80211: call ieee80211_tx_h_rate_ctrl() when dequeue
5 Make ieee80211_tx_h_rate_ctrl() get called on dequeue to improve
6 performance since it reduces the turnaround time for rate control.
8 Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
11 --- a/net/mac80211/tx.c
12 +++ b/net/mac80211/tx.c
13 @@ -1778,8 +1778,6 @@ static int invoke_tx_handlers_early(stru
14 CALL_TXH(ieee80211_tx_h_ps_buf);
15 CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
16 CALL_TXH(ieee80211_tx_h_select_key);
17 - if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
18 - CALL_TXH(ieee80211_tx_h_rate_ctrl);
21 if (unlikely(res == TX_DROP)) {
22 @@ -1812,6 +1810,9 @@ static int invoke_tx_handlers_late(struc
26 + if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
27 + CALL_TXH(ieee80211_tx_h_rate_ctrl);
29 CALL_TXH(ieee80211_tx_h_michael_mic_add);
30 CALL_TXH(ieee80211_tx_h_sequence);
31 CALL_TXH(ieee80211_tx_h_fragment);
32 @@ -3382,15 +3383,21 @@ out:
33 * Can be called while the sta lock is held. Anything that can cause packets to
34 * be generated will cause deadlock!
36 -static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
37 - struct sta_info *sta, u8 pn_offs,
38 - struct ieee80211_key *key,
39 - struct sk_buff *skb)
40 +static ieee80211_tx_result
41 +ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
42 + struct sta_info *sta, u8 pn_offs,
43 + struct ieee80211_key *key,
44 + struct ieee80211_tx_data *tx)
46 + struct sk_buff *skb = tx->skb;
47 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
48 struct ieee80211_hdr *hdr = (void *)skb->data;
49 u8 tid = IEEE80211_NUM_TIDS;
51 + if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL) &&
52 + ieee80211_tx_h_rate_ctrl(tx) != TX_CONTINUE)
56 info->control.hw_key = &key->conf;
58 @@ -3439,6 +3446,8 @@ static void ieee80211_xmit_fast_finish(s
66 static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
67 @@ -3542,24 +3551,17 @@ static bool ieee80211_xmit_fast(struct i
69 tx.key = fast_tx->key;
71 - if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
73 - r = ieee80211_tx_h_rate_ctrl(&tx);
77 - if (r != TX_CONTINUE) {
84 if (ieee80211_queue_skb(local, sdata, sta, skb))
87 - ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs,
90 + r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs,
98 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
99 sdata = container_of(sdata->bss,
100 @@ -3670,8 +3672,12 @@ begin:
101 (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
102 pn_offs = ieee80211_hdrlen(hdr->frame_control);
104 - ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
106 + r = ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
108 + if (r != TX_CONTINUE) {
109 + ieee80211_free_txskb(&local->hw, skb);
113 if (invoke_tx_handlers_late(&tx))