From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
Stephen Hemminger <stephen@networkplumber.org>,
Kamal Heib <kamalh@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 13/14] net/mlx5e: Switch ipsec counters to use stats group API
Date: Tue, 31 Oct 2017 15:06:46 -0700 [thread overview]
Message-ID: <20171031220647.23614-14-saeedm@mellanox.com> (raw)
In-Reply-To: <20171031220647.23614-1-saeedm@mellanox.com>
From: Kamal Heib <kamalh@mellanox.com>
Switch the ipsec counters to use the new stats group API.
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Reviewed-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 +--------
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 24 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 6de948819034..ff21348b7623 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -31,7 +31,6 @@
*/
#include "en.h"
-#include "en_accel/ipsec.h"
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
struct ethtool_drvinfo *drvinfo)
@@ -150,8 +149,7 @@ int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset)
num_stats += mlx5e_stats_grps[i].get_num_stats(priv);
return num_stats +
MLX5E_NUM_RQ_STATS(priv) +
- MLX5E_NUM_SQ_STATS(priv) +
- mlx5e_ipsec_get_count(priv);
+ MLX5E_NUM_SQ_STATS(priv);
case ETH_SS_PRIV_FLAGS:
return ARRAY_SIZE(mlx5e_priv_flags);
@@ -177,9 +175,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, u8 *data)
for (i = 0; i < mlx5e_num_stats_grps; i++)
idx = mlx5e_stats_grps[i].fill_strings(priv, data, idx);
- /* IPSec counters */
- idx += mlx5e_ipsec_get_strings(priv, data + idx * ETH_GSTRING_LEN);
-
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
return;
@@ -244,9 +239,6 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
for (i = 0; i < mlx5e_num_stats_grps; i++)
idx = mlx5e_stats_grps[i].fill_stats(priv, data, idx);
- /* IPSec counters */
- idx += mlx5e_ipsec_get_stats(priv, data + idx);
-
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
return;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index b120957ea940..930a8224e013 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -31,6 +31,7 @@
*/
#include "en.h"
+#include "en_accel/ipsec.h"
static const struct counter_desc sw_stats_desc[] = {
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
@@ -702,6 +703,24 @@ static int mlx5e_grp_pme_fill_stats(struct mlx5e_priv *priv, u64 *data,
return idx;
}
+static int mlx5e_grp_ipsec_get_num_stats(struct mlx5e_priv *priv)
+{
+ return mlx5e_ipsec_get_count(priv);
+}
+
+static int mlx5e_grp_ipsec_fill_strings(struct mlx5e_priv *priv, u8 *data,
+ int idx)
+{
+ return idx + mlx5e_ipsec_get_strings(priv,
+ data + idx * ETH_GSTRING_LEN);
+}
+
+static int mlx5e_grp_ipsec_fill_stats(struct mlx5e_priv *priv, u64 *data,
+ int idx)
+{
+ return idx + mlx5e_ipsec_get_stats(priv, data + idx);
+}
+
const struct mlx5e_stats_grp mlx5e_stats_grps[] = {
{
.get_num_stats = mlx5e_grp_sw_get_num_stats,
@@ -763,6 +782,11 @@ const struct mlx5e_stats_grp mlx5e_stats_grps[] = {
.fill_strings = mlx5e_grp_pme_fill_strings,
.fill_stats = mlx5e_grp_pme_fill_stats,
},
+ {
+ .get_num_stats = mlx5e_grp_ipsec_get_num_stats,
+ .fill_strings = mlx5e_grp_ipsec_fill_strings,
+ .fill_stats = mlx5e_grp_ipsec_fill_stats,
+ },
};
const int mlx5e_num_stats_grps = ARRAY_SIZE(mlx5e_stats_grps);
--
2.14.2
next prev parent reply other threads:[~2017-10-31 22:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 22:06 [pull request][net-next 00/14] Mellanox, mlx5e stats groups Saeed Mahameed
2017-10-31 22:06 ` [net-next 01/14] net/mlx5e: Introduce stats group API Saeed Mahameed
2017-10-31 22:06 ` [net-next 02/14] net/mlx5e: Switch Q counters to use the " Saeed Mahameed
2017-10-31 22:06 ` [net-next 03/14] net/mlx5e: Switch vport " Saeed Mahameed
2017-10-31 22:06 ` [net-next 04/14] net/mlx5e: Switch IEEE 802.3 counters to use " Saeed Mahameed
2017-10-31 22:06 ` [net-next 05/14] net/mlx5e: Switch RFC 2863 " Saeed Mahameed
2017-10-31 22:06 ` [net-next 06/14] net/mlx5e: Switch RFC 2819 " Saeed Mahameed
2017-10-31 22:06 ` [net-next 07/14] net/mlx5e: Switch physical statistical " Saeed Mahameed
2017-10-31 22:06 ` [net-next 08/14] net/mlx5e: Switch ethernet extended " Saeed Mahameed
2017-10-31 22:06 ` [net-next 09/14] net/mlx5e: Switch pcie " Saeed Mahameed
2017-10-31 22:06 ` [net-next 10/14] net/mlx5e: Switch per prio traffic " Saeed Mahameed
2017-10-31 22:06 ` [net-next 11/14] net/mlx5e: Switch per prio pfc " Saeed Mahameed
2017-10-31 22:06 ` [net-next 12/14] net/mlx5e: Switch pme " Saeed Mahameed
2017-10-31 22:06 ` Saeed Mahameed [this message]
2017-10-31 22:06 ` [net-next 14/14] net/mlx5e: Switch channels " Saeed Mahameed
2017-11-01 2:37 ` [pull request][net-next 00/14] Mellanox, mlx5e stats groups David Miller
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=20171031220647.23614-14-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=davem@davemloft.net \
--cc=kamalh@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).