Commit 074e1b42 authored by Przemek Kitszel's avatar Przemek Kitszel Committed by David S. Miller

bnxt_en: devlink health: use retained error fmsg API

Drop unneeded error checking.

devlink_fmsg_*() family of functions is now retaining errors,
so there is no need to check for them after each call.
Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47957bb3
...@@ -104,20 +104,21 @@ static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter, ...@@ -104,20 +104,21 @@ static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter,
struct bnxt *bp = devlink_health_reporter_priv(reporter); struct bnxt *bp = devlink_health_reporter_priv(reporter);
struct bnxt_fw_health *h = bp->fw_health; struct bnxt_fw_health *h = bp->fw_health;
u32 fw_status, fw_resets; u32 fw_status, fw_resets;
int rc;
if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
return devlink_fmsg_string_pair_put(fmsg, "Status", "recovering"); devlink_fmsg_string_pair_put(fmsg, "Status", "recovering");
return 0;
}
if (!h->status_reliable) if (!h->status_reliable) {
return devlink_fmsg_string_pair_put(fmsg, "Status", "unknown"); devlink_fmsg_string_pair_put(fmsg, "Status", "unknown");
return 0;
}
mutex_lock(&h->lock); mutex_lock(&h->lock);
fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG); fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
if (BNXT_FW_IS_BOOTING(fw_status)) { if (BNXT_FW_IS_BOOTING(fw_status)) {
rc = devlink_fmsg_string_pair_put(fmsg, "Status", "initializing"); devlink_fmsg_string_pair_put(fmsg, "Status", "initializing");
if (rc)
goto unlock;
} else if (h->severity || fw_status != BNXT_FW_STATUS_HEALTHY) { } else if (h->severity || fw_status != BNXT_FW_STATUS_HEALTHY) {
if (!h->severity) { if (!h->severity) {
h->severity = SEVERITY_FATAL; h->severity = SEVERITY_FATAL;
...@@ -126,58 +127,35 @@ static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter, ...@@ -126,58 +127,35 @@ static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter,
devlink_health_report(h->fw_reporter, devlink_health_report(h->fw_reporter,
"FW error diagnosed", h); "FW error diagnosed", h);
} }
rc = devlink_fmsg_string_pair_put(fmsg, "Status", "error"); devlink_fmsg_string_pair_put(fmsg, "Status", "error");
if (rc) devlink_fmsg_u32_pair_put(fmsg, "Syndrome", fw_status);
goto unlock;
rc = devlink_fmsg_u32_pair_put(fmsg, "Syndrome", fw_status);
if (rc)
goto unlock;
} else { } else {
rc = devlink_fmsg_string_pair_put(fmsg, "Status", "healthy"); devlink_fmsg_string_pair_put(fmsg, "Status", "healthy");
if (rc)
goto unlock;
} }
rc = devlink_fmsg_string_pair_put(fmsg, "Severity", devlink_fmsg_string_pair_put(fmsg, "Severity",
bnxt_health_severity_str(h->severity)); bnxt_health_severity_str(h->severity));
if (rc)
goto unlock;
if (h->severity) { if (h->severity) {
rc = devlink_fmsg_string_pair_put(fmsg, "Remedy", devlink_fmsg_string_pair_put(fmsg, "Remedy",
bnxt_health_remedy_str(h->remedy)); bnxt_health_remedy_str(h->remedy));
if (rc) if (h->remedy == REMEDY_DEVLINK_RECOVER)
goto unlock; devlink_fmsg_string_pair_put(fmsg, "Impact",
if (h->remedy == REMEDY_DEVLINK_RECOVER) {
rc = devlink_fmsg_string_pair_put(fmsg, "Impact",
"traffic+ntuple_cfg"); "traffic+ntuple_cfg");
if (rc)
goto unlock;
}
} }
unlock:
mutex_unlock(&h->lock); mutex_unlock(&h->lock);
if (rc || !h->resets_reliable) if (!h->resets_reliable)
return rc; return 0;
fw_resets = bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG); fw_resets = bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG);
rc = devlink_fmsg_u32_pair_put(fmsg, "Resets", fw_resets); devlink_fmsg_u32_pair_put(fmsg, "Resets", fw_resets);
if (rc) devlink_fmsg_u32_pair_put(fmsg, "Arrests", h->arrests);
return rc; devlink_fmsg_u32_pair_put(fmsg, "Survivals", h->survivals);
rc = devlink_fmsg_u32_pair_put(fmsg, "Arrests", h->arrests); devlink_fmsg_u32_pair_put(fmsg, "Discoveries", h->discoveries);
if (rc) devlink_fmsg_u32_pair_put(fmsg, "Fatalities", h->fatalities);
return rc; devlink_fmsg_u32_pair_put(fmsg, "Diagnoses", h->diagnoses);
rc = devlink_fmsg_u32_pair_put(fmsg, "Survivals", h->survivals); return 0;
if (rc)
return rc;
rc = devlink_fmsg_u32_pair_put(fmsg, "Discoveries", h->discoveries);
if (rc)
return rc;
rc = devlink_fmsg_u32_pair_put(fmsg, "Fatalities", h->fatalities);
if (rc)
return rc;
return devlink_fmsg_u32_pair_put(fmsg, "Diagnoses", h->diagnoses);
} }
static int bnxt_fw_dump(struct devlink_health_reporter *reporter, static int bnxt_fw_dump(struct devlink_health_reporter *reporter,
...@@ -203,19 +181,12 @@ static int bnxt_fw_dump(struct devlink_health_reporter *reporter, ...@@ -203,19 +181,12 @@ static int bnxt_fw_dump(struct devlink_health_reporter *reporter,
rc = bnxt_get_coredump(bp, BNXT_DUMP_LIVE, data, &dump_len); rc = bnxt_get_coredump(bp, BNXT_DUMP_LIVE, data, &dump_len);
if (!rc) { if (!rc) {
rc = devlink_fmsg_pair_nest_start(fmsg, "core"); devlink_fmsg_pair_nest_start(fmsg, "core");
if (rc) devlink_fmsg_binary_pair_put(fmsg, "data", data, dump_len);
goto exit; devlink_fmsg_u32_pair_put(fmsg, "size", dump_len);
rc = devlink_fmsg_binary_pair_put(fmsg, "data", data, dump_len); devlink_fmsg_pair_nest_end(fmsg);
if (rc)
goto exit;
rc = devlink_fmsg_u32_pair_put(fmsg, "size", dump_len);
if (rc)
goto exit;
rc = devlink_fmsg_pair_nest_end(fmsg);
} }
exit:
vfree(data); vfree(data);
return rc; return rc;
} }
......
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