public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat•com>
To: Daniel Borkmann <daniel@iogearbox•net>
Cc: netdev@vger•kernel.org, Daniel Borkmann <borkmann@iogearbox•net>,
	Alexei Starovoitov <alexei.starovoitov@gmail•com>,
	jhsiao@redhat•com, brouer@redhat•com
Subject: Re: [bpf-next PATCH 2/2] samples/bpf: xdp_redirect_cpu load balance like Suricata
Date: Thu, 9 Aug 2018 22:36:19 +0200	[thread overview]
Message-ID: <20180809223619.27ac88fa@redhat.com> (raw)
In-Reply-To: <8e6cdc1c-1f97-7280-58b9-d9db10986338@iogearbox.net>

On Thu, 9 Aug 2018 22:15:22 +0200
Daniel Borkmann <daniel@iogearbox•net> wrote:

> On 08/09/2018 03:26 PM, Jesper Dangaard Brouer wrote:
> > This implement XDP CPU redirection load-balancing across available
> > CPUs, based on the hashing IP-pairs + L4-protocol.  This equivalent to
> > xdp-cpu-redirect feature in Suricata, which is inspired by the
> > Suricata 'ippair' hashing code.
> > 
> > An important property is that the hashing is flow symmetric, meaning
> > that if the source and destination gets swapped then the selected CPU
> > will remain the same.  This is helps locality by placing both directions
> > of a flows on the same CPU, in a forwarding/routing scenario.
> > 
> > The hashing INITVAL (15485863 the 10^6th prime number) was fairly
> > arbitrary choosen, but experiments with kernel tree pktgen scripts
> > (pktgen_sample04_many_flows.sh +pktgen_sample05_flow_per_thread.sh)
> > showed this improved the distribution.
> > 
> > This patch also change the default loaded XDP program to be this
> > load-balancer.  As based on different user feedback, this seems to be
> > the expected behavior of the sample xdp_redirect_cpu.
> > 
> > Link: https://github.com/OISF/suricata/commit/796ec08dd7a63
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat•com>
> > ---
> >  samples/bpf/xdp_redirect_cpu_kern.c |  103 +++++++++++++++++++++++++++++++++++
> >  samples/bpf/xdp_redirect_cpu_user.c |    4 +
> >  2 files changed, 105 insertions(+), 2 deletions(-)
> > 
> > diff --git a/samples/bpf/xdp_redirect_cpu_kern.c b/samples/bpf/xdp_redirect_cpu_kern.c
> > index 0cc3d71057f0..a306d1c75622 100644
> > --- a/samples/bpf/xdp_redirect_cpu_kern.c
> > +++ b/samples/bpf/xdp_redirect_cpu_kern.c
> > @@ -13,6 +13,7 @@
> >  
> >  #include <uapi/linux/bpf.h>
> >  #include "bpf_helpers.h"
> > +#include "hash_func01.h"
> >  
> >  #define MAX_CPUS 64 /* WARNING - sync with _user.c */  
> 
> Hmm, this doesn't apply cleanly. I have the following in bpf-next:
> 
> #define MAX_CPUS 12 /* WARNING - sync with _user.c */
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/samples/bpf/xdp_redirect_cpu_kern.c#n17
> 
> Rebase issue? Please respin, thanks.

Ah, this is due to the teardown-fixes patchset for "bpf" git-tree,
which you just applied, which changed MAX_CPUS to 64 (so, QA can use
the reproducer).

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

      reply	other threads:[~2018-08-09 23:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 13:26 [bpf-next PATCH 0/2] Implement sample code for XDP cpumap IP-pair load-balancing Jesper Dangaard Brouer
2018-08-09 13:26 ` [bpf-next PATCH 1/2] samples/bpf: add Paul Hsieh's (LGPL 2.1) hash function SuperFastHash Jesper Dangaard Brouer
2018-08-09 13:26 ` [bpf-next PATCH 2/2] samples/bpf: xdp_redirect_cpu load balance like Suricata Jesper Dangaard Brouer
2018-08-09 20:15   ` Daniel Borkmann
2018-08-09 20:36     ` Jesper Dangaard Brouer [this message]

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=20180809223619.27ac88fa@redhat.com \
    --to=brouer@redhat$(echo .)com \
    --cc=alexei.starovoitov@gmail$(echo .)com \
    --cc=borkmann@iogearbox$(echo .)net \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=jhsiao@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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