From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
David Ahern <dsahern-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: RDMA mailing list
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Stephen Hemminger
<stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>,
Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH iproute2-next v1 4/9] rdma: Set pointer to device name position
Date: Thu, 4 Jan 2018 09:01:45 +0200 [thread overview]
Message-ID: <20180104070150.15625-5-leon@kernel.org> (raw)
In-Reply-To: <20180104070150.15625-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
The dev and link execution callbacks expects that next
command line argument is device or port name.
Set pointer to device or port name position prior calls to
rd_exec_dev()/rd_exec_link().
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
rdma/rdma.h | 1 +
rdma/utils.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/rdma/rdma.h b/rdma/rdma.h
index cd415670..e842d076 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -81,6 +81,7 @@ 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_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);
int rd_argc(struct rd *rd);
/*
diff --git a/rdma/utils.c b/rdma/utils.c
index 446c23da..73f0d04e 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -403,6 +403,25 @@ void rd_free(struct rd *rd)
filters_cleanup(rd);
}
+int rd_set_arg_to_devname(struct rd *rd)
+{
+ int ret = 0;
+
+ while (!rd_no_arg(rd)) {
+ if (rd_argv_match(rd, "dev") || rd_argv_match(rd, "link")) {
+ rd_arg_inc(rd);
+ if (rd_no_arg(rd)) {
+ pr_err("No device name was supplied\n");
+ ret = -EINVAL;
+ }
+ goto out;
+ }
+ rd_arg_inc(rd);
+ }
+out:
+ return ret;
+}
+
int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port)
{
struct dev_map *dev_map;
--
2.15.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-04 7:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 7:01 [PATCH iproute2-next v1 0/9] RDMA resource tracking Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 1/9] rdma: Add option to provide "-" sign for the port number Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 2/9] rdma: Make visible the number of arguments Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 5/9] rdma: Allow external usage of compare string routine Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 6/9] rdma: Update kernel header file Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 7/9] rdma: Add resource tracking summary Leon Romanovsky
[not found] ` <20180104070150.15625-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-04 7:01 ` [PATCH iproute2-next v1 3/9] rdma: Add filtering infrastructure Leon Romanovsky
2018-01-05 3:29 ` David Ahern
2018-01-07 7:44 ` Leon Romanovsky
2018-01-04 7:01 ` Leon Romanovsky [this message]
2018-01-04 7:01 ` [PATCH iproute2-next v1 8/9] rdma: Add QP resource tracking information Leon Romanovsky
2018-01-04 7:01 ` [PATCH iproute2-next v1 9/9] rdma: Document resource tracking 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=20180104070150.15625-5-leon@kernel.org \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dsahern-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.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).