[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1518598522-27713-5-git-send-email-arkadis@mellanox.com>
Date: Wed, 14 Feb 2018 10:55:19 +0200
From: Arkadi Sharshevsky <arkadis@...lanox.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, stephen@...workplumber.org,
dsa@...ulusnetworks.com, mlxsw@...lanox.com,
Arkadi Sharshevsky <arkadis@...lanox.com>
Subject: [PATCH iproute2 4/7] devlink: Add support for hot reload
Add support for hot reload. It should be used in order for resource
updates to take place.
Signed-off-by: Arkadi Sharshevsky <arkadis@...lanox.com>
Acked-by: Jiri Pirko <jiri@...lanox.com>
---
devlink/devlink.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 4c392a7..21835d9 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1179,6 +1179,7 @@ static void cmd_dev_help(void)
pr_err(" [ inline-mode { none | link | network | transport } ]\n");
pr_err(" [ encap { disable | enable } ]\n");
pr_err(" devlink dev eswitch show DEV\n");
+ pr_err(" devlink dev reload DEV\n");
}
static bool cmp_arr_last_handle(struct dl *dl, const char *bus_name,
@@ -1620,6 +1621,31 @@ static int cmd_dev_show(struct dl *dl)
return err;
}
+static void cmd_dev_reload_help(void)
+{
+ pr_err("Usage: devlink dev reload [ DEV ]\n");
+}
+
+static int cmd_dev_reload(struct dl *dl)
+{
+ struct nlmsghdr *nlh;
+ int err;
+
+ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
+ cmd_dev_reload_help();
+ return 0;
+ }
+
+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_RELOAD,
+ NLM_F_REQUEST | NLM_F_ACK);
+
+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0);
+ if (err)
+ return err;
+
+ return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
+}
+
static int cmd_dev(struct dl *dl)
{
if (dl_argv_match(dl, "help")) {
@@ -1632,6 +1658,9 @@ static int cmd_dev(struct dl *dl)
} else if (dl_argv_match(dl, "eswitch")) {
dl_arg_inc(dl);
return cmd_dev_eswitch(dl);
+ } else if (dl_argv_match(dl, "reload")) {
+ dl_arg_inc(dl);
+ return cmd_dev_reload(dl);
}
pr_err("Command \"%s\" not found\n", dl_argv(dl));
return -ENOENT;
--
2.4.11
Powered by blists - more mailing lists