From nobody Mon Apr 29 20:24:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1596895355; cv=none; d=zohomail.com; s=zohoarc; b=LKhJiOL2/GNR9ujW/W/XVyTgkispfdZMy3JmZ/f4muky7gg+O0khHSBwvnLKD/eSMOO9a1kcbS9YglYiKeGmeiEGWJI+MFZczi5dZIU2u6q4X9OzLkiTJfTwOOhpzsR5AFaQcFGUUyMgFX8Bc9O58VNc6vpQ/4JNmmHhDhBniyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596895355; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=tKOH4oBpuNH2rgSBNnbogckejjCgH0RgWCKB45W6P3o=; b=gGnc82f95KFl4K96aoWo3/y6V6AyE+7DItuF88SrGqnnFfZAz0cDUveA+9rBI4WthxOQsZ/PENKsHGtVFZ7O1vNwuVjPh8cRyDcy5RB3kvPkcxHt6hOwVUTif1dCN2NkSz9AlvDbh//ezFbOh9UsgNxoT4e465VHCuX0R4u6dyY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1596895355074796.5292265126996; Sat, 8 Aug 2020 07:02:35 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-lHwGs1Z7NTu7wCQpOueo8Q-1; Sat, 08 Aug 2020 10:02:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF1E457; Sat, 8 Aug 2020 14:02:25 +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 641D3100239A; Sat, 8 Aug 2020 14:02:23 +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 6A5D81809554; Sat, 8 Aug 2020 14:02:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 078DxK6k018285 for ; Sat, 8 Aug 2020 09:59:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5DB1D1010AEE; Sat, 8 Aug 2020 13:59:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C9E21010AED for ; Sat, 8 Aug 2020 13:59:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 15D65185A78B for ; Sat, 8 Aug 2020 13:59:17 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-370-m_zwefUbMj6OM7KLXiwEjg-1; Sat, 08 Aug 2020 09:59:15 -0400 Received: by mail-qv1-f65.google.com with SMTP id o2so2103164qvk.6 for ; Sat, 08 Aug 2020 06:59:14 -0700 (PDT) Received: from localhost (pool-72-92-80-32.phlapa.fios.verizon.net. [72.92.80.32]) by smtp.gmail.com with ESMTPSA id b131sm9497471qkc.121.2020.08.08.06.59.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Aug 2020 06:59:13 -0700 (PDT) X-MC-Unique: lHwGs1Z7NTu7wCQpOueo8Q-1 X-MC-Unique: m_zwefUbMj6OM7KLXiwEjg-1 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:mime-version :content-transfer-encoding; bh=tKOH4oBpuNH2rgSBNnbogckejjCgH0RgWCKB45W6P3o=; b=CUlgx6UDyy5EdQ2G0lDP/8ZBN5gn0lTq9jC1HC4yxkbSeKsj7I8DeOZCPpqc2CY8+1 UHlEKRSnSa70Jv0fZP8j79TA8QxD2Qr19n3+OWK0RtzD7+758SYapCYE5tpUkDCkcmgF FfIYDGssbkRagqw/v88ThJP83bZjGtWYDyBDKi2867qpgq27P7D64074QY1lWXgoYBBe kC0xJgnmJm+n0slXAhbf4OYOxxEte57xNBvDEaRwrGTzl5av5rihHuZqHWgHIuJqQoQK +aCLvuAVQvL9CMCz4XyqigMCsQSFlAAv3JzCKePAdOf2VVLc6sMS4EMMcrGogWnsAPTZ aOTg== X-Gm-Message-State: AOAM532PnzojzBqoleit2LdK3SCb7jj141t5EGyFvH08i8skDbgMXM/3 822uzReyMI/HEhfXxLKSCfgXoSXa7r8= X-Google-Smtp-Source: ABdhPJyX+5EI8fFvHv3TWmPbgLcVRy9ESISwO5xS/C9kMypi8q8pGm+09KT+04d7h2NhMVlvZCN14g== X-Received: by 2002:a0c:d44e:: with SMTP id r14mr20005270qvh.105.1596895154573; Sat, 08 Aug 2020 06:59:14 -0700 (PDT) From: Patrick Magauran To: patmagauran.i@gmail.com, libvir-list@redhat.com Subject: [libvirt PATCH v2] Adds e1000e/vmxnet3 Vnet_hdr suuport Date: Sat, 8 Aug 2020 09:59:13 -0400 Message-Id: <20200808135913.39739-1-patmagauran.j@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Patrick Magauran 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Changes from Original: Moved Comparison to qemuInterfaceIsVnetCompatModel in qemu_interface.c per = the recommendation of Daniel Berrang=C3=A9 Reviewed-by: Daniel Henrique Barboza Reviewed-by: Laine Stump ----- Libvirt bases its decision about whether to apply the vnet_hdr flag to the = tap interface on whether or not the selected model is VirtIO. Originally, V= irtIO was the only model to support the vnet_hdr in QEMU; however, the e100= 0e & vmxnet3 adapters also support it(seemingly from introduction based on = commits). This passes the whole packet to the host, reducing emulation over= head and improving performance. Signed-off-by: Patrick Magauran --- src/qemu/qemu_interface.c | 15 +++++++++++---- src/qemu/qemu_interface.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index ffec992596..229bb299aa 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -230,6 +230,13 @@ qemuInterfaceStopDevices(virDomainDefPtr def) return 0; } =20 +bool qemuInterfaceIsVnetCompatModel(const virDomainNetDef *net) +{ + return (virDomainNetIsVirtioModel(net) || + net->model =3D=3D VIR_DOMAIN_NET_MODEL_E1000E || + net->model =3D=3D VIR_DOMAIN_NET_MODEL_VMXNET3); +} + =20 /** * qemuInterfaceDirectConnect: @@ -255,7 +262,7 @@ qemuInterfaceDirectConnect(virDomainDefPtr def, virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); unsigned int macvlan_create_flags =3D VIR_NETDEV_MACVLAN_CREATE_WITH_T= AP; =20 - if (virDomainNetIsVirtioModel(net)) + if (qemuInterfaceIsVnetCompatModel(net)) macvlan_create_flags |=3D VIR_NETDEV_MACVLAN_VNET_HDR; =20 if (virNetDevMacVLanCreateWithVPortProfile(net->ifname, @@ -417,7 +424,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, } } =20 - if (virDomainNetIsVirtioModel(net)) + if (qemuInterfaceIsVnetCompatModel(net)) tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_VNET_HDR; =20 if (net->managed_tap =3D=3D VIR_TRISTATE_BOOL_NO) { @@ -436,7 +443,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0) goto cleanup; if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, - virDomainNetIsVirtioModel(net)) <= 0) { + qemuInterfaceIsVnetCompatModel(ne= t)) < 0) { goto cleanup; } } else { @@ -559,7 +566,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, template_ifname =3D true; } =20 - if (virDomainNetIsVirtioModel(net)) + if (qemuInterfaceIsVnetCompatModel(net)) tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_VNET_HDR; =20 if (driver->privileged) { diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h index 0464b903d7..9e3f61e8e0 100644 --- a/src/qemu/qemu_interface.h +++ b/src/qemu/qemu_interface.h @@ -58,3 +58,4 @@ int qemuInterfaceOpenVhostNet(virDomainDefPtr def, =20 qemuSlirpPtr qemuInterfacePrepareSlirp(virQEMUDriverPtr driver, virDomainNetDefPtr net); +bool qemuInterfaceIsVnetCompatModel(const virDomainNetDef *net); --=20 2.26.2