64 lines
2.0 KiB
Diff
64 lines
2.0 KiB
Diff
From 349c43f99f876e0663fb0b00396ac3d387bc32e9 Mon Sep 17 00:00:00 2001
|
|
From: Andrea Claudi <aclaudi@redhat.com>
|
|
Date: Mon, 10 Jun 2019 15:32:55 +0200
|
|
Subject: [PATCH] rdma: Introduce command execution helper with required device
|
|
name
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1663228
|
|
Upstream Status: iproute2.git commit a14ceed32524c
|
|
|
|
commit a14ceed32524c7f9c05572886cd63e921e4c0faf
|
|
Author: Leon Romanovsky <leonro@mellanox.com>
|
|
Date: Wed Oct 31 09:17:56 2018 +0200
|
|
|
|
rdma: Introduce command execution helper with required device name
|
|
|
|
In contradiction to various show commands, the set command explicitly
|
|
requires to use device name as an argument. Provide new command
|
|
execution helper which enforces it.
|
|
|
|
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
|
|
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
|
|
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
---
|
|
rdma/rdma.h | 1 +
|
|
rdma/utils.c | 10 ++++++++++
|
|
2 files changed, 11 insertions(+)
|
|
|
|
diff --git a/rdma/rdma.h b/rdma/rdma.h
|
|
index c3b7530b6cc71..547bb5749a39f 100644
|
|
--- a/rdma/rdma.h
|
|
+++ b/rdma/rdma.h
|
|
@@ -90,6 +90,7 @@ int cmd_link(struct rd *rd);
|
|
int cmd_res(struct rd *rd);
|
|
int rd_exec_cmd(struct rd *rd, const struct rd_cmd *c, const char *str);
|
|
int rd_exec_dev(struct rd *rd, int (*cb)(struct rd *rd));
|
|
+int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd));
|
|
int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port);
|
|
void rd_free(struct rd *rd);
|
|
int rd_set_arg_to_devname(struct rd *rd);
|
|
diff --git a/rdma/utils.c b/rdma/utils.c
|
|
index 4840bf226d54d..61f4aeb1bcf27 100644
|
|
--- a/rdma/utils.c
|
|
+++ b/rdma/utils.c
|
|
@@ -577,6 +577,16 @@ out:
|
|
return ret;
|
|
}
|
|
|
|
+int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd))
|
|
+{
|
|
+ if (rd_no_arg(rd)) {
|
|
+ pr_err("Please provide device name.\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ return rd_exec_dev(rd, cb);
|
|
+}
|
|
+
|
|
int rd_exec_cmd(struct rd *rd, const struct rd_cmd *cmds, const char *str)
|
|
{
|
|
const struct rd_cmd *c;
|
|
--
|
|
2.20.1
|
|
|