DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"olivier.matz@6wind.com" <olivier.matz@6wind.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix not working on 32-bit system
Date: Fri, 14 Apr 2017 07:14:08 +0000	[thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E365119F801@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170414070114.GN7333@yliu-dev.sh.intel.com>



> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Friday, April 14, 2017 3:01 PM
> To: Tan, Jianfeng
> Cc: dev@dpdk.org; olivier.matz@6wind.com; stable@dpdk.org
> Subject: Re: [PATCH] net/virtio-user: fix not working on 32-bit system
> 
> On Fri, Apr 14, 2017 at 06:56:01AM +0000, Tan, Jianfeng wrote:
> >
> >
> > > -----Original Message-----
> > > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> > > Sent: Friday, April 14, 2017 2:20 PM
> > > To: Tan, Jianfeng
> > > Cc: dev@dpdk.org; olivier.matz@6wind.com; stable@dpdk.org
> > > Subject: Re: [PATCH] net/virtio-user: fix not working on 32-bit system
> > >
> > > On Fri, Apr 14, 2017 at 05:53:55AM +0000, Tan, Jianfeng wrote:
> > > > > > diff --git a/drivers/net/virtio/virtqueue.h
> > > b/drivers/net/virtio/virtqueue.h
> > > > > > index f9e3736..f43ea70 100644
> > > > > > --- a/drivers/net/virtio/virtqueue.h
> > > > > > +++ b/drivers/net/virtio/virtqueue.h
> > > > > > @@ -72,7 +72,8 @@ struct rte_mbuf;
> > > > > >   * Return the physical address (or virtual address in case of
> > > > > >   * virtio-user) of mbuf data buffer.
> > > > > >   */
> > > > > > -#define VIRTIO_MBUF_ADDR(mb, vq) (*(uint64_t
> *)((uintptr_t)(mb)
> > > +
> > > > > (vq)->offset))
> > > > > > +#define VIRTIO_MBUF_ADDR(mb, vq) \
> > > > > > +	((uint64_t)((uintptr_t)(*(void **)((uintptr_t)(mb) + (vq)-
> >offset))))
> > > > >
> > > > > The "void **" cast makes it a bit complex (thus hard to read). I think
> > > > > following should work?
> > > >
> > > > Yes, uintptr_t can work. I thought void ** is easier to understand,
> meaning
> > > a convert to a pointer which pointing to a pointer.
> > >
> > > It's twisted, isn't it? :)
> > >
> > > > I usually use uintptr_t only for converter from pointer to integer, not
> the
> > > opposite way.
> > >
> > > Yes, that's a typical usage. But the fact of the matter is uintptr_t
> > > represents the word size, which is exactly what needed in this case.
> >
> > Another fold, if you refer to the definition of struct rte_mbuf, the first field
> is defined as void * instead of uintptr_t. I think that why I prefer to use ((void
> *)*) in the beginning.
> 
> But the type is hidden here: isn't this the purpose you were introducing
> the "offset" here? Besides, it could be type "phys_addr_t".
> 

Fair enough.

  reply	other threads:[~2017-04-14  7:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 14:12 Jianfeng Tan
2017-04-14  5:32 ` Yuanhan Liu
2017-04-14  5:53   ` Tan, Jianfeng
2017-04-14  6:20     ` Yuanhan Liu
2017-04-14  6:56       ` Tan, Jianfeng
2017-04-14  7:01         ` Yuanhan Liu
2017-04-14  7:14           ` Tan, Jianfeng [this message]
2017-04-19  2:30 ` [dpdk-dev] [PATCH v2] " Jianfeng Tan
2017-04-19  5:53   ` Yuanhan Liu
2017-04-19  6:21     ` Tan, Jianfeng
2017-04-19  6:24       ` 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=ED26CBA2FAD1BF48A8719AEF02201E365119F801@SHSMSX103.ccr.corp.intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.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).