DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Olivier Matz <olivier.matz@6wind.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"Xie, Huawei" <huawei.xie@intel.com>,
	"yuanhan.liu@linux.intel.com" <yuanhan.liu@linux.intel.com>
Subject: Re: [dpdk-dev] [PATCH] virtio: fix packet corruption
Date: Tue, 19 Jul 2016 13:57:57 +0000	[thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E36106216C8@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <d9d58218-1b2a-1991-898d-ddda26f641f0@6wind.com>



> -----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 virtual
> >> 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 == 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 consume these mbufs, right?

Thanks,
Jianfeng

> 
> 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.
> 
> Regards,
> Olivier

  reply	other threads:[~2016-07-19 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 12:31 Olivier Matz
2016-07-19 13:03 ` Tan, Jianfeng
2016-07-19 13:11   ` Olivier Matz
2016-07-19 13:57     ` Tan, Jianfeng [this message]
2016-07-19 13:59       ` Olivier Matz
2016-07-19 14:23         ` Tan, Jianfeng
2016-07-21  8:28 ` Yuanhan Liu
2016-07-21 22:28   ` Thomas Monjalon

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=ED26CBA2FAD1BF48A8719AEF02201E36106216C8@SHSMSX103.ccr.corp.intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=olivier.matz@6wind.com \
    --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).