DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"yuanhan.liu@linux.intel.com" <yuanhan.liu@linux.intel.com>,
	"Xie, Huawei" <huawei.xie@intel.com>
Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix implicit int to enum conversion
Date: Fri, 24 Jun 2016 00:51:13 +0000	[thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E361060D0F4@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20160623135114.2bcfea3d@samsung9>

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
> 
> On Thu, 23 Jun 2016 07:40:20 +0000
> Jianfeng Tan <jianfeng.tan@intel.com> wrote:
> 
> > 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 = 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 <jianfeng.tan@intel.com>
> > ---
> >  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 = req;
> > +	msg.request = (enum vhost_user_request)req;
> >  	msg.flags = VHOST_USER_VERSION;
> >  	msg.size = 0;
> >
> 
> 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 request. But yes, now we only have vhost-user supported, I'll change to use enum instead of uint64_t as the type of req.

Thank you for suggestion!

Thanks,
Jianfeng

  reply	other threads:[~2016-06-24  0:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  7:40 Jianfeng Tan
2016-06-23 20:51 ` Stephen Hemminger
2016-06-24  0:51   ` Tan, Jianfeng [this message]
2016-06-26 13:48 ` [dpdk-dev] [PATCH v2] " Jianfeng Tan
2016-06-30  5:28   ` Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ED26CBA2FAD1BF48A8719AEF02201E361060D0F4@SHSMSX103.ccr.corp.intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).