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