Article View: linux.kernel.netdev
Article #10133[PATCH net v2] octeontx2-pf: fix XDP frames freed as skbs on interface down
From: Nicolai Buchwitz
Date: Tue, 03 Nov 2026 09:04
Date: Tue, 03 Nov 2026 09:04
71 lines
11135 bytes
11135 bytes
On interface down, the TX completion cleanup also runs on the XDP
queues, but treats the pending xdp_frames as skbs. Freeing them with
dev_kfree_skb_any() corrupts page pool memory. AF_XDP TX completions
in these queues were never reported to the socket either.
This happens when XDP_TX or redirected packets are still in flight on
ifdown, or when the XDP program is replaced.
Fixes: 94c80f748873 ("octeontx2-pf: use xdp_return_frame() to free xdp buffers")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Pre-existing bug, flagged by the clashiko review of my ipsec transmit
fixes for this driver [1], which seems reasonable (and fixable) to me.
The other pre-existing findings there (e.g. the SA lifetime in
cn10k_ipsec_del_state()) may be worth fixing too, but I'll leave those
to the maintainers.
Compile-tested only, I have no octeontx2 hardware.
[1] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261027-nb-otx2-ipsec-tx-fixes-net-v1-0-2114c4f10c36%40tipi-net.de
---
Changes in v2:
- Report AF_XDP TX completions with xsk_tx_completed() (Daniel, sashiko)
- Link to v1: https://patch.msgid.link/20261030-nb-otx2-xdp-cqe-cleanup-net-v1-1-710635c0f504@tipi-net.de
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 90af9b9044aa0..b038bb1451949 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;
+ }
sg = &sq->sg[cqe->comp.sqe_id];
skb = (struct sk_buff *)sg->skb;
if (skb) {
@@ -1359,6 +1364,9 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
}
}
+ if (xsk_frames && sq->xsk_pool)
+ xsk_tx_completed(sq->xsk_pool, xsk_frames);
+
if (likely(tx_pkts)) {
if (qidx >= pfvf->hw.tx_queues)
qidx -= pfvf->hw.xdp_queues;
---
base-commit: c3e67bd82b9b9b1a5118f09a429ccefe2aab0741
change-id: 20261028-nb-otx2-xdp-cqe-cleanup-net-5810d40e1d30
Best regards,
--
Nicolai Buchwitz <nb@tipi-net.de>
Technical Details
Message-ID:
<20261103-nb-otx2-xdp-cqe-cleanup-net-v2-1-5430545c9cbc@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355307-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355307-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2] octeontx2-pf: fix XDP frames freed as skbs on interface down Date: Tue, 03 Nov 2026 10:04:49 +0100 Organization: Usenet Network Message-ID: <20261103-nb-otx2-xdp-cqe-cleanup-net-v2-1-5430545c9cbc@tipi-net.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3128353"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LqmL52o7qwAgJ7hskCUuqvOe3TY= sha256:4P5idmFlVUg1HfZlkvPoR8kw4JeBpmqGmIcfpUEERkY= sha1:hHwWOg7+t2dkbdmhdEve9QXvzAA= sha256:zLIT8gK7R+uRjr5QiMt74HeRqX35JDCObo8xbJgrI2Y= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 69DF2112784; Tue, 3 Nov 2026 12:10:16 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3g62p99jHWjB; Tue, 3 Nov 2026 12:10:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355307-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 63B0A11275E; Tue, 3 Nov 2026 12:09:54 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9D0CA2FFA5; Tue, 3 Nov 2026 09:05:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793696716; b=JqiJX4K9KA9RI+aZZCe+n5OjADNRNDZeB98OfuZgARA8bvpoitj3HY3Q9tqJP5rCtN0C 33kXihWK1V0GVaotHJirLrXlePr/SiRIFyCbtOl0RrXJ5eKZUHLJSe6pI1YgMOgTWmNQV +jbxs6tIPPs2oR3/IQ9M8Igp+OMVtTUDCYGE1GtmjyPsY2y7woxIE/310BDEk5AjL3fNV bCrBVtMCKSUFnLhJvoNWw3vLxIMHurIKWqiwvLX7kzAvje7m42Qnwn0jxTszaLph3yHkZ z9VOoHG5oPZ/eidy417Kqwtc3mgTeg6UvIGhqbetU4DSwg6iVBs3DWdJDOkPqQKkbpw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793696716; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From: Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=ELsL0x7qBytlZgP42ggxXZDWX3Lx3FRVsRzrdJlITNU=; b=qvv4rsvoCo71GRUo4Pz8Z2X/oOVw4cMTD/qY/jn7EDpc1WMUGZk8hY6mF+4uonkwNif1 pCODAmbTx2JfD7XPSv5o1gAMn5PkgFnI2KmT/GejEbd/Ye1tjzaYo5keSlVPGfjnDIbiN YBEqGgCBqqFLv/O2Hp3aiCkXX689NejyyPh0Hapa01OI+khzjyfWTMdNQ+QDVdEZTUkVG poHWBKuBk5ZaaSVV1scU3rSMUCyOO7kBP0XChoGOekQ9rMAAopoUhRt0VgktC/Nuyn1nP YdllAxQjRve1mtv8ql+GyMBAIFoOGT2TYAyNTMpuIgnGcL3/2+eAB/9P9qqDR3P8J6A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=D6LleYEk; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FDB8606A330; Tue, 3 Nov 2026 09:05:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=D6LleYEk X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793696710; b=5iCDzPPyUUuwV6A0sQi3BtsON/p5wT7m2sGClNPkaVCtNmp9nI9xGFahOxXL7SL0C15l mJqgr7WA3oqaIQiMH0SsUemOVSLjlK4GHIX4g4tGVugBDOg83W8RWZ6QrrG+q+GGBtiSM q/ZVsGrjrDfLOKUld8wWhhaNs6+23/62sxBqguYPTabOylxoL6F8qAjsEIgiLYNJnOKQy Yw1Mae0aqmN8H8DZmSTOVWvUBbsyoOZ9KtQMGeU4rpYd9ADpt04PEAAdBlFcDAwgUSq89 VPemtmY5Q9MJQPu5lxuMc7SxRMWIwsQxk5pJMoH3KNay18bcep07B5e6VtvE39GLgog== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793696710; h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=ELsL0x7qBytlZgP42ggxXZDWX3Lx3FRVsRzrdJlITNU=; b=gAwvouCftCTUvHaknzERjLeeEyA3ixs4T0dhjozaROo5Qfv0DwmHQb+ElPxzLJkwAp2y 9oQuaDyESDIFleHBDgiLRJf/3BSwcq9MoWOm7HdnNGKrTC6GUwSeL9Jy79i4dPFAjxc7c 9yjomGdjVwsJHyOwFPoKNzerWDMpmmon2CVF0CFrelC+PAew0x+RUUJN/0Yl+GKZClkTK 7tJd1XbSpKclX9LYTLFiOFhXOCVsiIVom2X/WNqPtUXtIrC8xq57OadJgSZbDF9NdWxDh Wp4tNyJeDf+39mhge8CU3+KVVgQnhVhxwzblWUHFp+43QyXchR0leheqPE2dLInl6Eg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=D6LleYEk; arc=none smtp.remote-ip=194.13.80.246 X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1371F606A327; Tue, 3 Nov 2026 09:05:07 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1371F606A327 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6EEDAA1643; Tue, 03 Nov 2026 10:04:56 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1793696699; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding; bh=ELsL0x7qBytlZgP42ggxXZDWX3Lx3FRVsRzrdJlITNU=; b=D6LleYEk8UR4/zsyHkwNJxtbFKPqhLNOuZdLo+PkIcQklWkBhyWie03oIH321xLsR96e87 XJ96XX6NwJM4FHqJNavDmgefmkiYd/eEHJ/r7gvXutlAMa/z0YsFsdaAWSHTJppSzxCigN jIJWiRP3AXYsb1hD7H+ZhivpPphH8TaRn/KAduQuABL+GNoqk2WzH8V40HiIm9dTJqLnYU UO0NIiPksUApshlc6T/YxcvAHzYBywV7j5EBAys77Ws374rlcfsfKTVvKwQVhRnyjoEaIB VR7Q3NrKLVcKNXtMHSkvbWqVMkS/UYzdZECstP9akU/3GhNK0EI00aRX6tLAVg== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-B4-Tracking: v=1; b=H4sIAAAAAAAC/32Oyw6CMBBFf4XM2jHT8pC48j8MC2hHqTGltoVgC P9ugb3Le+fk3FkgsDcc4Jot4HkywQw2BXnKQPWtfTIanTJIkpUgWaPtcIizxFk7VB9G9ebWjg4 tRyxrQbogFjonSAbn+WHm3X6HBEBzlGHsXqzi5t2w3oQ4+O/+wyR2+JjL6e/cJFDgRVCVl4oeJ RW3aJzZTmfN0Kzr+gP8/kfT3wAAAA== X-Change-ID: 20261028-nb-otx2-xdp-cqe-cleanup-net-5810d40e1d30 X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Daniel Machon <daniel.machon@microchip.com>, Nicolai Buchwitz <nb@tipi-net.de> X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3