tools/testing/selftests/bpf/prog_tests/test_xsk.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/test_xsk.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/prog_tests/test_xsk.h
Extension
.h
Size
10058 bytes
Lines
323
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct xsk_socket_info {
	struct xsk_ring_cons rx;
	struct xsk_ring_prod tx;
	struct xsk_umem_info *umem_real;
	struct xsk_umem_info *umem;
	struct xsk_socket *xsk;
	struct pkt_stream *pkt_stream;
	u32 outstanding_tx;
	u32 rxqsize;
	u32 batch_size;
	u8 dst_mac[ETH_ALEN];
	u8 src_mac[ETH_ALEN];
	bool check_consumer;
};

int kick_rx(struct xsk_socket_info *xsk);
int kick_tx(struct xsk_socket_info *xsk);

struct xsk_umem_info {
	struct xsk_ring_prod fq;
	struct xsk_ring_cons cq;
	struct xsk_umem *umem;
	u64 next_buffer;
	u64 mmap_size;
	u32 num_frames;
	u32 frame_headroom;
	void *buffer;
	u32 frame_size;
	u32 base_addr;
	u32 fill_size;
	u32 comp_size;
	bool unaligned_mode;
};

struct set_hw_ring {
	u32 default_tx;
	u32 default_rx;
};

int hw_ring_size_reset(struct ifobject *ifobj);

struct ifobject {
	char ifname[MAX_INTERFACE_NAME_CHARS];
	struct xsk_socket_info *xsk;
	struct xsk_socket_info *xsk_arr;
	thread_func_t func_ptr;
	validation_func_t validation_func;
	struct xsk_xdp_progs *xdp_progs;
	struct bpf_map *xskmap;
	struct bpf_program *xdp_prog;
	struct ethtool_ringparam ring;
	struct set_hw_ring set_ring;
	enum test_mode mode;
	int ifindex;
	int mtu;
	u32 bind_flags;
	u32 xdp_zc_max_segs;
	u32 umem_tailroom;
	u32 max_skb_frags;
	bool tx_on;
	bool rx_on;
	bool use_poll;
	bool busy_poll;
	bool use_fill_ring;
	bool release_rx;
	bool shared_umem;
	bool use_metadata;
	bool unaligned_supp;
	bool multi_buff_supp;
	bool multi_buff_zc_supp;
	bool hw_ring_size_supp;
};
struct ifobject *ifobject_create(void);
void ifobject_delete(struct ifobject *ifobj);
int init_iface(struct ifobject *ifobj, thread_func_t func_ptr);

int xsk_configure_umem(struct ifobject *ifobj, struct xsk_umem_info *umem, void *buffer, u64 size);
int xsk_configure_socket(struct xsk_socket_info *xsk, struct xsk_umem_info *umem,
			 struct ifobject *ifobject, bool shared);


struct pkt {
	int offset;
	u32 len;
	u32 pkt_nb;
	bool valid;
	u16 options;
};

struct pkt_stream {

Annotation

Implementation Notes