From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B3C95C668 for ; Fri, 24 Jun 2016 02:51:16 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 23 Jun 2016 17:51:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,518,1459839600"; d="scan'208";a="724206135" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jun 2016 17:51:15 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 23 Jun 2016 17:51:15 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 23 Jun 2016 17:51:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by shsmsx102.ccr.corp.intel.com ([169.254.2.147]) with mapi id 14.03.0248.002; Fri, 24 Jun 2016 08:51:13 +0800 From: "Tan, Jianfeng" To: Stephen Hemminger CC: "dev@dpdk.org" , "yuanhan.liu@linux.intel.com" , "Xie, Huawei" Thread-Topic: [dpdk-dev] [PATCH] net/virtio-user: fix implicit int to enum conversion Thread-Index: AQHRzSKRbNHPSfeax0i18MNvZNCFP5/3AZQAgADIJZA= Date: Fri, 24 Jun 2016 00:51:13 +0000 Message-ID: References: <1466667620-67731-1-git-send-email-jianfeng.tan@intel.com> <20160623135114.2bcfea3d@samsung9> In-Reply-To: <20160623135114.2bcfea3d@samsung9> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix implicit int to enum conversion X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 00:51:17 -0000 Hi Stephen, > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, June 24, 2016 4:51 AM > To: Tan, Jianfeng > Cc: dev@dpdk.org; yuanhan.liu@linux.intel.com; Xie, Huawei > Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix implicit int to enum > conversion >=20 > On Thu, 23 Jun 2016 07:40:20 +0000 > Jianfeng Tan wrote: >=20 > > Implicit int to enum conversion is not allowed when icc is used as > > the compiler. It raises the compiling error like, > > /.../dpdk/drivers/net/virtio/virtio_user/vhost_user.c(257): > > error #188: enumerated type mixed with another type > > msg.request =3D req; > > ^ > > > > The fix is simple, aka make such conversion explicit. > > > > Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer") > > > > Signed-off-by: Jianfeng Tan > > --- > > drivers/net/virtio/virtio_user/vhost_user.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/virtio/virtio_user/vhost_user.c > b/drivers/net/virtio/virtio_user/vhost_user.c > > index 95e80f8..e2772d5 100644 > > --- a/drivers/net/virtio/virtio_user/vhost_user.c > > +++ b/drivers/net/virtio/virtio_user/vhost_user.c > > @@ -254,7 +254,7 @@ vhost_user_sock(int vhostfd, uint64_t req, void > *arg) > > > > PMD_DRV_LOG(INFO, "%s", vhost_msg_strings[req]); > > > > - msg.request =3D req; > > + msg.request =3D (enum vhost_user_request)req; > > msg.flags =3D VHOST_USER_VERSION; > > msg.size =3D 0; > > >=20 > Why not just just change API, to use enum? This would move type checking > out to the user. The history reason to do this is to adapt both vhost-user and vhost-net req= uest. But yes, now we only have vhost-user supported, I'll change to use en= um instead of uint64_t as the type of req. Thank you for suggestion! Thanks, Jianfeng