From nobody Sat Nov 1 22:17:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527087324031161.73636576235413; Wed, 23 May 2018 07:55:24 -0700 (PDT) Received: from localhost ([::1]:33879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLVAh-0002fD-6A for importer@patchew.org; Wed, 23 May 2018 10:55:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLUyr-0001ls-HY for qemu-devel@nongnu.org; Wed, 23 May 2018 10:43:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLUyq-0000nb-5Q for qemu-devel@nongnu.org; Wed, 23 May 2018 10:43:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38594 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fLUyp-0000nT-Us for qemu-devel@nongnu.org; Wed, 23 May 2018 10:43:08 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EBD24023112; Wed, 23 May 2018 14:43:07 +0000 (UTC) Received: from redhat.com (ovpn-124-180.rdu2.redhat.com [10.10.124.180]) by smtp.corp.redhat.com (Postfix) with SMTP id 21C5F210C6C1; Wed, 23 May 2018 14:43:07 +0000 (UTC) Date: Wed, 23 May 2018 17:43:06 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1527086545-68024-13-git-send-email-mst@redhat.com> References: <1527086545-68024-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1527086545-68024-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 23 May 2018 14:43:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 23 May 2018 14:43:07 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 12/28] vhost-user: add Net prefix to internal state structure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Tiwei Bie Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tiwei Bie We are going to introduce a shared vhost user state which will be named as 'VhostUserState'. So add 'Net' prefix to the existing internal state structure in the vhost-user netdev to avoid conflict. Signed-off-by: Tiwei Bie Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-user.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index e0f16c8..fa28aad 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -20,38 +20,38 @@ #include "qemu/option.h" #include "trace.h" =20 -typedef struct VhostUserState { +typedef struct NetVhostUserState { NetClientState nc; CharBackend chr; /* only queue index 0 */ VHostNetState *vhost_net; guint watch; uint64_t acked_features; bool started; -} VhostUserState; +} NetVhostUserState; =20 VHostNetState *vhost_user_get_vhost_net(NetClientState *nc) { - VhostUserState *s =3D DO_UPCAST(VhostUserState, nc, nc); + NetVhostUserState *s =3D DO_UPCAST(NetVhostUserState, nc, nc); assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER); return s->vhost_net; } =20 uint64_t vhost_user_get_acked_features(NetClientState *nc) { - VhostUserState *s =3D DO_UPCAST(VhostUserState, nc, nc); + NetVhostUserState *s =3D DO_UPCAST(NetVhostUserState, nc, nc); assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER); return s->acked_features; } =20 static void vhost_user_stop(int queues, NetClientState *ncs[]) { - VhostUserState *s; + NetVhostUserState *s; int i; =20 for (i =3D 0; i < queues; i++) { assert(ncs[i]->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER); =20 - s =3D DO_UPCAST(VhostUserState, nc, ncs[i]); + s =3D DO_UPCAST(NetVhostUserState, nc, ncs[i]); =20 if (s->vhost_net) { /* save acked features */ @@ -68,7 +68,7 @@ static int vhost_user_start(int queues, NetClientState *n= cs[], CharBackend *be) { VhostNetOptions options; struct vhost_net *net =3D NULL; - VhostUserState *s; + NetVhostUserState *s; int max_queues; int i; =20 @@ -77,7 +77,7 @@ static int vhost_user_start(int queues, NetClientState *n= cs[], CharBackend *be) for (i =3D 0; i < queues; i++) { assert(ncs[i]->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER); =20 - s =3D DO_UPCAST(VhostUserState, nc, ncs[i]); + s =3D DO_UPCAST(NetVhostUserState, nc, ncs[i]); =20 options.net_backend =3D ncs[i]; options.opaque =3D be; @@ -123,7 +123,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, c= onst uint8_t *buf, without GUEST_ANNOUNCE capability. */ if (size =3D=3D 60) { - VhostUserState *s =3D DO_UPCAST(VhostUserState, nc, nc); + NetVhostUserState *s =3D DO_UPCAST(NetVhostUserState, nc, nc); int r; static int display_rarp_failure =3D 1; char mac_addr[6]; @@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, c= onst uint8_t *buf, =20 static void vhost_user_cleanup(NetClientState *nc) { - VhostUserState *s =3D DO_UPCAST(VhostUserState, nc, nc); + NetVhostUserState *s =3D DO_UPCAST(NetVhostUserState, nc, nc); =20 if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); @@ -180,7 +180,7 @@ static bool vhost_user_has_ufo(NetClientState *nc) =20 static NetClientInfo net_vhost_user_info =3D { .type =3D NET_CLIENT_DRIVER_VHOST_USER, - .size =3D sizeof(VhostUserState), + .size =3D sizeof(NetVhostUserState), .receive =3D vhost_user_receive, .cleanup =3D vhost_user_cleanup, .has_vnet_hdr =3D vhost_user_has_vnet_hdr, @@ -190,7 +190,7 @@ static NetClientInfo net_vhost_user_info =3D { static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond, void *opaque) { - VhostUserState *s =3D opaque; + NetVhostUserState *s =3D opaque; =20 qemu_chr_fe_disconnect(&s->chr); =20 @@ -203,7 +203,7 @@ static void chr_closed_bh(void *opaque) { const char *name =3D opaque; NetClientState *ncs[MAX_QUEUE_NUM]; - VhostUserState *s; + NetVhostUserState *s; Error *err =3D NULL; int queues; =20 @@ -212,7 +212,7 @@ static void chr_closed_bh(void *opaque) MAX_QUEUE_NUM); assert(queues < MAX_QUEUE_NUM); =20 - s =3D DO_UPCAST(VhostUserState, nc, ncs[0]); + s =3D DO_UPCAST(NetVhostUserState, nc, ncs[0]); =20 qmp_set_link(name, false, &err); vhost_user_stop(queues, ncs); @@ -229,7 +229,7 @@ static void net_vhost_user_event(void *opaque, int even= t) { const char *name =3D opaque; NetClientState *ncs[MAX_QUEUE_NUM]; - VhostUserState *s; + NetVhostUserState *s; Chardev *chr; Error *err =3D NULL; int queues; @@ -239,7 +239,7 @@ static void net_vhost_user_event(void *opaque, int even= t) MAX_QUEUE_NUM); assert(queues < MAX_QUEUE_NUM); =20 - s =3D DO_UPCAST(VhostUserState, nc, ncs[0]); + s =3D DO_UPCAST(NetVhostUserState, nc, ncs[0]); chr =3D qemu_chr_fe_get_driver(&s->chr); trace_vhost_user_event(chr->label, event); switch (event) { @@ -283,7 +283,7 @@ static int net_vhost_user_init(NetClientState *peer, co= nst char *device, { Error *err =3D NULL; NetClientState *nc, *nc0 =3D NULL; - VhostUserState *s; + NetVhostUserState *s; int i; =20 assert(name); @@ -296,7 +296,7 @@ static int net_vhost_user_init(NetClientState *peer, co= nst char *device, nc->queue_index =3D i; if (!nc0) { nc0 =3D nc; - s =3D DO_UPCAST(VhostUserState, nc, nc); + s =3D DO_UPCAST(NetVhostUserState, nc, nc); if (!qemu_chr_fe_init(&s->chr, chr, &err)) { error_report_err(err); return -1; @@ -305,7 +305,7 @@ static int net_vhost_user_init(NetClientState *peer, co= nst char *device, =20 } =20 - s =3D DO_UPCAST(VhostUserState, nc, nc0); + s =3D DO_UPCAST(NetVhostUserState, nc, nc0); do { if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) { error_report_err(err); --=20 MST