From patchwork Wed Jul 19 07:47:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13318486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FD6DC001B0 for ; Wed, 19 Jul 2023 07:49:18 +0000 (UTC) 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) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Eugenio Pérez 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érez Reviewed-by: Hawkins Jiawei Signed-off-by: Hawkins Jiawei --- 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 *vdev, uint64_t features) vhost_net_save_acked_features(nc->peer); } - 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); }