hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/net/fq_impl.h
....@@ -1,7 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2016 Qualcomm Atheros, Inc
3
- *
4
- * GPL v2
54 *
65 * Based on net/sched/sch_fq_codel.c
76 */
....@@ -107,21 +106,23 @@
107106 return skb;
108107 }
109108
109
+static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
110
+{
111
+ u32 hash = skb_get_hash(skb);
112
+
113
+ return reciprocal_scale(hash, fq->flows_cnt);
114
+}
115
+
110116 static struct fq_flow *fq_flow_classify(struct fq *fq,
111
- struct fq_tin *tin,
117
+ struct fq_tin *tin, u32 idx,
112118 struct sk_buff *skb,
113119 fq_flow_get_default_t get_default_func)
114120 {
115121 struct fq_flow *flow;
116
- u32 hash;
117
- u32 idx;
118122
119123 lockdep_assert_held(&fq->lock);
120124
121
- hash = skb_get_hash_perturb(skb, &fq->perturbation);
122
- idx = reciprocal_scale(hash, fq->flows_cnt);
123125 flow = &fq->flows[idx];
124
-
125126 if (flow->tin && flow->tin != tin) {
126127 flow = get_default_func(fq, tin, idx, skb);
127128 tin->collisions++;
....@@ -153,7 +154,7 @@
153154 }
154155
155156 static void fq_tin_enqueue(struct fq *fq,
156
- struct fq_tin *tin,
157
+ struct fq_tin *tin, u32 idx,
157158 struct sk_buff *skb,
158159 fq_skb_free_t free_func,
159160 fq_flow_get_default_t get_default_func)
....@@ -163,7 +164,7 @@
163164
164165 lockdep_assert_held(&fq->lock);
165166
166
- flow = fq_flow_classify(fq, tin, skb, get_default_func);
167
+ flow = fq_flow_classify(fq, tin, idx, skb, get_default_func);
167168
168169 flow->tin = tin;
169170 flow->backlog += skb->len;
....@@ -307,7 +308,6 @@
307308 INIT_LIST_HEAD(&fq->backlogs);
308309 spin_lock_init(&fq->lock);
309310 fq->flows_cnt = max_t(u32, flows_cnt, 1);
310
- get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
311311 fq->quantum = 300;
312312 fq->limit = 8192;
313313 fq->memory_limit = 16 << 20; /* 16 MBytes */