From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 217214A65 for ; Tue, 19 Jul 2016 15:58:01 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 19 Jul 2016 06:58:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="1024796136" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 19 Jul 2016 06:58:00 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jul 2016 06:57:59 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jul 2016 06:57:59 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.8]) with mapi id 14.03.0248.002; Tue, 19 Jul 2016 21:57:57 +0800 From: "Tan, Jianfeng" To: Olivier Matz , "dev@dpdk.org" , "Xie, Huawei" , "yuanhan.liu@linux.intel.com" Thread-Topic: [PATCH] virtio: fix packet corruption Thread-Index: AQHR4bmfu4jhgh1RaEuZY16Y/8PJDaAft+RA//98pgCAAJIG0A== Date: Tue, 19 Jul 2016 13:57:57 +0000 Message-ID: References: <1468931519-7381-1-git-send-email-olivier.matz@6wind.com> In-Reply-To: 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] virtio: fix packet corruption 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: Tue, 19 Jul 2016 13:58:02 -0000 > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Tuesday, July 19, 2016 9:11 PM > To: Tan, Jianfeng; dev@dpdk.org; Xie, Huawei; yuanhan.liu@linux.intel.com > Subject: Re: [PATCH] virtio: fix packet corruption >=20 > Hi Jianfeng, >=20 > On 07/19/2016 03:03 PM, Tan, Jianfeng wrote: > > Hi Oliver, > > > >> -----Original Message----- > >> From: Olivier Matz [mailto:olivier.matz@6wind.com] > >> Sent: Tuesday, July 19, 2016 8:32 PM > >> To: dev@dpdk.org; Tan, Jianfeng; Xie, Huawei; > yuanhan.liu@linux.intel.com > >> Subject: [PATCH] virtio: fix packet corruption > >> > >> The support of virtio-user changed the way the mbuf dma address is > >> retrieved, using a physical address in case of virtio-pci and a virtua= l > >> address in case of virtio-user. > >> > >> This change introduced some possible memory corruption in packets, > >> replacing: > >> m->buf_physaddr + RTE_PKTMBUF_HEADROOM > >> by: > >> m->buf_physaddr + m->data_off (through a macro) > >> > >> This patch fixes this issue, restoring the original behavior. > > > > Could you be more specific on why we cannot use m->data_off here? >=20 > There is no guarantee that m->data_off =3D=3D RTE_PKTMBUF_HEADROOM here > as > virtqueue_enqueue_recv_refill() is called on a mbuf that is just > allocated with rte_mbuf_raw_alloc(). An alternative would be to set > data_off to RTE_PKTMBUF_HEADROOM, but as it's a fix and we are close to > the release, I prefered to restore the initial behavior. Oh yes, gotcha. But if we do not set data_off properly, it's still buggy when others consum= e these mbufs, right? Thanks, Jianfeng >=20 > I did not include the test plan because it relies on patch that are not > submitted yet (offload patches, they will be upstreamed very soon). It > is a quite simple test case with testpmd. >=20 > Regards, > Olivier