naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/0057-devlink-Add-support-for-hot-reload.patch

36cfb7
From ceaa3a5ecffe0c558c990be6c4ba682be5ce85e8 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 25 Mar 2019 11:40:57 +0100
36cfb7
Subject: [PATCH] devlink: Add support for hot reload
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1644731
36cfb7
Upstream Status: iproute2.git commit 06dd94f952e50
36cfb7
36cfb7
commit 06dd94f952e50edeffe5ea8b7b95b5cd562b9365
36cfb7
Author: Arkadi Sharshevsky <arkadis@mellanox.com>
36cfb7
Date:   Wed Feb 14 10:55:19 2018 +0200
36cfb7
36cfb7
    devlink: Add support for hot reload
36cfb7
36cfb7
    Add support for hot reload. It should be used in order for resource
36cfb7
    updates to take place.
36cfb7
36cfb7
    Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
36cfb7
    Acked-by: Jiri Pirko <jiri@mellanox.com>
36cfb7
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
36cfb7
---
36cfb7
 devlink/devlink.c | 29 +++++++++++++++++++++++++++++
36cfb7
 1 file changed, 29 insertions(+)
36cfb7
36cfb7
diff --git a/devlink/devlink.c b/devlink/devlink.c
36cfb7
index 7f47b79450094..fc3939e564bc8 100644
36cfb7
--- a/devlink/devlink.c
36cfb7
+++ b/devlink/devlink.c
36cfb7
@@ -1163,6 +1163,7 @@ static void cmd_dev_help(void)
36cfb7
 	pr_err("                               [ inline-mode { none | link | network | transport } ]\n");
36cfb7
 	pr_err("                               [ encap { disable | enable } ]\n");
36cfb7
 	pr_err("       devlink dev eswitch show DEV\n");
36cfb7
+	pr_err("       devlink dev reload DEV\n");
36cfb7
 }
36cfb7
 
36cfb7
 static bool cmp_arr_last_handle(struct dl *dl, const char *bus_name,
36cfb7
@@ -1602,6 +1603,31 @@ static int cmd_dev_show(struct dl *dl)
36cfb7
 	return err;
36cfb7
 }
36cfb7
 
36cfb7
+static void cmd_dev_reload_help(void)
36cfb7
+{
36cfb7
+	pr_err("Usage: devlink dev reload [ DEV ]\n");
36cfb7
+}
36cfb7
+
36cfb7
+static int cmd_dev_reload(struct dl *dl)
36cfb7
+{
36cfb7
+	struct nlmsghdr *nlh;
36cfb7
+	int err;
36cfb7
+
36cfb7
+	if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
36cfb7
+		cmd_dev_reload_help();
36cfb7
+		return 0;
36cfb7
+	}
36cfb7
+
36cfb7
+	nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_RELOAD,
36cfb7
+			       NLM_F_REQUEST | NLM_F_ACK);
36cfb7
+
36cfb7
+	err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0);
36cfb7
+	if (err)
36cfb7
+		return err;
36cfb7
+
36cfb7
+	return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
36cfb7
+}
36cfb7
+
36cfb7
 static int cmd_dev(struct dl *dl)
36cfb7
 {
36cfb7
 	if (dl_argv_match(dl, "help")) {
36cfb7
@@ -1614,6 +1640,9 @@ static int cmd_dev(struct dl *dl)
36cfb7
 	} else if (dl_argv_match(dl, "eswitch")) {
36cfb7
 		dl_arg_inc(dl);
36cfb7
 		return cmd_dev_eswitch(dl);
36cfb7
+	} else if (dl_argv_match(dl, "reload")) {
36cfb7
+		dl_arg_inc(dl);
36cfb7
+		return cmd_dev_reload(dl);
36cfb7
 	}
36cfb7
 	pr_err("Command \"%s\" not found\n", dl_argv(dl));
36cfb7
 	return -ENOENT;
36cfb7
-- 
e138d9
2.21.0
36cfb7