Skip to content
Snippets Groups Projects
Unverified Commit 5d5b8f01 authored by David Bauer's avatar David Bauer Committed by GitHub
Browse files

mac80211: update broadcast AQL patch (#3237)

parent 5388eb15
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
diff --git a/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch b/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c26899969f5a
index 0000000000000000000000000000000000000000..5f6754e5024f90f7ba6833c3702fe3ce425c50bb
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch
@@ -0,0 +1,226 @@
@@ -0,0 +1,302 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Fri, 9 Feb 2024 19:43:40 +0100
+Subject: [PATCH] mac80211: add AQL support for broadcast packets
......@@ -110,48 +110,48 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+ spin_lock_init(&local->active_txq_lock[i]);
+--- a/net/mac80211/sta_info.c
++++ b/net/mac80211/sta_info.c
+@@ -2166,28 +2166,27 @@ void ieee80211_sta_update_pending_airtim
+@@ -2164,13 +2164,28 @@ EXPORT_SYMBOL(ieee80211_sta_recalc_aggre
+
+ void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local,
+ struct sta_info *sta, u8 ac,
+ u16 tx_airtime, bool tx_completed)
+- u16 tx_airtime, bool tx_completed)
++ u16 tx_airtime, bool tx_completed,
++ bool mcast)
+ {
++ atomic_t *counter;
+ int tx_pending;
+
+ if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL))
+ return;
+
+- if (!tx_completed) {
+- if (sta)
+- atomic_add(tx_airtime,
+- &sta->airtime[ac].aql_tx_pending);
++ if (sta)
++ counter = &sta->airtime[ac].aql_tx_pending;
++ else
++ counter = &local->aql_bc_pending_airtime;
+
++ if (mcast) {
++ if (!tx_completed) {
++ atomic_add(tx_airtime, counter);
+ atomic_add(tx_airtime, &local->aql_total_pending_airtime);
+ atomic_add(tx_airtime, &local->aql_ac_pending_airtime[ac]);
+ return;
+ }
+
+- if (sta) {
+- tx_pending = atomic_sub_return(tx_airtime,
+- &sta->airtime[ac].aql_tx_pending);
+- if (tx_pending < 0)
+- atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending,
+- tx_pending, 0);
+- }
++ tx_pending = atomic_sub_return(tx_airtime, counter);
++ atomic_add(tx_airtime, &local->aql_bc_pending_airtime);
++ return;
++ }
++
++ tx_pending = atomic_sub_return(tx_airtime,
++ &local->aql_bc_pending_airtime);
++ if (tx_pending < 0)
++ atomic_cmpxchg(counter, tx_pending, 0);
+
+ atomic_sub(tx_airtime, &local->aql_total_pending_airtime);
+ tx_pending = atomic_sub_return(tx_airtime,
++ atomic_cmpxchg(&local->aql_bc_pending_airtime,
++ tx_pending, 0);
++ return;
++ }
++
+ if (!tx_completed) {
+ if (sta)
+ atomic_add(tx_airtime,
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -3957,9 +3957,8 @@ begin:
+@@ -2553,7 +2553,7 @@ static u16 ieee80211_store_ack_skb(struc
+
+ spin_lock_irqsave(&local->ack_status_lock, flags);
+ id = idr_alloc(&local->ack_status_frames, ack_skb,
+- 1, 0x2000, GFP_ATOMIC);
++ 1, 0x1000, GFP_ATOMIC);
+ spin_unlock_irqrestore(&local->ack_status_lock, flags);
+
+ if (id >= 0) {
+@@ -3957,20 +3957,20 @@ begin:
+ encap_out:
+ IEEE80211_SKB_CB(skb)->control.vif = vif;
+
......@@ -163,7 +163,26 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+ u32 airtime;
+
+ airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta,
+@@ -4025,6 +4024,7 @@ struct ieee80211_txq *ieee80211_next_txq
+ skb->len, ampdu);
+- if (airtime) {
+- airtime = ieee80211_info_set_tx_time_est(info, airtime);
+- ieee80211_sta_update_pending_airtime(local, tx.sta,
+- txq->ac,
+- airtime,
+- false);
+- }
++ if (!airtime)
++ return skb;
++
++ airtime = ieee80211_info_set_tx_time_est(info, airtime);
++ info->tx_time_mc = !tx.sta;
++ ieee80211_sta_update_pending_airtime(local, tx.sta, txq->ac,
++ airtime, false,
++ info->tx_time_mc);
+ }
+
+ return skb;
+@@ -4025,6 +4025,7 @@ struct ieee80211_txq *ieee80211_next_txq
+ struct ieee80211_txq *ret = NULL;
+ struct txq_info *txqi = NULL, *head = NULL;
+ bool found_eligible_txq = false;
......@@ -171,7 +190,7 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+
+ spin_lock_bh(&local->active_txq_lock[ac]);
+
+@@ -4048,26 +4048,26 @@ struct ieee80211_txq *ieee80211_next_txq
+@@ -4048,26 +4049,26 @@ struct ieee80211_txq *ieee80211_next_txq
+ if (!head)
+ head = txqi;
+
......@@ -210,7 +229,7 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+ if (txqi->schedule_round == local->schedule_round[ac])
+ goto out;
+
+@@ -4132,7 +4132,8 @@ bool ieee80211_txq_airtime_check(struct
+@@ -4132,7 +4133,8 @@ bool ieee80211_txq_airtime_check(struct
+ return true;
+
+ if (!txq->sta)
......@@ -220,7 +239,7 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+
+ if (unlikely(txq->tid == IEEE80211_NUM_TIDS))
+ return true;
+@@ -4181,15 +4182,15 @@ bool ieee80211_txq_may_transmit(struct i
+@@ -4181,15 +4183,15 @@ bool ieee80211_txq_may_transmit(struct i
+
+ spin_lock_bh(&local->active_txq_lock[ac]);
+
......@@ -239,3 +258,60 @@ index 0000000000000000000000000000000000000000..9095f4916f1a80fee004bbef4d37c268
+ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac],
+ schedule_order) {
+ if (iter == txqi)
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -1092,6 +1092,7 @@ ieee80211_rate_get_vht_nss(const struct
+ * link the frame will be transmitted on
+ * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
+ * @ack_frame_id: internal frame ID for TX status, used internally
++ * @tx_time_mc: TX time is for a multicast packet
+ * @tx_time_est: TX time estimate in units of 4us, used internally
+ * @control: union part for control data
+ * @control.rates: TX rates array to try
+@@ -1131,8 +1132,9 @@ struct ieee80211_tx_info {
+ /* common information */
+ u32 flags;
+ u32 band:3,
+- ack_frame_id:13,
++ ack_frame_id:12,
+ hw_queue:4,
++ tx_time_mc:1,
+ tx_time_est:10;
+ /* 2 free bits */
+
+--- a/net/mac80211/sta_info.h
++++ b/net/mac80211/sta_info.h
+@@ -147,7 +147,8 @@ struct airtime_info {
+
+ void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local,
+ struct sta_info *sta, u8 ac,
+- u16 tx_airtime, bool tx_completed);
++ u16 tx_airtime, bool tx_completed,
++ bool mcast);
+
+ struct sta_info;
+
+--- a/net/mac80211/status.c
++++ b/net/mac80211/status.c
+@@ -716,7 +716,7 @@ static void ieee80211_report_used_skb(st
+ ieee80211_sta_update_pending_airtime(local, sta,
+ skb_get_queue_mapping(skb),
+ tx_time_est,
+- true);
++ true, info->tx_time_mc);
+ rcu_read_unlock();
+ }
+
+@@ -1127,10 +1127,11 @@ void ieee80211_tx_status_ext(struct ieee
+ /* Do this here to avoid the expensive lookup of the sta
+ * in ieee80211_report_used_skb().
+ */
++ bool mcast = IEEE80211_SKB_CB(skb)->tx_time_mc;
+ ieee80211_sta_update_pending_airtime(local, sta,
+ skb_get_queue_mapping(skb),
+ tx_time_est,
+- true);
++ true, mcast);
+ ieee80211_info_set_tx_time_est(IEEE80211_SKB_CB(skb), 0);
+ }
+
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment