From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C96E22236EB; Tue, 30 Sep 2025 15:11:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245111; cv=none; b=eUhmIrIZfZ64c+iwj633/tUtM1rSp+6nmhjBtCYkZ06i1wnMSgVou/yLVL/v58BtwfjNu1ni7OKdxoWv0AHUjkzAjo3WaCPH0VyrBlgWDRfjLPkeKr5O/a0egwtlWKUidSlwrIKEirYWANuQxGxFisUX2qJvLlfzUUHtYywGkeE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245111; c=relaxed/simple; bh=XeD2//t1Uu/7GFl1W0c54ghE4xWbToa5+7Lq9V9wE2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lculBBdsG+0gH1A/asQfO+0yN/D4wv3lCzV78OI90uozHO/K3rTfk7gxjZTV9g+Od8JfQAId+EI2G8Wr5IlpW7RKV2Nwmgxz+3CqNRCoyxmoHI3RsIofSmr8KwRFkvljrd0ZAwPqDR1E7m2o8cVQiBlWt/Yy/y3xDf0T1I+qIyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Wvihnp2i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Wvihnp2i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D7C2C4CEF0; Tue, 30 Sep 2025 15:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759245111; bh=XeD2//t1Uu/7GFl1W0c54ghE4xWbToa5+7Lq9V9wE2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wvihnp2iqxQxbi+kx8pzGD64B5nHkRxizfBSmpWVS96j5SHXn+XZbJtdu/zwBXNsj Vss0JDDFhmlVNFA7Pfnn4oPNYWOq1PruUYY55j84sWs35XWxUOQzlNmnZRc4ubXV15 ln2djOFZZku6w3GEtx0KgcAJzQX6CJwP3h1Zt6wc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yeounsu Moon , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 072/151] net: natsemi: fix `rx_dropped` double accounting on `netif_rx()` failure Date: Tue, 30 Sep 2025 16:46:42 +0200 Message-ID: <20250930143830.466082674@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143827.587035735@linuxfoundation.org> References: <20250930143827.587035735@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yeounsu Moon [ Upstream commit 93ab4881a4e2b9657bdce4b8940073bfb4ed5eab ] `netif_rx()` already increments `rx_dropped` core stat when it fails. The driver was also updating `ndev->stats.rx_dropped` in the same path. Since both are reported together via `ip -s -s` command, this resulted in drops being counted twice in user-visible stats. Keep the driver update on `if (unlikely(!skb))`, but skip it after `netif_rx()` errors. Fixes: caf586e5f23c ("net: add a core netdev->rx_dropped counter") Signed-off-by: Yeounsu Moon Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250913060135.35282-3-yyyynoom@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/natsemi/ns83820.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index 72794d1588711..09dbc975fcee9 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c @@ -820,7 +820,7 @@ static void rx_irq(struct net_device *ndev) struct ns83820 *dev = PRIV(ndev); struct rx_info *info = &dev->rx_info; unsigned next_rx; - int rx_rc, len; + int len; u32 cmdsts; __le32 *desc; unsigned long flags; @@ -881,8 +881,10 @@ static void rx_irq(struct net_device *ndev) if (likely(CMDSTS_OK & cmdsts)) { #endif skb_put(skb, len); - if (unlikely(!skb)) + if (unlikely(!skb)) { + ndev->stats.rx_dropped++; goto netdev_mangle_me_harder_failed; + } if (cmdsts & CMDSTS_DEST_MULTI) ndev->stats.multicast++; ndev->stats.rx_packets++; @@ -901,15 +903,12 @@ static void rx_irq(struct net_device *ndev) __vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag); } #endif - rx_rc = netif_rx(skb); - if (NET_RX_DROP == rx_rc) { -netdev_mangle_me_harder_failed: - ndev->stats.rx_dropped++; - } + netif_rx(skb); } else { dev_kfree_skb_irq(skb); } +netdev_mangle_me_harder_failed: nr++; next_rx = info->next_rx; desc = info->descs + (DESC_SIZE * next_rx); -- 2.51.0