[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180912040038.oobnr4yfzoaajk6k@ast-mbp>
Date: Tue, 11 Sep 2018 21:00:39 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Tushar Dave <tushar.n.dave@...cle.com>
Cc: ast@...nel.org, daniel@...earbox.net, davem@...emloft.net,
santosh.shilimkar@...cle.com, jakub.kicinski@...ronome.com,
quentin.monnet@...ronome.com, jiong.wang@...ronome.com,
sandipan@...ux.vnet.ibm.com, john.fastabend@...il.com,
kafai@...com, rdna@...com, yhs@...com, netdev@...r.kernel.org,
rds-devel@....oracle.com, sowmini.varadhan@...cle.com
Subject: Re: [PATCH net-next 5/5] ebpf: Add sample ebpf program for
SOCKET_SG_FILTER
On Tue, Sep 11, 2018 at 09:38:04PM +0200, Tushar Dave wrote:
> Add a sample program that shows how socksg program is used and attached
> to socket filter. The kernel sample program deals with struct
> scatterlist that is passed as bpf context.
>
> When run in server mode, the sample RDS program opens PF_RDS socket,
> attaches eBPF program to RDS socket which then uses bpf_msg_pull_data
> helper to inspect packet data contained in struct scatterlist and
> returns appropriate action code back to kernel.
>
> To ease testing, RDS client functionality is also added so that users
> can generate RDS packet.
>
> Server:
> [root@...71 bpf]# ./rds_filter -s 192.168.3.71 -t tcp
> running server in a loop
> transport tcp
> server bound to address: 192.168.3.71 port 4000
> server listening on 192.168.3.71
>
> Client:
> [root@...70 bpf]# ./rds_filter -s 192.168.3.71 -c 192.168.3.70 -t tcp
> transport tcp
> client bound to address: 192.168.3.70 port 25278
> client sending 8192 byte message from 192.168.3.70 to 192.168.3.71 on
> port 25278
> payload contains:30 31 32 33 34 35 36 37 38 39 ...
>
> Server output:
> 192.168.3.71 received a packet from 192.168.3.71 of len 8192 cmsg len 0,
> on port 25278
> payload contains:30 31 32 33 34 35 36 37 38 39 ...
> server listening on 192.168.3.71
>
> [root@...71 tushar]# cat /sys/kernel/debug/tracing/trace_pipe
> <idle>-0 [038] ..s. 146.947362: 0: 30 31 32
> <idle>-0 [038] ..s. 146.947364: 0: 33 34 35
>
> Similarly specifying '-t ib' will run this on IB link.
>
> Signed-off-by: Tushar Dave <tushar.n.dave@...cle.com>
> Acked-by: Sowmini Varadhan <sowmini.varadhan@...cle.com>
> ---
> samples/bpf/Makefile | 3 +
> samples/bpf/rds_filter_kern.c | 42 ++++++
> samples/bpf/rds_filter_user.c | 339 ++++++++++++++++++++++++++++++++++++++++++
please no samples.
Add this as proper test to tools/testing/selftests/bpf
that reports PASS/FAIL and can be run automatically.
samples/bpf is effectively dead code.
Powered by blists - more mailing lists