summaryrefslogtreecommitdiffstats
path: root/sys/dev/mlx5/mlx5_en
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2017-01-09 16:52:35 +0000
committerhselasky <hselasky@FreeBSD.org>2017-01-09 16:52:35 +0000
commited39504d3861ed5f595118d966def3233aacc0d8 (patch)
treeafdc22c44fbd6e97be307657d253b84192250eeb /sys/dev/mlx5/mlx5_en
parent9ff9e425935ff703857c5383a7507e652a81607f (diff)
downloadFreeBSD-src-ed39504d3861ed5f595118d966def3233aacc0d8.zip
FreeBSD-src-ed39504d3861ed5f595118d966def3233aacc0d8.tar.gz
MFC r310387:
Add more comments regarding collection of statistics counters. Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/dev/mlx5/mlx5_en')
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 567025e..d61ada0 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -306,6 +306,12 @@ mlx5e_update_carrier_work(struct work_struct *work)
PRIV_UNLOCK(priv);
}
+/*
+ * This function reads the physical port counters from the firmware
+ * using a pre-defined layout defined by various MLX5E_PPORT_XXX()
+ * macros. The output is converted from big-endian 64-bit values into
+ * host endian ones and stored in the "priv->stats.pport" structure.
+ */
static void
mlx5e_update_pport_counters(struct mlx5e_priv *priv)
{
@@ -319,20 +325,27 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv)
unsigned x;
unsigned y;
+ /* allocate firmware request structures */
in = mlx5_vzalloc(sz);
out = mlx5_vzalloc(sz);
if (in == NULL || out == NULL)
goto free_out;
+ /*
+ * Get pointer to the 64-bit counter set which is located at a
+ * fixed offset in the output firmware request structure:
+ */
ptr = (const uint64_t *)MLX5_ADDR_OF(ppcnt_reg, out, counter_set);
MLX5_SET(ppcnt_reg, in, local_port, 1);
+ /* read IEEE802_3 counter group using predefined counter layout */
MLX5_SET(ppcnt_reg, in, grp, MLX5_IEEE_802_3_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
for (x = y = 0; x != MLX5E_PPORT_IEEE802_3_STATS_NUM; x++, y++)
s->arg[y] = be64toh(ptr[x]);
+ /* read RFC2819 counter group using predefined counter layout */
MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2819_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
for (x = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM; x++, y++)
@@ -341,20 +354,29 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv)
MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++)
s_debug->arg[y] = be64toh(ptr[x]);
+ /* read RFC2863 counter group using predefined counter layout */
MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2863_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
for (x = 0; x != MLX5E_PPORT_RFC2863_STATS_DEBUG_NUM; x++, y++)
s_debug->arg[y] = be64toh(ptr[x]);
+ /* read physical layer stats counter group using predefined counter layout */
MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++)
s_debug->arg[y] = be64toh(ptr[x]);
free_out:
+ /* free firmware request structures */
kvfree(in);
kvfree(out);
}
+/*
+ * This function is called regularly to collect all statistics
+ * counters from the firmware. The values can be viewed through the
+ * sysctl interface. Execution is serialized using the priv's global
+ * configuration lock.
+ */
static void
mlx5e_update_stats_work(struct work_struct *work)
{
OpenPOWER on IntegriCloud