From: Leon Romanovsky <leon@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
netdev <netdev@vger.kernel.org>, Mark Zhang <markz@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next 5/8] rdma: Make get_port_from_argv() returns valid port in strict port mode
Date: Wed, 10 Apr 2019 14:21:18 +0300 [thread overview]
Message-ID: <20190410112121.6790-6-leon@kernel.org> (raw)
In-Reply-To: <20190410112121.6790-1-leon@kernel.org>
From: Mark Zhang <markz@mellanox.com>
When strict_port is set, make get_port_from_argv() returns failure if
no valid port is specified.
Signed-off-by: Mark Zhang <markz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/utils.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/rdma/utils.c b/rdma/utils.c
index 1fda2879..8dc06fc6 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -56,7 +56,7 @@ bool rd_no_arg(struct rd *rd)
* mlx5_1/1 | 1 | false
* mlx5_1/- | 0 | false
*
- * In strict mode, /- will return error.
+ * In strict port mode, a non-0 port must be provided
*/
static int get_port_from_argv(struct rd *rd, uint32_t *port,
bool *is_dump_all, bool strict_port)
@@ -64,7 +64,7 @@ static int get_port_from_argv(struct rd *rd, uint32_t *port,
char *slash;
*port = 0;
- *is_dump_all = true;
+ *is_dump_all = strict_port ? false : true;
slash = strchr(rd_argv(rd), '/');
/* if no port found, return 0 */
@@ -83,6 +83,9 @@ static int get_port_from_argv(struct rd *rd, uint32_t *port,
if (!*port && strlen(slash))
return -EINVAL;
}
+ if (strict_port && (*port == 0))
+ return -EINVAL;
+
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-04-10 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 11:21 [PATCH iproute2-next 0/8] Statistics counter support Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 1/8] rdma: Update uapi headers to add statistic " Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 2/8] rdma: Add "stat qp show" support Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 3/8] rdma: Add get per-port counter mode support Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 4/8] rdma: Add rdma statistic counter per-port auto " Leon Romanovsky
2019-04-10 11:21 ` Leon Romanovsky [this message]
2019-04-10 11:21 ` [PATCH iproute2-next 6/8] rdma: Add stat manual " Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 7/8] rdma: Add default counter show support Leon Romanovsky
2019-04-10 11:21 ` [PATCH iproute2-next 8/8] rdma: Document counter statistic Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190410112121.6790-6-leon@kernel.org \
--to=leon@kernel.org \
--cc=dsahern@gmail.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=markz@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).