lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250924121820.186373-1-toke@redhat.com>
Date: Wed, 24 Sep 2025 14:18:20 +0200
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: David Ahern <dsahern@...il.com>,
	Stephen Hemminger <stephen@...workplumber.org>
Cc: cake@...ts.bufferbloat.net,
	netdev@...r.kernel.org,
	Jonas Köppeler <j.koeppeler@...berlin.de>
Subject: [PATCH RFC net-next] tc: cake: add cake_mq support

From: Jonas Köppeler <j.koeppeler@...berlin.de>

This adds support for the cake_mq variant of sch_cake to tc.

Signed-off-by: Jonas Köppeler <j.koeppeler@...berlin.de>
---
 include/uapi/linux/pkt_sched.h |  2 ++
 tc/q_cake.c                    | 37 +++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 15d1a37ac6d8..f85a5316f372 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -1014,6 +1014,7 @@ enum {
 	TCA_CAKE_ACK_FILTER,
 	TCA_CAKE_SPLIT_GSO,
 	TCA_CAKE_FWMARK,
+	TCA_CAKE_SYNC_TIME,
 	__TCA_CAKE_MAX
 };
 #define TCA_CAKE_MAX	(__TCA_CAKE_MAX - 1)
@@ -1036,6 +1037,7 @@ enum {
 	TCA_CAKE_STATS_DROP_NEXT_US,
 	TCA_CAKE_STATS_P_DROP,
 	TCA_CAKE_STATS_BLUE_TIMER_US,
+	TCA_CAKE_STATS_ACTIVE_QUEUES,
 	__TCA_CAKE_STATS_MAX
 };
 #define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1)
diff --git a/tc/q_cake.c b/tc/q_cake.c
index e2b8de55e5a2..60688b3478ec 100644
--- a/tc/q_cake.c
+++ b/tc/q_cake.c
@@ -82,6 +82,7 @@ static void explain(void)
 		"                [ split-gso* | no-split-gso ]\n"
 		"                [ ack-filter | ack-filter-aggressive | no-ack-filter* ]\n"
 		"                [ memlimit LIMIT ]\n"
+		"                [ sync_time TIME ]\n"
 		"                [ fwmark MASK ]\n"
 		"                [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n"
 		"                [ mpu N ] [ ingress | egress* ]\n"
@@ -93,6 +94,8 @@ static int cake_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
 {
 	struct cake_preset *preset, *preset_set = NULL;
 	bool overhead_override = false;
+	unsigned int sync_time = 0;
+	bool set_sync_time = false;
 	bool overhead_set = false;
 	unsigned int interval = 0;
 	int diffserv = -1;
@@ -340,6 +343,13 @@ static int cake_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
 					"Illegal value for \"fwmark\": \"%s\"\n", *argv);
 				return -1;
 			}
+		} else if (strcmp(*argv, "sync_time") == 0) {
+			NEXT_ARG();
+			if (get_time(&sync_time, *argv)) {
+				fprintf(stderr, "Illegal sync time\n");
+				return -1;
+			}
+			set_sync_time = true;
 		} else if (strcmp(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -399,6 +409,8 @@ static int cake_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
 	if (ack_filter != -1)
 		addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter,
 			  sizeof(ack_filter));
+	if(set_sync_time)
+		addattr_l(n, 1024, TCA_CAKE_SYNC_TIME, &sync_time, sizeof(sync_time));
 
 	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
@@ -421,6 +433,7 @@ static int cake_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *o
 	unsigned int interval = 0;
 	unsigned int memlimit = 0;
 	unsigned int fwmark = 0;
+	unsigned int sync_time = 0;
 	__u64 bandwidth = 0;
 	int ack_filter = 0;
 	int split_gso = 0;
@@ -525,7 +538,10 @@ static int cake_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *o
 	    RTA_PAYLOAD(tb[TCA_CAKE_FWMARK]) >= sizeof(__u32)) {
 		fwmark = rta_getattr_u32(tb[TCA_CAKE_FWMARK]);
 	}
-
+	if (tb[TCA_CAKE_SYNC_TIME] &&
+	    RTA_PAYLOAD(tb[TCA_CAKE_SYNC_TIME]) >= sizeof(__u32)) {
+		sync_time = rta_getattr_u32(tb[TCA_CAKE_SYNC_TIME]);
+	}
 	if (wash)
 		print_string(PRINT_FP, NULL, "wash ", NULL);
 	else
@@ -574,6 +590,13 @@ static int cake_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *o
 	if (memlimit)
 		print_size(PRINT_ANY, "memlimit", "memlimit %s ", memlimit);
 
+	if (sync_time) {
+		print_uint(PRINT_JSON, "sync_time", NULL,
+			   sync_time);
+		print_string(PRINT_FP, NULL, "sync_time %s",
+			     sprint_time(sync_time, b2));
+	}
+
 	if (fwmark)
 		print_uint(PRINT_FP, NULL, "fwmark 0x%x ", fwmark);
 	print_0xhex(PRINT_JSON, "fwmark", NULL, fwmark);
@@ -667,6 +690,11 @@ static int cake_print_xstats(const struct qdisc_util *qu, FILE *f,
 			   " /%8u\n", GET_STAT_U32(MAX_ADJLEN));
 	}
 
+	if (st[TCA_CAKE_STATS_ACTIVE_QUEUES])
+		print_uint(PRINT_ANY, "active_queues",
+			   " active queues: %25u\n",
+			   GET_STAT_U32(ACTIVE_QUEUES));
+
 	if (st[TCA_CAKE_STATS_AVG_NETOFF])
 		print_uint(PRINT_ANY, "avg_hdr_offset",
 			   " average network hdr offset: %12u\n\n",
@@ -827,3 +855,10 @@ struct qdisc_util cake_qdisc_util = {
 	.print_qopt	= cake_print_opt,
 	.print_xstats	= cake_print_xstats,
 };
+
+struct qdisc_util cake_mq_qdisc_util = {
+	.id		= "cake_mq",
+	.parse_qopt	= cake_parse_opt,
+	.print_qopt	= cake_print_opt,
+	.print_xstats	= cake_print_xstats,
+};
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ