OSDN Git Service

samples/bpf: xdpsock: Add timestamp for Tx-only operation
authorOng Boon Leong <boon.leong.ong@intel.com>
Thu, 30 Dec 2021 03:54:47 +0000 (11:54 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 6 Jan 2022 01:53:24 +0000 (17:53 -0800)
commiteb68db45b747756c351ea84e9af55a69468d0549
treee0a2dfd5ddbbdba66ee0228602aca766caed5b10
parent8121e78932018df48758985e00651e16ff34ae5f
samples/bpf: xdpsock: Add timestamp for Tx-only operation

It may be useful to add timestamp for Tx packets for continuous or cyclic
transmit operation. The timestamp and sequence ID of a Tx packet are
stored according to pktgen header format. To enable per-packet timestamp,
use -y|--tstamp option. If timestamp is off, pktgen header is not
included in the UDP payload. This means receiving side can use the magic
number for pktgen for differentiation.

The implementation supports both VLAN tagged and untagged option. By
default, the minimum packet size is set at 64B. However, if VLAN tagged
is on (-V), the minimum packet size is increased to 66B just so to fit
the pktgen_hdr size.

Added hex_dump() into the code path just for future cross-checking.
As before, simply change to "#define DEBUG_HEXDUMP 1" to inspect the
accuracy of TX packet.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211230035447.523177-8-boon.leong.ong@intel.com
samples/bpf/xdpsock_user.c