From: Vikas Gupta <[email protected]>
Add a devlink notification for reporter recovery
Signed-off-by: Vikas Gupta <[email protected]>
Signed-off-by: Sheetal Tigadoli <[email protected]>
---
net/core/devlink.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index e48680e..42909fb 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4730,6 +4730,28 @@ struct devlink_health_reporter *
}
EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
+static void __devlink_recover_notify(struct devlink *devlink,
+ 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_fill(msg, devlink, cmd, 0, 0, 0);
+ if (err) {
+ nlmsg_free(msg);
+ return;
+ }
+
+ genlmsg_multicast_netns(&devlink_nl_family, devlink_net(devlink),
+ msg, 0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
+}
+
static int
devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
void *priv_ctx)
@@ -4747,6 +4769,9 @@ struct devlink_health_reporter *
reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY;
reporter->last_recovery_ts = jiffies;
+ __devlink_recover_notify(reporter->devlink,
+ DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
+
return 0;
}
--
1.9.1
Wed, Sep 18, 2019 at 08:52:21PM CEST, [email protected] wrote:
>From: Vikas Gupta <[email protected]>
>
>Add a devlink notification for reporter recovery
>
>Signed-off-by: Vikas Gupta <[email protected]>
>Signed-off-by: Sheetal Tigadoli <[email protected]>
>---
> net/core/devlink.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
>diff --git a/net/core/devlink.c b/net/core/devlink.c
>index e48680e..42909fb 100644
>--- a/net/core/devlink.c
>+++ b/net/core/devlink.c
>@@ -4730,6 +4730,28 @@ struct devlink_health_reporter *
> }
> EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
>
>+static void __devlink_recover_notify(struct devlink *devlink,
>+ 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_fill(msg, devlink, cmd, 0, 0, 0);
>+ if (err) {
>+ nlmsg_free(msg);
>+ return;
>+ }
>+
>+ genlmsg_multicast_netns(&devlink_nl_family, devlink_net(devlink),
>+ msg, 0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
>+}
>+
> static int
> devlink_health_reporter_recover(struct devlink_health_reporter *reporter,
> void *priv_ctx)
>@@ -4747,6 +4769,9 @@ struct devlink_health_reporter *
> reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY;
> reporter->last_recovery_ts = jiffies;
>
>+ __devlink_recover_notify(reporter->devlink,
>+ DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
>+
> return 0;
> }
To follow the rest of the code The notification should be done upon
any reported change, using devlink_nl_health_reporter_fill() to prepare
the message.
Also, this is net-next patch net-next is closed now.
>