1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 25 Nov 2020 18:09:10 +0100
3 Subject: [PATCH] net/fq_impl: drop get_default_func, move default flow to
6 Simplifies the code and prepares for a rework of scanning for flows on
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 --- a/include/net/fq.h
13 +++ b/include/net/fq.h
14 @@ -47,6 +47,7 @@ struct fq_flow {
16 struct list_head new_flows;
17 struct list_head old_flows;
18 + struct fq_flow default_flow;
22 --- a/include/net/fq_impl.h
23 +++ b/include/net/fq_impl.h
24 @@ -151,8 +151,7 @@ static u32 fq_flow_idx(struct fq *fq, st
26 static struct fq_flow *fq_flow_classify(struct fq *fq,
27 struct fq_tin *tin, u32 idx,
28 - struct sk_buff *skb,
29 - fq_flow_get_default_t get_default_func)
30 + struct sk_buff *skb)
34 @@ -160,7 +159,7 @@ static struct fq_flow *fq_flow_classify(
36 flow = &fq->flows[idx];
37 if (flow->tin && flow->tin != tin) {
38 - flow = get_default_func(fq, tin, idx, skb);
39 + flow = &tin->default_flow;
43 @@ -192,15 +191,14 @@ static void fq_recalc_backlog(struct fq
44 static void fq_tin_enqueue(struct fq *fq,
45 struct fq_tin *tin, u32 idx,
47 - fq_skb_free_t free_func,
48 - fq_flow_get_default_t get_default_func)
49 + fq_skb_free_t free_func)
54 lockdep_assert_held(&fq->lock);
56 - flow = fq_flow_classify(fq, tin, idx, skb, get_default_func);
57 + flow = fq_flow_classify(fq, tin, idx, skb);
60 flow->backlog += skb->len;
61 @@ -331,6 +329,7 @@ static void fq_tin_init(struct fq_tin *t
63 INIT_LIST_HEAD(&tin->new_flows);
64 INIT_LIST_HEAD(&tin->old_flows);
65 + fq_flow_init(&tin->default_flow);
68 static int fq_init(struct fq *fq, int flows_cnt)
69 --- a/net/mac80211/ieee80211_i.h
70 +++ b/net/mac80211/ieee80211_i.h
71 @@ -846,7 +846,6 @@ enum txq_info_flags {
75 - struct fq_flow def_flow;
76 struct codel_vars def_cvars;
77 struct codel_stats cstats;
78 struct sk_buff_head frags;
79 --- a/net/mac80211/tx.c
80 +++ b/net/mac80211/tx.c
81 @@ -1322,7 +1322,7 @@ static struct sk_buff *codel_dequeue_fun
84 if (cvars == &txqi->def_cvars)
85 - flow = &txqi->def_flow;
86 + flow = &txqi->tin.default_flow;
88 flow = &fq->flows[cvars - local->cvars];
90 @@ -1365,7 +1365,7 @@ static struct sk_buff *fq_tin_dequeue_fu
91 cparams = &local->cparams;
94 - if (flow == &txqi->def_flow)
95 + if (flow == &tin->default_flow)
96 cvars = &txqi->def_cvars;
98 cvars = &local->cvars[flow - fq->flows];
99 @@ -1392,17 +1392,6 @@ static void fq_skb_free_func(struct fq *
100 ieee80211_free_txskb(&local->hw, skb);
103 -static struct fq_flow *fq_flow_get_default_func(struct fq *fq,
104 - struct fq_tin *tin,
106 - struct sk_buff *skb)
108 - struct txq_info *txqi;
110 - txqi = container_of(tin, struct txq_info, tin);
111 - return &txqi->def_flow;
114 static void ieee80211_txq_enqueue(struct ieee80211_local *local,
115 struct txq_info *txqi,
117 @@ -1415,8 +1404,7 @@ static void ieee80211_txq_enqueue(struct
119 spin_lock_bh(&fq->lock);
120 fq_tin_enqueue(fq, tin, flow_idx, skb,
122 - fq_flow_get_default_func);
124 spin_unlock_bh(&fq->lock);
127 @@ -1459,7 +1447,6 @@ void ieee80211_txq_init(struct ieee80211
128 struct txq_info *txqi, int tid)
130 fq_tin_init(&txqi->tin);
131 - fq_flow_init(&txqi->def_flow);
132 codel_vars_init(&txqi->def_cvars);
133 codel_stats_init(&txqi->cstats);
134 __skb_queue_head_init(&txqi->frags);
135 @@ -3310,8 +3297,7 @@ static bool ieee80211_amsdu_aggregate(st
139 - flow = fq_flow_classify(fq, tin, flow_idx, skb,
140 - fq_flow_get_default_func);
141 + flow = fq_flow_classify(fq, tin, flow_idx, skb);
142 head = skb_peek_tail(&flow->queue);
143 if (!head || skb_is_gso(head))