aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf/xdp_redirect_map_user.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-10-29samples/bpf: adjust rlimit RLIMIT_MEMLOCK for xdp_redirect_mapTushar Dave1-0/+7
Default rlimit RLIMIT_MEMLOCK is 64KB, causes bpf map failure. e.g. [root@labbpf]# ./xdp_redirect_map $(</sys/class/net/eth2/ifindex) \ > $(</sys/class/net/eth3/ifindex) failed to create a map: 1 Operation not permitted The failure is 100% when multiple xdp programs are running. Fix it. Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-29samples/bpf: xdp_redirect load XDP dummy prog on TX deviceJesper Dangaard Brouer1-7/+15
For supporting XDP_REDIRECT, a device driver must (obviously) implement the "TX" function ndo_xdp_xmit(). An additional requirement is you cannot TX out a device, unless it also have a xdp bpf program attached. This dependency is caused by the driver code need to setup XDP resources before it can ndo_xdp_xmit. Update bpf samples xdp_redirect and xdp_redirect_map to automatically attach a dummy XDP program to the configured ifindex_out device. Use the XDP flag XDP_FLAGS_UPDATE_IF_NOEXIST on the dummy load, to avoid overriding an existing XDP prog on the device. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-07-17samples/bpf: add option for native and skb mode for redirect appsAndy Gospodarek1-9/+41
When testing with a driver that has both native and generic redirect support: $ sudo ./samples/bpf/xdp_redirect -N 5 6 input: 5 output: 6 ifindex 6: 4961879 pkt/s ifindex 6: 6391319 pkt/s ifindex 6: 6419468 pkt/s $ sudo ./samples/bpf/xdp_redirect -S 5 6 input: 5 output: 6 ifindex 6: 1845435 pkt/s ifindex 6: 3882850 pkt/s ifindex 6: 3893974 pkt/s $ sudo ./samples/bpf/xdp_redirect_map -N 5 6 input: 5 output: 6 map[0] (vports) = 4, map[1] (map) = 5, map[2] (count) = 0 ifindex 6: 2207374 pkt/s ifindex 6: 6212869 pkt/s ifindex 6: 6286515 pkt/s $ sudo ./samples/bpf/xdp_redirect_map -S 5 6 input: 5 output: 6 map[0] (vports) = 4, map[1] (map) = 5, map[2] (count) = 0 ifindex 6: 5052528 pkt/s ifindex 6: 5736631 pkt/s ifindex 6: 5739962 pkt/s Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-07-17xdp: bpf redirect with map sample programJohn Fastabend1-0/+105
Signed-off-by: John Fastabend <john.fastabend@gmail.com> Tested-by: Andy Gospodarek <andy@greyhouse.net> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>