mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
devlink: Add support for direct reporter health state update
It is possible that a reporter state will be updated due to a recover flow which is not triggered by a devlink health related operation, but as a side effect of some other operation in the system. Expose devlink health API for a direct update of a reporter status. Move devlink_health_reporter_state enum definition to devlink.h so it could be used from drivers as a parameter of devlink_health_reporter_state_update. In addition, add trace_devlink_health_reporter_state_update to provide user notification for reporter state change. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a0a21adb6a
commit
3167b27a7d
3 changed files with 62 additions and 5 deletions
|
@ -4409,11 +4409,6 @@ struct devlink_health_reporter {
|
|||
u64 last_recovery_ts;
|
||||
};
|
||||
|
||||
enum devlink_health_reporter_state {
|
||||
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY,
|
||||
DEVLINK_HEALTH_REPORTER_STATE_ERROR,
|
||||
};
|
||||
|
||||
void *
|
||||
devlink_health_reporter_priv(struct devlink_health_reporter *reporter)
|
||||
{
|
||||
|
@ -4498,6 +4493,23 @@ 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);
|
||||
|
||||
static int
|
||||
devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
|
||||
void *priv_ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue