From nobody Tue Feb 10 01:30:23 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15181853276111014.0382338161536; Fri, 9 Feb 2018 06:08:47 -0800 (PST) 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 460963ADA9; Fri, 9 Feb 2018 14:08:46 +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 1C5826EE5C; Fri, 9 Feb 2018 14:08:46 +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 D5B954A471; Fri, 9 Feb 2018 14:08:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w19E1p8j009807 for ; Fri, 9 Feb 2018 09:01:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id A35505D723; Fri, 9 Feb 2018 14:01:51 +0000 (UTC) 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 9AA0F5D995 for ; Fri, 9 Feb 2018 14:01:48 +0000 (UTC) Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) (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 61CBFC05FEF7 for ; Fri, 9 Feb 2018 14:01:47 +0000 (UTC) Received: by mail-io0-f193.google.com with SMTP id f89so9720578ioj.4 for ; Fri, 09 Feb 2018 06:01:47 -0800 (PST) Received: from linux-8bx1.caveonetworks.com ([115.113.156.2]) by smtp.googlemail.com with ESMTPSA id n4sm3900604itg.2.2018.02.09.06.01.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z6dkQkDw/JGmQwDpsvg1hwVbKIRYPOCDafJkoCx4j+w=; b=WTyeZKM3F1LOfVlmQiG+LlMgjuZa8nY6hDbaE/qT2vMITPh1kjx7KsKWa4SfODZNrC za5xy5SNyVBFBus+qwc8P9+2V/8LFYdza0BOGW3cbga0I2eQWg+Xs/A4B0InXRZF/EJF SlwmRcs5Amumlr/KNPLAOgSoyB9EdnnO4Vo4HoDvPrXPDo8UlePb228rt0z4MT0nqa27 WA4qD2NNykCOZmOOz2vDksC40W8dw1BdRaiJOazT1uQCOl1mtqWZWbBSpOTI7Tn13Sx8 3rpf7hdp2m650kNyydIc3KlKuzWSN579cCGSECh2yEhsualW06q0eWMotm9il4AExKOv LJNg== 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=z6dkQkDw/JGmQwDpsvg1hwVbKIRYPOCDafJkoCx4j+w=; b=Bemq8dMtVnxf6/jnC4970FSGrwCxNfRvjpE3CpGsPCrABvbdzE3Wnzd+JMsXmvj9vZ g7146prBjV5u2IOiorO6/sw1P4KFiy6XVoyQVu+mHDnd1rbAQEbjLT2T11P/oBEAPJMH LAsl1PQYH4ZU49z5ggTV3/P1IWkdc8UQX4QJGd7H5Pacx3AkcuV4GqTlDPvkBMDj0zio 39QKcC1+AELIAQk1jr8kFN36itqSnO9Hp8kdSmyWGHtcFDXWHqhyH3MqIDTJXDgtG9we 6gZZahcIDWhcs6Rv4mSZsj+kEnDkgEjMGc5gwz0j9s1Mh1Fd2HHZq7qk91uQuzqnQetB j2Zw== X-Gm-Message-State: APf1xPBjnzFr5Q8/gPcB78EzE/orTBEze4+WCZqOuzVQN1ly/cYaYUHB NGJh1DkMP1EcuN1N1NcJys+gQu1B X-Google-Smtp-Source: AH8x225wfcXiEwlnH7Umg7Zh7EPPtp/A7bac1/v+sKOFWTzi4sUZwpRMoPTGH/+CFOu7NcCbNNcpeg== X-Received: by 10.107.7.69 with SMTP id 66mr3194419ioh.216.1518184906090; Fri, 09 Feb 2018 06:01:46 -0800 (PST) From: Jai Singh Rana X-Google-Original-From: Jai Singh Rana To: libvir-list@redhat.com Date: Fri, 9 Feb 2018 19:30:45 +0530 Message-Id: <20180209140045.25480-3-JaiSingh.Rana@cavium.com> In-Reply-To: <20180209140045.25480-1-JaiSingh.Rana@cavium.com> References: <20180209140045.25480-1-JaiSingh.Rana@cavium.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 09 Feb 2018 14:01:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 09 Feb 2018 14:01:47 +0000 (UTC) for IP:'209.85.223.193' DOMAIN:'mail-io0-f193.google.com' HELO:'mail-io0-f193.google.com' FROM:'jai.rana@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.223.193 mail-io0-f193.google.com 209.85.223.193 mail-io0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: jai.rana@gmail.com, Jai Singh Rana Subject: [libvirt] [PATCH 2/2] qemu: conf: Network stats support for hostdev VF Representor 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 09 Feb 2018 14:08:46 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In case of , return stats if its a Switchdev VF Representor interface of pci SR-IOV device. --- src/conf/domain_conf.c | 7 +++++++ src/qemu/qemu_driver.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fb732a0c2..649fc2eb8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -58,6 +58,7 @@ #include "virnetdev.h" #include "virnetdevmacvlan.h" #include "virhostdev.h" +#include "virnetdevhostdev.h" #include "virmdev.h" =20 #define VIR_FROM_THIS VIR_FROM_DOMAIN @@ -28112,6 +28113,12 @@ virDomainNetFind(virDomainDefPtr def, const char *= device) return net; } =20 + /* Give a try to hostdev */ + for (i =3D 0; i < def->nnets; i++) { + if(!virNetdevHostdevCheckVFRepIFName(def->hostdevs[i], device)) + return def->nets[i]; + } + virReportError(VIR_ERR_INVALID_ARG, _("'%s' is not a known interface"), device); return NULL; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 978ecd4e0..3a3a9c986 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -67,6 +67,7 @@ #include "virhostcpu.h" #include "virhostmem.h" #include "virnetdevtap.h" +#include "virnetdevhostdev.h" #include "virnetdevopenvswitch.h" #include "capabilities.h" #include "viralloc.h" @@ -11153,6 +11154,11 @@ qemuDomainInterfaceStats(virDomainPtr dom, if (virDomainNetGetActualType(net) =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSE= R) { if (virNetDevOpenvswitchInterfaceStats(net->ifname, stats) < 0) goto cleanup; + } else if (virDomainNetGetActualType(net) =3D=3D VIR_DOMAIN_NET_TYPE_H= OSTDEV) { + if (virNetdevHostdevVFRepInterfaceStats(device, stats, + !virDomainNetTypeSharesHos= tView + (net)) < 0) + goto cleanup; } else { if (virNetDevTapInterfaceStats(net->ifname, stats, !virDomainNetTypeSharesHostView(net= )) < 0) @@ -19794,6 +19800,7 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver= ATTRIBUTE_UNUSED, { size_t i; struct _virDomainInterfaceStats tmp; + char *vf_representor_ifname =3D NULL; int ret =3D -1; =20 if (!virDomainObjIsActive(dom)) @@ -19806,21 +19813,40 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driv= er ATTRIBUTE_UNUSED, virDomainNetDefPtr net =3D dom->def->nets[i]; virDomainNetType actualType; =20 - if (!net->ifname) + actualType =3D virDomainNetGetActualType(net); + + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { + if (virNetdevHostdevGetVFRepIFName(dom->def->hostdevs[i], + &vf_representor_ifname)) + continue; + } + else if (!net->ifname) continue; =20 memset(&tmp, 0, sizeof(tmp)); =20 - actualType =3D virDomainNetGetActualType(net); =20 - QEMU_ADD_NAME_PARAM(record, maxparams, - "net", "name", i, net->ifname); + if (actualType !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) + QEMU_ADD_NAME_PARAM(record, maxparams, + "net", "name", i, net->ifname); + else + QEMU_ADD_NAME_PARAM(record, maxparams, + "net", "name", i, vf_representor_ifname); =20 if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER) { if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0)= { virResetLastError(); continue; } + } else if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { + if (virNetdevHostdevVFRepInterfaceStats + (vf_representor_ifname, &tmp, + !virDomainNetTypeSharesHostView(net)) < 0) { + VIR_FREE(vf_representor_ifname); + virResetLastError(); + continue; + } + VIR_FREE(vf_representor_ifname); } else { if (virNetDevTapInterfaceStats(net->ifname, &tmp, !virDomainNetTypeSharesHostView= (net)) < 0) { --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list