DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rich Lane <rich.lane@bigswitch.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>,
	"Xie, Huawei" <huawei.xie@intel.com>,
	dev@dpdk.org, stephen@networkplumber.org
Subject: Re: [dpdk-dev] [PATCH] virtio: use zeroed memory for simple TX header
Date: Mon, 4 Apr 2016 15:57:11 -0700	[thread overview]
Message-ID: <CAGSMBPO-gDTdBRXTWy6Aq4b8dPoHG1YoUuzNX-ae0E9eNyO6gw@mail.gmail.com> (raw)
In-Reply-To: <20160404200538.GK3080@yliu-dev.sh.intel.com>

On Mon, Apr 4, 2016 at 1:05 PM, Yuanhan Liu <yuanhan.liu@linux.intel.com>
wrote:

> On Mon, Apr 04, 2016 at 03:13:37PM +0200, Thomas Monjalon wrote:
> > Huawei, Yuanhan, any comment?
> >
> > 2016-03-31 13:01, Rich Lane:
> > >                             vq->vq_ring.desc[i + mid_idx].next = i;
> > >                             vq->vq_ring.desc[i + mid_idx].addr =
> > > -                                   vq->virtio_net_hdr_mem +
> > > -                                           i * vq->hw->vtnet_hdr_size;
> > > +                                   vq->virtio_net_hdr_mem;
>
> I could be wrong, but this looks like a special case when i == 0,
> which is by no way that zeroed memory is guaranteed? Huawei, do
> you have time to check this patch?


This bug exists because the type of the objects pointed to by
virtio_net_hdr_mem changed in 6dc5de3a (virtio: use indirect ring
elements), but because it isn't a C pointer the compiler didn't catch the
type mismatch. We could also fix it with:

    vq->virtio_net_hdr_mem + i * sizeof(struct virtio_tx_region) +
offsetof(struct virtio_tx_region, tx_hdr)

Given that tx_hdr is the first member in struct virtio_tx_region, and using
a single header optimizes cache use, that simplifies to the code in my
patch. The virtio-net header is never written to by simple TX so it remains
zeroed.

I can respin the patch using offsetof if that's preferred.

Note that right now virtio simple TX is broken with DPDK vhost due to the
flood of error messages.

  reply	other threads:[~2016-04-04 22:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 20:01 Rich Lane
2016-04-04 13:13 ` Thomas Monjalon
2016-04-04 20:05   ` Yuanhan Liu
2016-04-04 22:57     ` Rich Lane [this message]
2016-04-05  0:11       ` Yuanhan Liu

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=CAGSMBPO-gDTdBRXTWy6Aq4b8dPoHG1YoUuzNX-ae0E9eNyO6gw@mail.gmail.com \
    --to=rich.lane@bigswitch.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas.monjalon@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).