From nobody Fri May 3 11:41:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=tencent.com ARC-Seal: i=1; a=rsa-sha256; t=1600745334; cv=none; d=zohomail.com; s=zohoarc; b=Z1aB3qjluxN0myq4C+7O2ypMZ+DhylhGwC1M+CYEzs+aYKrLmPcTRBSce3GOFlrR0PK5qemNuLxV5DWXzgFyAXrCEM2PAEdyCliv0y7HcuPb5GJID5Xpw+qzntXGzMoxm7kvf5PuZkto5nISZrItIFJUk5dT6dmvNHet36/YG4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600745334; h=Content-ID: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=5qpVKvA2egJXwbKcD4TeoqIYuhE5xklLswijF2foncQ=; b=ZPB+dxDB7vTkMsncdh6SBMO/htfPFUS9Dm51sJisM4uDiaKRfKb872x2guyLbh82cXcpObfKLYLYCkIOKw1o+DDf4O1+FKn+RMHF5BCtL3chdTNSFY0HOVWzWaVRM4/X+IiV3FBwJQG/2aKKMzixOtJCXj4RuzBD4cuBuKff3XI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600745334692245.56121892307317; Mon, 21 Sep 2020 20:28:54 -0700 (PDT) Received: from localhost ([::1]:49778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKYz6-0001Rh-59 for importer@patchew.org; Mon, 21 Sep 2020 23:28:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKYyS-0000zh-AU for qemu-devel@nongnu.org; Mon, 21 Sep 2020 23:28:13 -0400 Received: from mail4.tencent.com ([183.57.53.109]:60920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKYyL-000532-Bv for qemu-devel@nongnu.org; Mon, 21 Sep 2020 23:28:09 -0400 Received: from EX-SZ018.tencent.com (unknown [10.28.6.39]) by mail4.tencent.com (Postfix) with ESMTP id C6BF072578; Tue, 22 Sep 2020 11:27:54 +0800 (CST) Received: from EX-SZ007.tencent.com (10.28.6.31) by EX-SZ018.tencent.com (10.28.6.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 22 Sep 2020 11:27:54 +0800 Received: from EX-SZ006.tencent.com (10.28.6.30) by EX-SZ007.tencent.com (10.28.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 22 Sep 2020 11:27:54 +0800 Received: from EX-SZ006.tencent.com ([fe80::a84e:872e:7c90:2930]) by EX-SZ006.tencent.com ([fe80::a84e:872e:7c90:2930%2]) with mapi id 15.01.2106.002; Tue, 22 Sep 2020 11:27:54 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tencent.com; s=s202002; t=1600745274; bh=5qpVKvA2egJXwbKcD4TeoqIYuhE5xklLswijF2foncQ=; h=From:To:CC:Subject:Date; b=ivYhmu4Tx7C000J9uqW2TswCEvCCi13OblfP3IxLbajRhYv2HbTtvnqkPgwWf4SdD L7ty+ySlX57G/jdCayGHQ4zAOupFTZwKf/G2I1u/O2ss0Jr1fBCQQsYz3kGhfdFGUc SNnonGN0RgXfx0w6vo6reae8/C8gROWlU3nXXgZ0= From: =?gb2312?B?aGFpYmluemhhbmco1cW6o7HzKQ==?= To: "Michael S. Tsirkin" , Jason Wang , Adrian Moreno Subject: [PATCH] vhost-user: save features of multiqueues if chardev is closed Thread-Topic: [PATCH] vhost-user: save features of multiqueues if chardev is closed Thread-Index: AQHWkJBbURiqOHG7gEeDe0rUGA5Yvw== Date: Tue, 22 Sep 2020 03:27:54 +0000 Message-ID: <46CBC206-E0CA-4249-81CD-10F75DA30441@tencent.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [9.19.161.114] Content-ID: <690BCF2A1B3C524FBC55E4FBA166007B@tencent.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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=183.57.53.109; envelope-from=haibinzhang@tencent.com; helo=mail4.tencent.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 23:27:55 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, CHARSET_FARAWAY_HEADER=3.2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-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: "xtay.haibin@gmail.com" , "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Fore-commit(c6beefd674) only saves features of queue0, this makes wrong features of other queues in multiqueues situation. For examples: qemu-system-aarch64 ... \ -chardev socket,id=3Dcharnet0,path=3D/var/run/vhost_sock \ -netdev vhost-user,chardev=3Dcharnet0,queues=3D2,id=3Dhostnet0 \ ... There are two queues in nic assocated with one chardev. When chardev is reconnected, it is necessary to save and restore features of all queues. Signed-of-by: Haibin Zhang --- net/vhost-user.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index 17532daaf3..ffbd94d944 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -226,7 +226,7 @@ static void chr_closed_bh(void *opaque) NetClientState *ncs[MAX_QUEUE_NUM]; NetVhostUserState *s; Error *err =3D NULL; - int queues; + int queues, i; =20 queues =3D qemu_find_net_clients_except(name, ncs, NET_CLIENT_DRIVER_NIC, @@ -235,8 +235,12 @@ static void chr_closed_bh(void *opaque) =20 s =3D DO_UPCAST(NetVhostUserState, nc, ncs[0]); =20 - if (s->vhost_net) { - s->acked_features =3D vhost_net_get_acked_features(s->vhost_net); + for (i =3D queues -1; i >=3D 0; i--) { + s =3D DO_UPCAST(NetVhostUserState, nc, ncs[i]); + + if (s->vhost_net) { + s->acked_features =3D vhost_net_get_acked_features(s->vhost_ne= t); + } } =20 qmp_set_link(name, false, &err); --=20 2.23.0