Re: [PATCH net-next v6 2/6] net/sched: sch_cake: Factor out config variables into separate struct
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2026-01-07 14:42:30
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2026-01-07 14:42:30
Toke Høiland-Jørgensen wrote:
Willem de Bruijn [off-list ref] writes:quoted
quoted
static int cake_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { - struct cake_sched_data *q = qdisc_priv(sch); + struct cake_sched_data *qd = qdisc_priv(sch); + struct cake_sched_config *q; int i, j, err; + q = kvcalloc(1, sizeof(struct cake_sched_config), GFP_KERNEL); + if (!q) + return -ENOMEM; +Can this just be a regular kzalloc?Yeah, I guess so. I'll change this if there's a need to respin for other reasons, but probably not worth respinning for this on its own? Seeing as it'll all end up in the same kmalloc call anyway :)
Sounds good.
quoted
More importantly, where is q assigned to qd->config after init?Just below:quoted
quoted
sch->limit = 10240; sch->flags |= TCQ_F_DEQUEUE_DROPS;@@ -2742,33 +2755,36 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, * for 5 to 10% of interval */ q->rate_flags |= CAKE_FLAG_SPLIT_GSO; - q->cur_tin = 0; - q->cur_flow = 0; + qd->cur_tin = 0; + qd->cur_flow = 0; + qd->config = q;Here: ^^^^^^^
I'm blind. Thanks! Reviewed-by: Willem de Bruijn <willemb@google.com>