On Thu, 6 Feb 2025 21:46:45 +0100 Ariel Otilibili <ariel.otilibili@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; };