From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C97CD2BB1; Fri, 14 Apr 2017 08:23:13 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 23:23:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,197,1488873600"; d="scan'208";a="1135542696" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga001.fm.intel.com with ESMTP; 13 Apr 2017 23:23:11 -0700 Date: Fri, 14 Apr 2017 14:20:17 +0800 From: Yuanhan Liu To: "Tan, Jianfeng" Cc: "dev@dpdk.org" , "olivier.matz@6wind.com" , "stable@dpdk.org" Message-ID: <20170414062017.GM7333@yliu-dev.sh.intel.com> References: <1492092776-57008-1-git-send-email-jianfeng.tan@intel.com> <20170414053222.GK7333@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-stable] [PATCH] net/virtio-user: fix not working on 32-bit system X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 06:23:14 -0000 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. --yliu > > > > > (uint64_t(*(uintptr_t *)((uintptr_t)(mb) + (vq)->offset))) > > > > Besides, it deserves a comment. > > Will add comment in next version. > > Thanks, > Jianfeng > > > > > --yliu > > > > > #else > > > #define VIRTIO_MBUF_ADDR(mb, vq) ((mb)->buf_physaddr) > > > #endif > > > -- > > > 2.7.4