Subject: Re: [PATCH net v2 1/5] net_sched: drr: Fix double list add in class with netem as child qdisc

From: Jakub Kicinski <[email-masked]>
Date: Tue, 22 Apr 2025 17:44:06 -0700

On Wed, 16 Apr 2025 07:24:23 -0300 Victor Nogueira wrote:
> +static bool cl_is_initialised(struct drr_class *cl)

cl_is_active() ?
Had to look at the code to figure out what it does, but doesn't seem to
have much to do with being "initialised". The point is that the list
node of this class is not on the list of active classes.

> +	return !list_empty(&cl->alist);
> +}
> +
>  static struct drr_class *drr_find_class(struct Qdisc *sch, u32 classid)
>  {
>  	struct drr_sched *q = qdisc_priv(sch);
> @@ -357,7 +362,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
>  		return err;
>  	}
>  
> -	if (first) {
> +	if (first && !cl_is_initialised(cl)) {

I think we can delete the "first" check and temp variable.
The code under the if() does not touch the packet so it doesn't matter
whether we execute it for the initial or the nested call, right?