From nobody Sat May 18 18:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1612470667; cv=none; d=zohomail.com; s=zohoarc; b=ILF8uhTdiJ5Gclrth6i945RJRbLcbQuIifpGPqdghf569mC8OwH/zox+PIi6NEY+HjZRFfRB/tUgCoco8Xe6uIjIoT9673wjWYaYB0YfJy+s2qH/IlRQy0xqkECphHzVUVaO71sh/ej3TUVuOmQF237s/6NYrSQH9M0EGR55GOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612470667; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=vXzMO6i9R0x1KvOrRVIzXnXswl1dMtXqTbmX3II/M48=; b=MH6wvGnUGk6tniv3XIFT54vRGwr8uW0RM5aPV33ClUsl+kA6acz/+xFgdc7Ci92ZEc2xc2hLLAYVBnyDynlEV23Gij7JpWzGUnrvq2JTQ6U7tSMHh73ZJvTErWLVXaVn+sm4ra2GQVQh6yN0Jsg73djPwbhhTj0+aLs7GFmRGZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612470667347900.7610692167192; Thu, 4 Feb 2021 12:31:07 -0800 (PST) Received: from localhost ([::1]:54724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7lHO-00006h-2F for importer@patchew.org; Thu, 04 Feb 2021 15:31:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7lFr-0007Eq-1k for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:31 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:40707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7lFp-0002dv-MR for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:30 -0500 Received: by mail-wm1-x333.google.com with SMTP id c127so4122554wmf.5 for ; Thu, 04 Feb 2021 12:29:29 -0800 (PST) Received: from f2.Home (bzq-109-64-9-177.red.bezeqint.net. [109.64.9.177]) by smtp.gmail.com with ESMTPSA id f7sm8807834wre.78.2021.02.04.12.29.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Feb 2021 12:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vXzMO6i9R0x1KvOrRVIzXnXswl1dMtXqTbmX3II/M48=; b=ajeJPW5ndkDGNuEb4kuhLWMpnSBO3aSHobF+0r3an4Uwspf1lFGsAbCzuIiD9+Z0/d cq8sV8yD8/5NfzrE5hZjgjD6s1nLYl7vUM5FXyADEEgTMQzxhEUzGsTGPP8bb6USLoeL PxVVHTvVQyfIdALmEiFViY6qFbWrlePx7LoJd1Sv9153ikg9csdgXWKoYnKciPw7Koth aZSvP7366AabczkDMExD+xE+YRWlFQveR6byKJOhmDEpDNPbxENPqSdISlWdLrhbUcXs 8pdM9TDQPKMiKYjuzozzz0Q4bwu4FrHtRy0r38Qk66+JQY0dMhh94KBAJOwykToHEHnt e9LQ== 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=vXzMO6i9R0x1KvOrRVIzXnXswl1dMtXqTbmX3II/M48=; b=OZvd1SXGf3Cz8w8z+dhX7RrtfYreoBj/nvF5u++0qO3v5g/Bxd9WZ44poVJQ0JPzNq mG5ytR0GPvjy3prNrxs+gGFPRVzk8A3wTWtpBOdPJODwAL+rnFmNwSPp67lznT4Q10cY UWyP52rbdUC9dvg4jC/wRNUQIG3aID0TutnrvaBM1U7nbj7AoNe/FEQ7aCJ+o59asmUZ /3KhBb3V0kNk2l2p4I76Yln+LavA4mYVMX3VtTwaKA1SI9tTvFh6Ktf7jNWTE/pIz7to ce0Kd2fR2UtYqtJSt1/3+hChBQMKaswB0oIX9F3lW8mMiCxFbASWOh01HxeOTxVBtoTp mZTQ== X-Gm-Message-State: AOAM531E3NBOOOkQA8892vuXTJQiQWHkh6Joe/Y70irSmWW008lB+nb7 A6QnNz+ykul8t9pwrqo1dMgxCgGqpyN02g== X-Google-Smtp-Source: ABdhPJz8+6VzEdzBb0fQETBegW8F3y3jWeL5lx58C6oKMnlWFAfb+39sa8/mOknMexWdo3zwPy5Zbg== X-Received: by 2002:a1c:7f93:: with SMTP id a141mr763821wmd.105.1612470568123; Thu, 04 Feb 2021 12:29:28 -0800 (PST) From: Yuri Benditovich To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 1/3] vhost-net: add VIRTIO_NET_F_HASH_REPORT to the list of kernel features Date: Thu, 4 Feb 2021 22:29:13 +0200 Message-Id: <20210204202915.15925-2-yuri.benditovich@daynix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210204202915.15925-1-yuri.benditovich@daynix.com> References: <20210204202915.15925-1-yuri.benditovich@daynix.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2a00:1450:4864:20::333; envelope-from=yuri.benditovich@daynix.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @daynix-com.20150623.gappssmtp.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In case of vhost TAP the kernel must support this feature, otherwise the device can't offer it. Signed-off-by: Yuri Benditovich --- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 24d555e764..8282e440bd 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -45,6 +45,7 @@ static const int kernel_feature_bits[] =3D { VIRTIO_NET_F_MTU, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, + VIRTIO_NET_F_HASH_REPORT, VHOST_INVALID_FEATURE_BIT }; =20 --=20 2.17.1 From nobody Sat May 18 18:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1612470786; cv=none; d=zohomail.com; s=zohoarc; b=P9GILeyPSzivYaPRHWJi9r/tV1yiSoVhAOdT45MP0IKVZlMHk5kxuRhqX+BxG8SC+dfEdUcQntDMVPfK6NgqOQnxAjYN+zFHDRUGXmjaJrmS8pJ6O8Z0vFxwDxrCoBxpibZ112+vMlTPTfLar1+66XaCFNOb4sMlO7DqYqmGtwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612470786; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L7PVBmk+2nxLogepx4whST2GuDoJC+uo2HBF8DDdhak=; b=jaWneRvl8woApvnka0G5xV07LWO+wyO/jXBRw4610aALiZIzHTPA4clciYGsjcZWkTMBnilZEIuD0pzipdzkWcohGOkOj29dqiB0k4L2uhr72hqdyXCawGi1JV+QD6yMTKfZogZ0LlFG/aRw8G8HPQ2uk6Nt0Nqhg1ssuc2vZQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612470786112517.6461803135472; Thu, 4 Feb 2021 12:33:06 -0800 (PST) Received: from localhost ([::1]:59564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7lJJ-0002Jf-2V for importer@patchew.org; Thu, 04 Feb 2021 15:33:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7lFu-0007Ik-Eu for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:34 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:38339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7lFq-0002eb-K9 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:33 -0500 Received: by mail-wm1-x336.google.com with SMTP id y187so4139559wmd.3 for ; Thu, 04 Feb 2021 12:29:30 -0800 (PST) Received: from f2.Home (bzq-109-64-9-177.red.bezeqint.net. [109.64.9.177]) by smtp.gmail.com with ESMTPSA id f7sm8807834wre.78.2021.02.04.12.29.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Feb 2021 12:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L7PVBmk+2nxLogepx4whST2GuDoJC+uo2HBF8DDdhak=; b=tPjeG6yWV72ECYG4Ny4LNsINTYj5ZNy/Jqz78LSDShHjdNBBqNIaeozVjBAOe2Bpee DbGGjEwGgBxJHAvQREW2a3hO0D6zEr8kyqTFSToIxA3k7tkEDEuKu2d9QJmGOlp7KKD8 JVBFIyieWC5fWVGUwghbvNsqPCsrreDKBBkBtXhDvh+tjF37synJnUyy+R/RJYJoe8jj 2Em1Mtw/Nkj4tdadBOyh8yJSA8FKCyC948UbXkIWnMREm+0tZ50lJ3Zhsg3AsLnSKUdh v/oo2uRI58gttZ2klZiTJ7Yk98JRSfmzMj5JKmcKg2TlhMb0JCfpI9HWFl3BfvlViBti w0lQ== 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=L7PVBmk+2nxLogepx4whST2GuDoJC+uo2HBF8DDdhak=; b=jlLZnKoO/+avY8NIanjcQO8PoTaEcrJqefRFsftRqK7uIAdbsFM4o9SmwHk9cPtw80 75yUCAl2nHAB/F2qbHJTKcwYv4G/hfgq8l6voUkFjUnhQGopKl0h1PWXcBllGzRJULvw A+zskdZ051T7/JAMZpwyWKSWjt15tAIXLbVXxLa8v6SA3ygYyxgCnzkNush65QKNOuTH VYdFaUJna/WBJd+0Oj6/9qkLdpAFUIwTyiiZrDaYq0LrDBsqs/cO96u6PzCxobe9bO4Y LXiPdP6Vj+hi3om7uprO4HFi9dwcKUfvnxKXKvBNGVbEeoSGBJl9Zvv0OfvNoMt71fAI +stA== X-Gm-Message-State: AOAM533wExFCRuZHOYO7ADoqL3ElCUl1km6CLg8q25EB+fV6aCfOBa2C /WyMV233ntDysCU2nBmRsyJ+qw== X-Google-Smtp-Source: ABdhPJx7jVzE/HZCbr9I28b4vMFSAK8p2yvRLds345lrqA+cr7b4ZHnEIdSTv0+AhsmACiG6ePiBVQ== X-Received: by 2002:a05:600c:19c8:: with SMTP id u8mr754077wmq.59.1612470569295; Thu, 04 Feb 2021 12:29:29 -0800 (PST) From: Yuri Benditovich To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 2/3] net: add ability to hide (disable) vhost_net Date: Thu, 4 Feb 2021 22:29:14 +0200 Message-Id: <20210204202915.15925-3-yuri.benditovich@daynix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210204202915.15925-1-yuri.benditovich@daynix.com> References: <20210204202915.15925-1-yuri.benditovich@daynix.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2a00:1450:4864:20::336; envelope-from=yuri.benditovich@daynix.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @daynix-com.20150623.gappssmtp.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If 'vhost_net_disabled' in the NetClientState of the net device, get_vhost_net for TAP returns NULL. Network adapters can use this ability to hide the vhost_net temporary between resets in case some active features contradict with vhost. Signed-off-by: Yuri Benditovich --- hw/net/vhost_net.c | 4 +++- include/net/net.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 8282e440bd..7873d27a36 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -437,7 +437,9 @@ VHostNetState *get_vhost_net(NetClientState *nc) =20 switch (nc->info->type) { case NET_CLIENT_DRIVER_TAP: - vhost_net =3D tap_get_vhost_net(nc); + if (!nc->vhost_net_disabled) { + vhost_net =3D tap_get_vhost_net(nc); + } break; #ifdef CONFIG_VHOST_NET_USER case NET_CLIENT_DRIVER_VHOST_USER: diff --git a/include/net/net.h b/include/net/net.h index 919facaad2..4479bdcec0 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -100,6 +100,7 @@ struct NetClientState { int vring_enable; int vnet_hdr_len; bool is_netdev; + bool vhost_net_disabled; QTAILQ_HEAD(, NetFilterState) filters; }; =20 --=20 2.17.1 From nobody Sat May 18 18:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1612470857; cv=none; d=zohomail.com; s=zohoarc; b=kpHVczuQbfmAgZ1fBoyws3bQFxEEk270C5H/VyrqPQGfzi7CayYloh6DGddXxMz8OCZFEuRqjRWyKr/mgslSgyApBxhXQgCjGGrq75jDHxneCZfKBpARQ+bmXFw+8/wtbEZaLggXaG96/+Bx4pstKOXUliTuM7ANmoIC4+pKOrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612470857; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3sq4FAI5dt7o+cZJkil0F6/H4mLfESOkV51VC98s95A=; b=dyqZdLEvekljkbAzFy6TkJQKhuIQgA/bSc1cb1MhBSHkZgkWdyRTN0WiLy2nkqG0HFuiRnhHyVVt9LkB457waN37Fxsw0TOc1BHdPDudIJcaoZ7eeqcjrc7VffasKp8SxSISyFt/8OjZDg39mah42FzK5RiQgLMejJZBbYFhDeo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612470857769315.78069479168425; Thu, 4 Feb 2021 12:34:17 -0800 (PST) Received: from localhost ([::1]:33418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7lKS-0003DU-MQ for importer@patchew.org; Thu, 04 Feb 2021 15:34:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7lFv-0007Jq-55 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:36 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:53850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7lFs-0002ep-N8 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 15:29:34 -0500 Received: by mail-wm1-x331.google.com with SMTP id j11so4243486wmi.3 for ; Thu, 04 Feb 2021 12:29:31 -0800 (PST) Received: from f2.Home (bzq-109-64-9-177.red.bezeqint.net. [109.64.9.177]) by smtp.gmail.com with ESMTPSA id f7sm8807834wre.78.2021.02.04.12.29.29 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Feb 2021 12:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3sq4FAI5dt7o+cZJkil0F6/H4mLfESOkV51VC98s95A=; b=lzszdjTru2eXBOWLP2e0XhG1jwA4IgxnJ+Eg8CtI6aWXhXW1llJ2RkFD1HtXHmztVn yTFW1UoMF6FR+jNHOI+5pQKIxf20U9ZsoV8tWmfI8L1ZQpbLVopSC+cFzi/bcHQVpjc3 +tKLS9n+xu2ATLwyLDTgKMFbqeB+NdTyKktVPkTIg7zH+gpNH0OkNgXCyG3t2CwAz3XY DSX8Q28ybMSyQOxo9jRMiM8d9NfRJp5OaooCldb8PqelzD6TEHCAJNd28AmIwqzLueZX 02rkNy3qaW6xfCE1ijC06gVArsFbL3fNr7ds3dJux7sIyP1wxb1ekl4Fx4t7PLUQrWj9 K8mw== 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=3sq4FAI5dt7o+cZJkil0F6/H4mLfESOkV51VC98s95A=; b=oi/B9SQT7Pe3Q+sARMrnlqeJSZWNh78qP6WSxFqQDtC9L8hf1hfUxr8p40/kfaIn6J jEYajrNSiE0G7fBoZ/zJ6V4Yu7DjLKbKaBvM6Q461MXfNCPt01sfKbBt99CILO1/2nCd 7JASdIEXiKxVEMREUHH9Hjvr7v9z5NPRNZ9jq/hHqCWD3reKTP/gdotQclTYdnFp6MlG brZz+JawSXrR+/w/Eoov/zabIOg0tFWaOdMW9ACTS17qtP2USwnpxf4PuV+uTO0eN3Ld BB16+QopPIDW9ZZLZCiKVtv39AC66zvnYkA7L7TwD87Pv0VCrnCboMmybgXHnGT8pi/P K2yQ== X-Gm-Message-State: AOAM532vcH5MdcRno1M4Qh3p+COFK6F5vfn0ViEYXQTtAaYwFoF7M7Gm STn3IHUekYYnqV9YPs4B1CO1TyjEg29y2A== X-Google-Smtp-Source: ABdhPJyEX2UW0LppG7uTBhww97aSf51oviyMOc+L797TpcyhzstQjjErEgGKfMIUWEtXi/g+fDVF2g== X-Received: by 2002:a1c:cc14:: with SMTP id h20mr782936wmb.180.1612470570651; Thu, 04 Feb 2021 12:29:30 -0800 (PST) From: Yuri Benditovich To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 3/3] virtio-net: graceful fallback to vhost=off for tap netdev Date: Thu, 4 Feb 2021 22:29:15 +0200 Message-Id: <20210204202915.15925-4-yuri.benditovich@daynix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210204202915.15925-1-yuri.benditovich@daynix.com> References: <20210204202915.15925-1-yuri.benditovich@daynix.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2a00:1450:4864:20::331; envelope-from=yuri.benditovich@daynix.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @daynix-com.20150623.gappssmtp.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently virtio-net silently clears features if they are not supported by respective vhost. This may create migration problems in future if vhost features on the source and destination are different. Implement graceful fallback to no-vhost mode when some acked features contradict with vhost. The decision is taken on set_features call and the vhost will be disabled till next reset (or migration). Such fallback is currently enabled only for TAP netdev. Signed-off-by: Yuri Benditovich --- hw/net/virtio-net.c | 58 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5150f295e8..b353060e63 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -515,6 +515,15 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClie= ntState *nc) return info; } =20 +static void virtio_net_allow_vhost(VirtIONet *n, bool allow) +{ + int i; + for (i =3D 0; i < n->max_queues; i++) { + NetClientState *nc =3D qemu_get_subqueue(n->nic, i)->peer; + nc->vhost_net_disabled =3D !allow; + } +} + static void virtio_net_reset(VirtIODevice *vdev) { VirtIONet *n =3D VIRTIO_NET(vdev); @@ -552,6 +561,7 @@ static void virtio_net_reset(VirtIODevice *vdev) assert(!virtio_net_get_subqueue(nc)->async_tx.elem); } } + virtio_net_allow_vhost(n, true); } =20 static void peer_test_vnet_hdr(VirtIONet *n) @@ -689,6 +699,15 @@ static void virtio_net_set_queues(VirtIONet *n) } } =20 +static bool can_disable_vhost(VirtIONet *n) +{ + NetClientState *peer =3D qemu_get_queue(n->nic)->peer; + if (!get_vhost_net(peer)) { + return false; + } + return !peer || peer->info->type =3D=3D NET_CLIENT_DRIVER_TAP; +} + static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue); =20 static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t featu= res, @@ -725,14 +744,14 @@ static uint64_t virtio_net_get_features(VirtIODevice = *vdev, uint64_t features, return features; } =20 - virtio_clear_feature(&features, VIRTIO_NET_F_RSS); - virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT); - features =3D vhost_net_get_features(get_vhost_net(nc->peer), features); - vdev->backend_features =3D features; + vdev->backend_features =3D vhost_net_get_features(get_vhost_net(nc->pe= er), features); =20 - if (n->mtu_bypass_backend && - (n->host_features & 1ULL << VIRTIO_NET_F_MTU)) { - features |=3D (1ULL << VIRTIO_NET_F_MTU); + if (!can_disable_vhost(n)) { + features =3D vdev->backend_features; + if (n->mtu_bypass_backend && + (n->host_features & 1ULL << VIRTIO_NET_F_MTU)) { + features |=3D (1ULL << VIRTIO_NET_F_MTU); + } } =20 return features; @@ -872,10 +891,25 @@ static void failover_add_primary(VirtIONet *n, Error = **errp) error_propagate(errp, err); } =20 +static bool check_vhost_features(VirtIONet *n, uint64_t features) +{ + NetClientState *nc =3D qemu_get_queue(n->nic); + uint64_t filtered; + if (n->rss_data.redirect) { + return false; + } + filtered =3D vhost_net_get_features(get_vhost_net(nc->peer), features); + if (filtered !=3D features) { + return false; + } + return true; +} + static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features) { VirtIONet *n =3D VIRTIO_NET(vdev); Error *err =3D NULL; + bool disable_vhost =3D false; int i; =20 if (n->mtu_bypass_backend && @@ -894,13 +928,21 @@ static void virtio_net_set_features(VirtIODevice *vde= v, uint64_t features) VIRTIO_F_VERSION_1), virtio_has_feature(features, VIRTIO_NET_F_HASH_REPORT= )); - n->rsc4_enabled =3D virtio_has_feature(features, VIRTIO_NET_F_RSC_EXT)= && virtio_has_feature(features, VIRTIO_NET_F_GUEST_TSO4); n->rsc6_enabled =3D virtio_has_feature(features, VIRTIO_NET_F_RSC_EXT)= && virtio_has_feature(features, VIRTIO_NET_F_GUEST_TSO6); n->rss_data.redirect =3D virtio_has_feature(features, VIRTIO_NET_F_RSS= ); =20 + if (can_disable_vhost(n)) { + disable_vhost =3D !check_vhost_features(n, features); + } + if (disable_vhost) { + warn_report("Some of requested features aren't supported by vhost,= " + "vhost is turned off till next reset"); + virtio_net_allow_vhost(n, false); + } + if (n->has_vnet_hdr) { n->curr_guest_offloads =3D virtio_net_guest_offloads_by_features(features); --=20 2.17.1