Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The patch does not repair the idpf in-flight XDP_TX count it says it fixes. -- libeth: xsk: Count each XDP_TX buffer on its own This patch stops libeth from reading the XSk XDP_TX buffer count from the frame's shared info at flush time. Each XSk XDP_TX SQE, head or fragment, now counts as one completed buffer and carries its own byte count. The head SQE also counts the packet.
> diff --git a/include/net/libeth/xdp.h b/include/net/libeth/xdp.h > index 898723ab62e81..66a3c4ec9967e 100644 > --- a/include/net/libeth/xdp.h > +++ b/include/net/libeth/xdp.h > @@ -1794,12 +1794,19 @@ __libeth_xdp_complete_tx(struct libeth_sqe *sqe, struct libeth_cq_pp *cp, > switch (type) { > case LIBETH_SQE_XDP_TX: > case LIBETH_SQE_XDP_XMIT: > - case LIBETH_SQE_XSK_TX: > cp->xdp_tx -= sqe->nr_frags; > > cp->xss->packets++; > cp->xss->bytes += sqe->bytes; > break; > + case LIBETH_SQE_XSK_TX: > + cp->xss->packets++; > + fallthrough; > + case LIBETH_SQE_XSK_TX_FRAG: > + /* One buffer per SQE, see libeth_xsk_tx_fill_buf() */ > + cp->xdp_tx--;
[Severity: High] Does the sign of this decrement match what idpf expects? The count is now one per SQE. On the send side, though, libeth_xdp_tx_xmit_bulk() adds to the same counter: include/net/libeth/xdp.h:libeth_xdp_tx_xmit_bulk() { ... if (sq.xdp_tx) *sq.xdp_tx += n; ... } For XSk XDP_TX, idpf_xsk_tx_prep() points sq.xdp_tx at xdpsq->xdp_tx. On completion, idpf_xsksq_complete_slow() starts with a zeroed cp. After k XSk XDP_TX buffers complete, cp.xdp_tx holds (u32)-k. The driver then does this: drivers/net/ethernet/intel/idpf/xsk.c:idpf_xsksq_complete_slow() { ... xdpsq->next_to_clean = ntc; xdpsq->xdp_tx -= cp.xdp_tx; ... } That adds k to xdpsq->xdp_tx instead of subtracting it. Doesn't the in-flight counter then grow on both send and completion? The kernel-doc for struct libeth_cq_pp describes xdp_tx as "number of XDP-not-XSk frames processed", which is a positive count. In idpf/xdp.c, idpf_xdpsq_complete() uses the same "xdpsq->xdp_tx -= cp.xdp_tx" pattern with the existing "cp->xdp_tx -= sqe->nr_frags" line. The new XSk case copies that sign. idpf_xsksq_complete() uses this counter to choose its fast path: if (likely(!xdpsq->xdp_tx)) { tx_ntc += done_frames; ... xsk_frames = done_frames; goto finalize; } After the first XSk XDP_TX the counter never goes back to zero, so the slow path is always taken. Each XDP_TX buffer adds 2 to the counter. After about 2^31 buffers the u32 wraps, and it can read exactly zero while XDP_TX SQEs are still on the ring. In that case, would the fast path pass those XDP_TX buffers to xsk_tx_completed() as xmit completions and never call xsk_buff_free() on them? Userspace would then see completion ring entries that were never reserved for xmit, and those UMEM buffers would leak from the pool. That looks like the same outcome the commit message describes: "idpf may then complete XDP_TX buffers as XSk xmit frames". The later patch in this series, "xsk: Keep the shared info of zero-copy buffers in kernel memory", leaves both cp->xdp_tx-- and xdpsq->xdp_tx -= cp.xdp_tx unchanged. The mismatch is still present at the end of the series. Would it work to have libeth return a positive count (cp->xdp_tx++ and cp->xdp_tx += sqe->nr_frags)? Changing the idpf consumers to += would also work.
> + cp->xss->bytes += sqe->bytes; > + break; > default: > break; > }
[ ... ]
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org