[libvirt PATCH v5 1/3] Set VF MAC and VLAN ID in two different operations

Dmitrii Shcherbakov dmitrii.shcherbakov at canonical.com
Thu Nov 18 17:17:19 UTC 2021


Hi Daniel,

Addressed the below in v6.

https://listman.redhat.com/archives/libvir-list/2021-November/msg00539.html

> > +int
> > +virNetDevSetVfConfig(const char *ifname, int vf,
> > +                     const virMacAddr *macaddr, int vlanid,
> > +                     bool *allowRetry)
> > +{
> > +    int rc = 0;
> > +    if ((rc = virNetDevSetVfMac(ifname, vf, macaddr, allowRetry)) < 0) {
> > +        return rc;
> > +    } else if ((rc = virNetDevSetVfVlan(ifname, vf, vlanid)) < 0) {
> > +        return rc;
> > +    }
>
> Minor point I would get rid of the 'else' here, to make it obvious that
> in the "success" case, we're intending to be making both of these method
> calls.
>
>     if ((rc = virNetDevSetVfMac(ifname, vf, macaddr, allowRetry)) < 0)
>         return rc;
>     if ((rc = virNetDevSetVfVlan(ifname, vf, vlanid)) < 0)
>         return rc;
>
> Or alternatively compress them
>
>
>     if ((rc = virNetDevSetVfMac(ifname, vf, macaddr, allowRetry)) < 0 ||
>         (rc = virNetDevSetVfVlan(ifname, vf, vlanid)) < 0)
>         return rc;
>
>
>
> > +    return rc;
> > +}
> > +


Best Regards,
Dmitrii Shcherbakov
LP/oftc: dmitriis




More information about the libvir-list mailing list