On Thu, 15 Nov 2018 at 12:23, Michal Privoznik <mpriv...@redhat.com> wrote:

> On 11/10/2018 01:56 PM, Radoslaw Biernacki wrote:
> > libvirt wrongly assumes that VF netdev has to have the
> > netdev assigned to PF. There is no such requirement in SRIOV standard.
> > This patch change the virNetDevSwitchdevFeature() function to deal
> > with SRIOV devices which does not have netdev on PF. Also removes
> > one comment about PF netdev assumption.
> >
> > One example of such devices is ThunderX VNIC.
> > By applying this change, VF device is used for virNetlinkCommand() as
> > it is the only netdev assigned to VNIC.
> >
> > Signed-off-by: Radoslaw Biernacki <radoslaw.bierna...@linaro.org>
> > ---
> >  src/util/virnetdev.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> > index 5867977df4..e55c538a29 100644
> > --- a/src/util/virnetdev.c
> > +++ b/src/util/virnetdev.c
> > @@ -1359,9 +1359,6 @@ virNetDevGetPhysicalFunction(const char *ifname,
> char **pfname)
> >      }
> >
> >      if (!*pfname) {
> > -        /* this shouldn't be possible. A VF can't exist unless its
> > -         * PF device is bound to a network driver
> > -         */
> >          virReportError(VIR_ERR_INTERNAL_ERROR,
> >                         _("The PF device for VF %s has no network device
> name"),
> >                         ifname);
> > @@ -3182,8 +3179,11 @@ virNetDevSwitchdevFeature(const char *ifname,
> >      if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
> >          return ret;
> >
> > -    if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
> > -        goto cleanup;
> > +    if (is_vf == 1) {
> > +        /* ignore error if PF does noto have netdev assigned
> > +         * in that case pfname == NULL */
> > +        ignore_value(virNetDevGetPhysicalFunction(ifname, &pfname));
>
> Problem is that virNetDevGetPhysicalFunction() reports error on failure.
> So either you need to take that out and put it into the other place that
> calls the function (virNetDevReadNetConfig) or call virResetLastError().
>

Moved error reporting out of  virNetDevGetPhysicalFunction().
Fortunately with 2/4 patch, only virNetDevGetVirtualFunctionInfo() calls it.
Fixed in v2.


> > +    }
> >
> >      pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
> >                                virNetDevGetPCIDevice(ifname);
> >
>
> Michal
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to