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

Maryam Tahhan mtahhan at redhat.com
Fri Feb 7 10:18:14 CET 2025


On 06/02/2025 21:42, Stephen Hemminger wrote:
> 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.
>
I think it's ok as we would end up casting it anyway for the `struct xdp_desc`

/* Rx/Tx descriptor */
struct xdp_desc {
     __u64 addr;
     __u32 len;
     __u32 options;
};


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/stable/attachments/20250207/0fc5d728/attachment.htm>


More information about the stable mailing list