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 0930C199939; Tue, 30 Sep 2025 14:58:10 +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=1759244290; cv=none; b=fcGCAQn1EE368d5tSdyRnWnDTQoj7V21XTtrVpQcZKdZQiZSI0mU+Sg3PZFwre/BPzvlKblz2gNpk7oPS4x2c6VP8EOfm2w4Yq0UoI86bxTRLZ8wfJJKcZTdClrvIUlVFsvn99s3bb1B4BVZ1Jy3tWVmkeF8+BmhKKVjctbsYJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759244290; c=relaxed/simple; bh=GiyI85x7ExS6niKCXJVqRkat8/5Ozih0vT6hpTAeBb8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hfLVugsXGcLp4rISHFlnlj/o6O+ZYZwUn3UEcgqZ/Fdi79+HDC98OTebatD7oKbYRtmniTA7ScXZZMn7iN4D/2MxuHS4itnxFxYatCNjM/1KI3ALCkkaYRyQiMEo7+28GCUTIFfK1iWYga3j+g0CBdgM6gWNNzGHmfhgOJ5Bmcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CX+l3/7o; 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="CX+l3/7o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763E5C4CEF0; Tue, 30 Sep 2025 14:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759244289; bh=GiyI85x7ExS6niKCXJVqRkat8/5Ozih0vT6hpTAeBb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CX+l3/7oUcZYqRuxIux6fCBO7firhAa6VvHnTqrIKAHNPHBIQuwuBW3MjXHshlQUM LTSOaUWNMhlgKbP/7mSvRrFnTeMSyzmGx7FpexNff5EvlqGoAZ6yvkZdbfF4ar2efE gILMgI/NDVyUZHBJmsLCL5SOqLGKcuKJN5qbuenI= 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.10 052/122] net: natsemi: fix `rx_dropped` double accounting on `netif_rx()` failure Date: Tue, 30 Sep 2025 16:46:23 +0200 Message-ID: <20250930143825.130801114@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143822.939301999@linuxfoundation.org> References: <20250930143822.939301999@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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