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 14:23:03 +0000	[thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E3610621778@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1c15f3d4-ed12-c315-cf88-8a71cc6fee5f@6wind.com>

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
> 
> Hi,
> 
> 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 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?
> >
> 
> 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 <jianfeng.tan@intel.com>

  reply	other threads:[~2016-07-19 14:23 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
2016-07-19 13:59       ` Olivier Matz
2016-07-19 14:23         ` Tan, Jianfeng [this message]
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=ED26CBA2FAD1BF48A8719AEF02201E3610621778@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).