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=1796387368; b=rrYSOBiAPYmBTQ/k9ZZAp52D+eVjSEbpbrRx5neBu91MSyTnr8bCTClKraNBqLtAQU5/ ksI4mzxgKPV60DdoXZq1IUNFQCxWSpDllW/NKBzckTPxBK+SLtHr0Mosj0Iq9McA1Nu0Z W0u8+QWK/NOfq2X7rVggR1mh7OSan0O9X6qaJ07UKkB2kjCXNsUTA+Y+EYrxIanEGLJFJ z5/MIHfu565emB2Sr6lu+h4zCUNf9cnh46oeYvL/yYbquAPpoNAW86YCrIeEIiFi8hESb Ne5mbTj49A/NWW5V1YH1u5Uebra0xeDqB4XVhtZH2mLzhpfs4LYfZPredawh1u+BAhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387368; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=1X5OgdsO6+5Pe5ug/WnwojD6jYPSJfHe9fQJiZ9NYgo=; b=0zkBRdSaOVTiRTbjCKJ7bBCyHemR/fRtE58evxUumyl/0LfUHCnijErZ/3v/pUUKv8zE /q4ySdc/Y/ev3aCzP7Cp/zucfkhHqqFBnEFxViNoagxY7j7tj6BTDbhxpOZOu6FR25YrL y209Crs6t8aPOsm2gkQdyptj5PLGmaWrkEWInTGn7cGDewukZTpEYKPQLBArT9nw+5qnQ JQOM209g1mX6e6YoVxPD2eIs88mcKPMDR0sWMlBp672z1faT+bBvX1ofdTeKgi3FSm2gA 3Uj/uF5megGaIhQWgNGHXcT5VDtC2QdY4AU/jB1XPWUat4/8FnU1GgfYsBVZdzWZozw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aFRBoVHQ; 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 D81BE606A322; Fri, 4 Dec 2026 12:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aFRBoVHQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AA361F000C2; Fri, 4 Dec 2026 12:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387368; bh=1X5OgdsO6+5Pe5ug/WnwojD6jYPSJfHe9fQJiZ9NYgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aFRBoVHQ32jnEvSMZOjftDbSyMQjmz5jfT+H/swsh65mWpRovYoJfua/Ek/wUZQUq fGKPI7GhW5PlHAkK7RCBIBsBbbP6YWB1+8fmvQ4iVpxeTJZga1jXEKtctG8W+DDEQr ck+gUBcmXl9QsQYPC7NOsJtIaVLbsB8xvT03atR8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anandu Padinhare , Lorenzo Bianconi , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 0189/1059] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Date: Fri, 4 Dec 2026 18:55:20 +0900 Message-ID: <20261204100649.175801261@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anandu Padinhare [ Upstream commit 070411c1590c8172eb4d86f045d99c372f22fe23 ] In the AF_XDP zero-copy RX path, frames that the XDP program passes to the stack are handed over by stmmac_dispatch_skb_zc(). That function increments rx_pkt_n instead of rx_packets since commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary"). stmmac_rx_zc() already adds every processed frame to rx_pkt_n, so each XDP_PASS frame is counted twice there, and rx_packets, which ndo_get_stats64() reports, never counts them: on a zero-copy queue rx_bytes grows with the passed frames while rx_packets stays still. Count the frame in rx_packets, as the regular RX path and the code before that commit did. Found while testing AF_XDP zero-copy on an ADSP-SC598 (adi-dwmac, 100 Mbit/s link): rx_pkt_n grew almost twice as fast as the frames the MAC delivered, while "ip -s link" counted almost none. Tested on that board with a 6.18-based kernel, whose zero-copy RX accounting matches net. An AF_XDP zero-copy socket on queue 0 received frames of one EtherType while UDP traffic was passed to the stack. In a run with 60 s of traffic before the change, rx_pkt_n was 1.88 times the frames that reached the driver (MAC frames minus RX FIFO overflows) and "ip -s link" counted 55 RX packets. In the same test with the change, rx_pkt_n equals the frames that reached the driver and rx_packets equals the frames passed to the stack. Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary") Signed-off-by: Anandu Padinhare Reviewed-by: Lorenzo Bianconi Link: https://patch.msgid.link/PNYPR01MB11444552E41C2B17A992492C0FD762@PNYPR01MB11444.INDPRD01.PROD.OUTLOOK.COM Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a4eb6089dfbb1..8145518cb83a0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5023,7 +5023,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue, napi_gro_receive(&ch->rxtx_napi, skb); u64_stats_update_begin(&rxq_stats->napi_syncp); - u64_stats_inc(&rxq_stats->napi.rx_pkt_n); + u64_stats_inc(&rxq_stats->napi.rx_packets); u64_stats_add(&rxq_stats->napi.rx_bytes, len); u64_stats_update_end(&rxq_stats->napi_syncp); } -- 2.53.0