From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394052; b=JSbSmbitlC94St0M9kYgRJeIc85ncSvEz/bCO+2wqYreogMQGFVd8Err6Mpk+Ti7k/ZD LSsrfxPz7MAUlyvZMFnfv5rUA588GCqNID1RGBxGpXRhNMVC5ZX4r9GkQ9OZ9Quq8vkGX AlspIN1jWJUGUFYizgDQIeG7QVP6DR5+nhEGWZ0oNbUCbKSolZzij/N+FEffwqVJDKvbq piDtVOZkzP6fxz8HhVGwT2ioSKRNKaVMJSrMEsYjatCuiMcmifM/ed2+GUAOU2V8w7b0y aX7zEfzHRnSnkXXnZ7kTfu0FgHuxhiXhXh+KJvBtdW1dRYom4HvQm9GYOjeEw77+YxA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394052; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=6/rPUekGYcfBVj7HlIOptGKIRjakD9k3PsGVTSoPS+w=; b=WO92N+IjWR5O1ce59jrqHpvO4QuVieRYbxTDlzv8b8shA74A9EXEo/LMrVH3exedc1yx mJB/34bR28VTDw0WL25lxgxTFQp25zBcvRO+XgdiWviixtrSuTXx8zLcOhctOWFU4n/mh jA+RC0BufDPPbWnI7Mi0RGssBWdd4zNYC5nx3+1QjLOxXg8CWSqmb+s1ITTG2lRw+AFxm TRzeKPO9AStQHqvzAYfYd1iMvhHYJJ+1Z4ngHsV0cQBofJDSQrQ/TS64DZImh90pRZnPl CpDShcs5CCjWwL0KH1Dl3CduyiBpjCb7catz+85fL1psBj9JulRtoMtJUei//ReeYKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fDo0JhYR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBE0F606A32D; Fri, 4 Dec 2026 14:20:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.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: 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-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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