BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nicolai Buchwitz" <nb@tipi-net.de>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net] octeontx2-pf: fix XDP frames freed as skbs on interface down
Date: Sat, 31 Oct 2026 20:12:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-192109@kernel.org> (raw)
In-Reply-To: <20261030-nb-otx2-xdp-cqe-cleanup-net-v1-1-710635c0f504@tipi-net.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] octeontx2-pf: missing xsk_tx_completed() call in otx2_cleanup_tx_cqes()
--

commit 40946781f760bef2ef894a136c752dbc204d2650
Author: Nicolai Buchwitz <nb@tipi-net.de>

octeontx2-pf: fix XDP frames freed as skbs on interface down

This commit updates otx2_cleanup_tx_cqes() to handle CQ_XDP completions via
otx2_xdp_snd_pkt_handler() instead of freeing pending xdp_frame pointers with
dev_kfree_skb_any() during interface teardown or XDP program replacement.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> index 90af9b9044aa0..e3b07e5335fb8 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> @@ -1332,6 +1332,7 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
>  	struct nix_cqe_tx_s *cqe;
>  	struct netdev_queue *txq;
>  	int processed_cqe = 0;
> +	int xsk_frames = 0;
>  	struct sg_list *sg;
>  	int qidx;
>  
> @@ -1348,6 +1349,10 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
>  
>  		if (!cqe)
>  			continue;
> +		if (cq->cq_type == CQ_XDP) {
> +			otx2_xdp_snd_pkt_handler(pfvf, sq, cqe, &xsk_frames);
> +			continue;
> +		}

[Severity: Medium]
Does otx2_cleanup_tx_cqes() also need to pass xsk_frames to
xsk_tx_completed() after draining the loop?

When AF_XDP zero-copy TX descriptors are reaped in
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c:

otx2_xdp_snd_pkt_handler() {
	...
	sg = &sq->sg[snd_comp->sqe_id];
	if (sg->flags & OTX2_AF_XDP_FRAME) {
		(*xsk_frames)++;
		return;
	}
	...
}

the handler only increments xsk_frames and relies on the caller to publish
the completions to sq->xsk_pool, as done in the normal NAPI completion path via
otx2_tx_napi_handler() -> otx2_zc_submit_pkts():

	if (*xsk_frames)
		xsk_tx_completed(xsk_pool, *xsk_frames);

In otx2_cleanup_tx_cqes(), xsk_frames is accumulated across the while
(cq->pend_cqe) loop, but it is never read afterwards. If an interface with an
active AF_XDP zero-copy TX socket is brought down or has its XDP program
replaced while AF_XDP TX completions are pending in a CQ_XDP queue, wouldn't
those completion ring entries be leaked without calling
xsk_tx_completed(sq->xsk_pool, xsk_frames)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261030-nb-otx2-xdp-cqe-cleanup-net-v1-1-710635c0f504@tipi-net.de?part=1

  reply	other threads:[~2026-10-31 20:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 20:12 [PATCH net] octeontx2-pf: fix XDP frames freed as skbs on interface down Nicolai Buchwitz
2026-10-31 20:12 ` sashiko-bot [this message]
2026-11-02  4:27 ` Ratheesh Kannoth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-192109@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=nb@tipi-net.de \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox