From 752b8aabfa6c13d15838c829c6540ccb878cd71c Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Wed, 8 May 2019 10:53:25 +0000 Subject: [PATCH] Let rx_out_of_buffer be a 32-bit counter in mlx5en(4). This fixes counting issues when the firmware resets the counter during allocation of the counter set where the counter belongs. MFC after: 3 days Sponsored by: Mellanox Technologies --- sys/dev/mlx5/mlx5_en/en.h | 1 - sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b760cef99058..6b7e87b276b7 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -196,7 +196,6 @@ struct mlx5e_vport_stats { struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) - u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 951a788931ac..7e292579e200 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -593,10 +593,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, &rx_out_of_buffer) == 0) { - /* accumulate difference into a 64-bit counter */ - s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - - s->rx_out_of_buffer_prev); - s->rx_out_of_buffer_prev = rx_out_of_buffer; + s->rx_out_of_buffer = rx_out_of_buffer; } /* get port statistics */