From patchwork Wed Apr 3 17:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10884267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49C5C184E for ; Wed, 3 Apr 2019 17:12:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 343AC1FE82 for ; Wed, 3 Apr 2019 17:12:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28DB72848B; Wed, 3 Apr 2019 17:12:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9F692018E for ; Wed, 3 Apr 2019 17:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726155AbfDCRLw (ORCPT ); Wed, 3 Apr 2019 13:11:52 -0400 Received: from linode.aoot.com ([69.164.194.13]:54710 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726206AbfDCRLw (ORCPT ); Wed, 3 Apr 2019 13:11:52 -0400 Received: from work.aoot.com.com (li1110-136.members.linode.com [45.79.11.136]) by linode.aoot.com (Postfix) with ESMTP id E6A0D87B5; Wed, 3 Apr 2019 12:11:51 -0500 (CDT) From: Steve Wise To: dsahern@gmail.com Cc: Steve Wise , leon@kernel.org, stephen@networkplumber.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH v3 iproute2-next 1/4] Add .mailmap file Date: Wed, 3 Apr 2019 12:10:29 -0500 Message-Id: <117ec8d5d01aa70fff44c515d9525bc21291cc04.1554304142.git.larrystevenwise@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP .mailmap allows tracking multiple email addresses to the proper user name. Signed-off-by: Steve Wise Reviewed-by: Leon Romanovsky --- .mailmap | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..c012d3d0 --- /dev/null +++ b/.mailmap @@ -0,0 +1,8 @@ +# +# This list is used by git-shortlog to fix a few botched name translations +# in the git archive, either because the author's full name was messed up +# and/or not always written the same way, making contributions from the +# same person appearing not to be so or badly displayed. +# +Steve Wise +Steve Wise From patchwork Wed Apr 3 17:10:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10884269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61CB9139A for ; Wed, 3 Apr 2019 17:12:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF081FE82 for ; Wed, 3 Apr 2019 17:12:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 404D42848B; Wed, 3 Apr 2019 17:12:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2DD71FE82 for ; Wed, 3 Apr 2019 17:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbfDCRLw (ORCPT ); Wed, 3 Apr 2019 13:11:52 -0400 Received: from linode.aoot.com ([69.164.194.13]:54722 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfDCRLw (ORCPT ); Wed, 3 Apr 2019 13:11:52 -0400 Received: from work.aoot.com.com (li1110-136.members.linode.com [45.79.11.136]) by linode.aoot.com (Postfix) with ESMTP id E918487BA; Wed, 3 Apr 2019 12:11:51 -0500 (CDT) From: Steve Wise To: dsahern@gmail.com Cc: Steve Wise , leon@kernel.org, stephen@networkplumber.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH v3 iproute2-next 2/4] rdma: add helper rd_sendrecv_msg() Date: Wed, 3 Apr 2019 12:10:30 -0500 Message-Id: <15b656f2c6235902f34321c052d3eaec2632c82e.1554304142.git.larrystevenwise@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function sends the constructed netlink message and then receives the response. Change rd_recv_msg() to display any error messages. Change 'rdma dev set' to use rd_sendrecv_msg(). Signed-off-by: Steve Wise Reviewed-by: Leon Romanovsky --- rdma/dev.c | 2 +- rdma/rdma.h | 2 ++ rdma/res.h | 1 + rdma/utils.c | 18 ++++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/rdma/dev.c b/rdma/dev.c index 954e0015..33962520 100644 --- a/rdma/dev.c +++ b/rdma/dev.c @@ -268,7 +268,7 @@ static int dev_set_name(struct rd *rd) mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx); mnl_attr_put_strz(rd->nlh, RDMA_NLDEV_ATTR_DEV_NAME, rd_argv(rd)); - return rd_send_msg(rd); + return rd_sendrecv_msg(rd, seq); } static int dev_one_set(struct rd *rd) diff --git a/rdma/rdma.h b/rdma/rdma.h index 1022e9a2..6c7f7d15 100644 --- a/rdma/rdma.h +++ b/rdma/rdma.h @@ -68,6 +68,7 @@ struct rd { json_writer_t *jw; bool json_output; bool pretty_output; + bool suppress_errors; struct list_head filter_list; }; @@ -119,6 +120,7 @@ bool rd_is_string_filtered_attr(struct rd *rd, const char *key, const char *val, */ int rd_send_msg(struct rd *rd); int rd_recv_msg(struct rd *rd, mnl_cb_t callback, void *data, uint32_t seq); +int rd_sendrecv_msg(struct rd *rd, unsigned int seq); void rd_prepare_msg(struct rd *rd, uint32_t cmd, uint32_t *seq, uint16_t flags); int rd_dev_init_cb(const struct nlmsghdr *nlh, void *data); int rd_attr_cb(const struct nlattr *attr, void *data); diff --git a/rdma/res.h b/rdma/res.h index b4a7e552..525171fc 100644 --- a/rdma/res.h +++ b/rdma/res.h @@ -31,6 +31,7 @@ int res_qp_idx_parse_cb(const struct nlmsghdr *nlh, void *data); if (id) { \ ret = rd_doit_index(rd, &idx); \ if (ret) { \ + rd->suppress_errors = true; \ ret = _res_send_idx_msg(rd, command, \ name##_idx_parse_cb, \ idx, id); \ diff --git a/rdma/utils.c b/rdma/utils.c index 1f6bf330..11ed8a73 100644 --- a/rdma/utils.c +++ b/rdma/utils.c @@ -693,10 +693,28 @@ int rd_recv_msg(struct rd *rd, mnl_cb_t callback, void *data, unsigned int seq) ret = mnl_cb_run(buf, ret, seq, portid, callback, data); } while (ret > 0); + if (ret < 0 && !rd->suppress_errors) + perror("error"); + mnl_socket_close(rd->nl); return ret; } +static int null_cb(const struct nlmsghdr *nlh, void *data) +{ + return MNL_CB_OK; +} + +int rd_sendrecv_msg(struct rd *rd, unsigned int seq) +{ + int ret; + + ret = rd_send_msg(rd); + if (!ret) + ret = rd_recv_msg(rd, null_cb, rd, seq); + return ret; +} + static struct dev_map *_dev_map_lookup(struct rd *rd, const char *dev_name) { struct dev_map *dev_map; From patchwork Wed Apr 3 17:10:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10884263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7311B184E for ; Wed, 3 Apr 2019 17:12:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D13B1FE82 for ; Wed, 3 Apr 2019 17:12:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5169B2848B; Wed, 3 Apr 2019 17:12:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E639B1FE82 for ; Wed, 3 Apr 2019 17:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726329AbfDCRL6 (ORCPT ); Wed, 3 Apr 2019 13:11:58 -0400 Received: from linode.aoot.com ([69.164.194.13]:54736 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbfDCRLx (ORCPT ); Wed, 3 Apr 2019 13:11:53 -0400 Received: from work.aoot.com.com (li1110-136.members.linode.com [45.79.11.136]) by linode.aoot.com (Postfix) with ESMTP id 02F5F87BC; Wed, 3 Apr 2019 12:11:52 -0500 (CDT) From: Steve Wise To: dsahern@gmail.com Cc: Steve Wise , leon@kernel.org, stephen@networkplumber.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH v3 iproute2-next 3/4] rdma: add 'link add/delete' commands Date: Wed, 3 Apr 2019 12:10:31 -0500 Message-Id: <649bcc162076ff46ba149f0e1c168b8a08963a55.1554304142.git.larrystevenwise@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add new 'link' subcommand 'add' and 'delete' to allow binding a soft-rdma device to a netdev interface. EG: rdma link add rxe_eth0 type rxe netdev eth0 rdma link delete rxe_eth0 Signed-off-by: Steve Wise Reviewed-by: Leon Romanovsky --- rdma/link.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ rdma/rdma.h | 2 ++ 2 files changed, 80 insertions(+) diff --git a/rdma/link.c b/rdma/link.c index 89e81b84..10b2e513 100644 --- a/rdma/link.c +++ b/rdma/link.c @@ -9,6 +9,9 @@ static int link_help(struct rd *rd) { pr_out("Usage: %s link show [DEV/PORT_INDEX]\n", rd->filename); + pr_out("Usage: %s link add NAME type TYPE netdev NETDEV\n", + rd->filename); + pr_out("Usage: %s link delete NAME\n", rd->filename); return 0; } @@ -336,10 +339,85 @@ static int link_show(struct rd *rd) return rd_exec_link(rd, link_one_show, true); } +static int link_add_netdev(struct rd *rd) +{ + char *link_netdev; + uint32_t seq; + + if (rd_no_arg(rd)) { + pr_err("Please provide a net device name.\n"); + return -EINVAL; + } + + link_netdev = rd_argv(rd); + rd_prepare_msg(rd, RDMA_NLDEV_CMD_NEWLINK, &seq, + (NLM_F_REQUEST | NLM_F_ACK)); + mnl_attr_put_strz(rd->nlh, RDMA_NLDEV_ATTR_DEV_NAME, rd->link_name); + mnl_attr_put_strz(rd->nlh, RDMA_NLDEV_ATTR_LINK_TYPE, rd->link_type); + mnl_attr_put_strz(rd->nlh, RDMA_NLDEV_ATTR_NDEV_NAME, link_netdev); + return rd_sendrecv_msg(rd, seq); +} + +static int link_add_type(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, link_help}, + { "netdev", link_add_netdev}, + { 0 } + }; + + if (rd_no_arg(rd)) { + pr_err("Please provide a link type name.\n"); + return -EINVAL; + } + rd->link_type = rd_argv(rd); + rd_arg_inc(rd); + return rd_exec_cmd(rd, cmds, "parameter"); +} + +static int link_add(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, link_help}, + { "type", link_add_type}, + { 0 } + }; + + if (rd_no_arg(rd)) { + pr_err("Please provide a link name to add.\n"); + return -EINVAL; + } + rd->link_name = rd_argv(rd); + rd_arg_inc(rd); + + return rd_exec_cmd(rd, cmds, "parameter"); +} + +static int _link_del(struct rd *rd) +{ + uint32_t seq; + + if (!rd_no_arg(rd)) { + pr_err("Unknown parameter %s\n", rd_argv(rd)); + return -EINVAL; + } + rd_prepare_msg(rd, RDMA_NLDEV_CMD_DELLINK, &seq, + (NLM_F_REQUEST | NLM_F_ACK)); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx); + return rd_sendrecv_msg(rd, seq); +} + +static int link_del(struct rd *rd) +{ + return rd_exec_require_dev(rd, _link_del); +} + int cmd_link(struct rd *rd) { const struct rd_cmd cmds[] = { { NULL, link_show }, + { "add", link_add }, + { "delete", link_del }, { "show", link_show }, { "list", link_show }, { "help", link_help }, diff --git a/rdma/rdma.h b/rdma/rdma.h index 6c7f7d15..9ed9e045 100644 --- a/rdma/rdma.h +++ b/rdma/rdma.h @@ -70,6 +70,8 @@ struct rd { bool pretty_output; bool suppress_errors; struct list_head filter_list; + char *link_name; + char *link_type; }; struct rd_cmd { From patchwork Wed Apr 3 17:10:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10884261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE52813B5 for ; Wed, 3 Apr 2019 17:11:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 990D11FE82 for ; Wed, 3 Apr 2019 17:11:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D3372848B; Wed, 3 Apr 2019 17:11:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 364161FE82 for ; Wed, 3 Apr 2019 17:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbfDCRLx (ORCPT ); Wed, 3 Apr 2019 13:11:53 -0400 Received: from linode.aoot.com ([69.164.194.13]:54744 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfDCRLw (ORCPT ); Wed, 3 Apr 2019 13:11:52 -0400 Received: from work.aoot.com.com (li1110-136.members.linode.com [45.79.11.136]) by linode.aoot.com (Postfix) with ESMTP id 10CEE87BD; Wed, 3 Apr 2019 12:11:52 -0500 (CDT) From: Steve Wise To: dsahern@gmail.com Cc: Steve Wise , leon@kernel.org, stephen@networkplumber.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH v3 iproute2-next 4/4] rdma: man page update for link add/delete Date: Wed, 3 Apr 2019 12:10:32 -0500 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Update the 'rdma link' man page with 'link add/delete' info. Signed-off-by: Steve Wise Reviewed-by: Leon Romanovsky --- man/man8/rdma-link.8 | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/man/man8/rdma-link.8 b/man/man8/rdma-link.8 index bddf3474..b3b40de7 100644 --- a/man/man8/rdma-link.8 +++ b/man/man8/rdma-link.8 @@ -22,6 +22,18 @@ rdma-link \- rdma link configuration .B rdma link show .RI "[ " DEV/PORT_INDEX " ]" +.ti -8 +.B rdma link add +.BR NAME +.BR type +.BR TYPE +.BR netdev +.BR NETDEV + +.ti -8 +.B rdma link delete +.RI NAME + .ti -8 .B rdma link help @@ -33,6 +45,31 @@ rdma-link \- rdma link configuration - specifies the RDMA link to show. If this argument is omitted all links are listed. +.SS rdma link add NAME type TYPE netdev NETDEV - add an rdma link for the specified type to the network device +.sp +.BR NAME +- specifies the new name of the rdma link to add + +.BR TYPE +- specifies which rdma type to use. Link types: +.sp +.in +8 +.B rxe +- Soft RoCE driver +.sp +.B siw +- Soft iWARP driver +.in -8 + +.BR NETDEV +- specifies the network device to which the link is bound + +.SS rdma link delete NAME - delete an rdma link +.PP +.BR NAME +- specifies the name of the rdma link to delete +.PP + .SH "EXAMPLES" .PP rdma link show @@ -45,6 +82,16 @@ rdma link show mlx5_2/1 Shows the state of specified rdma link. .RE .PP +rdma link add rxe_eth0 type rxe netdev eth0 +.RS 4 +Adds a RXE link named rxe_eth0 to network device eth0 +.RE +.PP +rdma link del rxe_eth0 +.RS 4 +Removes RXE link rxe_eth0 +.RE +.PP .SH SEE ALSO .BR rdma (8),