Commit 2d708887 authored by Aya Levin's avatar Aya Levin Committed by Saeed Mahameed

net/mlx5e: Extend tx reporter diagnostics output

Enhance tx reporter's diagnostics output to include: information common
to all SQs: SQ size, SQ stride size.
In addition add channel ix, tc, txq ix, cc and pc.

$ devlink health diagnose pci/0000:00:0b.0 reporter tx
 Common config:
   SQ:
     stride size: 64 size: 1024
 SQs:
   channel ix: 0 tc: 0 txq ix: 0 sqn: 4307 HW state: 1 stopped: false cc: 0 pc: 0
   channel ix: 1 tc: 0 txq ix: 1 sqn: 4312 HW state: 1 stopped: false cc: 0 pc: 0
   channel ix: 2 tc: 0 txq ix: 2 sqn: 4317 HW state: 1 stopped: false cc: 0 pc: 0
   channel ix: 3 tc: 0 txq ix: 3 sqn: 4322 HW state: 1 stopped: false cc: 0 pc: 0

$ devlink health diagnose pci/0000:00:0b.0 reporter tx -jp
{
    "Common config": {
        "SQ": {
            "stride size": 64,
            "size": 1024
        }
    },
    "SQs": [ {
            "channel ix": 0,
            "tc": 0,
            "txq ix": 0,
            "sqn": 4307,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0
        },{
            "channel ix": 1,
            "tc": 0,
            "txq ix": 1,
            "sqn": 4312,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0
        },{
            "channel ix": 2,
            "tc": 0,
            "txq ix": 2,
            "sqn": 4317,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0
        },{
            "channel ix": 3,
            "tc": 0,
            "txq ix": 3,
            "sqn": 4322,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0
         } ]
}
Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent dd921fd2
...@@ -4,6 +4,36 @@ ...@@ -4,6 +4,36 @@
#include "health.h" #include "health.h"
#include "lib/eq.h" #include "lib/eq.h"
int mlx5e_reporter_named_obj_nest_start(struct devlink_fmsg *fmsg, char *name)
{
int err;
err = devlink_fmsg_pair_nest_start(fmsg, name);
if (err)
return err;
err = devlink_fmsg_obj_nest_start(fmsg);
if (err)
return err;
return 0;
}
int mlx5e_reporter_named_obj_nest_end(struct devlink_fmsg *fmsg)
{
int err;
err = devlink_fmsg_obj_nest_end(fmsg);
if (err)
return err;
err = devlink_fmsg_pair_nest_end(fmsg);
if (err)
return err;
return 0;
}
int mlx5e_health_sq_to_ready(struct mlx5e_channel *channel, u32 sqn) int mlx5e_health_sq_to_ready(struct mlx5e_channel *channel, u32 sqn)
{ {
struct mlx5_core_dev *mdev = channel->mdev; struct mlx5_core_dev *mdev = channel->mdev;
......
...@@ -11,6 +11,9 @@ void mlx5e_reporter_tx_destroy(struct mlx5e_priv *priv); ...@@ -11,6 +11,9 @@ void mlx5e_reporter_tx_destroy(struct mlx5e_priv *priv);
void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq); void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq);
int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq); int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq);
int mlx5e_reporter_named_obj_nest_start(struct devlink_fmsg *fmsg, char *name);
int mlx5e_reporter_named_obj_nest_end(struct devlink_fmsg *fmsg);
#define MLX5E_REPORTER_PER_Q_MAX_LEN 256 #define MLX5E_REPORTER_PER_Q_MAX_LEN 256
struct mlx5e_err_ctx { struct mlx5e_err_ctx {
......
...@@ -146,7 +146,7 @@ static int mlx5e_tx_reporter_recover(struct devlink_health_reporter *reporter, ...@@ -146,7 +146,7 @@ static int mlx5e_tx_reporter_recover(struct devlink_health_reporter *reporter,
static int static int
mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg, mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg,
struct mlx5e_txqsq *sq) struct mlx5e_txqsq *sq, int tc)
{ {
struct mlx5e_priv *priv = sq->channel->priv; struct mlx5e_priv *priv = sq->channel->priv;
bool stopped = netif_xmit_stopped(sq->txq); bool stopped = netif_xmit_stopped(sq->txq);
...@@ -161,6 +161,18 @@ mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg, ...@@ -161,6 +161,18 @@ mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg,
if (err) if (err)
return err; return err;
err = devlink_fmsg_u32_pair_put(fmsg, "channel ix", sq->ch_ix);
if (err)
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "tc", tc);
if (err)
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "txq ix", sq->txq_ix);
if (err)
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "sqn", sq->sqn); err = devlink_fmsg_u32_pair_put(fmsg, "sqn", sq->sqn);
if (err) if (err)
return err; return err;
...@@ -173,6 +185,14 @@ mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg, ...@@ -173,6 +185,14 @@ mlx5e_tx_reporter_build_diagnose_output(struct devlink_fmsg *fmsg,
if (err) if (err)
return err; return err;
err = devlink_fmsg_u32_pair_put(fmsg, "cc", sq->cc);
if (err)
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "pc", sq->pc);
if (err)
return err;
err = devlink_fmsg_obj_nest_end(fmsg); err = devlink_fmsg_obj_nest_end(fmsg);
if (err) if (err)
return err; return err;
...@@ -184,25 +204,58 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter, ...@@ -184,25 +204,58 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg) struct devlink_fmsg *fmsg)
{ {
struct mlx5e_priv *priv = devlink_health_reporter_priv(reporter); struct mlx5e_priv *priv = devlink_health_reporter_priv(reporter);
int i, err = 0; struct mlx5e_txqsq *generic_sq = priv->txq2sq[0];
u32 sq_stride, sq_sz;
int i, tc, err = 0;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
goto unlock; goto unlock;
sq_sz = mlx5_wq_cyc_get_size(&generic_sq->wq);
sq_stride = MLX5_SEND_WQE_BB;
err = mlx5e_reporter_named_obj_nest_start(fmsg, "Common Config");
if (err)
goto unlock;
err = mlx5e_reporter_named_obj_nest_start(fmsg, "SQ");
if (err)
goto unlock;
err = devlink_fmsg_u64_pair_put(fmsg, "stride size", sq_stride);
if (err)
goto unlock;
err = devlink_fmsg_u32_pair_put(fmsg, "size", sq_sz);
if (err)
goto unlock;
err = mlx5e_reporter_named_obj_nest_end(fmsg);
if (err)
goto unlock;
err = mlx5e_reporter_named_obj_nest_end(fmsg);
if (err)
goto unlock;
err = devlink_fmsg_arr_pair_nest_start(fmsg, "SQs"); err = devlink_fmsg_arr_pair_nest_start(fmsg, "SQs");
if (err) if (err)
goto unlock; goto unlock;
for (i = 0; i < priv->channels.num * priv->channels.params.num_tc; for (i = 0; i < priv->channels.num; i++) {
i++) { struct mlx5e_channel *c = priv->channels.c[i];
struct mlx5e_txqsq *sq = priv->txq2sq[i];
err = mlx5e_tx_reporter_build_diagnose_output(fmsg, sq); for (tc = 0; tc < priv->channels.params.num_tc; tc++) {
struct mlx5e_txqsq *sq = &c->sq[tc];
err = mlx5e_tx_reporter_build_diagnose_output(fmsg, sq, tc);
if (err) if (err)
goto unlock; goto unlock;
} }
}
err = devlink_fmsg_arr_pair_nest_end(fmsg); err = devlink_fmsg_arr_pair_nest_end(fmsg);
if (err) if (err)
goto unlock; goto unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment