[PATCH v4] net/af_xdp: enable AF_XDP program attachment mode

Stephen Hemminger stephen at networkplumber.org
Wed Jul 30 00:10:03 CEST 2025


On Tue, 29 Jul 2025 16:17:47 +0000
Shivaji Kant <shivajikant at google.com> wrote:

> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 5f65850a27..9858ac24b2 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -169,6 +169,7 @@ struct pmd_internals {
>  	int queue_cnt;
>  	int max_queue_cnt;
>  	int configured_queue_cnt;
> +	uint mode_flag;
>  	bool shared_umem;
>  	char prog_path[PATH_MAX];
>  	bool custom_prog_configured;

Don't use the typedef uint, it is not what DPDK usually uses.
In types.h these are under "Old compatibility names for C types."

Better to use uint32_t which matches the __u32 arg for bpf_xdp_attach prototype.

I would also prefer that drivers avoid using int for things like
queue count because it can lead to overflow bugs. But that is a different problem.

The pmd_internals could also use some reordering to eliminate padding
and put hot elements in same cache.


More information about the dev mailing list