From nobody Tue Feb 10 09:24:56 2026 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 Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523546241002381.61224944587; Thu, 12 Apr 2018 08:17:21 -0700 (PDT) Received: from localhost ([::1]:46907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6dyL-0007CQ-3C for importer@patchew.org; Thu, 12 Apr 2018 11:17:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6dw3-0005j7-Ue for qemu-devel@nongnu.org; Thu, 12 Apr 2018 11:14:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6dw2-0007QS-0Q for qemu-devel@nongnu.org; Thu, 12 Apr 2018 11:14:51 -0400 Received: from mga09.intel.com ([134.134.136.24]:48812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f6dw1-0007PY-KG for qemu-devel@nongnu.org; Thu, 12 Apr 2018 11:14:49 -0400 Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 08:14:49 -0700 Received: from debian.sh.intel.com ([10.67.104.164]) by orsmga007.jf.intel.com with ESMTP; 12 Apr 2018 08:14:47 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,442,1517904000"; d="scan'208";a="32878580" From: Tiwei Bie To: mst@redhat.com, jasowang@redhat.com, alex.williamson@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, virtio-dev@lists.oasis-open.org Date: Thu, 12 Apr 2018 23:12:27 +0800 Message-Id: <20180412151232.17506-2-tiwei.bie@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180412151232.17506-1-tiwei.bie@intel.com> References: <20180412151232.17506-1-tiwei.bie@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Subject: [Qemu-devel] [PATCH v3 1/6] 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: jianfeng.tan@intel.com, tiwei.bie@intel.com, cunming.liang@intel.com, xiao.w.wang@intel.com, zhihong.wang@intel.com, dan.daly@intel.com 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 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 e0f16c895b..fa28aad12d 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 2.11.0