netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver
@ 2020-01-02 15:48 Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 1/3] devlink: add support for reporter recovery completion Vikas Gupta
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Vikas Gupta @ 2020-01-02 15:48 UTC (permalink / raw)
  To: Michael Chan, David S. Miller, Jiri Pirko, netdev, linux-kernel
  Cc: vasundhara-v.volam, vikram.prakash, Vikas Gupta

Hi,
 This patchset adds following feature in devlink 
  1) Recovery complete direct call API to be used by drivers when it
     successfully completes. It is required as recovery triggered by
     devlink may return with EINPROGRESS and eventually recovery 
     completes in different context.
  2) A notification when health status is updated by reporter.

 Patchset also contains required changes in bnxt_en driver to 
 mark recovery in progress when recovery is triggered from kernel 
 devlink.


Vikas Gupta (3):
  devlink: add support for reporter recovery completion
  devlink: add devink notification when reporter update health state
  bnxt_en: Call recovery done after reset is successfully done

 drivers/net/ethernet/broadcom/bnxt/bnxt.c         |  1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 14 ++++-
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h |  1 +
 include/net/devlink.h                             |  2 +
 net/core/devlink.c                                | 62 +++++++++++++++++------
 5 files changed, 63 insertions(+), 17 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/3] devlink: add support for reporter recovery completion
  2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
@ 2020-01-02 15:48 ` Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 2/3] devlink: add devink notification when reporter update health state Vikas Gupta
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vikas Gupta @ 2020-01-02 15:48 UTC (permalink / raw)
  To: Michael Chan, David S. Miller, Jiri Pirko, netdev, linux-kernel
  Cc: vasundhara-v.volam, vikram.prakash, Vikas Gupta

It is possible that a reporter recovery completion do not finish
successfully when recovery is triggered via
devlink_health_reporter_recover as recovery could be processed in
different context. In such scenario an error is returned by driver when
recover hook is invoked and successful recovery completion is
intimated later.
Expose devlink recover done API to update recovery stats.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
---
 include/net/devlink.h |  2 ++
 net/core/devlink.c    | 11 +++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index 47f87b2..453f45c 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1000,6 +1000,8 @@ int devlink_health_report(struct devlink_health_reporter *reporter,
 void
 devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
 				     enum devlink_health_reporter_state state);
+void
+devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
 
 bool devlink_is_reload_failed(const struct devlink *devlink);
 
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 4c63c9a..e686ae6 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4860,6 +4860,14 @@ devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
 }
 EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
 
+void
+devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter)
+{
+	reporter->recovery_count++;
+	reporter->last_recovery_ts = jiffies;
+}
+EXPORT_SYMBOL_GPL(devlink_health_reporter_recovery_done);
+
 static int
 devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
 				void *priv_ctx, struct netlink_ext_ack *extack)
@@ -4876,9 +4884,8 @@ devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
 	if (err)
 		return err;
 
-	reporter->recovery_count++;
+	devlink_health_reporter_recovery_done(reporter);
 	reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY;
-	reporter->last_recovery_ts = jiffies;
 
 	return 0;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/3] devlink: add devink notification when reporter update health state
  2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 1/3] devlink: add support for reporter recovery completion Vikas Gupta
@ 2020-01-02 15:48 ` Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 3/3] bnxt_en: Call recovery done after reset is successfully done Vikas Gupta
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vikas Gupta @ 2020-01-02 15:48 UTC (permalink / raw)
  To: Michael Chan, David S. Miller, Jiri Pirko, netdev, linux-kernel
  Cc: vasundhara-v.volam, vikram.prakash, Vikas Gupta

add a devlink notification when reporter update the health
state.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
---
 net/core/devlink.c | 59 ++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 42 insertions(+), 17 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index e686ae6..d30aa47 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4844,23 +4844,6 @@ devlink_health_reporter_destroy(struct devlink_health_reporter *reporter)
 EXPORT_SYMBOL_GPL(devlink_health_reporter_destroy);
 
 void
-devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
-				     enum devlink_health_reporter_state state)
-{
-	if (WARN_ON(state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY &&
-		    state != DEVLINK_HEALTH_REPORTER_STATE_ERROR))
-		return;
-
-	if (reporter->health_state == state)
-		return;
-
-	reporter->health_state = state;
-	trace_devlink_health_reporter_state_update(reporter->devlink,
-						   reporter->ops->name, state);
-}
-EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
-
-void
 devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter)
 {
 	reporter->recovery_count++;
@@ -5097,6 +5080,48 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
 	return -EMSGSIZE;
 }
 
+static void devlink_recover_notify(struct devlink_health_reporter *reporter,
+				   enum devlink_command cmd)
+{
+	struct sk_buff *msg;
+	int err;
+
+	WARN_ON(cmd != DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (!msg)
+		return;
+
+	err = devlink_nl_health_reporter_fill(msg, reporter->devlink,
+					      reporter, cmd, 0, 0, 0);
+	if (err) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	genlmsg_multicast_netns(&devlink_nl_family,
+				devlink_net(reporter->devlink),
+				msg, 0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
+}
+
+void
+devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
+				     enum devlink_health_reporter_state state)
+{
+	if (WARN_ON(state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY &&
+		    state != DEVLINK_HEALTH_REPORTER_STATE_ERROR))
+		return;
+
+	if (reporter->health_state == state)
+		return;
+
+	reporter->health_state = state;
+	trace_devlink_health_reporter_state_update(reporter->devlink,
+						   reporter->ops->name, state);
+	devlink_recover_notify(reporter, DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
+}
+EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
+
 static int devlink_nl_cmd_health_reporter_get_doit(struct sk_buff *skb,
 						   struct genl_info *info)
 {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 3/3] bnxt_en: Call recovery done after reset is successfully done
  2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 1/3] devlink: add support for reporter recovery completion Vikas Gupta
  2020-01-02 15:48 ` [PATCH v1 2/3] devlink: add devink notification when reporter update health state Vikas Gupta
@ 2020-01-02 15:48 ` Vikas Gupta
  2020-01-05 22:07 ` [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver David Miller
  2020-01-08 23:48 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Vikas Gupta @ 2020-01-02 15:48 UTC (permalink / raw)
  To: Michael Chan, David S. Miller, Jiri Pirko, netdev, linux-kernel
  Cc: vasundhara-v.volam, vikram.prakash, Vikas Gupta

Return EINPROGRESS to devlink health reporter recover as we are not yet
done and call devlink_health_reporter_recovery_done once reset is
successfully completed from workqueue context.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c         |  1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 14 ++++++++++++--
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7b0fe19..39d4309 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10822,6 +10822,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_recovery_done(bp);
 		bnxt_dl_health_status_update(bp, true);
 		rtnl_unlock();
 		break;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index 3eedd44..0c3d224 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -89,7 +89,7 @@ static int bnxt_fw_reset_recover(struct devlink_health_reporter *reporter,
 		return -EOPNOTSUPP;
 
 	bnxt_fw_reset(bp);
-	return 0;
+	return -EINPROGRESS;
 }
 
 static const
@@ -116,7 +116,7 @@ static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
 	else if (event == BNXT_FW_EXCEPTION_SP_EVENT)
 		bnxt_fw_exception(bp);
 
-	return 0;
+	return -EINPROGRESS;
 }
 
 static const
@@ -262,6 +262,16 @@ void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy)
 	health->fatal = false;
 }
 
+void bnxt_dl_health_recovery_done(struct bnxt *bp)
+{
+	struct bnxt_fw_health *hlth = bp->fw_health;
+
+	if (hlth->fatal)
+		devlink_health_reporter_recovery_done(hlth->fw_fatal_reporter);
+	else
+		devlink_health_reporter_recovery_done(hlth->fw_reset_reporter);
+}
+
 static const struct devlink_ops bnxt_dl_ops = {
 #ifdef CONFIG_BNXT_SRIOV
 	.eswitch_mode_set = bnxt_dl_eswitch_mode_set,
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
index 6db6c3d..08aaa44 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
@@ -58,6 +58,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);
+void bnxt_dl_health_recovery_done(struct bnxt *bp);
 void bnxt_dl_fw_reporters_create(struct bnxt *bp);
 void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all);
 int bnxt_dl_register(struct bnxt *bp);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver
  2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
                   ` (2 preceding siblings ...)
  2020-01-02 15:48 ` [PATCH v1 3/3] bnxt_en: Call recovery done after reset is successfully done Vikas Gupta
@ 2020-01-05 22:07 ` David Miller
  2020-01-08 23:48 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-01-05 22:07 UTC (permalink / raw)
  To: vikas.gupta
  Cc: michael.chan, jiri, netdev, linux-kernel, vasundhara-v.volam,
	vikram.prakash

From: Vikas Gupta <vikas.gupta@broadcom.com>
Date: Thu,  2 Jan 2020 21:18:08 +0530

> Hi,
>  This patchset adds following feature in devlink 
>   1) Recovery complete direct call API to be used by drivers when it
>      successfully completes. It is required as recovery triggered by
>      devlink may return with EINPROGRESS and eventually recovery 
>      completes in different context.
>   2) A notification when health status is updated by reporter.
> 
>  Patchset also contains required changes in bnxt_en driver to 
>  mark recovery in progress when recovery is triggered from kernel 
>  devlink.

Jiri et al., please review this.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver
  2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
                   ` (3 preceding siblings ...)
  2020-01-05 22:07 ` [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver David Miller
@ 2020-01-08 23:48 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-01-08 23:48 UTC (permalink / raw)
  To: vikas.gupta
  Cc: michael.chan, jiri, netdev, linux-kernel, vasundhara-v.volam,
	vikram.prakash

From: Vikas Gupta <vikas.gupta@broadcom.com>
Date: Thu,  2 Jan 2020 21:18:08 +0530

>  This patchset adds following feature in devlink 
>   1) Recovery complete direct call API to be used by drivers when it
>      successfully completes. It is required as recovery triggered by
>      devlink may return with EINPROGRESS and eventually recovery 
>      completes in different context.
>   2) A notification when health status is updated by reporter.
> 
>  Patchset also contains required changes in bnxt_en driver to 
>  mark recovery in progress when recovery is triggered from kernel 
>  devlink.

Series applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-08 23:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 15:48 [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver Vikas Gupta
2020-01-02 15:48 ` [PATCH v1 1/3] devlink: add support for reporter recovery completion Vikas Gupta
2020-01-02 15:48 ` [PATCH v1 2/3] devlink: add devink notification when reporter update health state Vikas Gupta
2020-01-02 15:48 ` [PATCH v1 3/3] bnxt_en: Call recovery done after reset is successfully done Vikas Gupta
2020-01-05 22:07 ` [PATCH INTERNAL v1 0/3] Devlink notification after recovery complete by bnxt_en driver David Miller
2020-01-08 23:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).