From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Zvi Effron <zeffron@riotgames.com>
Cc: Xdp <xdp-newbies@vger.kernel.org>,
"Anton Protopopov" <a.s.protopopov@gmail.com>,
dsahern@gmail.com, "Toke Høiland-Jørgensen" <toke@redhat.com>,
brouer@redhat.com,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [bpf-next PATCH 0/3] bpf: improvements to xdp_fwd sample
Date: Thu, 8 Aug 2019 11:29:55 +0200 [thread overview]
Message-ID: <20190808112955.5a29c9e1@carbon> (raw)
In-Reply-To: <CAC1LvL29KS9CKcXYwR4EHeNo7++i4hYQuXfY5OLtbPFDVUO2mw@mail.gmail.com>
On Wed, 7 Aug 2019 15:09:09 -0700
Zvi Effron <zeffron@riotgames.com> wrote:
> On Wed, Aug 7, 2019 at 6:00 AM Jesper Dangaard Brouer <brouer@redhat.com> wrote:
> >
> > Toke's devmap lookup improvement is first avail in kernel v5.3.
> > Thus, not part of XDP-tutorial yet.
> >
> I probably missed this in an earlier email, but what are Toke's devmap
> improvements? Performance? Capability?
Toke's devmap and redirect improvements are primarily about usability.
Currently, from BPF-context (kernel-side) you cannot read the contents
of devmap (or cpumap or xskmap(AF_XDP)). Because for devmap you get
the real pointer to the net_device ifindex, and we cannot allow you to
write/change that from BPF (kernel would likely crash or be inconsistent).
The work-around, is to keep a shadow map, that contains the "config" of
the devmap, which you check/validate against instead. It is just a pain
to maintain this shadow map. Toke's change allow you to read devmap
from BPF-context. Thus, you can avoid this shadow map.
Another improvement from Toke, is that the bpf_redirect_map() helper,
now also check if the redirect index is valid in the map. If not, then
it returns another value than XDP_REDIRECT. You can choose the
alternative return value yourself, via "flags" e.g. XDP_PASS. Thus,
you don't even need to check/validate devmap in your BPF-code, as it is
part of the bpf_redirect_map() call now.
action = bpf_redirect_map(&map, &index, flags_as_xdp_value)
The default flags used in most programs today is 0, which maps to
XDP_ABORTED. This is sort of a small UAPI change, but for the better.
As today, the packet is dropped later, only diagnose/seen via
tracepoint xdp:xdp_redirect_map_err.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2019-08-08 9:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 12:36 [bpf-next PATCH 0/3] bpf: improvements to xdp_fwd sample Jesper Dangaard Brouer
2019-08-07 12:36 ` [bpf-next PATCH 1/3] samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports Jesper Dangaard Brouer
2019-08-07 17:52 ` Y Song
2019-08-07 17:52 ` David Ahern
2019-08-07 12:36 ` [bpf-next PATCH 2/3] samples/bpf: make xdp_fwd more practically usable via devmap lookup Jesper Dangaard Brouer
2019-08-07 17:52 ` David Ahern
2019-08-07 18:04 ` Y Song
2019-08-08 6:51 ` Jesper Dangaard Brouer
2019-08-07 12:36 ` [bpf-next PATCH 3/3] samples/bpf: xdp_fwd explain bpf_fib_lookup return codes Jesper Dangaard Brouer
2019-08-07 17:52 ` David Ahern
2019-08-07 18:05 ` Y Song
[not found] ` <20190807150010.1a58a1d2@carbon>
[not found] ` <CAC1LvL29KS9CKcXYwR4EHeNo7++i4hYQuXfY5OLtbPFDVUO2mw@mail.gmail.com>
2019-08-08 9:29 ` Jesper Dangaard Brouer [this message]
2019-08-08 17:21 ` [bpf-next PATCH 0/3] bpf: improvements to xdp_fwd sample Zvi Effron
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=20190808112955.5a29c9e1@carbon \
--to=brouer@redhat.com \
--cc=a.s.protopopov@gmail.com \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).