Message ID | 20240808144107.2095424-6-tariqt@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0b4a4534d083e055831b3bc29c5eafc918ed4d86 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | mlx5 misc fixes 2024-08-08 | expand |
On Thu, Aug 08, 2024 at 05:41:06PM +0300, Tariq Toukan wrote: > From: Gal Pressman <gal@nvidia.com> > > The queue stats API queries the queues according to the > real_num_[tr]x_queues, in case the device is down and channels were not > yet created, don't try to query their statistics. [...] > --- > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > index f04decca39f2..5df904639b0c 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > @@ -5296,7 +5296,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i, > struct mlx5e_rq_stats *rq_stats; > > ASSERT_RTNL(); > - if (mlx5e_is_uplink_rep(priv)) > + if (mlx5e_is_uplink_rep(priv) || !priv->stats_nch) > return; > > channel_stats = priv->channel_stats[i]; > @@ -5316,6 +5316,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i, > struct mlx5e_sq_stats *sq_stats; > > ASSERT_RTNL(); > + if (!priv->stats_nch) > + return; > + > /* no special case needed for ptp htb etc since txq2sq_stats is kept up > * to date for active sq_stats, otherwise get_base_stats takes care of > * inactive sqs. > -- > 2.44.0 Reviewed-by: Joe Damato <jdamato@fastly.com>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index f04decca39f2..5df904639b0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5296,7 +5296,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i, struct mlx5e_rq_stats *rq_stats; ASSERT_RTNL(); - if (mlx5e_is_uplink_rep(priv)) + if (mlx5e_is_uplink_rep(priv) || !priv->stats_nch) return; channel_stats = priv->channel_stats[i]; @@ -5316,6 +5316,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i, struct mlx5e_sq_stats *sq_stats; ASSERT_RTNL(); + if (!priv->stats_nch) + return; + /* no special case needed for ptp htb etc since txq2sq_stats is kept up * to date for active sq_stats, otherwise get_base_stats takes care of * inactive sqs.