<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 06/02/2025 21:42, Stephen Hemminger
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20250206134245.0989988f@hermes.local">
<pre wrap="" class="moz-quote-pre">On Thu, 6 Feb 2025 21:46:45 +0100
Ariel Otilibili <a class="moz-txt-link-rfc2396E" href="mailto:ariel.otilibili@6wind.com"><ariel.otilibili@6wind.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">
+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;
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
addr (and the cast of mbuf) should probably be uintptr_t since the
intent is to do calculations with pointers.
</pre>
</blockquote>
<pre>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;
};</pre>
<br>
<br>
</body>
</html>