From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, netdev@vger.kernel.org
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Martin KaFai Lau" <kafai@fb.com>,
"Eric Leblond" <eric@regit.org>,
bpf@vger.kernel.org
Subject: Re: [PATCH net-next v6 3/5] bpf: cpumap: implement generic cpumap
Date: Fri, 2 Jul 2021 15:33:46 +0200 [thread overview]
Message-ID: <954f8592-285c-8d2b-db22-7d8818e0903c@redhat.com> (raw)
In-Reply-To: <20210702111825.491065-4-memxor@gmail.com>
On 02/07/2021 13.18, Kumar Kartikeya Dwivedi wrote:
> This change implements CPUMAP redirect support for generic XDP programs.
> The idea is to reuse the cpu map entry's queue that is used to push
> native xdp frames for redirecting skb to a different CPU. This will
> match native XDP behavior (in that RPS is invoked again for packet
> reinjected into networking stack).
>
> To be able to determine whether the incoming skb is from the driver or
> cpumap, we reuse skb->redirected bit that skips generic XDP processing
> when it is set. To always make use of this, CONFIG_NET_REDIRECT guard on
> it has been lifted and it is always available.
>
> From the redirect side, we add the skb to ptr_ring with its lowest bit
> set to 1. This should be safe as skb is not 1-byte aligned. This allows
> kthread to discern between xdp_frames and sk_buff. On consumption of the
> ptr_ring item, the lowest bit is unset.
>
> In the end, the skb is simply added to the list that kthread is anyway
> going to maintain for xdp_frames converted to skb, and then received
> again by using netif_receive_skb_list.
>
> Bulking optimization for generic cpumap is left as an exercise for a
> future patch for now.
>
> Since cpumap entry progs are now supported, also remove check in
> generic_xdp_install for the cpumap.
>
> Reviewed-by: Toke Høiland-Jørgensen<toke@redhat.com>
> Signed-off-by: Kumar Kartikeya Dwivedi<memxor@gmail.com>
> ---
> include/linux/bpf.h | 9 +++-
> include/linux/skbuff.h | 10 +---
> kernel/bpf/cpumap.c | 116 ++++++++++++++++++++++++++++++++++-------
> net/core/dev.c | 3 +-
> net/core/filter.c | 6 ++-
> 5 files changed, 114 insertions(+), 30 deletions(-)
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
next prev parent reply other threads:[~2021-07-02 13:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 11:18 [PATCH net-next v6 0/5] Generic XDP improvements Kumar Kartikeya Dwivedi
2021-07-02 11:18 ` [PATCH net-next v6 1/5] net: core: split out code to run generic XDP prog Kumar Kartikeya Dwivedi
2021-07-02 11:18 ` [PATCH net-next v6 2/5] bitops: add non-atomic bitops for pointers Kumar Kartikeya Dwivedi
2021-07-02 14:47 ` David Laight
2021-07-02 16:11 ` Kumar Kartikeya Dwivedi
2021-07-02 11:18 ` [PATCH net-next v6 3/5] bpf: cpumap: implement generic cpumap Kumar Kartikeya Dwivedi
2021-07-02 13:33 ` Jesper Dangaard Brouer [this message]
2021-07-02 11:18 ` [PATCH net-next v6 4/5] bpf: devmap: implement devmap prog execution for generic XDP Kumar Kartikeya Dwivedi
2021-07-02 11:18 ` [PATCH net-next v6 5/5] bpf: tidy xdp attach selftests Kumar Kartikeya Dwivedi
2021-07-08 3:10 ` [PATCH net-next v6 0/5] Generic XDP improvements Alexei Starovoitov
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=954f8592-285c-8d2b-db22-7d8818e0903c@redhat.com \
--to=jbrouer@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eric@regit.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.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).