<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><snip><br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@@ -559,51 +587,30 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)<br>
mbuf = bufs[i];<br>
<br>
if (mbuf->pool == umem->mb_pool) {<br>
- if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {<br>
+ if (!(desc = reserve_and_fill(txq, mbuf, umem, NULL))) {<br>
kick_tx(txq, cq);<br>
- if (!xsk_ring_prod__reserve(&txq->tx, 1,<br>
- &idx_tx))<br>
+ desc = reserve_and_fill(txq, mbuf, umem, NULL);<br>
+ if (!desc)<br>
goto out;<br>
}<br>
- desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);<br>
- desc->len = mbuf->pkt_len;<br>
- addr = (uint64_t)mbuf - (uint64_t)umem->buffer -<br>
- umem->mb_pool->header_size;<br>
- offset = rte_pktmbuf_mtod(mbuf, uint64_t) -<br>
- (uint64_t)mbuf +<br>
- umem->mb_pool->header_size;<br>
- offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;<br>
- desc->addr = addr | offset;<br>
+<br>
tx_bytes += desc->len;<br>
count++;<br>
} else {<br>
- struct rte_mbuf *local_mbuf =<br>
- rte_pktmbuf_alloc(umem->mb_pool);<br>
- void *pkt;<br>
-<br>
- if (local_mbuf == NULL)<br>
+ if (!(local_mbuf = rte_pktmbuf_alloc(umem->mb_pool)))<br>
goto out;<br>
<br>
- if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {<br>
+ desc = reserve_and_fill(txq, local_mbuf, umem, &pkt);<br>
+ if (!desc) {<br>
rte_pktmbuf_free(local_mbuf);<br>
goto out;<br>
}<br>
<br>
- desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);<br>
- desc->len = mbuf->pkt_len;<br>
-<br>
- addr = (uint64_t)local_mbuf - (uint64_t)umem->buffer -<br>
- umem->mb_pool->header_size;<br>
- offset = rte_pktmbuf_mtod(local_mbuf, uint64_t) -<br>
- (uint64_t)local_mbuf +<br>
- umem->mb_pool->header_size;<br>
- pkt = xsk_umem__get_data(umem->buffer, addr + offset);<br>
- offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;<br>
- desc->addr = addr | offset;<br>
+ desc->len = local_mbuf->pkt_len;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Sorry if my remarks were confusing, it was just missing from the previous patch and it needs to be:</div><div dir="auto">desc->len = mbuf->pkt_len;</div><div dir="auto"><br></div><div dir="auto">We need to keep this the same as the original code. This is a scenario where we need to copy the data from an mbuf that isn't in from the pool of buffers allocated for the umem. So the desc->len needs to be set to that of the (non umem) mbuf. </div><div dir="auto"><br></div><div dir="auto">The other changes look good. Nearly there,</div><div dir="auto"><br></div><div dir="auto">Thanks again</div><div dir="auto"><br></div><div dir="auto"><snip></div></div>