Skip to content

Commit 6181e5c

Browse files
vikasbrcmdavem330
authored andcommitted
devlink: add support for reporter recovery completion
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6ea0032 commit 6181e5c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

include/net/devlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,8 @@ int devlink_health_report(struct devlink_health_reporter *reporter,
10001000
void
10011001
devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
10021002
enum devlink_health_reporter_state state);
1003+
void
1004+
devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
10031005

10041006
bool devlink_is_reload_failed(const struct devlink *devlink);
10051007

net/core/devlink.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4860,6 +4860,14 @@ devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
48604860
}
48614861
EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
48624862

4863+
void
4864+
devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter)
4865+
{
4866+
reporter->recovery_count++;
4867+
reporter->last_recovery_ts = jiffies;
4868+
}
4869+
EXPORT_SYMBOL_GPL(devlink_health_reporter_recovery_done);
4870+
48634871
static int
48644872
devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
48654873
void *priv_ctx, struct netlink_ext_ack *extack)
@@ -4876,9 +4884,8 @@ devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
48764884
if (err)
48774885
return err;
48784886

4879-
reporter->recovery_count++;
4887+
devlink_health_reporter_recovery_done(reporter);
48804888
reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY;
4881-
reporter->last_recovery_ts = jiffies;
48824889

48834890
return 0;
48844891
}

0 commit comments

Comments
 (0)