[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1fc9e26e-35b9-b14c-eac2-c240649e1417@iogearbox.net>
Date: Mon, 2 Jul 2018 10:01:58 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Saeed Mahameed <saeedm@...lanox.com>,
"saeedm@....mellanox.co.il" <saeedm@....mellanox.co.il>,
"brouer@...hat.com" <brouer@...hat.com>
Cc: "alexander.h.duyck@...el.com" <alexander.h.duyck@...el.com>,
"peter.waskiewicz.jr@...el.com" <peter.waskiewicz.jr@...el.com>,
Rony Efraim <ronye@...lanox.com>,
Tariq Toukan <tariqt@...lanox.com>,
"neerav.parikh@...el.com" <neerav.parikh@...el.com>,
Opher Reviv <opher@...lanox.com>,
"alexei.starovoitov@...il.com" <alexei.starovoitov@...il.com>,
"pjwaskiewicz@...il.com" <pjwaskiewicz@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"ttoukan.linux@...il.com" <ttoukan.linux@...il.com>,
john.fastabend@...il.com
Subject: Re: [RFC bpf-next 2/6] net: xdp: RX meta data infrastructure
On 06/27/2018 07:55 PM, Saeed Mahameed wrote:
> On Wed, 2018-06-27 at 16:15 +0200, Jesper Dangaard Brouer wrote:
>> On Tue, 26 Jun 2018 19:46:11 -0700
>> Saeed Mahameed <saeedm@....mellanox.co.il> wrote:
>>
>>> diff --git a/include/net/xdp.h b/include/net/xdp.h
>>> index 2deea7166a34..afe302613ae1 100644
>>> --- a/include/net/xdp.h
>>> +++ b/include/net/xdp.h
>>> @@ -138,6 +138,12 @@ xdp_set_data_meta_invalid(struct xdp_buff
>>> *xdp)
>>> xdp->data_meta = xdp->data + 1;
>>> }
>>>
>>> +static __always_inline void
>>> +xdp_reset_data_meta(struct xdp_buff *xdp)
>>> +{
>>> + xdp->data_meta = xdp->data_hard_start;
>>> +}
>>
>> This is WRONG ... it should be:
>>
>> xdp->data_meta = xdp->data;
>
> maybe the name of the function is not suitable for the use case.
> i need to set xdp->data_meta = xdp->data in the driver to start storing
> meta data.
The xdp_set_data_meta_invalid() is a straight forward way for XDP drivers
to tell they do not support xdp->data_meta, since setting xdp->data + 1 will
fail the checks for direct (meta) packet access in the BPF code and at the
same time bpf_xdp_adjust_meta() will know to bail out with error when program
attempts to make headroom for meta data that driver cannot handle later on.
So later setting 'xdp->data_meta = xdp->data' to enable it is as setting any
other of the initializers in xdp_buff, and done so today in the i40e, ixgbe,
ixgbevf and nfp drivers. (Theoretically it wouldn't have to be exactly set to
xdp->data, but anything <= xdp->data works, if the driver would prepend info
from hw in front of it that program can then use or later override.)
Thanks,
Daniel
Powered by blists - more mailing lists