Skip to content

Commit d2a5dca

Browse files
IronShendavem330
authored andcommitted
net: hns3: Fix an error of total drop packet statistics
The dropped tx/rx packets number of each tqp should also be counted into the total drop tx/rx packets numbers. Fixes: 76ad4f0 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Jian Shen <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b875cc3 commit d2a5dca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
11391139
u64 rx_bytes = 0;
11401140
u64 tx_pkts = 0;
11411141
u64 rx_pkts = 0;
1142+
u64 tx_drop = 0;
1143+
u64 rx_drop = 0;
11421144

11431145
if (test_bit(HNS3_NIC_STATE_DOWN, &priv->state))
11441146
return;
@@ -1152,6 +1154,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
11521154
start = u64_stats_fetch_begin_irq(&ring->syncp);
11531155
tx_bytes += ring->stats.tx_bytes;
11541156
tx_pkts += ring->stats.tx_pkts;
1157+
tx_drop += ring->stats.tx_busy;
1158+
tx_drop += ring->stats.sw_err_cnt;
11551159
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
11561160

11571161
/* fetch the rx stats */
@@ -1160,6 +1164,9 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
11601164
start = u64_stats_fetch_begin_irq(&ring->syncp);
11611165
rx_bytes += ring->stats.rx_bytes;
11621166
rx_pkts += ring->stats.rx_pkts;
1167+
rx_drop += ring->stats.non_vld_descs;
1168+
rx_drop += ring->stats.err_pkt_len;
1169+
rx_drop += ring->stats.l2_err;
11631170
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
11641171
}
11651172

@@ -1175,8 +1182,8 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
11751182
stats->rx_missed_errors = netdev->stats.rx_missed_errors;
11761183

11771184
stats->tx_errors = netdev->stats.tx_errors;
1178-
stats->rx_dropped = netdev->stats.rx_dropped;
1179-
stats->tx_dropped = netdev->stats.tx_dropped;
1185+
stats->rx_dropped = rx_drop + netdev->stats.rx_dropped;
1186+
stats->tx_dropped = tx_drop + netdev->stats.tx_dropped;
11801187
stats->collisions = netdev->stats.collisions;
11811188
stats->rx_over_errors = netdev->stats.rx_over_errors;
11821189
stats->rx_frame_errors = netdev->stats.rx_frame_errors;

0 commit comments

Comments
 (0)