Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: David Ahern <dsahern@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: cake@lists.bufferbloat.net, netdev@vger.kernel.org,
	"Jonas Köppeler" <j.koeppeler@tu-berlin.de>
Subject: [Cake] [PATCH RFC net-next] tc: cake: add cake_mq support
Date: Wed, 24 Sep 2025 14:18:20 +0200	[thread overview]
Message-ID: <20250924121820.186373-1-toke@redhat.com> (raw)
In-Reply-To: <20250924-mq-cake-sub-qdisc-v1-0-43a060d1112a@redhat.com>

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

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

Signed-off-by: Jonas Köppeler <j.koeppeler@tu-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


      parent reply	other threads:[~2025-09-24 12:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 12:16 [Cake] [PATCH RFC net-next 0/4] Multi-queue aware sch_cake Toke Høiland-Jørgensen
2025-09-24 12:16 ` [Cake] [PATCH RFC net-next 1/4] net/sched: sch_cake: Factor out config variables into separate struct Toke Høiland-Jørgensen
2025-09-24 12:16 ` [Cake] [PATCH RFC net-next 2/4] net/sched: sch_cake: Add cake_mq qdisc for using cake on mq devices Toke Høiland-Jørgensen
2025-09-24 12:16 ` [Cake] [PATCH RFC net-next 3/4] net/sched: sch_cake: Share config across cake_mq sub-qdiscs Toke Høiland-Jørgensen
2025-09-24 12:16 ` [Cake] [PATCH RFC net-next 4/4] net/sched: sch_cake: share shaper state across sub-instances of cake_mq Toke Høiland-Jørgensen
2025-09-25  9:04   ` [Cake] " Donald Hunter
2025-09-25 13:29     ` Toke Høiland-Jørgensen
2025-09-24 12:18 ` Toke Høiland-Jørgensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250924121820.186373-1-toke@redhat.com \
    --to=toke@redhat.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=dsahern@gmail.com \
    --cc=j.koeppeler@tu-berlin.de \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox