bnxt_en: Report health status update after reset is done
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Mon, 18 Nov 2019 08:56:40 +0000 (03:56 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Nov 2019 01:13:28 +0000 (17:13 -0800)
Report health status update to devlink health reporter, once
reset is completed.

Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@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.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h

index 178490cb4158973f800f8998f60f74335ae09626..a1683249e36064b3ed2a6215c5bce68f80c0d304 100644 (file)
@@ -10750,6 +10750,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                smp_mb__before_atomic();
                clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
                bnxt_ulp_start(bp, rc);
+               bnxt_dl_health_status_update(bp, true);
                rtnl_unlock();
                break;
        }
@@ -10757,6 +10758,8 @@ static void bnxt_fw_reset_task(struct work_struct *work)
 
 fw_reset_abort:
        clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
+       if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
+               bnxt_dl_health_status_update(bp, false);
        bp->fw_reset_state = 0;
        rtnl_lock();
        dev_close(bp->dev);
index 271085f7e4810fcff124c6bc43a04b0f43cfb9d7..37549cac3de67af570375ef9a3f95bb9f2a368ea 100644 (file)
@@ -1384,6 +1384,7 @@ struct bnxt_fw_health {
        u32 last_fw_reset_cnt;
        u8 enabled:1;
        u8 master:1;
+       u8 fatal:1;
        u8 tmr_multiplier;
        u8 tmr_counter;
        u8 fw_reset_seq_cnt;
index ae4ddf33fe5cb086a141540c9352998bdf1b0e87..d85e439e94904e062054858c99328589e5f6482d 100644 (file)
@@ -91,6 +91,7 @@ static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
        if (!priv_ctx)
                return -EOPNOTSUPP;
 
+       bp->fw_health->fatal = true;
        event = fw_reporter_ctx->sp_event;
        if (event == BNXT_FW_RESET_NOTIFY_SP_EVENT)
                bnxt_fw_reset(bp);
@@ -199,6 +200,26 @@ void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event)
        }
 }
 
+void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy)
+{
+       struct bnxt_fw_health *health = bp->fw_health;
+       u8 state;
+
+       if (healthy)
+               state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY;
+       else
+               state = DEVLINK_HEALTH_REPORTER_STATE_ERROR;
+
+       if (health->fatal)
+               devlink_health_reporter_state_update(health->fw_fatal_reporter,
+                                                    state);
+       else
+               devlink_health_reporter_state_update(health->fw_reset_reporter,
+                                                    state);
+
+       health->fatal = false;
+}
+
 static const struct devlink_ops bnxt_dl_ops = {
 #ifdef CONFIG_BNXT_SRIOV
        .eswitch_mode_set = bnxt_dl_eswitch_mode_set,
index 2f4fd0a7d04bfae168cc9aefc6e0faac0eacd7e4..665d4bdcd8c0269421003dd7ee66bc167d586017 100644 (file)
@@ -57,6 +57,7 @@ struct bnxt_dl_nvm_param {
 };
 
 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
+void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy);
 int bnxt_dl_register(struct bnxt *bp);
 void bnxt_dl_unregister(struct bnxt *bp);