[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200526143340.GA3769@localhost.localdomain>
Date: Tue, 26 May 2020 16:33:40 +0200
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...nel.org,
davem@...emloft.net, daniel@...earbox.net,
lorenzo.bianconi@...hat.com, dsahern@...nel.org,
toshiaki.makita1@...il.com
Subject: Re: [PATCH bpf-next] xdp: introduce convert_to_xdp_buff utility
routine
> On Tue, 26 May 2020 15:48:13 +0200
> Lorenzo Bianconi <lorenzo@...nel.org> wrote:
>
[...]
> > diff --git a/include/net/xdp.h b/include/net/xdp.h
> > index 90f11760bd12..5dbdd65866a9 100644
> > --- a/include/net/xdp.h
> > +++ b/include/net/xdp.h
> > @@ -106,6 +106,16 @@ void xdp_warn(const char *msg, const char *func, const int line);
> >
> > struct xdp_frame *xdp_convert_zc_to_xdp_frame(struct xdp_buff *xdp);
> >
> > +static inline
> > +void convert_to_xdp_buff(struct xdp_frame *frame, struct xdp_buff *xdp)
> > +{
> > + xdp->data_hard_start = (void *)frame;
>
> This assumption is problematic. You are suppose to deduct this from
> frame->data pointer.
>
> Currently the xdp_frame is designed and access such that is is possible
> to use another memory area for xdp_frame. That would break after this
> change.
>
> This should instead be:
>
> xdp->data_hard_start = frame->data - (frame->headroom + sizeof(struct xdp_frame));
ack, fine. I will fix it v2.
Regards,
Lorenzo
>
> > + xdp->data = frame->data;
> > + xdp->data_end = frame->data + frame->len;
> > + xdp->data_meta = frame->data - frame->metasize;
> > + xdp->frame_sz = frame->frame_sz;
> > +}
> > +
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists