Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2015 10:15:02 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Vincenzo Maffione <v.maffione@gmail.com>
Cc:        Avinash Sridharan <avinash.sridharan@gmail.com>, Luigi Rizzo <rizzo@iet.unipi.it>, "freebsd-net@freebsd.org" <net@freebsd.org>
Subject:   Re: netmap over virtio giving packets with extra 12 bytes
Message-ID:  <CAJ-Vmokq0_6otpq=wJWAw_5%2BMrThjV7JnVOgss1gOyruQLQ0-Q@mail.gmail.com>
In-Reply-To: <CA%2B_eA9hmH35_ioVCXyWTM7WKF3JdPsCPaDxW2ZVQPyGJpY-_BA@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>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6 January 2015 at 08:57, Vincenzo Maffione <v.maffione@gmail.com> wrote:
> 2015-01-06 17:31 GMT+01:00 Avinash Sridharan <avinash.sridharan@gmail.com>:
>> Hi Vincenzo,
>>  Thanks for the explanation. From your explanation it seems like the netmap
>> in "native" mode over virtio-net should be giving some indication of how
>> many extra bytes have been added by the virtio-net driver (or for that
>> matter any other driver that provides this type of rx-descriptor).
>> Otherwise, the application will have to store knowledge about the specifics
>> of the underlying devices which dosen't seem that clean. (I think Adrian was
>> referring to the same issue)
>
> I understand the problem (this was left as an open problem), and it's
> not clear to me what should be the best solution.
>
> On one hand, one could modify the native virtio-net adapter so that it
> discards the extra header. This can be done with a copy - as Luigi
> suggests - or with some trick involving scatter-gather virtio support
> - e.g. trying to make the virtio-net headers go in some other buffers
> parallel to the "official" netmap buffers (i.e. the ones your
> application reads from).
>
> On the other end, the virtio-net header carry some information (mainly
> TCP/UDP related) that you may not want to discard - even when using
> netmap - and this depends on the specific application.
>
> So to avoid making a one-for-all decision, I thought it was better to
> leave it to the application.
>
>>
>> That said, how do we handle TX in this case? Since the underlying driver
>> (netmap + virtio-net) expects an extra 12 bytes of header that the
>> application should know when to add. Or is this optional?
>
> Yes you have to add it, otherwise it won't work! It's not optional. In
> order to make tests for virtio-net tx, I added a "-H" option to
> pkt-gen, which pushes an empty virtio-net-header before the ethernet
> frame. You can use "-H 12" for your tests.
>
> Again, it's not clear (at least to me) how we should manage this
> virtio-net peculiarity at the netmap API level.

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.


-adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmokq0_6otpq=wJWAw_5%2BMrThjV7JnVOgss1gOyruQLQ0-Q>