[PATCH v8 2/2] net/af_xdp: Refactor af_xdp_tx_zc

Stephen Hemminger stephen at networkplumber.org
Thu Feb 6 22:42:45 CET 2025


On Thu,  6 Feb 2025 21:46:45 +0100
Ariel Otilibili <ariel.otilibili at 6wind.com> wrote:

>  
> +static inline struct xdp_desc *
> +reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf,
> +		 struct xsk_umem_info *umem, void **pkt_ptr)
> +{
> +	struct xdp_desc *desc = NULL;
> +	uint64_t addr, offset;
> +	uint32_t idx_tx;
> +
> +	if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx))
> +		goto out;
> +
> +	desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);
> +	desc->len = mbuf->pkt_len;
> +
> +	addr = (uint64_t)mbuf - (uint64_t)umem->buffer
> +		- umem->mb_pool->header_size;

addr (and the cast of mbuf) should probably be uintptr_t since the
intent is to do calculations with pointers.


More information about the stable mailing list