From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Christian Deacon <gamemann@gflclan.com>
Cc: brouer@redhat.com, "Toke Høiland-Jørgensen" <toke@redhat.com>,
xdp-newbies@vger.kernel.org
Subject: Re: Using AF_XDP To Modify Outgoing Packets
Date: Wed, 1 Apr 2020 11:55:12 +0200 [thread overview]
Message-ID: <20200401115512.4b28f975@carbon> (raw)
In-Reply-To: <8013b38c-696c-cadd-a4cd-756eca658215@gflclan.com>
On Tue, 31 Mar 2020 18:22:53 -0500
Christian Deacon <gamemann@gflclan.com> wrote:
> After looking into the TC Hook, it looks like this will work for my
> case. I'll try to get a program made in the next few days or so.
If you want code examples of TC egress hook with BPF look at[1]:
[1] https://github.com/xdp-project/xdp-cpumap-tc/
Notice that map pinning with libbpf have gotten easier (thanks to
Toke). This example does work (runs in production), it shares and reuse
maps between XDP and TC-bpf. The example uses the old way to define
maps, and I recommend switching to the new BTF-based syntax instead
(requires LLVM 10), which defines ".maps" SEC, see example[2], and
notice "pinning" option, which obsoletes a lot of the map code in[1].
Attaching TC-bpf progs are different that XDP. I've hidden the detail
in C-code function tc_egress_attach_bpf() (see[3]), which actually just
calls the "tc" command. I was hoping that this would be replaced with a
libbpf call, like we have for XDP, but that have not happened.
[2] https://github.com/xdp-project/xdp-tools/blob/master/xdp-filter/xdpfilt_prog.h#L124-L131
[3] https://github.com/xdp-project/xdp-cpumap-tc/blob/master/src/common_user.c#L386
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
google keywords: tc qdisc clsact cls_bpf egress filter
next prev parent reply other threads:[~2020-04-01 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 16:11 Using AF_XDP To Modify Outgoing Packets Christian Deacon
2020-03-30 16:24 ` David Ahern
2020-03-30 18:10 ` Jakub Kicinski
2020-03-30 19:28 ` Christian Deacon
2020-03-31 9:29 ` Toke Høiland-Jørgensen
2020-03-31 23:22 ` Christian Deacon
2020-04-01 8:33 ` Toke Høiland-Jørgensen
2020-04-01 9:55 ` Jesper Dangaard Brouer [this message]
2020-04-02 8:26 ` Christian Deacon
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=20200401115512.4b28f975@carbon \
--to=brouer@redhat.com \
--cc=gamemann@gflclan.com \
--cc=toke@redhat.com \
--cc=xdp-newbies@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.