Commit df3ed000 authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Alexei Starovoitov

selftests/xsk: Support tx_metadata_len

Add new config field and propagate to UMEM registration setsockopt.
Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/20231127190319.1190813-10-sdf@google.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 11614723
...@@ -115,6 +115,7 @@ static void xsk_set_umem_config(struct xsk_umem_config *cfg, ...@@ -115,6 +115,7 @@ static void xsk_set_umem_config(struct xsk_umem_config *cfg,
cfg->frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE; cfg->frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE;
cfg->frame_headroom = XSK_UMEM__DEFAULT_FRAME_HEADROOM; cfg->frame_headroom = XSK_UMEM__DEFAULT_FRAME_HEADROOM;
cfg->flags = XSK_UMEM__DEFAULT_FLAGS; cfg->flags = XSK_UMEM__DEFAULT_FLAGS;
cfg->tx_metadata_len = 0;
return; return;
} }
...@@ -123,6 +124,7 @@ static void xsk_set_umem_config(struct xsk_umem_config *cfg, ...@@ -123,6 +124,7 @@ static void xsk_set_umem_config(struct xsk_umem_config *cfg,
cfg->frame_size = usr_cfg->frame_size; cfg->frame_size = usr_cfg->frame_size;
cfg->frame_headroom = usr_cfg->frame_headroom; cfg->frame_headroom = usr_cfg->frame_headroom;
cfg->flags = usr_cfg->flags; cfg->flags = usr_cfg->flags;
cfg->tx_metadata_len = usr_cfg->tx_metadata_len;
} }
static int xsk_set_xdp_socket_config(struct xsk_socket_config *cfg, static int xsk_set_xdp_socket_config(struct xsk_socket_config *cfg,
...@@ -252,6 +254,7 @@ int xsk_umem__create(struct xsk_umem **umem_ptr, void *umem_area, ...@@ -252,6 +254,7 @@ int xsk_umem__create(struct xsk_umem **umem_ptr, void *umem_area,
mr.chunk_size = umem->config.frame_size; mr.chunk_size = umem->config.frame_size;
mr.headroom = umem->config.frame_headroom; mr.headroom = umem->config.frame_headroom;
mr.flags = umem->config.flags; mr.flags = umem->config.flags;
mr.tx_metadata_len = umem->config.tx_metadata_len;
err = setsockopt(umem->fd, SOL_XDP, XDP_UMEM_REG, &mr, sizeof(mr)); err = setsockopt(umem->fd, SOL_XDP, XDP_UMEM_REG, &mr, sizeof(mr));
if (err) { if (err) {
......
...@@ -200,6 +200,7 @@ struct xsk_umem_config { ...@@ -200,6 +200,7 @@ struct xsk_umem_config {
__u32 frame_size; __u32 frame_size;
__u32 frame_headroom; __u32 frame_headroom;
__u32 flags; __u32 flags;
__u32 tx_metadata_len;
}; };
int xsk_attach_xdp_program(struct bpf_program *prog, int ifindex, u32 xdp_flags); int xsk_attach_xdp_program(struct bpf_program *prog, int ifindex, u32 xdp_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment