<div dir="ltr"><div dir="ltr">Hi Maryam,<br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2025 at 3:09 AM Maryam Tahhan <<a href="mailto:mtahhan@redhat.com">mtahhan@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat 1 Feb 2025, 10:03 Ariel Otilibili, <<a href="mailto:ariel.otilibili@6wind.com" target="_blank">ariel.otilibili@6wind.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c<br>
index 092bcb73aa0a..840a12dbf508 100644<br>
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c<br>
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c<br>
@@ -536,6 +536,31 @@ kick_tx(struct pkt_tx_queue *txq, struct xsk_ring_cons *cq)<br>
}<br>
}<br>
<br>
+static inline struct xdp_desc *<br>
+reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf,<br>
+ struct xsk_umem_info *umem)<br>
+{<br>
+ struct xdp_desc *desc = NULL;<br>
+ uint32_t *idx_tx = NULL;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Took me a while to spot this but this needs to be a uint32_t not a pointer to uint32_t, because xsk_ring_prod__reserve() does not allocate memory for idx_tx it just expects to dereference a pointer to a uint32_t to store the index...</div></div></blockquote><div><br></div><div>Only now could I answer back; sorry the late response. And thanks for your thorough investigation.</div><div><br></div><div>I didn't get the chance to use <i>testpmd;</i> which arguments did you pass?<br></div><div><br></div><div>I ran a scan-build while compiling, as well as a compilation with sanitized flags. And I saw no error in af_xdp source files.</div><div><br></div><div>meson --wipe build -Db_sanitize=address<br>ninja -C build 2>&1 san_`date -Iseconds`.log<br>ninja -C build 2>&1 | tee --append san_`date -Iseconds`.log<br>ninja -C build scan-build 2>&1 | tee --append san_`date -Iseconds`.log </div><div><br></div><div>How did you spot the error?</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ uint64_t addr, offset;<br>
+<br>
+ if (!xsk_ring_prod__reserve(&txq->tx, 1, idx_tx))<br>
+ goto out;<br>
+<br>
+ desc = xsk_ring_prod__tx_desc(&txq->tx, *idx_tx);<br>
+ desc->len = mbuf->pkt_len;<br>
+<br>
+ addr = (uint64_t)mbuf - (uint64_t)umem->buffer<br>
+ - umem->mb_pool->header_size;<br>
+ offset = rte_pktmbuf_mtod(mbuf, uint64_t) - (uint64_t)mbuf<br>
+ + umem->mb_pool->header_size;<br>
+ offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;<br>
+ desc->addr = addr | offset;<br>
+<br>
+out:<br>
+ return desc;<br>
+}<br>
+<br><snip></blockquote></div></div></div>
</blockquote></div></div>