[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 5 May 2019 17:52:43 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Saeed Mahameed <saeedm@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Jiri Pirko <jiri@...lanox.com>,
Moshe Shemesh <moshe@...lanox.com>
Subject: Re: [net-next 14/15] net/mlx5: Add support for FW fatal reporter dump
Sun, May 05, 2019 at 02:33:33AM CEST, saeedm@...lanox.com wrote:
>From: Moshe Shemesh <moshe@...lanox.com>
>
>Add support of dump callback for mlx5 FW fatal reporter.
>The FW fatal dump use cr-dump functionality to gather cr-space data for
>debug. The cr-dump uses vsc interface which is valid even if the FW
>command interface is not functional, which is the case in most FW fatal
>errors.
>The cr-dump is stored as a memory region snapshot to ease read by
>address.
>
>Command example and output:
>$ devlink health dump show pci/0000:82:00.0 reporter fw_fatal
>devlink_region_name: cr-space snapshot_id: 1
>
>$ devlink region read pci/0000:82:00.0/cr-space snapshot 1 address 983064 length 8
>00000000000f0018 e1 03 00 00 fb ae a9 3f
>
>Signed-off-by: Moshe Shemesh <moshe@...lanox.com>
>Signed-off-by: Saeed Mahameed <saeedm@...lanox.com>
>---
> .../net/ethernet/mellanox/mlx5/core/health.c | 39 +++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
>index e64f0e32cd67..5271c88ef64c 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
>@@ -547,9 +547,48 @@ mlx5_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter,
> return mlx5_health_care(dev);
> }
>
>+static int
>+mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
>+ struct devlink_fmsg *fmsg, void *priv_ctx)
>+{
>+ struct mlx5_core_dev *dev = devlink_health_reporter_priv(reporter);
>+ char crdump_region[20];
>+ u32 snapshot_id;
>+ int err;
>+
>+ if (!mlx5_core_is_pf(dev)) {
>+ mlx5_core_err(dev, "Only PF is permitted run FW fatal dump\n");
>+ return -EPERM;
>+ }
>+
>+ err = mlx5_crdump_collect(dev, crdump_region, &snapshot_id);
>+ if (err)
>+ return err;
>+
>+ if (priv_ctx) {
>+ struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;
>+
>+ err = mlx5_fw_reporter_ctx_pairs_put(fmsg, fw_reporter_ctx);
>+ if (err)
>+ return err;
>+ }
>+
>+ err = devlink_fmsg_string_pair_put(fmsg, "devlink_region_name",
>+ crdump_region);
Oh come on. You cannot be serious :/ Please do proper linkage to region
and snapshot in devlink core.
>+ if (err)
>+ return err;
>+
>+ err = devlink_fmsg_u32_pair_put(fmsg, "snapshot_id", snapshot_id);
>+ if (err)
>+ return err;
>+
>+ return 0;
>+}
>+
> static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = {
> .name = "fw_fatal",
> .recover = mlx5_fw_fatal_reporter_recover,
>+ .dump = mlx5_fw_fatal_reporter_dump,
> };
>
> #define MLX5_REPORTER_FW_GRACEFUL_PERIOD 1200000
>--
>2.20.1
>
Powered by blists - more mailing lists