Subject: Re: [PATCH net-next v5 2/6] net: dcb: add new apptrust attribute

From: <[email-masked]>
Date: Mon, 31 Oct 2022 13:45:06 +0000

Den Mon, Oct 31, 2022 at 11:40:42AM +0100 skrev Steen Hegelund:
> Hi Daniel,
> 
> On Fri, 2022-10-28 at 15:13 +0200, Daniel Machon wrote:
> > Add new apptrust extension attributes to the 8021Qaz APP managed object.
> > 
> > Two new attributes, DCB_ATTR_DCB_APP_TRUST_TABLE and
> > DCB_ATTR_DCB_APP_TRUST, has been added. Trusted selectors are passed in
> > the nested attribute DCB_ATTR_DCB_APP_TRUST, in order of precedence.
> > 
> > The new attributes are meant to allow drivers, whose hw supports the
> > notion of trust, to be able to set whether a particular app selector is
> > trusted - and in which order.
> > 
> > Signed-off-by: Daniel Machon <[email-masked]>
> > ---
> 
> ...snip...
> 
> > @ -1185,6 +1186,29 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
> >         spin_unlock_bh(&dcb_lock);
> >         nla_nest_end(skb, app);
> >  
> > +       if (ops->dcbnl_getapptrust) {
> > +               u8 selectors[IEEE_8021QAZ_APP_SEL_MAX + 1] = {0};
> > +               int nselectors, i;
> > +
> > +               apptrust = nla_nest_start(skb, DCB_ATTR_DCB_APP_TRUST_TABLE);
> > +               if (!app)
> 
> apptrust?

Wow, can't believe I missed this. Good catch. Will be fixed in next version, thanks :-)

> 
> > +                       return -EMSGSIZE;
> > +
> > +               err = ops->dcbnl_getapptrust(netdev, selectors, &nselectors);
> > +               if (!err) {
> > +                       for (i = 0; i < nselectors; i++) {
> > +                               err = nla_put_u8(skb, DCB_ATTR_DCB_APP_TRUST,
> > +                                                selectors[i]);
> > +                               if (err) {
> > +                                       nla_nest_cancel(skb, apptrust);
> > +                                       return err;
> > +                               }
> > +                       }
> > +               }
> > +
> > +               nla_nest_end(skb, apptrust);
> > +       }
> > +
> > 
> 
> ...snip...
> 
> >  err:
> >         err = nla_put_u8(skb, DCB_ATTR_IEEE, err);
> >         dcbnl_ieee_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_SET, seq, 0);
> 
> BR
> Steen