From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 6A42B606A6A4 for ; Fri, 4 Dec 2026 14:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=knSNhIgH; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fDo0JhYR Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4729D61C14; Fri, 4 Dec 2026 14:20:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id B3yulED4q1YZ; Fri, 4 Dec 2026 14:20:53 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org B38DB61BC4 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796394053; b=BjFN4rc7o9k1H3QV/oyhwRFyBq3RE2BGDvBCrk4umzuGpEwIEUQxH/J0dov/M3Sp+98W yn0mHfUWa/hddnMwpP8nQSRPcPksx8MJkW4ezLGWbNkWY7VN5uJMvnTZlPfkATHEWH3Nb hBBUkalTdOm07wC1FCKJz3oWOrZjaSHZkTNKNrS5MFKVz4v2O3LG1Aj8h8LtuR6gifgX0 lZL1aaFU5go0kd7XpQT3+u9JUUoMNWo1ttLM3sWR6FdWRZppgHnvoq820f0vlCINmuuGF /6hBKuy/B6hZEJSThnennGlNI0fsT1YMbONGq3cCE/KuwxQNliNZsjvZeM/O7PL9OsQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796394053; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:X-BeenThere:X-Mailman-Version:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=6/rPUekGYcfBVj7HlIOptGKIRjakD9k3PsGVTSoPS+w=; b=kllt/bvaTm19fcnjQg/TV33prIy7iQbnh3pFtIm6Db5zxHmfu3Z8qYM32zUku6M4U2If UVjP9+rJUlKqXN2SASXY+7+th8LMBm0sReRzJAzzBkoDwvo6RUC6alVkVUYqD9xIWHJ1y 4o5tzzdJ1PemgLWuE5lEnzobd/0ahNJwvVlwjk7xPoocy4M7CSDz3mJGLE6dTOQ+PObSW gY5pSpmdfziFIm4oxdCIU3Mz1Oblb4Jzhzd4oT3lvzDmJvTDbvs3FIqPvHR2rCG10i0oY KTva16AGwd8GpBIkrb3sxAR59OVjiZ9+NbuRMpdoDvQ7ArJOs6Kw3fGi40vhyFDelBw== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796394053; bh=6/rPUekGYcfBVj7HlIOptGKIRjakD9k3PsGVTSoPS+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=knSNhIgHl7UHE2dx56a0dAfzAx1FvG3eY6kGMOhFpdgEnc1WMtI8Rfm4wO3yv3bnf QAkQfDSphRVcMYVg+2/0Kvv0Xlb3kxIs0Bm1yYejC9I8dTuo0Bvd1+kFhQAkTMafwv 7dPtk0VcMZh4k/Cfr/7FD1d3KqnoH6alv86BvyHMPRDxi2ZZwjqq3K167JwBhe4I/e vVSUzFxRy2Ctam2+6ZYm1BeDGoafeXni8dtc9LI0H/x1jKL1x+i39zET7ZyXt3tkKy rD2ZKWINQUCChcTL5fUy6mXPI+9msRwZrbrsJkbOgJtvB+D8s96XwU++UGl+rFmy9K VVT1kVB0gUpxw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id B38DB61BC4; Fri, 4 Dec 2026 14:20:53 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id 3D736120 for ; Fri, 4 Dec 2026 14:20:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2F93D400A7 for ; Fri, 4 Dec 2026 14:20:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UNpjA1adJu2s for ; Fri, 4 Dec 2026 14:20:52 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp2.osuosl.org 8BF3040048 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip=172.234.252.31 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=bjorn@kernel.org; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fDo0JhYR Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8BF3040048 for ; Fri, 4 Dec 2026 14:20:51 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 9954744F81; Fri, 4 Dec 2026 14:20:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12F941F000CE; Fri, 4 Dec 2026 14:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394051; bh=6/rPUekGYcfBVj7HlIOptGKIRjakD9k3PsGVTSoPS+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fDo0JhYRJcIq7O7kXDITuf6+1yV2SjsbZ6y8RYXJGmOTTwk279rLeZLxOD3vnr7V2 zCcTjCcBETvVkpsH/uZYdLfCMObcC5VLCFWOc0pLO7Nz9Z79VbLY2f90Oko0rUp5az fFPHvhN6aOmfuMSe/Ljdla/inIL4YCt+Y23oHjaAdtcY6pEt2MqYZ43cN3sm+gluX1 wcyEPnuhA/8034JMa/QEcGBPzXMHoMroYRkLlcVn36M6ySI/yzUMAkXUimSIT+qtUp tvZtkNZLwGyC/9aBKF3lZktp2EV2mUVbGPDn6TV5HukpWV+P8GUNPV1sP2On3iplL4 BCUhDVQW6QvCA== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Magnus Karlsson , Maciej Fijalkowski , Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Andrew Lunn , Tony Nguyen , Przemek Kitszel , netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Simon Horman , Stanislav Fomichev , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , intel-wired-lan@lists.osuosl.org, =?UTF-8?q?Cl=C3=A9ment=20Lecigne?= , Michal Swiatkowski , Sriram Yagnaraman , Kurt Kanzenbach , Michal Kubiak Subject: [PATCH net v4 1/5] libeth: xdp: Count completed XDP_TX buffers up Date: Fri, 4 Dec 2026 15:20:21 +0100 Message-ID: <20261204142030.626820-2-bjorn@kernel.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204142030.626820-1-bjorn@kernel.org> References: <20261204142030.626820-1-bjorn@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 libeth adds the buffers it sends on an XDPSQ to the driver's in-flight XDP_TX count. On completion, libeth counts them in struct libeth_cq_pp, whose kernel-doc calls it the number processed, and idpf subtracts that number. Currently libeth counts down from 0, so the subtraction adds, and the count grows by two per buffer. idpf reads the count only on its XSk queues. At 0 it completes all done descriptors as XSk xmit frames at once. After the first XDP_TX buffer the count never gets back to 0, and every completion takes the slow path. After about 2^31 buffers the count wraps. If it lands on 0 while XDP_TX buffers are in flight, idpf completes them as XSk xmit frames. Their buffers are never freed, and userspace gets completions for xmit descriptors that are still in flight. Count the completed buffers up, as the kernel-doc says, and say buffers there, not frames. Found by an AI code review agent in review of this series. Not triggered at runtime. Fixes: 8ff6d62261a3 ("idpf: implement XSk xmit") Signed-off-by: Björn Töpel --- include/net/libeth/tx.h | 2 +- include/net/libeth/xdp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/libeth/tx.h b/include/net/libeth/tx.h index c3db5c6f1641..622c26059cb9 100644 --- a/include/net/libeth/tx.h +++ b/include/net/libeth/tx.h @@ -93,7 +93,7 @@ struct libeth_sqe { * @bq: XDP frame bulk to combine return operations * @ss: onstack NAPI stats to fill * @xss: onstack XDPSQ NAPI stats to fill - * @xdp_tx: number of XDP-not-XSk frames processed + * @xdp_tx: number of non-XSk-xmit XDP buffers processed * @napi: whether it's called from the NAPI context * * libeth uses this structure to access objects needed for performing full diff --git a/include/net/libeth/xdp.h b/include/net/libeth/xdp.h index 898723ab62e8..38fcd3fdff70 100644 --- a/include/net/libeth/xdp.h +++ b/include/net/libeth/xdp.h @@ -1795,7 +1795,7 @@ __libeth_xdp_complete_tx(struct libeth_sqe *sqe, struct libeth_cq_pp *cp, case LIBETH_SQE_XDP_TX: case LIBETH_SQE_XDP_XMIT: case LIBETH_SQE_XSK_TX: - cp->xdp_tx -= sqe->nr_frags; + cp->xdp_tx += sqe->nr_frags; cp->xss->packets++; cp->xss->bytes += sqe->bytes; -- 2.53.1