From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-cys01nam02on0096.outbound.protection.outlook.com ([104.47.37.96]:43108 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933841AbeCSPtQ (ORCPT ); Mon, 19 Mar 2018 11:49:16 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jian Shen , Peng Li , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 078/124] net: hns3: Fix an error of total drop packet statistics Date: Mon, 19 Mar 2018 15:48:25 +0000 Message-ID: <20180319154645.11350-78-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Jian Shen [ Upstream commit d2a5dca8404871be683c6bbc175ebf9c56dd2865 ] The dropped tx/rx packets number of each tqp should also be counted into the total drop tx/rx packets numbers. Fixes: 76ad4f0ee74 ("net: hns3: Add support of HNS3 Ethernet Driver for hip= 08 SoC") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index 853f273da22d..428ede16b10a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -1055,6 +1055,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struc= t rtnl_link_stats64 *stats) u64 rx_bytes =3D 0; u64 tx_pkts =3D 0; u64 rx_pkts =3D 0; + u64 tx_drop =3D 0; + u64 rx_drop =3D 0; =20 for (idx =3D 0; idx < queue_num; idx++) { /* fetch the tx stats */ @@ -1063,6 +1065,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struc= t rtnl_link_stats64 *stats) start =3D u64_stats_fetch_begin_irq(&ring->syncp); tx_bytes +=3D ring->stats.tx_bytes; tx_pkts +=3D ring->stats.tx_pkts; + tx_drop +=3D ring->stats.tx_busy; + tx_drop +=3D ring->stats.sw_err_cnt; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); =20 /* fetch the rx stats */ @@ -1071,6 +1075,9 @@ hns3_nic_get_stats64(struct net_device *netdev, struc= t rtnl_link_stats64 *stats) start =3D u64_stats_fetch_begin_irq(&ring->syncp); rx_bytes +=3D ring->stats.rx_bytes; rx_pkts +=3D ring->stats.rx_pkts; + rx_drop +=3D ring->stats.non_vld_descs; + rx_drop +=3D ring->stats.err_pkt_len; + rx_drop +=3D ring->stats.l2_err; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); } =20 @@ -1086,8 +1093,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struc= t rtnl_link_stats64 *stats) stats->rx_missed_errors =3D netdev->stats.rx_missed_errors; =20 stats->tx_errors =3D netdev->stats.tx_errors; - stats->rx_dropped =3D netdev->stats.rx_dropped; - stats->tx_dropped =3D netdev->stats.tx_dropped; + stats->rx_dropped =3D rx_drop + netdev->stats.rx_dropped; + stats->tx_dropped =3D tx_drop + netdev->stats.tx_dropped; stats->collisions =3D netdev->stats.collisions; stats->rx_over_errors =3D netdev->stats.rx_over_errors; stats->rx_frame_errors =3D netdev->stats.rx_frame_errors; --=20 2.14.1