[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161130001750.GB28238@ast-mbp.thefacebook.com>
Date: Tue, 29 Nov 2016 16:17:51 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Thomas Graf <tgraf@...g.ch>
Cc: davem@...emloft.net, netdev@...r.kernel.org, daniel@...earbox.net,
tom@...bertland.com, roopa@...ulusnetworks.com,
hannes@...essinduktion.org
Subject: Re: [PATCH net-next v3 4/4] bpf: Add tests and samples for LWT-BPF
On Tue, Nov 29, 2016 at 02:21:23PM +0100, Thomas Graf wrote:
> Adds a series of test to verify the functionality of attaching
> BPF programs at LWT hooks.
>
> Also adds a sample which collects a histogram of packet sizes which
> pass through an LWT hook.
>
> $ ./lwt_len_hist.sh
> Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
> MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.253.2 () port 0 AF_INET : demo
> Recv Send Send
> Socket Socket Message Elapsed
> Size Size Size Time Throughput
> bytes bytes bytes secs. 10^6bits/sec
>
> 87380 16384 16384 10.00 39857.69
Nice!
> + ret = bpf_redirect(ifindex, 0);
> + if (ret < 0) {
> + printk("bpf_redirect() failed: %d\n", ret);
> + return BPF_DROP;
> + }
this 'if' looks a bit weird. You're passing 0 as flags,
so this helper will always succeed.
Other sample code often does 'return bpf_redirect(...)'
due to this reasoning.
Powered by blists - more mailing lists