From: Jiri Pirko <jiri@resnulli.us>
To: Leon Romanovsky <leon@kernel.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Doug Ledford <dledford@redhat.com>,
Ariel Almog <ariela@mellanox.com>,
Linux RDMA <linux-rdma@vger.kernel.org>,
Linux Netdev <netdev@vger.kernel.org>,
Leon Romanovsky <leonro@mellanox.com>
Subject: Re: [PATCH iproute2 V3 1/4] rdma: Add basic infrastructure for RDMA tool
Date: Mon, 10 Jul 2017 09:47:17 +0200 [thread overview]
Message-ID: <20170710074717.GB1853@nanopsycho> (raw)
In-Reply-To: <20170704075541.12544-2-leon@kernel.org>
Tue, Jul 04, 2017 at 09:55:38AM CEST, leon@kernel.org wrote:
>From: Leon Romanovsky <leonro@mellanox.com>
>
>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@mellanox.com>
[...]
>+
>+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_".
>+{
>+ 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;
>+}
>+
next prev parent reply other threads:[~2017-07-10 7:47 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 [this message]
2017-07-11 7:23 ` Leon Romanovsky
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=20170710074717.GB1853@nanopsycho \
--to=jiri@resnulli.us \
--cc=ariela@mellanox.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--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