From patchwork Sat Nov 17 19:51:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 151422 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp904259ljp; Sat, 17 Nov 2018 13:09:24 -0800 (PST) X-Google-Smtp-Source: AJdET5cYBq5PG8cdoEUumBEss8aNMw/n0BMqysx0fmCBhx9laxUdXDErVOl+HLWJebmyDJliTQth X-Received: by 2002:ae9:edd8:: with SMTP id c207mr14599146qkg.184.1542488964405; Sat, 17 Nov 2018 13:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542488964; cv=none; d=google.com; s=arc-20160816; b=rq3y/X0pdzrx2RMhJ8QbsjfZ5vGvJZ3hGYODcdx8fAzXu3DW++R8Db9VHRdm57535t FclvYqL2A1yiDW9bC899pAyeTeCLmqNZuHOzQtXRWwgP45/wffP4sB5Eq26ot6O0mX+6 il2GQBEsyypCh7suCYvzeWIwd2ZGcPpN+oUbVBUFqjvYHJRqsrnZdN6axUAZe4vnYBiH 2oFV/AZZytKYJ4cYDPzD8Hm0Yrz7ayXcEIDppPOP6rJYY/rzw/0HUwd+IQC1LFZ9iIVH O1jsCbm4jM9gMRASNyG7E5r0IdACxYb2X/0+oWkTzdwgI9DPA2EzUvmxh8sEMkI4tHIf lCYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=H/v9zapIG5eRtNLAhalnbBtOj5JS3uiwGX4SCkWP+Ys=; b=wvn2+gkWvj/+LiGglRB5I+nCj2bcB993QhW7ih8VOzb4A6JbeO/8DckQWownFknFUX Bsyi473fGIEwhVLZKKlO3Vk1u7zGR6O4CR1AKfqMS+ALz618pabVKVlWPHwm+b4uBAbq WgPbKR/Zn5I2iNJPj4wGV4yzyceacbakF4kF5yuqtsxOF0CgKd4krKxV5eUMGI22/dPo +124dbY09JV3ATtn4TRXkJjrtZatPtr1LzfRe/HQSOfgQDengjD2v71pPhS4SyqLTuXy /Q7+G2/WhavKqu5IMKR/G2qDoIDIYFFMqHZ6R0+OZ6rj4K/toF02n3klqorC7zHAnA7b 0jeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AWPxVvus; 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=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id c4si10172260qvo.215.2018.11.17.13.09.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 13:09:24 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AWPxVvus; 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=linaro.org Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78796C049597; Sat, 17 Nov 2018 21:09:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4266917249; Sat, 17 Nov 2018 21:09:22 +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 D70F93F953; Sat, 17 Nov 2018 21:09:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAHJpO33029177 for ; Sat, 17 Nov 2018 14:51:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CC3765F57; Sat, 17 Nov 2018 19:51:24 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6434365F48 for ; Sat, 17 Nov 2018 19:51:22 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4B2E4E916 for ; Sat, 17 Nov 2018 19:51:20 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id f23so13068181edb.3 for ; Sat, 17 Nov 2018 11:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V4omFcjws/Z/+/+Zs4WSRpsJOEsX4CGTL83qjq0bh2o=; b=AWPxVvusEyIM+yqwDQv4LwnBl6Mw+GLYdFFjKgzW0kd4pMMLPjneGmI79nr8fEEPLP hQXPJlRluIEtZGl/pFjECMF/szTd7O/eo1h2III//seOCxr7tByQffSMT298poAegafP teH374CalvM0Smv3Ib3X8KL+c5Z59+nXrRbXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V4omFcjws/Z/+/+Zs4WSRpsJOEsX4CGTL83qjq0bh2o=; b=tscQ6Q3vsHIiCtSIX9Jlp0y6VghT7OaTVPXzXo0pC/KbzQRjOvemqCj8DhKBkWzrxQ JzXegWWYKzVp6QodpE3ThKvpIPQg62hZfn+3VA6J4oN4WeQiInnCSR8HOwUT5OOvqUYR JtKFtFaeNn9S8gkHIshLsmVRPpzK6keUBBMYB6q2ALjM2wRDgW2Koh9IfCRMk1RvCXED XOTSzilB/3qZUiaWwL/ysFtG/uIpdVeWbGW5VML7BUg1JtWqqO8ltAlsTNroUZ18ayGZ QAoMZTewgb/xP/2WsJRd1+e+g+9ttg0wW5vtP0KYEQmv6eNrGvU/fyFdP1eCFgsfxCkq prKw== X-Gm-Message-State: AGRZ1gKqxd8Pi1tzrVtbmT7IuqGIGORQY8b3zLtBG0ruzI2+wk171nfP Md4y9k3sD5Lu/+XBrPNAcPeP9ydHYqA= X-Received: by 2002:a17:906:1859:: with SMTP id w25-v6mr12253044eje.3.1542484279255; Sat, 17 Nov 2018 11:51:19 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id s12sm7887633edb.43.2018.11.17.11.51.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 11:51:18 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com, mprivozn@redhat.com Date: Sat, 17 Nov 2018 20:51:10 +0100 Message-Id: <20181117195113.12544-2-radoslaw.biernacki@linaro.org> In-Reply-To: <20181117195113.12544-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> <20181117195113.12544-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Nov 2018 19:51:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Nov 2018 19:51:21 +0000 (UTC) for IP:'209.85.208.66' DOMAIN:'mail-ed1-f66.google.com' HELO:'mail-ed1-f66.google.com' FROM:'radoslaw.biernacki@linaro.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.208.66 mail-ed1-f66.google.com 209.85.208.66 mail-ed1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v2 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Nov 2018 21:09:23 +0000 (UTC) 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. The error report was moved outside from virNetDevGetPhysicalFunction() and the error message changed slightly to reflect other potential root causes of error. 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 --- src/util/virnetdev.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) -- 2.14.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 5867977df4..f1c2ba8c17 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1358,15 +1358,8 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname) goto cleanup; } - 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); + if (!*pfname) goto cleanup; - } ret = 0; cleanup: @@ -1453,8 +1446,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; @@ -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)); + } pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) : virNetDevGetPCIDevice(ifname);