Re: [PATCH 1/4] util: fixing wrong assumption that PF has to have netdev assigned

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

 



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.biernacki@xxxxxxxxxx>
> ---
>  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().

> +    }
>  
>      pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
>                                virNetDevGetPCIDevice(ifname);
> 

Michal

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

  Powered by Linux