| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From: Johannes Berg <johannes.berg@intel.com> |
| 2 | Date: Fri, 19 Mar 2021 23:28:01 +0100 |
| 3 | Subject: [PATCH] mac80211: don't apply flow control on management frames |
| 4 | |
| 5 | In some cases (depending on the driver, but it's true e.g. for |
| 6 | iwlwifi) we're using an internal TXQ for management packets, |
| 7 | mostly to simplify the code and to have a place to queue them. |
| 8 | However, it appears that in certain cases we can confuse the |
| 9 | code and management frames are dropped, which is certainly not |
| 10 | what we want. |
| 11 | |
| 12 | Short-circuit the processing of management frames. To keep the |
| 13 | impact minimal, only put them on the frags queue and check the |
| 14 | tid == management only for doing that and to skip the airtime |
| 15 | fairness checks, if applicable. |
| 16 | |
| 17 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| 18 | --- |
| 19 | |
| 20 | --- a/net/mac80211/tx.c |
| 21 | +++ b/net/mac80211/tx.c |
| 22 | @@ -5,7 +5,7 @@ |
| 23 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 24 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
| 25 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
| 26 | - * Copyright (C) 2018-2020 Intel Corporation |
| 27 | + * Copyright (C) 2018-2021 Intel Corporation |
| 28 | * |
| 29 | * Transmit and frame generation functions. |
| 30 | */ |
| 31 | @@ -1401,8 +1401,17 @@ static void ieee80211_txq_enqueue(struct |
| 32 | ieee80211_set_skb_enqueue_time(skb); |
| 33 | |
| 34 | spin_lock_bh(&fq->lock); |
| 35 | - fq_tin_enqueue(fq, tin, flow_idx, skb, |
| 36 | - fq_skb_free_func); |
| 37 | + /* |
| 38 | + * For management frames, don't really apply codel etc., |
| 39 | + * we don't want to apply any shaping or anything we just |
| 40 | + * want to simplify the driver API by having them on the |
| 41 | + * txqi. |
| 42 | + */ |
| 43 | + if (unlikely(txqi->txq.tid == IEEE80211_NUM_TIDS)) |
| 44 | + __skb_queue_tail(&txqi->frags, skb); |
| 45 | + else |
| 46 | + fq_tin_enqueue(fq, tin, flow_idx, skb, |
| 47 | + fq_skb_free_func); |
| 48 | spin_unlock_bh(&fq->lock); |
| 49 | } |
| 50 | |
| 51 | @@ -3878,6 +3887,9 @@ bool ieee80211_txq_airtime_check(struct |
| 52 | if (!txq->sta) |
| 53 | return true; |
| 54 | |
| 55 | + if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) |
| 56 | + return true; |
| 57 | + |
| 58 | sta = container_of(txq->sta, struct sta_info, sta); |
| 59 | if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < |
| 60 | sta->airtime[txq->ac].aql_limit_low) |