Re: [Fwd: [PATCH v9] add 802.1Qbh and 802.1Qbg handling]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-05-27 at 16:50 +0200, Christian Benvenuti (benve) wrote:
> On Thu, 2010-05-27 at 08:47 -0400, Stefan Berger wrote:
> > On Thu, 2010-05-27 at 13:55 +0200, Arnd Bergmann wrote:
> > > On Thursday 27 May 2010, Stefan Berger wrote:
> > > 
> > > 
> > > > +static int
> > > > +getPortProfileStatus(struct nlattr **tb, int32_t vf, uint16_t *status)
> > > > +{
> > > > +    int rc = 1;
> > > > +    const char *msg = NULL;
> > > > +    struct nlattr *tb2[IFLA_VF_PORT_MAX + 1],
> > > > +                  *tb3[IFLA_PORT_MAX+1];
> > > > +
> > > > +    if (vf == PORT_SELF_VF) {
> > > > +        if (tb[IFLA_PORT_SELF]) {
> > > > +            if (nla_parse_nested(tb3, IFLA_PORT_MAX, tb[IFLA_PORT_SELF],
> > > > +                                 ifla_port_policy)) {
> > > > +                msg = _("error parsing nested IFLA_VF_PORT part");
> > > > +                goto err_exit;
> > > > +            }
> > > > +        }
> > > > +    } else {
> > > > +        if (tb[IFLA_VF_PORTS]) {
> > > > +            if (nla_parse_nested(tb2, IFLA_VF_PORT_MAX, tb[IFLA_VF_PORTS],
> > > > +                                 ifla_vf_ports_policy)) {
> > > > +                msg = _("error parsing nested IFLA_VF_PORTS part");
> > > > +                goto err_exit;
> > > > +            }
> > > > +            if (tb2[IFLA_VF_PORT]) {
> > > > +                if (nla_parse_nested(tb3, IFLA_PORT_MAX, tb2[IFLA_VF_PORT],
> > > > +                                     ifla_port_policy)) {
> > > > +                    msg = _("error parsing nested IFLA_VF_PORT part");
> > > > +                    goto err_exit;
> > > > +                }
> > > > +            }
> > > > +        }
> > > > +    }
> > > 
> > > There may be multiple IFLA_VF_PORT attributes in the IFLA_VF_PORTS list,
> > > so you cannot do nla_parse_nested. I think this should be nla_for_each_attr
> > > instead, and compare the uuid to the one you expect.
> > > 
> > 
> > Ok. I'll change that for v10.
> 
> Actually I believe calling
> 
>         nla_for_each_nested(attr, tb[IFLA_VF_PORTS], ...)
>         }
> 
> is even better than calling nla_for_each_attr directly.
> (You can check how Scott coded the kernel function do_setlink
> in his recent kernel patch "Add netlink support for virtual port"
> for a similar example)

Probably a typo from Arnd. I looked in rtnetlink.c. Thanks.

   Stefan

> 
> /Christian
> 
> 


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]