From nobody Sun May 19 04:56:02 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689752958; cv=none; d=zohomail.com; s=zohoarc; b=EPlXRf1dyp357aWp8vyHJGA5QWaHOuSwhJbAIJoghpNghX5IEB4nJDZ9UoeVlre9x+mBANFNJqdweL2dg+DGTKQPg0YRVA6gG61DcuHZJAeADmDqpCLlegnAukCiqd9RrF5K9vSBYP3JoQwtKOl7INS8Ikt0t9gNOj5G0vgxwJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689752958; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=749c16VfFqHXoK3rBi9xwn3HY6BMtdWqslVMXDL704I=; b=EBqR2tr8UseWOIqzEK6aleHc2PLzfSp8B9F/swgcYJdwuQTV99tHdmfWC/+B+CYJtUiQitLEBqL7fhNOqW/goKXb5XXthlOWNbBiNkxc6b4sgBmizZxzA6JsaK6Q25u/GTEbGD03JrT8Cfx+BAqP8jNnjoWcOD7RS68XLdO7dtQ= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16897529586441022.9826550392968; Wed, 19 Jul 2023 00:49:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM1uo-00007q-RQ; Wed, 19 Jul 2023 03:48:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM1uU-0008UA-QK for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:52 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM1uS-00027L-J4 for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:45 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-666ed230c81so6629383b3a.0 for ; Wed, 19 Jul 2023 00:47:44 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id i15-20020aa787cf000000b0067a6e48b720sm2667962pfo.181.2023.07.19.00.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 00:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689752863; x=1692344863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=749c16VfFqHXoK3rBi9xwn3HY6BMtdWqslVMXDL704I=; b=hjJXtBkl31jAZULG8qkGzePGbSQ+D+v/lEmWBQ9KwdMAnhUA2ghwHEZh5GnK6ofi3L ccrX/Z/BT72J1oRFr4Ysu0eVqJv0J1HPt0kX1RUqNMZFqam7dTQ9hF/bBGjDyDuivDSv j6ri8IdTLVBZG9kLQKAFEOhrTyFJ5Ed7QiVd+7MhVQ6qiU492VkuTtppZpJfdGvcI6HK OC/QWnL7UTK3++HfRBwvKBDpq3BThGN19HMwz/FY7/0WZGE2eMKTPym19tjw302crfDN q6efgD0pesI16am2nmQbpY5rxzk6MKZhWO7J8ehVpyuhYaPCdh7kimRsw7owy0j/6ZH1 T94A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689752863; x=1692344863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=749c16VfFqHXoK3rBi9xwn3HY6BMtdWqslVMXDL704I=; b=mF5Iib6ZDBlzVv3nGPZdvQd6barNg7dSwJDjO3xixzggoXd1hexLG70AHK6GfcxHRy F+N+4H+DOdkegj6tmQLzh20WVB9fFBXjxn33i51SoAjoQ3nhZjQrQIYJLYxMMBr5zL7n ho1zri4sQTVHCAYrahw7JT+fjmuQD/C+/YAMUqOtKtl9qwQp2kllbSHheZhh+GwjN6y+ cgqnqbL0mFFtiyvb3pSbOxkFpP7Pi9KespMa5r+CKFwEFPqCTJ4oOSgieSZQ9w5Rszgg S36akNdhfYZEJEalUH7/JurMyhZT52TGEYnfgwuFhxslUMFd+p6/ExuaS9e7RLrCJBaH a8Sw== X-Gm-Message-State: ABy/qLYnk1EWsP+eXFKx+HCERVyeyshFn+hgtcEnNiPj/uSRVXpwvjg9 /uLq2oI21V9+S7RV3gaguXY= X-Google-Smtp-Source: APBJJlFPaJsaEVOHIq1Wo/xF2GhxvGVjfO7pyikRY3NOdDZ2S6QstFQQWRyzIzX3m1DOnwH0riKocw== X-Received: by 2002:a05:6a21:3393:b0:137:3b34:93e5 with SMTP id yy19-20020a056a21339300b001373b3493e5mr1551631pzb.59.1689752862961; Wed, 19 Jul 2023 00:47:42 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH 1/4] virtio-net: do not reset vlan filtering at set_features Date: Wed, 19 Jul 2023 15:47:28 +0800 Message-Id: <966bd98eb6efe1754165f497e44f2de09c64e077.1689690854.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::432; envelope-from=yin31149@gmail.com; helo=mail-pf1-x432.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1689752960637100003 From: Eugenio P=C3=A9rez This function is called after virtio_load, so all vlan configuration is lost in migration case. Just allow all the vlan-tagged packets if vlan is not configured, and trust device reset to clear all filtered vlans. Fixes: 0b1eaa8803 ("virtio-net: Do not filter VLANs without F_CTRL_VLAN") Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Hawkins Jiawei Signed-off-by: Hawkins Jiawei Tested-by: Lei Yang --- hw/net/virtio-net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7102ec4817..d20d5a63cd 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1006,9 +1006,7 @@ static void virtio_net_set_features(VirtIODevice *vde= v, uint64_t features) vhost_net_save_acked_features(nc->peer); } =20 - if (virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { - memset(n->vlans, 0, MAX_VLAN >> 3); - } else { + if (!virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { memset(n->vlans, 0xff, MAX_VLAN >> 3); } =20 --=20 2.25.1 From nobody Sun May 19 04:56:02 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689752989; cv=none; d=zohomail.com; s=zohoarc; b=ZFYt8c93xvQfkeqT1Lim87jBQp/WVs1Bpv2ZT/Qpoti04rW6AOTi8AGpERvW0WD+fR+RbshKYYrwhXxkoXdqqS/0b/tGEU9lYWP+TixY26sa2TjLGSJjXzVnZfY2bJb3GgIUp8bFPVeIOAEYQa/eGP/SS5sqAmjlQaHVmq84X/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689752989; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OQXPMit78wxXOLwUXAdy/5EGNJNucIHi6SIpfnSqqAI=; b=FbVaDbu2ne5geefl1Tb3rYgzI4iinUEe/2L+RRy2jDfLx3OZx89p/73AIsJ4EqEyY3AnI9JFmiq/D/5n07KK65pAxqP+nxI7WutP4fDo59TZgsYgSbsQ5evFKZ3YjYoqz96opDPZF77g0BBFoFzQwkh8lGe7WLpFPi9ZCUEFLhU= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689752989048209.91602985133136; Wed, 19 Jul 2023 00:49:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM1uo-00007p-Q9; Wed, 19 Jul 2023 03:48:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM1uY-0008UM-Dn for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:53 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM1uW-00027u-Ph for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:50 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b9ecf0cb4cso40906745ad.2 for ; Wed, 19 Jul 2023 00:47:48 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id je19-20020a170903265300b001b8528da516sm3216400plb.116.2023.07.19.00.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 00:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689752867; x=1692344867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQXPMit78wxXOLwUXAdy/5EGNJNucIHi6SIpfnSqqAI=; b=WvhYJEm27ZNlSgl7NGonGEMJ7Lsgu+4o+UsrZueMrdvsVUrUVZ3PLtJTyspR8AxDdz pCROssillsbTAIw0nhajuoy+KGA0MGQ8yMhd8qSZKkCYHiVHop70jvtbISHx27BJ/Nzb 0w2MyWs8+f8uPVmnRmPEgy9KfvW6hzUZdcftHYTuW2GiE4YTK7yynLm8nLtJeIuQRa80 E2wGRfKH+HKaU/xOJtntNiOQeCRK8oiXLR0NcQfjG2CniPw5JHoTiVIKj/3dtL2E8DK6 0LE05dprL0Xx1XL5i8vMkutfgiGBIbDxRiM7aB8MV3IzURtZ0h0E31g6f5jBjznWE60Z dICg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689752867; x=1692344867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OQXPMit78wxXOLwUXAdy/5EGNJNucIHi6SIpfnSqqAI=; b=gI8orso0gjZCH+65P7jnZGvqElXOEysNBYAcErsk+HjqSpla24enVh1j3fER7Pi0hV GyVS0o+WGFSlmX0ebUdqqdMw8PrRIhzqrG8R4sL+R3FxO3yYO0CL3OcdS6rWDzd0JEaO bZfBLLitWM1xH30yVT5p7TpCN3hvAzJjFMZj4kqfRvDgj3EWm7Msv1FM0d8pcSLqJEz8 +cgthy8I1etQ6f7Dx3/G2iSvAwlizyw4viKS+vvQEWOeOyIpP3l0QElnPAE3CzQTu2fI JelG99ZNEb2b5CcvVNK4q7JwjFJ03aaLQSAT7K8kxato/nW2PwTqYr/qnjIUFU9SmUza dbtQ== X-Gm-Message-State: ABy/qLYHD2OGcTWbw9Ox/xUwLsuoQGAAhLObh9qE99o4p/bPAHzTCTYA BOEJh6s14W+oBwk+mCO7RkM= X-Google-Smtp-Source: APBJJlGgBiyU96KqNmR6NqfgWimiqfVkl/pvQM77pvJz7i2mGAZruMCwfTbwuKFm/fv+tdiLIwkKQw== X-Received: by 2002:a17:902:e810:b0:1b6:8a99:4979 with SMTP id u16-20020a170902e81000b001b68a994979mr2307598plg.22.1689752867339; Wed, 19 Jul 2023 00:47:47 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH 2/4] virtio-net: Expose MAX_VLAN Date: Wed, 19 Jul 2023 15:47:29 +0800 Message-Id: <9106e247646f3808d0b0c4be948f2217bbfd8fd1.1689690854.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::634; envelope-from=yin31149@gmail.com; helo=mail-pl1-x634.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1689752990806100003 vhost-vdpa shadowed CVQ needs to know the maximum number of vlans supported by the virtio-net device, so QEMU can restore the VLAN state in a migration. Co-developed-by: Eugenio P=C3=A9rez Signed-off-by: Eugenio P=C3=A9rez Signed-off-by: Hawkins Jiawei Tested-by: Lei Yang --- hw/net/virtio-net.c | 2 -- include/hw/virtio/virtio-net.h | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index d20d5a63cd..a32672039d 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -49,8 +49,6 @@ =20 #define VIRTIO_NET_VM_VERSION 11 =20 -#define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ - /* previously fixed value */ #define VIRTIO_NET_RX_QUEUE_DEFAULT_SIZE 256 #define VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE 256 diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 5f5dcb4572..93f3bb5d97 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -38,6 +38,12 @@ OBJECT_DECLARE_SIMPLE_TYPE(VirtIONet, VIRTIO_NET) /* Maximum VIRTIO_NET_CTRL_MAC_TABLE_SET unicast + multicast entries. */ #define MAC_TABLE_ENTRIES 64 =20 +/* + * The maximum number of VLANs in the VLAN filter table + * added by VIRTIO_NET_CTRL_VLAN_ADD + */ +#define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ + typedef struct virtio_net_conf { uint32_t txtimer; --=20 2.25.1 From nobody Sun May 19 04:56:02 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689752948; cv=none; d=zohomail.com; s=zohoarc; b=d6DM1TaYMY4VhN3c3trSlPLHUDuZajkPhZAFhjadOc4qUgf7VQMu2gkjzDvMUze0VTTvroGRhMnb/8CiJXNAq74aGNbrRQtcRYkeexw46zdVcZ0ngWVMw6UxGUbEtCjq4MvLCqnB69Z1wA7o/+GX7AOmQM7OJT+RaAoH63MIzRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689752948; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a0dk1wMkxNjWLjUCHUyq+4SMFlPjROSExPsMmBcqpSw=; b=YgfENs5NW1TwJjT1Y+fzVar0RaF90fqR2Lkr9JK+pqjCU+1QyjbcgdYf2iHzcG+HkUpNqDaMPl6AOPiEZVFVOK9wsZRO86QYkaBUhbXmPXzzqzUsksEF6YdvEp3DJEF86MMEnZh5E6MYJ0oO3mj+ySSk91Vp6GnbZcuULAmw2Vc= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689752948178695.8144084788478; Wed, 19 Jul 2023 00:49:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM1uq-000082-7y; Wed, 19 Jul 2023 03:48:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM1ud-000061-Lp for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:48:01 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM1ub-00028c-9C for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:54 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b8a44ee159so40814915ad.3 for ; Wed, 19 Jul 2023 00:47:52 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id w21-20020a170902a71500b001b9c5e0393csm3156914plq.225.2023.07.19.00.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 00:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689752872; x=1692344872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a0dk1wMkxNjWLjUCHUyq+4SMFlPjROSExPsMmBcqpSw=; b=IbkW86ohq3FjbdsLYQBVDrJBbL4mQN7HX/jMBHALJUWrlhWy19q6mXVyHaV5//8chk ybWaRHqLGgGCIvQDc9GcW8z4lD+6xvs64XFFbpdNdcX501K05eVa4g4LXU2JB0NWX2de ZpQlhE2VRdbfiZOYk29H0gMsOhfv7iRoHayLII3ZmK2XStIZg5KrFLtMGb8T/lgGV3RO qHh0ANiMyKX70jcg5m6uUBYjj/QSZdPqLSNc3x2PMcc2loKVizBF2aGgC93HheUxYekB 2LWhOPOFD/OlKEj/aarnjBVbC3/g6henQASwwgGVyzaQsk5HZ4GiLnTVW6dvjph6WPpB DWwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689752872; x=1692344872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a0dk1wMkxNjWLjUCHUyq+4SMFlPjROSExPsMmBcqpSw=; b=TbDD2/X+CgqxHtMRc0TC+uZic+Xt2HH9FS+IwjFDesy1xdVjKBQe1XGmfTOVQDEzmw xtSjbTeXbCRdu3ihr0vqgvHjKwE/kCZen1c8aP8rgpaNqWwcI3MXZnkudLXCsV3fBeI6 QKNDY+lSyQ9RYUbq13pMbL/2oAiClZHfe9dYYmVB69hgt8tbrSL7BDgh4kzHJZPQ090p 1Zk3nXeV3qb1JOKgdovleTcIQTkiB3zUKHoTJZP6hzc2kbVt5/A39C7iYLmJiTfAY8BX Lt69zcR8PuQaz4aEx1/tDyEq+3WW7/iHnkAxt42RHZ63G3ISNxPvkDOq34BTPaW7Z+8a AQjg== X-Gm-Message-State: ABy/qLZvAAGpv+ed6AZczWjHugutPads6B1XBaqWnsF9gaD1Y+RUJkbQ j9RUoJZmYMA3ePNoYbHE3+c= X-Google-Smtp-Source: APBJJlEd/D+1UU7fGPreXhyuEpwheKis8Nv8pT/yDoiU8/1A89a5uFwg7CuasBuKPnZNnkJu3eX5hw== X-Received: by 2002:a17:902:c94c:b0:1b2:4852:9a5f with SMTP id i12-20020a170902c94c00b001b248529a5fmr19768475pla.54.1689752871618; Wed, 19 Jul 2023 00:47:51 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH 3/4] vdpa: Restore vlan filtering state Date: Wed, 19 Jul 2023 15:47:30 +0800 Message-Id: <0a568cc8a8d2b750c2e09b2237e9f05cece07c3f.1689690854.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::632; envelope-from=yin31149@gmail.com; helo=mail-pl1-x632.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1689752948581100001 This patch introduces vhost_vdpa_net_load_single_vlan() and vhost_vdpa_net_load_vlan() to restore the vlan filtering state at device's startup. Co-developed-by: Eugenio P=C3=A9rez Signed-off-by: Eugenio P=C3=A9rez Signed-off-by: Hawkins Jiawei Tested-by: Lei Yang --- net/vhost-vdpa.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 9795306742..0787dd933b 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -965,6 +965,51 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, return 0; } =20 +static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s, + const VirtIONet *n, + uint16_t vid) +{ + const struct iovec data =3D { + .iov_base =3D &vid, + .iov_len =3D sizeof(vid), + }; + ssize_t dev_written =3D vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_VLA= N, + VIRTIO_NET_CTRL_VLAN_ADD, + &data, 1); + if (unlikely(dev_written < 0)) { + return dev_written; + } + if (unlikely(*s->status !=3D VIRTIO_NET_OK)) { + return -EIO; + } + + return 0; +} + +static int vhost_vdpa_net_load_vlan(VhostVDPAState *s, + const VirtIONet *n) +{ + int r; + + if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_VLAN)) { + return 0; + } + + for (int i =3D 0; i < MAX_VLAN >> 5; i++) { + for (int j =3D 0; n->vlans[i] && j <=3D 0x1f; j++) { + if (n->vlans[i] & (1U << j)) { + r =3D vhost_vdpa_net_load_single_vlan(s, n, (i << 5) + j); + if (unlikely(r !=3D 0)) { + return r; + } + } + } + } + + return 0; +} + + static int vhost_vdpa_net_load(NetClientState *nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); @@ -995,6 +1040,10 @@ static int vhost_vdpa_net_load(NetClientState *nc) if (unlikely(r)) { return r; } + r =3D vhost_vdpa_net_load_vlan(s, n); + if (unlikely(r)) { + return r; + } =20 return 0; } --=20 2.25.1 From nobody Sun May 19 04:56:02 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689752983; cv=none; d=zohomail.com; s=zohoarc; b=c3chKFndpLNJvrsV8JJPoi7v8pTmp4d4Qv7Mr84WP4B+SGQ612B5gPvT8zzOZ2rXuxGPirHitGCllbonlXGgK3kw7Y4sDkxzg9vvQbQIK/UkbKKqnq8+8wW3Q6WP/f+KJh8x0EHH8a51YvwRO5uk8mqlsE+MV6ulu0+bHnr5TpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689752983; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N4m+qFiL/6vxm0QTuj55sm23sigcWT4ob6LjjN0fg1I=; b=d+0wFd+3Q3i+a9b7kdpmwZtoqGqWgQngN0m77EaAIxEy5iaU8X4i1sFhoHIB8n33f45nMB9TC4NbrTuK8Gnn6/I054KHEr/9scZhlYcs0DidTqZlc6Ahm9tC4bkpxbTX+cLW4gkSmLoLSjT6Ch7bCh2Pk1xIAteYZCFi61BfUl4= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689752983101970.7324305226165; Wed, 19 Jul 2023 00:49:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM1ur-00008q-AE; Wed, 19 Jul 2023 03:48:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM1uh-00006E-2E for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:48:05 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM1uf-00029G-H2 for qemu-devel@nongnu.org; Wed, 19 Jul 2023 03:47:58 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-668704a5b5bso6600485b3a.0 for ; Wed, 19 Jul 2023 00:47:57 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id p22-20020aa78616000000b0064389eab4c8sm2675143pfn.126.2023.07.19.00.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 00:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689752876; x=1692344876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N4m+qFiL/6vxm0QTuj55sm23sigcWT4ob6LjjN0fg1I=; b=Kw+giX1P3zy1Mk7FD+zglYwSzNDMyAv5jYWF1goqshb+ZZVPXQDulVzPNP3mgiyv6U uhoOJFPUTFeL+7HFS45PMtLMzzi6UxgUNsUHT4gX89+8gK9r0IlIrSefNNw6Em8cKfBE 7P7gyRYUyaOdhWol0ASbQlHrJzFVxTaX/YBO94BoUP8vodqSD4KGcyA2cuO+DstZOuum +xF0y9DYCdgTn32fgCrC04L9Nq9wGLdQTxBIby3GMb4Dw5QeeroIRTbYjiByfKa6WJwR JNbGAc/2+LQH9TrDtYeKWPu+mA1l0IeeqzdVf1/BFGLD8I8CpdIfUqyumDzSbZLnveB8 mEPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689752876; x=1692344876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N4m+qFiL/6vxm0QTuj55sm23sigcWT4ob6LjjN0fg1I=; b=XYaDFPPdSiMuafY4dkFPFBFByOQ1vcXzq/MUunUxQASYrm+5tWbskK9RgVhkhXvQFv j16BiM0q7SnYffsIf5T3S7tt4diM0CSy4Jivv76EUzey6SqqEiCCwTF21aB5o8YRVjS6 /DRxCQveyDYkhPiOf8LGCZgLd3ltrTQfJrO5OhKg9G0ZavBQsuBupAPfwhsyUSh6rtw0 XR0OllqBSvYrzVjaOj0o9GQVfijKk/blrZ6N028qFauBbsv91F0jh2QDARoWtInmJFav S7nhfKLAicTZQkHBY7vOl6t3JKfCretcCthOUbstLlqS2S/+25ZiiwHPO7fDnU89k1Fl kH/g== X-Gm-Message-State: ABy/qLYAFQB21eUbC1mNyQfj6/tYUfN7zo33lgI2cAUIjapXi312E65V /PeUJGzrQgZahO8LzWWVIoY= X-Google-Smtp-Source: APBJJlELPexmWm8yl4cHI3cD84Ae0C+ksVyBFmVaKBane5eKqgFuwCjg2gJASdvlVUsCjCUJNDLOtg== X-Received: by 2002:a05:6a00:ac7:b0:674:6dd4:8337 with SMTP id c7-20020a056a000ac700b006746dd48337mr22135800pfl.12.1689752875894; Wed, 19 Jul 2023 00:47:55 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH 4/4] vdpa: Allow VIRTIO_NET_F_CTRL_VLAN in SVQ Date: Wed, 19 Jul 2023 15:47:31 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=yin31149@gmail.com; helo=mail-pf1-x42f.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1689752984778100003 Enable SVQ with VIRTIO_NET_F_CTRL_VLAN feature. Co-developed-by: Eugenio P=C3=A9rez Signed-off-by: Eugenio P=C3=A9rez Signed-off-by: Hawkins Jiawei Tested-by: Lei Yang --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 0787dd933b..dfd271c456 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -111,6 +111,7 @@ static const uint64_t vdpa_svq_device_features =3D BIT_ULL(VIRTIO_NET_F_STATUS) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ) | BIT_ULL(VIRTIO_NET_F_CTRL_RX) | + BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) | BIT_ULL(VIRTIO_NET_F_CTRL_RX_EXTRA) | BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_F_ANY_LAYOUT) | --=20 2.25.1