FW crashes are detected based on uptime going back, expose the uptime via devlink health diagnose. Signed-off-by: Jakub Kicinski --- .../device_drivers/ethernet/meta/fbnic.rst | 4 +++- drivers/net/ethernet/meta/fbnic/fbnic_devlink.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/device_drivers/ethernet/meta/fbnic.rst b/Documentation/networking/device_drivers/ethernet/meta/fbnic.rst index 62693566ff1f..3c81b58d8292 100644 --- a/Documentation/networking/device_drivers/ethernet/meta/fbnic.rst +++ b/Documentation/networking/device_drivers/ethernet/meta/fbnic.rst @@ -77,7 +77,9 @@ fw reporter The ``fw`` health reporter tracks FW crashes. Dumping the reporter will show the core dump of the most recent FW crash, and if no FW crash has -happened since power cycle - a snapshot of the FW memory. +happened since power cycle - a snapshot of the FW memory. Diagnose callback +shows current FW uptime (the crashes are detected by checking if uptime +goes down). Statistics ---------- diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c index 0e8920685da6..f3f3585c0aac 100644 --- a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c +++ b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c @@ -487,6 +487,18 @@ static int fbnic_fw_reporter_dump(struct devlink_health_reporter *reporter, return err; } +static int +fbnic_fw_reporter_diagnose(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, + struct netlink_ext_ack *extack) +{ + struct fbnic_dev *fbd = devlink_health_reporter_priv(reporter); + + devlink_fmsg_u32_pair_put(fmsg, "FW uptime", fbd->firmware_time); + + return 0; +} + void __printf(2, 3) fbnic_devlink_fw_report(struct fbnic_dev *fbd, const char *format, ...) { @@ -505,6 +517,7 @@ fbnic_devlink_fw_report(struct fbnic_dev *fbd, const char *format, ...) static const struct devlink_health_reporter_ops fbnic_fw_ops = { .name = "fw", .dump = fbnic_fw_reporter_dump, + .diagnose = fbnic_fw_reporter_diagnose, }; int fbnic_devlink_health_create(struct fbnic_dev *fbd) -- 2.51.0