Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2015 19:42:20 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        Vincenzo Maffione <v.maffione@gmail.com>, "freebsd-net@freebsd.org" <net@freebsd.org>
Subject:   Re: netmap over virtio giving packets with extra 12 bytes
Message-ID:  <20150106184220.GA35485@onelab2.iet.unipi.it>
In-Reply-To: <CAJ-Vmokq0_6otpq=wJWAw_5%2BMrThjV7JnVOgss1gOyruQLQ0-Q@mail.gmail.com>
References:  <CADJyuDg-PujV%2BtknoSBi3fDd3%2BK%2BOwvjgwh1%2B=Z-eoBUkP2gPg@mail.gmail.com> <CA%2BhQ2%2BgRz0Q-f5N-C_CrC27qE1i-zSvb3rjWDH0JPCq4Q1%2BA8A@mail.gmail.com> <CA%2B_eA9jsAYPm%2B7f6Lt6oXuOuDRbQOMnE=n2arQiUAGLeXg7UvQ@mail.gmail.com> <CADJyuDjo%2BVDvAt6zKD2A0iZbU__HUSr-AfWsMdc5Bu1tARf9vw@mail.gmail.com> <CA%2B_eA9hmH35_ioVCXyWTM7WKF3JdPsCPaDxW2ZVQPyGJpY-_BA@mail.gmail.com> <CAJ-Vmokq0_6otpq=wJWAw_5%2BMrThjV7JnVOgss1gOyruQLQ0-Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 06, 2015 at 10:15:02AM -0800, Adrian Chadd wrote:
...
> This won't be the first time that there'll be useful data at the front
> end of an RX mbuf that isn't related to the mbuf payload.
> 
> It'd be nice if there were something in each rx ring slot saying how
> far to skip into the buffer to get the beginning of the packet.

I am not opposed in principle, this is something we have been looking
at since day one. The blocking issue is that incompatible hw constraints
make it hard to make a decent choice.

Examples:
1. the rx buffer size you tell to ixgbe must be a power of two.
  If you want to write at some offset into the netmap buffer,
  you need to allocate one twice the size you pass to the driver.
2. some NICs may want buffers aligned to 4, 8, 16 bytes, so input
  offsets for headers cannot be arbitrary (12 is almost as bad as 14!)
3. irrespective of functionality, performance drops badly with small
  packets (where it matters the most) when buffers are not aligned
  to 64 byte boundaries.

The above makes me think that for small packets, copying is the
only reasonable way to go, and for large packets i have no idea
how to deal with #1 and #2 without having to do scatter-gather.

If you have a good suggestion please speak up.

cheers
luigi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150106184220.GA35485>