[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170711072314.GU1528@mtr-leonro.local>
Date: Tue, 11 Jul 2017 10:23:14 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Doug Ledford <dledford@...hat.com>,
Ariel Almog <ariela@...lanox.com>,
Linux RDMA <linux-rdma@...r.kernel.org>,
Linux Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2 V3 1/4] rdma: Add basic infrastructure for RDMA
tool
On Mon, Jul 10, 2017 at 09:47:17AM +0200, Jiri Pirko wrote:
> Tue, Jul 04, 2017 at 09:55:38AM CEST, leon@...nel.org wrote:
> >From: Leon Romanovsky <leonro@...lanox.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@...lanox.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_".
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;
> >+}
> >+
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists