From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id ADE453772 for ; Tue, 19 Jul 2016 16:23:12 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 19 Jul 2016 07:23:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="998289098" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 19 Jul 2016 07:23:06 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jul 2016 07:23:06 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by shsmsx102.ccr.corp.intel.com ([169.254.2.147]) with mapi id 14.03.0248.002; Tue, 19 Jul 2016 22:23:04 +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//98pgCAAJIG0P//e4OAgACMKYA= Date: Tue, 19 Jul 2016 14:23:03 +0000 Message-ID: References: <1468931519-7381-1-git-send-email-olivier.matz@6wind.com> <1c15f3d4-ed12-c315-cf88-8a71cc6fee5f@6wind.com> In-Reply-To: <1c15f3d4-ed12-c315-cf88-8a71cc6fee5f@6wind.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] 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 14:23:13 -0000 Hi Oliver, > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Tuesday, July 19, 2016 10:00 PM > To: Tan, Jianfeng; dev@dpdk.org; Xie, Huawei; yuanhan.liu@linux.intel.com > Subject: Re: [PATCH] virtio: fix packet corruption >=20 > Hi, >=20 > On 07/19/2016 03:57 PM, Tan, Jianfeng wrote: > > > > > >> -----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 > >> > >> Hi Jianfeng, > >> > >> 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 virt= ual > >>>> 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? > >> > >> 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 co= nsume > these mbufs, right? > > >=20 > This is done later in virtio_recv_pkts*() functions, one the host has > written the data in the mbuf. Thanks for clarification. Looks good to me. Acked-by: Jianfeng Tan