XDP Newbie developer discussions
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Zvi Effron <zeffron@riotgames.com>
Cc: Xdp <xdp-newbies@vger.kernel.org>,
	brouer@redhat.com, "Toke Høiland-Jørgensen" <toke@toke.dk>
Subject: Re: Packet access from bpf_perf_event_output
Date: Mon, 18 Jun 2018 09:40:56 +0200	[thread overview]
Message-ID: <20180618094056.4571a1c7@redhat.com> (raw)
In-Reply-To: <CAC1LvL2x3=LRdMOmipEr-LZ5XwXVjirr1_oQcP305t0pfbPn1Q@mail.gmail.com>

On Sun, 17 Jun 2018 18:07:02 -0700
Zvi Effron <zeffron@riotgames.com> wrote:

> Hi XDPeople!
> 
> In /include/uapi/linux/bpf.h, (in 4.18-rc1) the comment describing
> bpf_perf_event_output says:
> 
> /*
>  * Note that this helper is not restricted to tracing use cases
>  * and can be used with programs attached to TC or XDP as well,
>  * where it allows for passing data to user space listeners. Data
>  * can be:
>  *
>  * * Only custom structs,
>  * * Only the packet payload, or
>  * * A combination of both.
>  */
> 
> This seems to imply that for both TC and XDP, the packet can be used
> for passing data. When I try this, the verifier rejects the program
> with "helper access to the packet is not allowed". Looking through the
> kernel it doesn't look like bpf_perf_output_event has been tagged with
> the appropriate metadata to allow it to access the packet structure,
> either for TC or for XDP. Neither bpf_skb_event_output_proto nor
> bpf_xdp_event_output_proto have pkt_acess set to true. Is the
> documentation incorrect, should that metadata be updated to allow
> packet access, or is there something I'm missing?

Toke (Cc'ed) recently posted a samples/bpf/ program to the kernel that
implement this (but it didn't reach the merge window).  Thus, I assume
that this works...

 http://lkml.kernel.org/r/152830792912.21161.3609946361971472545.stgit@alrua-kau

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  parent reply	other threads:[~2018-06-18  7:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  1:07 Packet access from bpf_perf_event_output Zvi Effron
2018-06-18  1:54 ` Y Song
2018-06-18  7:40 ` Jesper Dangaard Brouer [this message]
2018-06-18  9:59   ` Zvi Effron
2018-06-18 10:47     ` Toke Høiland-Jørgensen
2018-06-18 10:50       ` Zvi Effron
2018-06-18 11:12         ` Toke Høiland-Jørgensen

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=20180618094056.4571a1c7@redhat.com \
    --to=brouer@redhat.com \
    --cc=toke@toke.dk \
    --cc=xdp-newbies@vger.kernel.org \
    --cc=zeffron@riotgames.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