From 26a111e40222dd36a412aa89705987c33226b644 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 16 May 2019 16:14:43 +0000 Subject: [PATCH] MFC r347293: Use software counters for rx_packets and rx_bytes in mlx5en(4). The physical- and virtual- port counters might not reflect the amount of data received after address filtering. Use the software counters instead for rx_packets and rx_bytes to know exactly how much data was received. Sponsored by: Mellanox Technologies --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 360f17bb980..9fade575b79 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -499,6 +499,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; + u64 rx_packets = 0; + u64 rx_bytes = 0; u32 rx_out_of_buffer = 0; int i; int j; @@ -522,6 +524,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) lro_bytes += rq_stats->lro_bytes; rx_csum_none += rq_stats->csum_none; rx_wqe_err += rq_stats->wqe_err; + rx_packets += rq_stats->packets; + rx_bytes += rq_stats->bytes; for (j = 0; j < priv->num_tc; j++) { sq_stats = &pch->sq[j].stats; @@ -548,6 +552,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->sw_lro_flushed = sw_lro_flushed; s->rx_csum_none = rx_csum_none; s->rx_wqe_err = rx_wqe_err; + s->rx_packets = rx_packets; + s->rx_bytes = rx_bytes; /* HW counters */ memset(in, 0, sizeof(in)); @@ -610,11 +616,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) s->tx_broadcast_bytes = MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); - s->rx_packets = s->rx_unicast_packets + - s->rx_multicast_packets + s->rx_broadcast_packets - - s->rx_out_of_buffer; - s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + - s->rx_broadcast_bytes; s->tx_packets = s->tx_unicast_packets + s->tx_multicast_packets + s->tx_broadcast_packets; s->tx_bytes = s->tx_unicast_bytes + s->tx_multicast_bytes + -- 2.45.0