netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, davem@davemloft.net,
	ast@kernel.org, daniel@iogearbox.net, toke@redhat.com,
	lorenzo.bianconi@redhat.com, dsahern@kernel.org,
	andrii.nakryiko@gmail.com, brouer@redhat.com
Subject: Re: [PATCH v3 bpf-next 6/9] bpf: cpumap: implement XDP_REDIRECT for eBPF programs attached to map entries
Date: Wed, 24 Jun 2020 10:32:09 +0200	[thread overview]
Message-ID: <20200624103209.18276e44@carbon> (raw)
In-Reply-To: <cad5c3a21ba8ac953b2a6e7fb70b39ae49c597ac.1592947694.git.lorenzo@kernel.org>

On Tue, 23 Jun 2020 23:39:31 +0200
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Introduce XDP_REDIRECT support for eBPF programs attached to cpumap
> entries.
> This patch has been tested on Marvell ESPRESSObin using a modified
> version of xdp_redirect_cpu sample in order to attach a XDP program
> to CPUMAP entries to perform a redirect on the mvneta interface.
> In particular the following scenario has been tested:
> 
> rq (cpu0) --> mvneta - XDP_REDIRECT (cpu0) --> CPUMAP - XDP_REDIRECT (cpu1) --> mvneta
> 
> $./xdp_redirect_cpu -p xdp_cpu_map0 -d eth0 -c 1 -e xdp_redirect \
> 	-f xdp_redirect_kern.o -m tx_port -r eth0
> 
> tx: 285.2 Kpps rx: 285.2 Kpps
> 
> Attacching a simple XDP program on eth0 to perform XDP_TX gives
  ^^^^^^^^^^

Spelling/typo.

> comparable results:
> 
> tx: 288.4 Kpps rx: 288.4 Kpps
> 
> Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

> ---
>  include/net/xdp.h          |  1 +
>  include/trace/events/xdp.h |  6 ++++--
>  kernel/bpf/cpumap.c        | 17 +++++++++++++++--
>  3 files changed, 20 insertions(+), 4 deletions(-)
[...]

> @@ -276,7 +286,10 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
>  		}
>  	}
>  
> -	rcu_read_unlock();
> +	if (stats->redirect)
> +		xdp_do_flush_map();
> +
> +	rcu_read_unlock_bh(); /* resched point, may call do_softirq() */

I've tested (on x86) that this extra resched point does not cause sched issues.

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


  reply	other threads:[~2020-06-24  8:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 21:39 [PATCH v3 bpf-next 0/9] introduce support for XDP programs in CPUMAP Lorenzo Bianconi
2020-06-23 21:39 ` [PATCH v3 bpf-next 1/9] cpumap: use non-locked version __ptr_ring_consume_batched Lorenzo Bianconi
2020-06-23 21:39 ` [PATCH v3 bpf-next 2/9] net: Refactor xdp_convert_buff_to_frame Lorenzo Bianconi
2020-06-24  8:06   ` Jesper Dangaard Brouer
2020-06-23 21:39 ` [PATCH v3 bpf-next 3/9] samples/bpf: xdp_redirect_cpu_user: do not update bpf maps in option loop Lorenzo Bianconi
2020-06-23 21:39 ` [PATCH v3 bpf-next 4/9] cpumap: formalize map value as a named struct Lorenzo Bianconi
2020-06-24  8:08   ` Jesper Dangaard Brouer
2020-06-23 21:39 ` [PATCH v3 bpf-next 5/9] bpf: cpumap: add the possibility to attach an eBPF program to cpumap Lorenzo Bianconi
2020-06-24  8:12   ` Jesper Dangaard Brouer
2020-06-23 21:39 ` [PATCH v3 bpf-next 6/9] bpf: cpumap: implement XDP_REDIRECT for eBPF programs attached to map entries Lorenzo Bianconi
2020-06-24  8:32   ` Jesper Dangaard Brouer [this message]
2020-06-23 21:39 ` [PATCH v3 bpf-next 7/9] libbpf: add SEC name for xdp programs attached to CPUMAP Lorenzo Bianconi
2020-06-24  5:49   ` Andrii Nakryiko
2020-06-24  8:36     ` Jesper Dangaard Brouer
2020-06-24 14:29       ` Alexei Starovoitov
2020-06-25 14:26         ` [PATCH bpf] libbpf: adjust SEC short cut for expected attach type BPF_XDP_DEVMAP Jesper Dangaard Brouer
2020-06-25 16:58           ` Andrii Nakryiko
2020-06-25 21:12           ` Daniel Borkmann
2020-06-23 21:39 ` [PATCH v3 bpf-next 8/9] samples/bpf: xdp_redirect_cpu: load a eBPF program on cpumap Lorenzo Bianconi
2020-06-24  9:00   ` Jesper Dangaard Brouer
2020-06-23 21:39 ` [PATCH v3 bpf-next 9/9] selftest: add tests for XDP programs in CPUMAP entries Lorenzo Bianconi
2020-06-24  5:51   ` Andrii Nakryiko
2020-06-24 15:37     ` Lorenzo Bianconi

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=20200624103209.18276e44@carbon \
    --to=brouer@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --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).