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

Stefan Berger stefanb at linux.vnet.ibm.com
Thu May 27 15:01:40 UTC 2010


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





More information about the libvir-list mailing list