You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
5.4 KiB
154 lines
5.4 KiB
From dd8e8f16e4fa95d701b184f9e8b93bd3f0177cb8 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Toppins <jtoppins@redhat.com>
|
|
Date: Wed, 2 Oct 2019 18:23:29 -0400
|
|
Subject: [PATCH 74/96] [netdrv] bnxt_en: Add devlink health reset reporter
|
|
|
|
Message-id: <4524cb0b03008ec82cf84ba49c1d62dc2c7e029a.1570027456.git.jtoppins@redhat.com>
|
|
Patchwork-id: 276496
|
|
O-Subject: [RHEL-8.2 PATCH 67/78] bnxt_en: Add devlink health reset reporter.
|
|
Bugzilla: 1724766
|
|
RH-Acked-by: John Linville <linville@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
Add devlink health reporter for the firmware reset event. Once we get
|
|
the notification from firmware about the impending reset, the driver
|
|
will report this to devlink and the call to bnxt_fw_reset() will be
|
|
initiated to complete the reset sequence.
|
|
|
|
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>
|
|
(cherry picked from commit 657a33c8a0a2342e91259b28356838dc89216b19)
|
|
Bugzilla: 1724766
|
|
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23809532
|
|
Tested: build, boot, basic ping
|
|
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
|
|
---
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 5 +++
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 52 +++++++++++++++++++++++
|
|
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 1 +
|
|
4 files changed, 61 insertions(+)
|
|
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2020-02-06 16:23:20.162472286 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2020-02-06 16:23:20.307470956 +0100
|
|
@@ -10172,6 +10172,9 @@
|
|
if (test_and_clear_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event))
|
|
bnxt_reset(bp, true);
|
|
|
|
+ if (test_and_clear_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event))
|
|
+ bnxt_devlink_health_report(bp, BNXT_FW_RESET_NOTIFY_SP_EVENT);
|
|
+
|
|
smp_mb__before_atomic();
|
|
clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
|
|
}
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.h
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.h 2020-02-06 16:23:20.163472277 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.h 2020-02-06 16:23:20.307470956 +0100
|
|
@@ -1371,6 +1371,11 @@
|
|
u32 fw_reset_seq_vals[16];
|
|
u32 fw_reset_seq_delay_msec[16];
|
|
struct devlink_health_reporter *fw_reporter;
|
|
+ struct devlink_health_reporter *fw_reset_reporter;
|
|
+};
|
|
+
|
|
+struct bnxt_fw_reporter_ctx {
|
|
+ unsigned long sp_event;
|
|
};
|
|
|
|
#define BNXT_FW_HEALTH_REG_TYPE_MASK 3
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c 2020-02-06 16:23:19.896474728 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c 2020-02-06 16:23:20.308470946 +0100
|
|
@@ -65,6 +65,24 @@
|
|
.diagnose = bnxt_fw_reporter_diagnose,
|
|
};
|
|
|
|
+static int bnxt_fw_reset_recover(struct devlink_health_reporter *reporter,
|
|
+ void *priv_ctx)
|
|
+{
|
|
+ struct bnxt *bp = devlink_health_reporter_priv(reporter);
|
|
+
|
|
+ if (!priv_ctx)
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
+ bnxt_fw_reset(bp);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static const
|
|
+struct devlink_health_reporter_ops bnxt_dl_fw_reset_reporter_ops = {
|
|
+ .name = "fw_reset",
|
|
+ .recover = bnxt_fw_reset_recover,
|
|
+};
|
|
+
|
|
static void bnxt_dl_fw_reporters_create(struct bnxt *bp)
|
|
{
|
|
struct bnxt_fw_health *health = bp->fw_health;
|
|
@@ -80,6 +98,16 @@
|
|
PTR_ERR(health->fw_reporter));
|
|
health->fw_reporter = NULL;
|
|
}
|
|
+
|
|
+ health->fw_reset_reporter =
|
|
+ devlink_health_reporter_create(bp->dl,
|
|
+ &bnxt_dl_fw_reset_reporter_ops,
|
|
+ 0, true, bp);
|
|
+ if (IS_ERR(health->fw_reset_reporter)) {
|
|
+ netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n",
|
|
+ PTR_ERR(health->fw_reset_reporter));
|
|
+ health->fw_reset_reporter = NULL;
|
|
+ }
|
|
}
|
|
|
|
static void bnxt_dl_fw_reporters_destroy(struct bnxt *bp)
|
|
@@ -91,6 +119,30 @@
|
|
|
|
if (health->fw_reporter)
|
|
devlink_health_reporter_destroy(health->fw_reporter);
|
|
+
|
|
+ if (health->fw_reset_reporter)
|
|
+ devlink_health_reporter_destroy(health->fw_reset_reporter);
|
|
+}
|
|
+
|
|
+void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event)
|
|
+{
|
|
+ struct bnxt_fw_health *fw_health = bp->fw_health;
|
|
+ struct bnxt_fw_reporter_ctx fw_reporter_ctx;
|
|
+
|
|
+ if (!fw_health)
|
|
+ return;
|
|
+
|
|
+ fw_reporter_ctx.sp_event = event;
|
|
+ switch (event) {
|
|
+ case BNXT_FW_RESET_NOTIFY_SP_EVENT:
|
|
+ if (!fw_health->fw_reset_reporter)
|
|
+ return;
|
|
+
|
|
+ devlink_health_report(fw_health->fw_reset_reporter,
|
|
+ "FW non-fatal reset event received",
|
|
+ &fw_reporter_ctx);
|
|
+ return;
|
|
+ }
|
|
}
|
|
|
|
static const struct devlink_ops bnxt_dl_ops = {
|
|
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
|
|
===================================================================
|
|
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h 2020-02-06 16:23:11.278553834 +0100
|
|
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h 2020-02-06 16:23:20.308470946 +0100
|
|
@@ -55,6 +55,7 @@
|
|
u16 num_bits;
|
|
};
|
|
|
|
+void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
|
|
int bnxt_dl_register(struct bnxt *bp);
|
|
void bnxt_dl_unregister(struct bnxt *bp);
|
|
|