]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: xdpsock: Add option to specify tx packet size
authorJay Jayatheerthan <jay.jayatheerthan@intel.com>
Fri, 20 Dec 2019 08:55:29 +0000 (14:25 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 21 Dec 2019 00:10:39 +0000 (16:10 -0800)
commit82ac6a5d2a6d72160c6bfa0b1d12d4858580535a
treeabe2b6d44e23d7c9735db6b44cb9bfd87d12827d
parent6be3c36ada7d12a690f15381a3bf8a7f433698fc
samples/bpf: xdpsock: Add option to specify tx packet size

New option '-s' or '--tx-pkt-size' has been added to specify the transmit
packet size. The packet size ranges from 47 to 4096 bytes. When this
option is not provided, it defaults to 64 byte packet.

The code uses struct ethhdr, struct iphdr and struct udphdr to form the
transmit packet. The MAC address, IP address and UDP ports are set to default
values.

The code calculates IP and UDP checksums before sending the packet.
Checksum calculation code in Linux kernel is used for this purpose.
The Ethernet FCS is not filled by the code.

Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191220085530.4980-6-jay.jayatheerthan@intel.com
samples/bpf/xdpsock_user.c