Skip to content

Commit 22542c2

Browse files
authored
Update SFQ parameters for flow management
1 parent a1bfc88 commit 22542c2

1 file changed

Lines changed: 47 additions & 6 deletions

File tree

patch/cp/sfq.patch

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
--- a/net/sched/sch_sfq.c 2024-12-09 16:55:55.000000000 +0000
2-
+++ b/net/sched/sch_sfq.c 2025-01-03 13:22:02.510816133 +0000
1+
--- a/net/sched/sch_sfq.c 2026-06-14 01:11:03.351041400 +0800
2+
+++ b/net/sched/sch_sfq.c 2026-06-14 01:15:48.262088400 +0800
33
@@ -71,11 +71,11 @@
44

55
It is easy to increase these values, but not in flight. */
66

77
-#define SFQ_MAX_DEPTH 127 /* max number of packets per flow */
88
-#define SFQ_DEFAULT_FLOWS 128
9-
+#define SFQ_MAX_DEPTH 268 /* max number of packets per flow */
10-
+#define SFQ_DEFAULT_FLOWS 212
9+
+#define SFQ_MAX_DEPTH 352 /* max number of packets per flow */
10+
+#define SFQ_DEFAULT_FLOWS 274
1111
#define SFQ_MAX_FLOWS (0x10000 - SFQ_MAX_DEPTH - 1) /* max number of flows */
1212
#define SFQ_EMPTY_SLOT 0xffff
1313
-#define SFQ_DEFAULT_HASH_DIVISOR 1024
@@ -28,12 +28,53 @@
2828
u8 flags;
2929
struct tcf_proto __rcu *filter_list;
3030
struct tcf_block *block;
31-
@@ -754,7 +754,9 @@
31+
@@ -639,9 +639,10 @@
32+
unsigned int divisor;
33+
int perturb_period;
34+
u8 headdrop;
35+
- u8 maxdepth;
36+
+ u16 maxdepth;
37+
int limit;
38+
u8 flags;
39+
+ u8 hook_max = 0;
40+
41+
42+
if (opt->nla_len < nla_attr_size(sizeof(*ctl)))
43+
@@ -694,6 +695,7 @@
44+
}
45+
if (ctl_v1) {
46+
if (ctl_v1->depth)
47+
+ hook_max = ctl_v1->depth == 1 ? 1 : hook_max;
48+
maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH);
49+
if (p) {
50+
red_set_parms(p,
51+
@@ -708,9 +710,10 @@
52+
}
53+
if (ctl->limit) {
54+
limit = min_t(u32, ctl->limit, maxdepth * maxflows);
55+
+ hook_max = ctl->limit == 1 ? 1 : hook_max;
56+
maxflows = min_t(u32, maxflows, limit);
57+
}
58+
- if (limit == 1) {
59+
+ if (limit == 1 && hook_max != 1) {
60+
sch_tree_unlock(sch);
61+
kfree(p);
62+
NL_SET_ERR_MSG_MOD(extack, "invalid limit");
63+
@@ -723,6 +726,8 @@
64+
q->headdrop = headdrop;
65+
q->maxdepth = maxdepth;
66+
q->maxflows = maxflows;
67+
+ if (hook_max == 1)
68+
+ q->limit = q->maxdepth = SFQ_MAX_DEPTH;
69+
WRITE_ONCE(q->perturb_period, perturb_period);
70+
q->quantum = quantum;
71+
q->flags = flags;
72+
@@ -797,7 +802,9 @@
3273
q->divisor = SFQ_DEFAULT_HASH_DIVISOR;
3374
q->maxflows = SFQ_DEFAULT_FLOWS;
3475
q->quantum = psched_mtu(qdisc_dev(sch));
3576
- q->perturb_period = 0;
36-
+ q->perturb_period = 225 * HZ;
77+
+ q->perturb_period = 300 * HZ;
3778
+ q->headdrop = 1;
3879
+ mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
3980
get_random_bytes(&q->perturbation, sizeof(q->perturbation));

0 commit comments

Comments
 (0)