All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
	Maxim Mikityanskiy <maximmi@mellanox.com>,
	"Raed Salem" <raeds@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 05/12] net/mlx5e: Fix IPSEC stats
Date: Tue, 26 Jan 2021 15:43:38 -0800	[thread overview]
Message-ID: <20210126234345.202096-6-saeedm@nvidia.com> (raw)
In-Reply-To: <20210126234345.202096-1-saeedm@nvidia.com>

From: Maxim Mikityanskiy <maximmi@mellanox.com>

When IPSEC offload isn't active, the number of stats is not zero, but
the strings are not filled, leading to exposing stats with empty names.
Fix this by using the same condition for NUM_STATS and FILL_STRS.

Fixes: 0aab3e1b04ae ("net/mlx5e: IPSec, Expose IPsec HW stat only for supporting HW")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
index 6c5c54bcd9be..5cb936541b9e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
@@ -76,7 +76,7 @@ static const struct counter_desc mlx5e_ipsec_sw_stats_desc[] = {
 
 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_sw)
 {
-	return NUM_IPSEC_SW_COUNTERS;
+	return priv->ipsec ? NUM_IPSEC_SW_COUNTERS : 0;
 }
 
 static inline MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_sw) {}
@@ -105,7 +105,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)
 
 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_hw)
 {
-	return (mlx5_fpga_ipsec_device_caps(priv->mdev)) ? NUM_IPSEC_HW_COUNTERS : 0;
+	return (priv->ipsec && mlx5_fpga_ipsec_device_caps(priv->mdev)) ? NUM_IPSEC_HW_COUNTERS : 0;
 }
 
 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_hw)
-- 
2.29.2


  parent reply	other threads:[~2021-01-27  4:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 23:43 [pull request][net 00/12] mlx5 fixes 2021-01-26 Saeed Mahameed
2021-01-26 23:43 ` [net 01/12] net/mlx5: Fix memory leak on flow table creation error flow Saeed Mahameed
2021-01-28  3:30   ` patchwork-bot+netdevbpf
2021-01-28  8:33     ` Saeed Mahameed
2021-01-29  1:37       ` Jakub Kicinski
2021-01-26 23:43 ` [net 02/12] net/mlx5e: E-switch, Fix rate calculation for overflow Saeed Mahameed
2021-01-26 23:43 ` [net 03/12] net/mlx5e: free page before return Saeed Mahameed
2021-01-26 23:43 ` [net 04/12] net/mlx5e: Reduce tc unsupported key print level Saeed Mahameed
2021-01-26 23:43 ` Saeed Mahameed [this message]
2021-01-26 23:43 ` [net 06/12] net/mlx5: Maintain separate page trees for ECPF and PF functions Saeed Mahameed
2021-01-26 23:43 ` [net 07/12] net/mlx5e: Disable hw-tc-offload when MLX5_CLS_ACT config is disabled Saeed Mahameed
2021-01-26 23:43 ` [net 08/12] net/mlx5e: Fix CT rule + encap slow path offload and deletion Saeed Mahameed
2021-01-26 23:43 ` [net 09/12] net/mlx5e: Correctly handle changing the number of queues when the interface is down Saeed Mahameed
2021-01-26 23:43 ` [net 10/12] net/mlx5e: Revert parameters on errors when changing trust state without reset Saeed Mahameed
2021-01-26 23:43 ` [net 11/12] net/mlx5e: Revert parameters on errors when changing MTU and LRO " Saeed Mahameed
2021-01-27 20:00   ` Willem de Bruijn
2021-01-27 23:06     ` Saeed Mahameed
2021-01-26 23:43 ` [net 12/12] net/mlx5: CT: Fix incorrect removal of tuple_nat_node from nat rhashtable Saeed Mahameed
2021-01-27 20:03 ` [pull request][net 00/12] mlx5 fixes 2021-01-26 Willem de Bruijn
2021-01-27 23:08   ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210126234345.202096-6-saeedm@nvidia.com \
    --to=saeedm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=raeds@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.