Add support for generic XDP mode
Reused some of the code and command-line format from kernel XDP samples.
$ sudo ./xdp_drop_count.py -S enp1s0
Printing drops per IP protocol-number, hit CTRL+C to stop
17: 36616 pkt/s
17: 19720757 pkt/s
17: 19685768 pkt/s
17: 19643601 pkt/s
17: 19694537 pkt/s
[...]
$ sudo ./xdp_drop_count.py enp1s0
Printing drops per IP protocol-number, hit CTRL+C to stop
17: 7029 pkt/s
17: 29996706 pkt/s
17: 30048705 pkt/s
17: 30261417 pkt/s
17: 30291967 pkt/s
[...]
Throughput difference is expected since generic XDP takes more
instructions per packet than optimized XDP.
v2: switch __u32 to uint32_t in bpf_attach_xdp
Signed-off-by: Andy Gospodarek <gospo@broadcom.com>
Showing
Please register or sign in to comment