Skip to content

Commit

Permalink
net/mlx5e: Add PTP RQ to RX reporter
Browse files Browse the repository at this point in the history
When present, add the PTP RQ to the RX reporter.

Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
ayalevin authored and Saeed Mahameed committed Mar 30, 2021
1 parent 19cfa36 commit b8fb109
Showing 1 changed file with 66 additions and 2 deletions.
68 changes: 66 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "params.h"
#include "txrx.h"
#include "devlink.h"
#include "ptp.h"

static int mlx5e_query_rq_state(struct mlx5_core_dev *dev, u32 rqn, u8 *state)
{
Expand Down Expand Up @@ -351,12 +352,34 @@ static int mlx5e_rx_reporter_diagnose_generic_rq(struct mlx5e_rq *rq,
return mlx5e_health_fmsg_named_obj_nest_end(fmsg);
}

static int
mlx5e_rx_reporter_diagnose_common_ptp_config(struct mlx5e_priv *priv, struct mlx5e_ptp *ptp_ch,
struct devlink_fmsg *fmsg)
{
int err;

err = mlx5e_health_fmsg_named_obj_nest_start(fmsg, "PTP");
if (err)
return err;

err = devlink_fmsg_u32_pair_put(fmsg, "filter_type", priv->tstamp.rx_filter);
if (err)
return err;

err = mlx5e_rx_reporter_diagnose_generic_rq(&ptp_ch->rq, fmsg);
if (err)
return err;

return mlx5e_health_fmsg_named_obj_nest_end(fmsg);
}

static int
mlx5e_rx_reporter_diagnose_common_config(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg)
{
struct mlx5e_priv *priv = devlink_health_reporter_priv(reporter);
struct mlx5e_rq *generic_rq = &priv->channels.c[0]->rq;
struct mlx5e_ptp *ptp_ch = priv->channels.ptp;
int err;

err = mlx5e_health_fmsg_named_obj_nest_start(fmsg, "Common config");
Expand All @@ -367,14 +390,45 @@ mlx5e_rx_reporter_diagnose_common_config(struct devlink_health_reporter *reporte
if (err)
return err;

if (ptp_ch && test_bit(MLX5E_PTP_STATE_RX, ptp_ch->state)) {
err = mlx5e_rx_reporter_diagnose_common_ptp_config(priv, ptp_ch, fmsg);
if (err)
return err;
}

return mlx5e_health_fmsg_named_obj_nest_end(fmsg);
}

static int mlx5e_rx_reporter_build_diagnose_output_ptp_rq(struct mlx5e_rq *rq,
struct devlink_fmsg *fmsg)
{
int err;

err = devlink_fmsg_obj_nest_start(fmsg);
if (err)
return err;

err = devlink_fmsg_string_pair_put(fmsg, "channel", "ptp");
if (err)
return err;

err = mlx5e_rx_reporter_build_diagnose_output_rq_common(rq, fmsg);
if (err)
return err;

err = devlink_fmsg_obj_nest_end(fmsg);
if (err)
return err;

return 0;
}

static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg,
struct netlink_ext_ack *extack)
{
struct mlx5e_priv *priv = devlink_health_reporter_priv(reporter);
struct mlx5e_ptp *ptp_ch = priv->channels.ptp;
int i, err = 0;

mutex_lock(&priv->state_lock);
Expand All @@ -397,9 +451,12 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,
if (err)
goto unlock;
}
if (ptp_ch && test_bit(MLX5E_PTP_STATE_RX, ptp_ch->state)) {
err = mlx5e_rx_reporter_build_diagnose_output_ptp_rq(&ptp_ch->rq, fmsg);
if (err)
goto unlock;
}
err = devlink_fmsg_arr_pair_nest_end(fmsg);
if (err)
goto unlock;
unlock:
mutex_unlock(&priv->state_lock);
return err;
Expand Down Expand Up @@ -531,6 +588,7 @@ static int mlx5e_rx_reporter_dump_rq(struct mlx5e_priv *priv, struct devlink_fms
static int mlx5e_rx_reporter_dump_all_rqs(struct mlx5e_priv *priv,
struct devlink_fmsg *fmsg)
{
struct mlx5e_ptp *ptp_ch = priv->channels.ptp;
struct mlx5_rsc_key key = {};
int i, err;

Expand Down Expand Up @@ -563,6 +621,12 @@ static int mlx5e_rx_reporter_dump_all_rqs(struct mlx5e_priv *priv,
return err;
}

if (ptp_ch && test_bit(MLX5E_PTP_STATE_RX, ptp_ch->state)) {
err = mlx5e_health_queue_dump(priv, fmsg, ptp_ch->rq.rqn, "PTP RQ");
if (err)
return err;
}

return devlink_fmsg_arr_pair_nest_end(fmsg);
}

Expand Down

0 comments on commit b8fb109

Please sign in to comment.