]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bnxt_en: consolidate fw devlink health reporters
authorEdwin Peer <edwin.peer@broadcom.com>
Fri, 29 Oct 2021 07:47:45 +0000 (03:47 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Oct 2021 11:13:05 +0000 (12:13 +0100)
Merge 'fw' and 'fw_fatal' health reporters.  There is no longer a need
to distinguish between firmware reporters. Only bonafide errors are
reported now and no reports were being generated for the 'fw' reporter.

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

index e640df62d2963db91177a5cc47ee53a675ab17c0..2873f600a7dd2708956f84b75311ad16ec381cce 100644 (file)
@@ -1551,7 +1551,6 @@ struct bnxt_fw_health {
        u32 echo_req_data1;
        u32 echo_req_data2;
        struct devlink_health_reporter  *fw_reporter;
-       struct devlink_health_reporter *fw_fatal_reporter;
 };
 
 #define BNXT_FW_HEALTH_REG_TYPE_MASK   3
index 2c72f3b3708f98dcaae61a4f6efb695b6aa9e3ee..a295d2042b6ed2648e5c48ca7e962cdf5209245e 100644 (file)
@@ -71,9 +71,9 @@ static int bnxt_hwrm_remote_dev_reset_set(struct bnxt *bp, bool remote_reset)
        return hwrm_req_send(bp, req);
 }
 
-static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
-                                    struct devlink_fmsg *fmsg,
-                                    struct netlink_ext_ack *extack)
+static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter,
+                           struct devlink_fmsg *fmsg,
+                           struct netlink_ext_ack *extack)
 {
        struct bnxt *bp = devlink_health_reporter_priv(reporter);
        u32 val;
@@ -110,14 +110,9 @@ static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
        return 0;
 }
 
-static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
-       .name = "fw",
-       .diagnose = bnxt_fw_reporter_diagnose,
-};
-
-static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
-                                void *priv_ctx,
-                                struct netlink_ext_ack *extack)
+static int bnxt_fw_recover(struct devlink_health_reporter *reporter,
+                          void *priv_ctx,
+                          struct netlink_ext_ack *extack)
 {
        struct bnxt *bp = devlink_health_reporter_priv(reporter);
 
@@ -127,43 +122,26 @@ static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
        return -EINPROGRESS;
 }
 
-static const
-struct devlink_health_reporter_ops bnxt_dl_fw_fatal_reporter_ops = {
-       .name = "fw_fatal",
-       .recover = bnxt_fw_fatal_recover,
+static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
+       .name = "fw",
+       .diagnose = bnxt_fw_diagnose,
+       .recover = bnxt_fw_recover,
 };
 
 void bnxt_dl_fw_reporters_create(struct bnxt *bp)
 {
        struct bnxt_fw_health *health = bp->fw_health;
 
-       if (!health)
+       if (!health || health->fw_reporter)
                return;
 
-       if (!health->fw_reporter) {
-               health->fw_reporter =
-                       devlink_health_reporter_create(bp->dl,
-                                                      &bnxt_dl_fw_reporter_ops,
-                                                      0, bp);
-               if (IS_ERR(health->fw_reporter)) {
-                       netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
-                                   PTR_ERR(health->fw_reporter));
-                       health->fw_reporter = NULL;
-                       return;
-               }
-       }
-
-       if (health->fw_fatal_reporter)
-               return;
-
-       health->fw_fatal_reporter =
-               devlink_health_reporter_create(bp->dl,
-                                              &bnxt_dl_fw_fatal_reporter_ops,
+       health->fw_reporter =
+               devlink_health_reporter_create(bp->dl, &bnxt_dl_fw_reporter_ops,
                                               0, bp);
-       if (IS_ERR(health->fw_fatal_reporter)) {
-               netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n",
-                           PTR_ERR(health->fw_fatal_reporter));
-               health->fw_fatal_reporter = NULL;
+       if (IS_ERR(health->fw_reporter)) {
+               netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
+                           PTR_ERR(health->fw_reporter));
+               health->fw_reporter = NULL;
                bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
        }
 }
@@ -182,11 +160,6 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all)
                devlink_health_reporter_destroy(health->fw_reporter);
                health->fw_reporter = NULL;
        }
-
-       if (health->fw_fatal_reporter) {
-               devlink_health_reporter_destroy(health->fw_fatal_reporter);
-               health->fw_fatal_reporter = NULL;
-       }
 }
 
 void bnxt_devlink_health_fw_report(struct bnxt *bp)
@@ -196,13 +169,12 @@ void bnxt_devlink_health_fw_report(struct bnxt *bp)
        if (!fw_health)
                return;
 
-       if (!fw_health->fw_fatal_reporter) {
+       if (!fw_health->fw_reporter) {
                __bnxt_fw_recover(bp);
                return;
        }
 
-       devlink_health_report(fw_health->fw_fatal_reporter,
-                             "FW fatal error reported", NULL);
+       devlink_health_report(fw_health->fw_reporter, "FW error reported", NULL);
 }
 
 void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy)
@@ -215,15 +187,14 @@ void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy)
        else
                state = DEVLINK_HEALTH_REPORTER_STATE_ERROR;
 
-       devlink_health_reporter_state_update(health->fw_fatal_reporter, state);
+       devlink_health_reporter_state_update(health->fw_reporter, state);
 }
 
 void bnxt_dl_health_fw_recovery_done(struct bnxt *bp)
 {
-       struct bnxt_fw_health *hlth = bp->fw_health;
        struct bnxt_dl *dl = devlink_priv(bp->dl);
 
-       devlink_health_reporter_recovery_done(hlth->fw_fatal_reporter);
+       devlink_health_reporter_recovery_done(bp->fw_health->fw_reporter);
        bnxt_hwrm_remote_dev_reset_set(bp, dl->remote_reset);
 }