From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [bpf-next PATCH 2/2] samples/bpf: xdp_redirect_cpu load balance like Suricata Date: Thu, 9 Aug 2018 22:15:22 +0200 Message-ID: <8e6cdc1c-1f97-7280-58b9-d9db10986338@iogearbox.net> References: <153382113738.1066.5820398510106188626.stgit@firesoul> <153382118685.1066.13384325128020314152.stgit@firesoul> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Daniel Borkmann , Alexei Starovoitov , jhsiao@redhat.com To: Jesper Dangaard Brouer , netdev@vger.kernel.org Return-path: Received: from www62.your-server.de ([213.133.104.62]:41021 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeHIWlt (ORCPT ); Thu, 9 Aug 2018 18:41:49 -0400 In-Reply-To: <153382118685.1066.13384325128020314152.stgit@firesoul> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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 > --- > 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 > #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.