Subject: Re: [PATCH net-next 01/44] sched: Add dualpi2 qdisc

From: Jakub Kicinski <[email-masked]>
Date: Tue, 15 Oct 2024 08:40:21 -0700

On Tue, 15 Oct 2024 11:30:01 -0400 Jamal Hadi Salim wrote:
> > +       if (tb[TCA_DUALPI2_ALPHA]) {
> > +               u32 alpha = nla_get_u32(tb[TCA_DUALPI2_ALPHA]);
> > +
> > +               if (alpha > ALPHA_BETA_MAX) {
> > +                       NL_SET_ERR_MSG_ATTR(extack, tb[TCA_DUALPI2_ALPHA],
> > +                                           "alpha is too large.");
> > +                       sch_tree_unlock(sch);
> > +                       return -EINVAL;
> > +               }
> > +               q->pi2.alpha = dualpi2_scale_alpha_beta(alpha);
> > +       }  
> 
> You should consider using netlink policies for these checks (for
> example, you can check for min/max without replicating code as above).
> Applies in quiet a few places (and not just for max/min validation)

In fact I think we should also start asking for YAML specs.
Donald already added most of the existing TC stuff.
Please extend Documentation/netlink/specs/tc.yaml