From patchwork Sun Apr 28 07:00:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13645911 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 BB0C3C19F53 for ; Sun, 28 Apr 2024 07:04:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0yXf-0002Ro-PS; Sun, 28 Apr 2024 03:01:43 -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 1s0yXd-0002RQ-Am for qemu-devel@nongnu.org; Sun, 28 Apr 2024 03:01:41 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s0yXa-0005T8-9P for qemu-devel@nongnu.org; Sun, 28 Apr 2024 03:01:40 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so34551015ad.1 for ; Sun, 28 Apr 2024 00:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1714287697; x=1714892497; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=C4LB9lF2MmoKxZle6uNJOUEsQ43ZTVig2zMCK8Mfd8I=; b=lxgTMkOU3T93RlPp5c3Toqnfky9eoQu4XSyPtci5t7z8nOmSZ123okd2emWXXTYGfp YeDyD7lVlowxwyb4zqKAPPsTjfEOxy3UkgupKP85sP2GvLhxQ3YsEzicZGvXT5PYh1hx lBWUFbufS1y656OMNvpFJwazqqYUES0glwN7JUquebJjJXQoarGMbRfifKFYBvWphXfZ p8Kw/dEULUKv1zm7RbqbU7Ch39E8eBIp2L92+bGVLV/20dUAbJ+fFQ0A31hOJyAxGo/J Pff6zsM1PiqeStCig14cD0OHmucUnMefFqGChqMU8sQXyG6Ad3aGvwzNKSKDvCepjjCf gw5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714287697; x=1714892497; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C4LB9lF2MmoKxZle6uNJOUEsQ43ZTVig2zMCK8Mfd8I=; b=sh2Gwwrs1ddvzINXZ3Cgh611XX99QdMYyTTizUVbIQ9mxhv0JIet16ZN4ejGuUrVZi HSFJ7XyiQww1NUuF1gNVO9tOiIKpCaOUlQt2Vy1lkRPmDjhNG94P9CqDjiQyskkTflrI 6Ymn9KbNb9HsGQb4mzQ5tYmdO7ChM9ZNjFFZb2ndxRrrK3phhMhxYjA4tU9mnN4tI/eb BGsHH8bUX5+Nuj4Dvhkrh6zdRA/t85Az8+2Qx9SpeqKZ75ihUBwmNtSbnyQ/Bqf3sRIB QkTs9p1h332o/150XtiMTTCp6znvJ2+V4Tn5WnVL5EpXmcLwWJukjNqCas1aiSALuD27 1Fjg== X-Gm-Message-State: AOJu0YwCnn66ZSiV64/c06FEjGaZr74WVEOKYaWHOHlP/zIFKax1Eryl UWjkgooFYB+qagK4jyaubhWAyito2RAKuJtutsmIcDajmRK0ttE6/zlDKGXBvu0= X-Google-Smtp-Source: AGHT+IGi5s8p3HlAMtIhldiQj20SG3IE4JsXQFwRCmtvN6tuNiUuMth2rPwpsL4qI9Rm/h3E+PTyFQ== X-Received: by 2002:a17:902:ecc4:b0:1e4:2879:3a38 with SMTP id a4-20020a170902ecc400b001e428793a38mr8917014plh.47.1714287696781; Sun, 28 Apr 2024 00:01:36 -0700 (PDT) Received: from localhost ([157.82.202.162]) by smtp.gmail.com with UTF8SMTPSA id w17-20020a170902d11100b001e42f215f33sm18055727plw.85.2024.04.28.00.01.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Apr 2024 00:01:36 -0700 (PDT) From: Akihiko Odaki Date: Sun, 28 Apr 2024 16:00:54 +0900 Subject: [PATCH v10 11/18] virtio-net: Disable RSS on reset MIME-Version: 1.0 Message-Id: <20240428-rss-v10-11-73cbaa91aeb6@daynix.com> References: <20240428-rss-v10-0-73cbaa91aeb6@daynix.com> In-Reply-To: <20240428-rss-v10-0-73cbaa91aeb6@daynix.com> To: Jason Wang , Dmitry Fleytman , Sriram Yagnaraman , "Michael S. Tsirkin" , Luigi Rizzo , Giuseppe Lettieri , Vincenzo Maffione , Andrew Melnychenko , Yuri Benditovich Cc: qemu-devel@nongnu.org, Akihiko Odaki , Michael Tokarev X-Mailer: b4 0.14-dev Received-SPF: none client-ip=2607:f8b0:4864:20::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.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.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 RSS is disabled by default. Fixes: 590790297c ("virtio-net: implement RSS configuration command") Signed-off-by: Akihiko Odaki Reviewed-by: Michael Tokarev --- hw/net/virtio-net.c | 70 +++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5aa0527a1921..1ac9c06f6865 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -600,40 +600,6 @@ static void virtio_net_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -static void virtio_net_reset(VirtIODevice *vdev) -{ - VirtIONet *n = VIRTIO_NET(vdev); - int i; - - /* Reset back to compatibility mode */ - n->promisc = 1; - n->allmulti = 0; - n->alluni = 0; - n->nomulti = 0; - n->nouni = 0; - n->nobcast = 0; - /* multiqueue is disabled by default */ - n->curr_queue_pairs = 1; - timer_del(n->announce_timer.tm); - n->announce_timer.round = 0; - n->status &= ~VIRTIO_NET_S_ANNOUNCE; - - /* Flush any MAC and VLAN filter table state */ - n->mac_table.in_use = 0; - n->mac_table.first_multi = 0; - n->mac_table.multi_overflow = 0; - n->mac_table.uni_overflow = 0; - memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN); - memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac)); - qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac); - memset(n->vlans, 0, MAX_VLAN >> 3); - - /* Flush any async TX */ - for (i = 0; i < n->max_queue_pairs; i++) { - flush_or_purge_queued_packets(qemu_get_subqueue(n->nic, i)); - } -} - static void peer_test_vnet_hdr(VirtIONet *n) { NetClientState *nc = qemu_get_queue(n->nic); @@ -3861,6 +3827,42 @@ static void virtio_net_device_unrealize(DeviceState *dev) virtio_cleanup(vdev); } +static void virtio_net_reset(VirtIODevice *vdev) +{ + VirtIONet *n = VIRTIO_NET(vdev); + int i; + + /* Reset back to compatibility mode */ + n->promisc = 1; + n->allmulti = 0; + n->alluni = 0; + n->nomulti = 0; + n->nouni = 0; + n->nobcast = 0; + /* multiqueue is disabled by default */ + n->curr_queue_pairs = 1; + timer_del(n->announce_timer.tm); + n->announce_timer.round = 0; + n->status &= ~VIRTIO_NET_S_ANNOUNCE; + + /* Flush any MAC and VLAN filter table state */ + n->mac_table.in_use = 0; + n->mac_table.first_multi = 0; + n->mac_table.multi_overflow = 0; + n->mac_table.uni_overflow = 0; + memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN); + memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac)); + qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac); + memset(n->vlans, 0, MAX_VLAN >> 3); + + /* Flush any async TX */ + for (i = 0; i < n->max_queue_pairs; i++) { + flush_or_purge_queued_packets(qemu_get_subqueue(n->nic, i)); + } + + virtio_net_disable_rss(n); +} + static void virtio_net_instance_init(Object *obj) { VirtIONet *n = VIRTIO_NET(obj);