aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/xskxceiver.h
diff options
context:
space:
mode:
authorTushar Vyavahare <tushar.vyavahare@intel.com>2023-03-20 15:57:05 +0530
committerAlexei Starovoitov <ast@kernel.org>2023-03-22 09:14:07 -0700
commit9a321fd3308e262f2a76761bea86dd0f311e3f86 (patch)
tree92878de369c68c3025b72fbaaae0fcd2b5a8fa1f /tools/testing/selftests/bpf/xskxceiver.h
parent6a9f5cdba3c5b4e8c2af290fe6c9e3538652ab42 (diff)
selftests/xsk: add xdp populate metadata test
Add a new test in copy-mode for testing the copying of metadata from the buffer in kernel-space to user-space. This is accomplished by adding a new XDP program and using the bss map to store a counter that is written to the metadata field. This counter is incremented for every packet so that the number becomes unique and should be the same as the payload. It is store in the bss so the value can be reset between runs. The XDP program populates the metadata and the userspace program checks the value stored in the metadata field against the payload using the new is_metadata_correct() function. To turn this verification on or off, add a new parameter (use_metadata) to the ifobject structure. Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/r/20230320102705.306187-1-tushar.vyavahare@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/xskxceiver.h')
-rw-r--r--tools/testing/selftests/bpf/xskxceiver.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
index 3e8ec7d8ec32..bdb4efedf3a9 100644
--- a/tools/testing/selftests/bpf/xskxceiver.h
+++ b/tools/testing/selftests/bpf/xskxceiver.h
@@ -88,6 +88,7 @@ enum test_type {
TEST_TYPE_STATS_FILL_EMPTY,
TEST_TYPE_BPF_RES,
TEST_TYPE_XDP_DROP_HALF,
+ TEST_TYPE_XDP_METADATA_COUNT,
TEST_TYPE_MAX
};
@@ -158,6 +159,7 @@ struct ifobject {
bool use_fill_ring;
bool release_rx;
bool shared_umem;
+ bool use_metadata;
u8 dst_mac[ETH_ALEN];
u8 src_mac[ETH_ALEN];
};