From patchwork Tue Jan 22 19:26:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 156320 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp7965296jaa; Tue, 22 Jan 2019 11:36:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4KXwKaOmgxSldU9EJyrAQDaaoa94H2VJ1NpBvyyZ7CoU73hXdf+CJlKV3++zWAjYp6k0AP X-Received: by 2002:ac8:4405:: with SMTP id j5mr31930536qtn.295.1548185781927; Tue, 22 Jan 2019 11:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548185781; cv=none; d=google.com; s=arc-20160816; b=sTqRabHngmetFYORYXDU6TT94Z/hYb/4R7uLOdD4n322FnPIOqZyncCAL9muEKs4V8 c5x+zYKw5C5aKk7JJat1LsvCcugvpCxsTOSRwFDv/jWdt0TyCYsa5swavs8fJViEoWYW mymVI7LXGirMiCsrIFPLSFdpvNqPpGpI8U4lAOOXmjrQCBaUiwgyZufZsG8x8i70g263 s+EursuM9z5WRt3yTlEQcb2OURe9oeh52vPYdCikYtqnNbCjWEGdnTKjlcL2psA5l+fF bNCSJblLpPo7NreGU3BllyZ2/Cto3IKsSJSaQ7MYreaw9NTzeBiBGAuzIEyKpvuKqifV igxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=QedHYV7qIHX3OfGUOhXUhtCQCToAhz45A3FSSTApw2M=; b=gLV6vQjuAqmwEqk1XoHjYATbbvPLxLOrhdEvIlmvIKxgCRh79JeRaYOj2Rfbf/osio P/MbuGz5Adt7nC3+3cf0GRYr3k9UMlAnOZOS0RK1joHXnenJ8tRzz6C+rd3JJcELrcEu ZhOy2baCBDlt3sFZxfhXYdtFDBVjQ/sTFSWySZpfnk68+S+e2lEH4dbvxp8OymUbE5/j dcjXbTwTrSyzkVYlNoX1E5YBHYmRCuI2rbjuQzUd5JwpcS+eefSn1PEa7A8/cj2pSEq1 mQRNbaRplt7Gk1MP3fM77pLByUt/838uXuIJAS2/k8EjJpK5xuuP+2kXIQCvg3tzSMWZ 2gXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id h2si207165qkc.249.2019.01.22.11.36.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 11:36:21 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35CB637E88; Tue, 22 Jan 2019 19:36:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6D01600C5; Tue, 22 Jan 2019 19:36:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5EA8E180339B; Tue, 22 Jan 2019 19:36:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0MJZu1D024873 for ; Tue, 22 Jan 2019 14:35:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id D89845C25A; Tue, 22 Jan 2019 19:35:56 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CAF885E1B0; Tue, 22 Jan 2019 19:35:53 +0000 (UTC) Received: from complete.lackof.org (complete.lackof.org [198.49.126.79]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 578F7C0495BA; Tue, 22 Jan 2019 19:35:51 +0000 (UTC) Received: from localhost (c-107-2-141-103.hsd1.co.comcast.net [107.2.141.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by complete.lackof.org (Postfix) with ESMTPSA id 812F633E019E; Tue, 22 Jan 2019 12:26:33 -0700 (MST) From: dann frazier To: libvir-list@redhat.com, Radoslaw Biernacki , Michal Privoznik Date: Tue, 22 Jan 2019 12:26:12 -0700 Message-Id: <20190122192615.9256-2-dann.frazier@canonical.com> In-Reply-To: <20190122192615.9256-1-dann.frazier@canonical.com> References: <20190122192615.9256-1-dann.frazier@canonical.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.100.2 at complete.lackof.org X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on complete.lackof.org X-Greylist: Delayed for 00:09:17 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 22 Jan 2019 19:35:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 22 Jan 2019 19:35:51 +0000 (UTC) for IP:'198.49.126.79' DOMAIN:'complete.lackof.org' HELO:'complete.lackof.org' FROM:'dannf@dannf.org' RCPT:'' X-RedHat-Spam-Score: 0.001 (HEADER_FROM_DIFFERENT_DOMAINS) 198.49.126.79 complete.lackof.org 198.49.126.79 complete.lackof.org X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v3 1/4] util: fixing wrong assumption that PF has to have netdev assigned X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 22 Jan 2019 19:36:21 +0000 (UTC) From: Radoslaw Biernacki 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 corrects 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 [ dannf: Reinstated error path in virNetDevGetPhysicalFunction() as suggested by Michal Privoznik ] Signed-off-by: dann frazier --- src/util/virnetdev.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 2111b3ada9..82823c0dfc 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1355,9 +1355,8 @@ 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 - */ + /* The SRIOV standard does not require VF netdevs to have the + netdev assigned to a PF */ virReportError(VIR_ERR_INTERNAL_ERROR, _("The PF device for VF %s has no network device name"), ifname); @@ -1449,8 +1448,12 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname, *pfname = NULL; - if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) + if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot get PF netdev name for VF %s"), + vfname); return ret; + } if (virNetDevSysfsFile(&pf_sysfs_path, *pfname, "device") < 0) goto cleanup; @@ -3178,8 +3181,12 @@ 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 */ + if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0) + virResetLastError(); + } pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) : virNetDevGetPCIDevice(ifname);