[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1ad5a62bee3eced25a136c7d92cd9668d9bf761.camel@mellanox.com>
Date: Tue, 3 Jul 2018 23:52:22 +0000
From: Saeed Mahameed <saeedm@...lanox.com>
To: "daniel@...earbox.net" <daniel@...earbox.net>,
"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>,
"john.fastabend@...il.com" <john.fastabend@...il.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>
Subject: Re: [RFC bpf-next 2/6] net: xdp: RX meta data infrastructure
On Mon, 2018-07-02 at 10:01 +0200, Daniel Borkmann wrote:
> 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.)
>
Right ! As jesper pointer out as well,
driver should set: xdp->data_meta = xdp->data
and then adjust it to the offset of the first meta data hint.
Powered by blists - more mailing lists