Subject: Re: [PATCH net-next v6 2/6] net/sched: sch_cake: Factor out config variables into separate struct

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Wed, 07 Jan 2026 10:17:27 +0100

Willem de Bruijn <[email-masked]> writes:

>>  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 :)

> More importantly, where is q assigned to qd->config after init?

Just below:

>>  	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:   ^^^^^^^

-Toke