From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1054C2BAE; Wed, 19 Apr 2017 08:22:03 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 18 Apr 2017 23:22:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,219,1488873600"; d="scan'208";a="1158104234" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 18 Apr 2017 23:22:02 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 18 Apr 2017 23:22:02 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 18 Apr 2017 23:22:01 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Wed, 19 Apr 2017 14:22:00 +0800 From: "Tan, Jianfeng" To: Yuanhan Liu CC: "dev@dpdk.org" , "olivier.matz@6wind.com" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/virtio-user: fix not working on 32-bit system Thread-Index: AQHSuLTTjD0jGhqPfEeeMyDHpeMRG6HLqxuAgACN2OA= Date: Wed, 19 Apr 2017 06:21:59 +0000 Message-ID: References: <1492092776-57008-1-git-send-email-jianfeng.tan@intel.com> <1492569033-140348-1-git-send-email-jianfeng.tan@intel.com> <20170419055349.GA31523@yliu-dev.sh.intel.com> In-Reply-To: <20170419055349.GA31523@yliu-dev.sh.intel.com> 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 v2] net/virtio-user: fix not working on 32-bit system X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2017 06:22:04 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: Wednesday, April 19, 2017 1:54 PM > To: Tan, Jianfeng > Cc: dev@dpdk.org; olivier.matz@6wind.com; stable@dpdk.org > Subject: Re: [PATCH v2] net/virtio-user: fix not working on 32-bit system >=20 > On Wed, Apr 19, 2017 at 02:30:33AM +0000, Jianfeng Tan wrote: > > virtio-user cannot work on 32-bit system as higher 32-bit of the > > addr field (64-bit) in the desc is filled with non-zero value > > which should not happen for a 32-bit system. > > > > In case of virtio-user, we use buf_addr of mbuf to fill the > > virtqueue desc addr. This is a regression bug. For 32-bit system, > > the first 4 bytes of mbuf is buf_addr, with following 8 bytes for > > buf_phyaddr. With below wrong definition, both buf_addr and lower > > 4 bytes buf_phyaddr are obtained to fill the virtqueue desc. > > #define VIRTIO_MBUF_ADDR(mb, vq) \ > > (*(uint64_t *)((uintptr_t)(mb) + (vq)->offset)) > > > > Fixes: 25f80d108780 ("net/virtio: fix packet corruption") > > Cc: stable@dpdk.org > > > > Signed-off-by: Jianfeng Tan > > --- > > drivers/net/virtio/virtqueue.h | 12 +++++++++--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqu= eue.h > > index f9e3736..2e67460 100644 > > --- a/drivers/net/virtio/virtqueue.h > > +++ b/drivers/net/virtio/virtqueue.h > > @@ -69,10 +69,16 @@ struct rte_mbuf; > > > > #ifdef RTE_VIRTIO_USER > > /** > > - * Return the physical address (or virtual address in case of > > - * virtio-user) of mbuf data buffer. > > + * > > + * Return the physical address of mbuf data buffer for virtio pci: > > + * on 32-bit system, offset equals 4, return the second four bytes of= mbuf; > > + * on 64-bit system, offset equals 8, return the second eight bytes o= f > mbuf. > > + * Return the virtual address of mbuf data buffer for virtio-user. > > + * on 32-bit system, offset equals 0, return the first four bytes of = mbuf; > > + * on 64-bit system, offset equals 0, return the first eight bytes of= mbuf; >=20 >=20 > I've expected it to be plain english, something like following: >=20 > /* > * Return the physical address (or virtual address in case of > * virtio-user) of mbuf data buffer. > * > * The address is firstly casted to the word size (sizeof(uintptr_t)) > * before casting it to uint64_t. This is to make it work with differ= ent > * combination of word size (64 bit and 32 bit) and virtio device > * (virtio-pci and virtio-user). > */ >=20 > Okay to you? Yep, sounds better. Thanks!