From nobody Mon May 6 09:44:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507642569512806.741208051676; Tue, 10 Oct 2017 06:36:09 -0700 (PDT) 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 9734481235; Tue, 10 Oct 2017 13:36:08 +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 6CA2C68893; Tue, 10 Oct 2017 13:36:08 +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 5E54562CF1; Tue, 10 Oct 2017 13:35:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9ADV3jt010783 for ; Tue, 10 Oct 2017 09:31:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F9F96BC2D; Tue, 10 Oct 2017 13:31:03 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-36.phx2.redhat.com [10.3.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2E156C403; Tue, 10 Oct 2017 13:30:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9734481235 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Tue, 10 Oct 2017 09:30:55 -0400 Message-Id: <20171010133055.6594-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: edand@mellanox.com Subject: [libvirt] [PATCH] nodedev: Fix missing network devices 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 Content-Transfer-Encoding: quoted-printable 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.25]); Tue, 10 Oct 2017 13:36:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit id '8708ca01c' added a check to determine whether the NIC had Switchdev capabilities; however, in doing so inadvertently would cause network devices without a PCI device to not be added to the node device database. Thus, network devices having a "computer" as a parent, such as "net_lo*", "net_virbr*", "net_tun*", "net_vnet*", etc. were not added. Alter the check to not even check for Switchdev bits if no PCI device found. Signed-off-by: John Ferlan --- Found this gem while running the Avocado test suite while doing some other work. It's only 3.8.0 that'll have the missing devices. src/util/virnetdev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 5060d051dc..41ef65d882 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -3236,6 +3236,14 @@ virNetDevSwitchdevFeature(const char *ifname, if (is_vf =3D=3D 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < = 0) goto cleanup; =20 + pci_device_ptr =3D pfname ? virNetDevGetPCIDevice(pfname) : + virNetDevGetPCIDevice(ifname); + /* No PCI device, then no feature bit to check/add */ + if (pci_device_ptr =3D=3D NULL) { + ret =3D 0; + goto cleanup; + } + if (!(nl_msg =3D nlmsg_alloc_simple(family_id, NLM_F_REQUEST | NLM_F_ACK))) { virReportOOMError(); @@ -3248,11 +3256,6 @@ virNetDevSwitchdevFeature(const char *ifname, gmsgh->cmd =3D DEVLINK_CMD_ESWITCH_GET; gmsgh->version =3D DEVLINK_GENL_VERSION; =20 - pci_device_ptr =3D pfname ? virNetDevGetPCIDevice(pfname) : - virNetDevGetPCIDevice(ifname); - if (pci_device_ptr =3D=3D NULL) - goto cleanup; - pci_name =3D virPCIDeviceGetName(pci_device_ptr); =20 if (nla_put(nl_msg, DEVLINK_ATTR_BUS_NAME, strlen("pci")+1, "pci") < 0= || --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list