From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
Cc: Stephen Hemminger
<stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>,
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Ariel Almog <ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH iproute2 V3 1/4] rdma: Add basic infrastructure for RDMA tool
Date: Tue, 11 Jul 2017 10:23:14 +0300 [thread overview]
Message-ID: <20170711072314.GU1528@mtr-leonro.local> (raw)
In-Reply-To: <20170710074717.GB1853@nanopsycho>
[-- Attachment #1: Type: text/plain, Size: 2435 bytes --]
On Mon, Jul 10, 2017 at 09:47:17AM +0200, Jiri Pirko wrote:
> Tue, Jul 04, 2017 at 09:55:38AM CEST, leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org wrote:
> >From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> >RDMA devices are cross-functional devices from one side,
> >but very tailored for the specific markets from another.
> >
> >Such diversity caused to spread of RDMA related configuration
> >across various tools, e.g. devlink, ip, ethtool, ib specific and
> >vendor specific solutions.
> >
> >This patch adds ability to fill device and port information
> >by reading RDMA netlink.
> >
> >Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> [...]
>
>
> >+
> >+int rd_dev_init_cb(const struct nlmsghdr *nlh, void *data)
> >+{
> >+ struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {};
> >+ struct dev_map *dev_map;
> >+ struct rdma *rd = data;
> >+ const char *dev_name;
> >+
> >+ mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
> >+ if (!tb[RDMA_NLDEV_ATTR_DEV_NAME] || !tb[RDMA_NLDEV_ATTR_DEV_INDEX])
> >+ return MNL_CB_ERROR;
> >+ if (!tb[RDMA_NLDEV_ATTR_PORT_INDEX]) {
> >+ pr_err("This tool doesn't support switches yet\n");
> >+ return MNL_CB_ERROR;
> >+ }
> >+
> >+ dev_name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
> >+
> >+ dev_map = dev_map_alloc(dev_name);
> >+ if (!dev_map)
> >+ /* The main function will cleanup the allocations */
> >+ return MNL_CB_ERROR;
> >+ list_add_tail(&dev_map->list, &rd->dev_map_list);
> >+
> >+ dev_map->num_ports = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
> >+ dev_map->idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
> >+
> >+ return MNL_CB_OK;
> >+}
> >+
> >+void rdma_free_devmap(struct rdma *rd)
> >+{
> >+ if(!rd)
> >+ return;
> >+ dev_map_cleanup(rd);
> >+}
> >+
> >+int rdma_exec_cmd(struct rdma *rd, const struct rdma_cmd *cmds, const char *str)
>
> Sometimes the functions are prefixed "rd_", sometimes "rdma_".
> I think it would be nice to unify this with "rd_".
Right, I'll fix.
>
>
> >+{
> >+ const struct rdma_cmd *c;
> >+
> >+ /* First argument in objs table is default variant */
> >+ if (rd_no_arg(rd))
> >+ return cmds->func(rd);
> >+
> >+ for (c = cmds + 1; c->cmd; ++c) {
> >+ if (rd_argv_match(rd, c->cmd)) {
> >+ /* Move to next argument */
> >+ rd_arg_inc(rd);
> >+ return c->func(rd);
> >+ }
> >+ }
> >+
> >+ pr_err("Unknown %s '%s'.\n", str, rd_argv(rd));
> >+ return 0;
> >+}
> >+
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-07-11 7:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-04 7:55 [PATCH iproute2 V3 0/4] RDMAtool Leon Romanovsky
2017-07-04 7:55 ` [PATCH iproute2 V3 1/4] rdma: Add basic infrastructure for RDMA tool Leon Romanovsky
2017-07-10 7:47 ` Jiri Pirko
2017-07-11 7:23 ` Leon Romanovsky [this message]
2017-07-04 7:55 ` [PATCH iproute2 V3 2/4] rdma: Add dev object Leon Romanovsky
2017-07-04 9:04 ` Leon Romanovsky
[not found] ` <20170704075541.12544-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-10 8:01 ` Jiri Pirko
2017-07-11 7:22 ` Leon Romanovsky
2017-07-04 7:55 ` [PATCH iproute2 V3 3/4] rdma: Add link object Leon Romanovsky
2017-07-10 8:13 ` Jiri Pirko
2017-07-10 16:22 ` Leon Romanovsky
2017-07-10 18:28 ` Jiri Pirko
2017-07-11 6:33 ` Leon Romanovsky
[not found] ` <20170704075541.12544-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-04 7:55 ` [PATCH iproute2 V3 4/4] rdma: Add initial manual for the tool Leon Romanovsky
2017-07-10 8:02 ` [PATCH iproute2 V3 0/4] RDMAtool Jiri Pirko
2017-07-10 16:01 ` Leon Romanovsky
2017-07-10 18:29 ` Jiri Pirko
2017-07-10 7:43 ` Jiri Pirko
2017-07-11 7:09 ` 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=20170711072314.GU1528@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jiri-rHqAuBHg3fBzbRFIqnYvSA@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