From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
davem@davemloft.net, daniel@iogearbox.net,
lorenzo.bianconi@redhat.com, dsahern@kernel.org,
toshiaki.makita1@gmail.com
Subject: Re: [PATCH bpf-next] xdp: introduce convert_to_xdp_buff utility routine
Date: Tue, 26 May 2020 16:33:40 +0200 [thread overview]
Message-ID: <20200526143340.GA3769@localhost.localdomain> (raw)
In-Reply-To: <20200526162008.7bd2d18f@carbon>
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
> On Tue, 26 May 2020 15:48:13 +0200
> Lorenzo Bianconi <lorenzo@kernel.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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2020-05-26 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 13:48 [PATCH bpf-next] xdp: introduce convert_to_xdp_buff utility routine Lorenzo Bianconi
2020-05-26 14:20 ` Jesper Dangaard Brouer
2020-05-26 14:33 ` Lorenzo Bianconi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200526143340.GA3769@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=toshiaki.makita1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).