From patchwork Sun Dec 23 17:14:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741769 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 DE17A746 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C33E42870D for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B802F2873E; Sun, 23 Dec 2018 17:15:24 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 616A52870D for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725810AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41679 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725803AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:37 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDBD030321; Sun, 23 Dec 2018 19:15:13 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDmd007158; Sun, 23 Dec 2018 19:15:13 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFDin007156; Sun, 23 Dec 2018 19:15:13 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 1/6] Update kernel headers Date: Sun, 23 Dec 2018 19:14:52 +0200 Message-Id: <1545585297-6677-2-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 To commit 641d1207d2ed ("IB/core: Move query port to ioctl") Signed-off-by: Yishai Hadas --- kernel-headers/rdma/ib_user_ioctl_cmds.h | 7 +++++++ kernel-headers/rdma/ib_user_ioctl_verbs.h | 7 +++++++ kernel-headers/rdma/rdma_netlink.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/kernel-headers/rdma/ib_user_ioctl_cmds.h b/kernel-headers/rdma/ib_user_ioctl_cmds.h index f046478..64f0e3a 100644 --- a/kernel-headers/rdma/ib_user_ioctl_cmds.h +++ b/kernel-headers/rdma/ib_user_ioctl_cmds.h @@ -66,6 +66,7 @@ enum { enum uverbs_methods_device { UVERBS_METHOD_INVOKE_WRITE, UVERBS_METHOD_INFO_HANDLES, + UVERBS_METHOD_QUERY_PORT, }; enum uverbs_attrs_invoke_write_cmd_attr_ids { @@ -74,6 +75,11 @@ enum uverbs_attrs_invoke_write_cmd_attr_ids { UVERBS_ATTR_WRITE_CMD, }; +enum uverbs_attrs_query_port_cmd_attr_ids { + UVERBS_ATTR_QUERY_PORT_PORT_NUM, + UVERBS_ATTR_QUERY_PORT_RESP, +}; + enum uverbs_attrs_create_cq_cmd_attr_ids { UVERBS_ATTR_CREATE_CQ_HANDLE, UVERBS_ATTR_CREATE_CQ_CQE, @@ -234,4 +240,5 @@ enum uverbs_methods_flow { enum uverbs_attrs_flow_destroy_ids { UVERBS_ATTR_DESTROY_FLOW_HANDLE, }; + #endif diff --git a/kernel-headers/rdma/ib_user_ioctl_verbs.h b/kernel-headers/rdma/ib_user_ioctl_verbs.h index 9dcd345..72c7fc7 100644 --- a/kernel-headers/rdma/ib_user_ioctl_verbs.h +++ b/kernel-headers/rdma/ib_user_ioctl_verbs.h @@ -35,6 +35,7 @@ #define IB_USER_IOCTL_VERBS_H #include +#include #ifndef RDMA_UAPI_PTR #define RDMA_UAPI_PTR(_type, _name) __aligned_u64 _name @@ -166,4 +167,10 @@ enum ib_uverbs_advise_mr_flag { IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0, }; +struct ib_uverbs_query_port_resp_ex { + struct ib_uverbs_query_port_resp legacy_resp; + __u16 port_cap_flags2; + __u8 reserved[6]; +}; + #endif diff --git a/kernel-headers/rdma/rdma_netlink.h b/kernel-headers/rdma/rdma_netlink.h index f9c41bf..2e18b77 100644 --- a/kernel-headers/rdma/rdma_netlink.h +++ b/kernel-headers/rdma/rdma_netlink.h @@ -283,6 +283,9 @@ enum rdma_nldev_attr { /* * Device and port capabilities + * + * When used for port info, first 32-bits are CapabilityMask followed by + * 16-bit CapabilityMask2. */ RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */ From patchwork Sun Dec 23 17:14:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741777 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 AB87F746 for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D60C283B1 for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81C7228736; Sun, 23 Dec 2018 17:15:25 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 C322B283B1 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725819AbeLWRPW (ORCPT ); Sun, 23 Dec 2018 12:15:22 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41678 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725798AbeLWRPW (ORCPT ); Sun, 23 Dec 2018 12:15:22 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:37 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDTe030324; Sun, 23 Dec 2018 19:15:13 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDcf007164; Sun, 23 Dec 2018 19:15:13 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFDBO007163; Sun, 23 Dec 2018 19:15:13 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 2/6] verbs: Migrate ibv_cmd_query_port to run over ioctl Date: Sun, 23 Dec 2018 19:14:53 +0200 Message-Id: <1545585297-6677-3-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Michael Guralnik Migrate ibv_cmd_query_port to run over ioctl with a fallback to the write method when ioctl is not supported by the kernel. Downstream patch in this series will extend the response over the ioctl interface. Signed-off-by: Michael Guralnik Signed-off-by: Yishai Hadas --- libibverbs/CMakeLists.txt | 1 + libibverbs/cmd.c | 41 ------------------- libibverbs/cmd_device.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 41 deletions(-) create mode 100644 libibverbs/cmd_device.c diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt index 2ddafd6..ddc891a 100644 --- a/libibverbs/CMakeLists.txt +++ b/libibverbs/CMakeLists.txt @@ -32,6 +32,7 @@ rdma_library(ibverbs "${CMAKE_CURRENT_BINARY_DIR}/libibverbs.map" cmd.c cmd_counters.c cmd_cq.c + cmd_device.c cmd_dm.c cmd_fallback.c cmd_flow_action.c diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index a824202..350210b 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -268,47 +268,6 @@ int ibv_cmd_query_device_ex(struct ibv_context *context, return 0; } -int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr, - struct ibv_query_port *cmd, size_t cmd_size) -{ - struct ib_uverbs_query_port_resp resp; - int ret; - - cmd->port_num = port_num; - memset(cmd->reserved, 0, sizeof cmd->reserved); - memset(&resp, 0, sizeof(resp)); - - ret = execute_cmd_write(context, IB_USER_VERBS_CMD_QUERY_PORT, cmd, - cmd_size, &resp, sizeof(resp)); - if (ret) - return ret; - - port_attr->state = resp.state; - port_attr->max_mtu = resp.max_mtu; - port_attr->active_mtu = resp.active_mtu; - port_attr->gid_tbl_len = resp.gid_tbl_len; - port_attr->port_cap_flags = resp.port_cap_flags; - port_attr->max_msg_sz = resp.max_msg_sz; - port_attr->bad_pkey_cntr = resp.bad_pkey_cntr; - port_attr->qkey_viol_cntr = resp.qkey_viol_cntr; - port_attr->pkey_tbl_len = resp.pkey_tbl_len; - port_attr->lid = resp.lid; - port_attr->sm_lid = resp.sm_lid; - port_attr->lmc = resp.lmc; - port_attr->max_vl_num = resp.max_vl_num; - port_attr->sm_sl = resp.sm_sl; - port_attr->subnet_timeout = resp.subnet_timeout; - port_attr->init_type_reply = resp.init_type_reply; - port_attr->active_width = resp.active_width; - port_attr->active_speed = resp.active_speed; - port_attr->phys_state = resp.phys_state; - port_attr->link_layer = resp.link_layer; - port_attr->flags = resp.flags; - - return 0; -} - int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd, struct ibv_alloc_pd *cmd, size_t cmd_size, struct ib_uverbs_alloc_pd_resp *resp, size_t resp_size) diff --git a/libibverbs/cmd_device.c b/libibverbs/cmd_device.c new file mode 100644 index 0000000..803d33d --- /dev/null +++ b/libibverbs/cmd_device.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include + +static void copy_query_port_resp_to_port_attr(struct ibv_port_attr *port_attr, + struct ib_uverbs_query_port_resp *resp) +{ + port_attr->state = resp->state; + port_attr->max_mtu = resp->max_mtu; + port_attr->active_mtu = resp->active_mtu; + port_attr->gid_tbl_len = resp->gid_tbl_len; + port_attr->port_cap_flags = resp->port_cap_flags; + port_attr->max_msg_sz = resp->max_msg_sz; + port_attr->bad_pkey_cntr = resp->bad_pkey_cntr; + port_attr->qkey_viol_cntr = resp->qkey_viol_cntr; + port_attr->pkey_tbl_len = resp->pkey_tbl_len; + port_attr->lid = resp->lid; + port_attr->sm_lid = resp->sm_lid; + port_attr->lmc = resp->lmc; + port_attr->max_vl_num = resp->max_vl_num; + port_attr->sm_sl = resp->sm_sl; + port_attr->subnet_timeout = resp->subnet_timeout; + port_attr->init_type_reply = resp->init_type_reply; + port_attr->active_width = resp->active_width; + port_attr->active_speed = resp->active_speed; + port_attr->phys_state = resp->phys_state; + port_attr->link_layer = resp->link_layer; + port_attr->flags = resp->flags; +} + +int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num, + struct ibv_port_attr *port_attr, + struct ibv_query_port *cmd, size_t cmd_size) +{ + DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_DEVICE, + UVERBS_METHOD_QUERY_PORT, 2, NULL); + int ret; + struct ib_uverbs_query_port_resp_ex resp_ex = {}; + + fill_attr_const_in(cmdb, UVERBS_ATTR_QUERY_PORT_PORT_NUM, port_num); + fill_attr_out_ptr(cmdb, UVERBS_ATTR_QUERY_PORT_RESP, &resp_ex); + + switch (execute_ioctl_fallback(context, query_port, cmdb, &ret)) { + case TRY_WRITE: { + struct ib_uverbs_query_port_resp resp; + + cmd->port_num = port_num; + memset(cmd->reserved, 0, sizeof(cmd->reserved)); + memset(&resp, 0, sizeof(resp)); + + ret = execute_cmd_write(context, + IB_USER_VERBS_CMD_QUERY_PORT, cmd, + cmd_size, &resp, sizeof(resp)); + if (ret) + return ret; + + copy_query_port_resp_to_port_attr(port_attr, &resp); + break; + } + case SUCCESS: + copy_query_port_resp_to_port_attr(port_attr, + &resp_ex.legacy_resp); + break; + default: + return ret; + }; + + return 0; +} + From patchwork Sun Dec 23 17:14:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741773 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 606691880 for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 405A528736 for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3541F2873E; Sun, 23 Dec 2018 17:15:25 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 A24D428739 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725817AbeLWRPW (ORCPT ); Sun, 23 Dec 2018 12:15:22 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41680 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725796AbeLWRPW (ORCPT ); Sun, 23 Dec 2018 12:15:22 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:37 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDAS030327; Sun, 23 Dec 2018 19:15:13 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFDOE007168; Sun, 23 Dec 2018 19:15:13 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFDmd007167; Sun, 23 Dec 2018 19:15:13 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 3/6] verbs: Make ibv_query_port extendable Date: Sun, 23 Dec 2018 19:14:54 +0200 Message-Id: <1545585297-6677-4-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Jason Gunthorpe To be able to add new fields to the end of the struct without breaking the ABI introduce a new query function that takes the length of the struct as an argument and have the inline wrapper preserve the user API. Signed-off-by: Jason Gunthorpe Signed-off-by: Yishai Hadas --- libibverbs/device.c | 8 +++++++ libibverbs/dummy_ops.c | 2 +- libibverbs/ibverbs.h | 2 ++ libibverbs/verbs.c | 53 +++++++++++++++++++++++++++++++++++++++++++++-- libibverbs/verbs.h | 27 ++++++++++++++++++------ providers/bnxt_re/verbs.c | 1 - 6 files changed, 83 insertions(+), 10 deletions(-) diff --git a/libibverbs/device.c b/libibverbs/device.c index 1fed29b..d710513 100644 --- a/libibverbs/device.c +++ b/libibverbs/device.c @@ -306,6 +306,14 @@ err_free: static void set_lib_ops(struct verbs_context *vctx) { vctx->create_cq_ex = __lib_ibv_create_cq_ex; + + /* + * The compat symver entry point behaves identically to what used to + * be pointed to by _compat_query_port. + */ +#undef ibv_query_port + vctx->context.ops._compat_query_port = ibv_query_port; + vctx->query_port = __lib_query_port; } struct ibv_context *verbs_open_device(struct ibv_device *device, void *private_data) diff --git a/libibverbs/dummy_ops.c b/libibverbs/dummy_ops.c index a5e9380..c861c3a 100644 --- a/libibverbs/dummy_ops.c +++ b/libibverbs/dummy_ops.c @@ -616,7 +616,7 @@ void verbs_set_ops(struct verbs_context *vctx, SET_OP(ctx, post_srq_recv); SET_PRIV_OP(ctx, query_device); SET_OP(vctx, query_device_ex); - SET_PRIV_OP(ctx, query_port); + SET_PRIV_OP_IC(ctx, query_port); SET_PRIV_OP(ctx, query_qp); SET_OP(vctx, query_rt_values); SET_OP(vctx, read_counters); diff --git a/libibverbs/ibverbs.h b/libibverbs/ibverbs.h index 36e29a6..6e4cff4 100644 --- a/libibverbs/ibverbs.h +++ b/libibverbs/ibverbs.h @@ -58,6 +58,8 @@ int ibverbs_get_device_list(struct list_head *list); int ibverbs_init(void); void ibverbs_device_put(struct ibv_device *dev); void ibverbs_device_hold(struct ibv_device *dev); +int __lib_query_port(struct ibv_context *context, uint8_t port_num, + struct ibv_port_attr *port_attr, size_t port_attr_len); #ifdef _STATIC_LIBRARY_BUILD_ static inline void load_drivers(void) diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index 5edd1bb..3540ef2 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -145,12 +145,61 @@ LATEST_SYMVER_FUNC(ibv_query_device, 1_1, "IBVERBS_1.1", return get_ops(context)->query_device(context, device_attr); } +int __lib_query_port(struct ibv_context *context, uint8_t port_num, + struct ibv_port_attr *port_attr, size_t port_attr_len) +{ + /* Don't expose this mess to the provider, provide a large enough + * temporary buffer if the user buffer is too small. + */ + if (port_attr_len < sizeof(struct ibv_port_attr)) { + struct ibv_port_attr tmp_attr = {}; + int rc; + + rc = get_ops(context)->query_port(context, port_num, + &tmp_attr); + if (rc) + return rc; + + memcpy(port_attr, &tmp_attr, port_attr_len); + return 0; + } + + memset(port_attr, 0, port_attr_len); + return get_ops(context)->query_port(context, port_num, port_attr); +} + +struct _compat_ibv_port_attr { + enum ibv_port_state state; + enum ibv_mtu max_mtu; + enum ibv_mtu active_mtu; + int gid_tbl_len; + uint32_t port_cap_flags; + uint32_t max_msg_sz; + uint32_t bad_pkey_cntr; + uint32_t qkey_viol_cntr; + uint16_t pkey_tbl_len; + uint16_t lid; + uint16_t sm_lid; + uint8_t lmc; + uint8_t max_vl_num; + uint8_t sm_sl; + uint8_t subnet_timeout; + uint8_t init_type_reply; + uint8_t active_width; + uint8_t active_speed; + uint8_t phys_state; + uint8_t link_layer; + uint8_t flags; +}; + LATEST_SYMVER_FUNC(ibv_query_port, 1_1, "IBVERBS_1.1", int, struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr) + struct _compat_ibv_port_attr *port_attr) { - return get_ops(context)->query_port(context, port_num, port_attr); + return __lib_query_port(context, port_num, + (struct ibv_port_attr *)port_attr, + sizeof(*port_attr)); } LATEST_SYMVER_FUNC(ibv_query_gid, 1_1, "IBVERBS_1.1", diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index caf78f4..4851c72 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1661,9 +1661,12 @@ struct ibv_device { char ibdev_path[IBV_SYSFS_PATH_MAX]; }; +struct _compat_ibv_port_attr; struct ibv_context_ops { void *(*_compat_query_device)(void); - void *(*_compat_query_port)(void); + int (*_compat_query_port)(struct ibv_context *context, + uint8_t port_num, + struct _compat_ibv_port_attr *port_attr); void *(*_compat_alloc_pd)(void); void *(*_compat_dealloc_pd)(void); void *(*_compat_reg_mr)(void); @@ -1786,6 +1789,9 @@ struct ibv_values_ex { struct verbs_context { /* "grows up" - new fields go here */ + int (*query_port)(struct ibv_context *context, uint8_t port_num, + struct ibv_port_attr *port_attr, + size_t port_attr_len); int (*advise_mr)(struct ibv_pd *pd, enum ibv_advise_mr_advice advice, uint32_t flags, @@ -1997,17 +2003,26 @@ int ibv_query_device(struct ibv_context *context, * ibv_query_port - Get port properties */ int ibv_query_port(struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr); + struct _compat_ibv_port_attr *port_attr); static inline int ___ibv_query_port(struct ibv_context *context, uint8_t port_num, struct ibv_port_attr *port_attr) { - /* For compatibility when running with old libibverbs */ - port_attr->link_layer = IBV_LINK_LAYER_UNSPECIFIED; - port_attr->flags = 0; + struct verbs_context *vctx = verbs_get_ctx_op(context, query_port); - return ibv_query_port(context, port_num, port_attr); + if (!vctx) { + int rc; + + memset(port_attr, 0, sizeof(*port_attr)); + + rc = ibv_query_port(context, port_num, + (struct _compat_ibv_port_attr *)port_attr); + return rc; + } + + return vctx->query_port(context, port_num, port_attr, + sizeof(*port_attr)); } #define ibv_query_port(context, port_num, port_attr) \ diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index 39b29b0..7786d24 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -74,7 +74,6 @@ int bnxt_re_query_port(struct ibv_context *ibvctx, uint8_t port, { struct ibv_query_port cmd; - memset(port_attr, 0, sizeof(struct ibv_port_attr)); return ibv_cmd_query_port(ibvctx, port, port_attr, &cmd, sizeof(cmd)); } From patchwork Sun Dec 23 17:14:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741771 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 1267218A6 for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EACE528736 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFA012873E; Sun, 23 Dec 2018 17:15:24 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 81E6628736 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725812AbeLWRPW (ORCPT ); Sun, 23 Dec 2018 12:15:22 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41689 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725801AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:38 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEx9030330; Sun, 23 Dec 2018 19:15:14 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEks007172; Sun, 23 Dec 2018 19:15:14 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFDho007171; Sun, 23 Dec 2018 19:15:13 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 4/6] verbs: Expose port_cap_mask2 in ibv_query_port Date: Sun, 23 Dec 2018 19:14:55 +0200 Message-Id: <1545585297-6677-5-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Michael Guralnik New port_cap_flags2 is derived from IB spec PortInfo CapabilityMask2. The field is added to ibv_port_attr and a new flag in port_cap_flags for port_cap_flags2 support is added. In addition, a print of port_cap_flags2 was added to devinfo. Signed-off-by: Michael Guralnik Signed-off-by: Yishai Hadas --- libibverbs/cmd_device.c | 1 + libibverbs/examples/devinfo.c | 1 + libibverbs/man/ibv_query_port.3 | 1 + libibverbs/verbs.h | 11 +++++++++++ 4 files changed, 14 insertions(+) diff --git a/libibverbs/cmd_device.c b/libibverbs/cmd_device.c index 803d33d..d806351 100644 --- a/libibverbs/cmd_device.c +++ b/libibverbs/cmd_device.c @@ -90,6 +90,7 @@ int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num, case SUCCESS: copy_query_port_resp_to_port_attr(port_attr, &resp_ex.legacy_resp); + port_attr->port_cap_flags2 = resp_ex.port_cap_flags2; break; default: return ret; diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index dee74b8..5bbe936 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -584,6 +584,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port) if (verbose) { printf("\t\t\tmax_msg_sz:\t\t0x%x\n", port_attr.max_msg_sz); printf("\t\t\tport_cap_flags:\t\t0x%08x\n", port_attr.port_cap_flags); + printf("\t\t\tport_cap_flags2:\t0x%04x\n", port_attr.port_cap_flags2); printf("\t\t\tmax_vl_num:\t\t%s (%d)\n", vl_str(port_attr.max_vl_num), port_attr.max_vl_num); printf("\t\t\tbad_pkey_cntr:\t\t0x%x\n", port_attr.bad_pkey_cntr); diff --git a/libibverbs/man/ibv_query_port.3 b/libibverbs/man/ibv_query_port.3 index b1f490a..6d077a3 100644 --- a/libibverbs/man/ibv_query_port.3 +++ b/libibverbs/man/ibv_query_port.3 @@ -47,6 +47,7 @@ uint8_t active_speed; /* Currently active link speed */ uint8_t phys_state; /* Physical port state */ uint8_t link_layer; /* link layer protocol of the port */ uint8_t flags; /* Port flags */ +uint16_t port_cap_flags2;/* Port capabilities */ .in -8 }; .sp diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 4851c72..40a7280 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -346,6 +346,7 @@ enum ibv_port_cap_flags { IBV_PORT_SYS_IMAGE_GUID_SUP = 1 << 11, IBV_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, IBV_PORT_EXTENDED_SPEEDS_SUP = 1 << 14, + IBV_PORT_CAP_MASK2_SUP = 1 << 15, IBV_PORT_CM_SUP = 1 << 16, IBV_PORT_SNMP_TUNNEL_SUP = 1 << 17, IBV_PORT_REINIT_SUP = 1 << 18, @@ -359,6 +360,15 @@ enum ibv_port_cap_flags { IBV_PORT_IP_BASED_GIDS = 1 << 26 }; +enum ibv_port_cap_flags2 { + IBV_PORT_SET_NODE_DESC_SUP = 1 << 0, + IBV_PORT_INFO_EXT_SUP = 1 << 1, + IBV_PORT_VIRT_SUP = 1 << 2, + IBV_PORT_SWITCH_PORT_STATE_TABLE_SUP = 1 << 3, + IBV_PORT_LINK_WIDTH_2X_SUP = 1 << 4, + IBV_PORT_LINK_SPEED_HDR_SUP = 1 << 5, +}; + struct ibv_port_attr { enum ibv_port_state state; enum ibv_mtu max_mtu; @@ -381,6 +391,7 @@ struct ibv_port_attr { uint8_t phys_state; uint8_t link_layer; uint8_t flags; + uint16_t port_cap_flags2; }; enum ibv_event_type { From patchwork Sun Dec 23 17:14:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741775 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 80F791A2B for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D7A2870D for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E6928736; Sun, 23 Dec 2018 17:15:25 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 E350B2870D for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725808AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41695 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725793AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:38 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEQS030333; Sun, 23 Dec 2018 19:15:14 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEui007176; Sun, 23 Dec 2018 19:15:14 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFE8Y007175; Sun, 23 Dec 2018 19:15:14 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 5/6] verbs: Added new rates derived from 2x and HDR support Date: Sun, 23 Dec 2018 19:14:56 +0200 Message-Id: <1545585297-6677-6-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Michael Guralnik Due to 2x and HDR addition new rates exposed: 28 Gbps - FDR 2x. 50 Gbps - EDR 2x or HDR 1x. 400 Gbps - HDR 8x. 600 Gbps - HDR 12x. Utility methods were updated to support the new rates. Rate to mult - Convert the IB rate enum to a multiple of the base rate of 2.5 Gbit/sec. For example, IBV_RATE_5_GBPS will be converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. Rate to mbps - Convert IB rate enum to the mbps value. conversion done by multiplication of IB rate in mbps from IB spec and width needed to reach the rate. For example, 400 GBPS is reached by HDR 8x so the mbps rate is 53.125 Gbit/sec * 8 = 425,000 mbps. In addition, speed_str() and width_str() as part of ibv_devinfo were updated to consider the new HDR and 2x options. Signed-off-by: Michael Guralnik Signed-off-by: Yishai Hadas --- libibverbs/examples/devinfo.c | 2 ++ libibverbs/verbs.c | 16 ++++++++++++++++ libibverbs/verbs.h | 6 +++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index 5bbe936..735adb1 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -128,6 +128,7 @@ static const char *width_str(uint8_t width) case 2: return "4"; case 4: return "8"; case 8: return "12"; + case 16: return "2"; default: return "invalid width"; } } @@ -143,6 +144,7 @@ static const char *speed_str(uint8_t speed) case 16: return "14.0 Gbps"; case 32: return "25.0 Gbps"; + case 64: return "50.0 Gbps"; default: return "invalid speed"; } } diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index 3540ef2..9cdc361 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -69,6 +69,10 @@ int __attribute__((const)) ibv_rate_to_mult(enum ibv_rate rate) case IBV_RATE_60_GBPS: return 24; case IBV_RATE_80_GBPS: return 32; case IBV_RATE_120_GBPS: return 48; + case IBV_RATE_28_GBPS: return 11; + case IBV_RATE_50_GBPS: return 20; + case IBV_RATE_400_GBPS: return 160; + case IBV_RATE_600_GBPS: return 240; default: return -1; } } @@ -85,6 +89,10 @@ enum ibv_rate __attribute__((const)) mult_to_ibv_rate(int mult) case 24: return IBV_RATE_60_GBPS; case 32: return IBV_RATE_80_GBPS; case 48: return IBV_RATE_120_GBPS; + case 11: return IBV_RATE_28_GBPS; + case 20: return IBV_RATE_50_GBPS; + case 160: return IBV_RATE_400_GBPS; + case 240: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } @@ -109,6 +117,10 @@ int __attribute__((const)) ibv_rate_to_mbps(enum ibv_rate rate) case IBV_RATE_100_GBPS: return 103125; case IBV_RATE_200_GBPS: return 206250; case IBV_RATE_300_GBPS: return 309375; + case IBV_RATE_28_GBPS: return 28125; + case IBV_RATE_50_GBPS: return 53125; + case IBV_RATE_400_GBPS: return 425000; + case IBV_RATE_600_GBPS: return 637500; default: return -1; } } @@ -133,6 +145,10 @@ enum ibv_rate __attribute__((const)) mbps_to_ibv_rate(int mbps) case 103125: return IBV_RATE_100_GBPS; case 206250: return IBV_RATE_200_GBPS; case 309375: return IBV_RATE_300_GBPS; + case 28125: return IBV_RATE_28_GBPS; + case 53125: return IBV_RATE_50_GBPS; + case 425000: return IBV_RATE_400_GBPS; + case 637500: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 40a7280..c9491a7 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -661,7 +661,11 @@ enum ibv_rate { IBV_RATE_25_GBPS = 15, IBV_RATE_100_GBPS = 16, IBV_RATE_200_GBPS = 17, - IBV_RATE_300_GBPS = 18 + IBV_RATE_300_GBPS = 18, + IBV_RATE_28_GBPS = 19, + IBV_RATE_50_GBPS = 20, + IBV_RATE_400_GBPS = 21, + IBV_RATE_600_GBPS = 22, }; /** From patchwork Sun Dec 23 17:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741767 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 ACD4517E8 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92239283B1 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 862392873E; Sun, 23 Dec 2018 17:15:24 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 40B0A283B1 for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725811AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41690 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725554AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:38 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEX0030340; Sun, 23 Dec 2018 19:15:14 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEEm007184; Sun, 23 Dec 2018 19:15:14 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFEug007183; Sun, 23 Dec 2018 19:15:14 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 6/6] mlx5: Add translation of new IB rates to mlx5 rates Date: Sun, 23 Dec 2018 19:14:57 +0200 Message-Id: <1545585297-6677-7-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Michael Guralnik Add translation of new IB rates added due to 2x and HDR support. Signed-off-by: Michael Guralnik Signed-off-by: Yishai Hadas --- providers/mlx5/verbs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 7d4ad33..bab675f 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -2361,6 +2361,10 @@ static const uint8_t ib_to_mlx5_rate_table[] = { 15, /* 100 Gbps to 120 Gbps */ 0, /* 200 Gbps to unlimited */ 0, /* 300 Gbps to unlimited */ + 9, /* 28 Gbps to 30 Gbps */ + 13, /* 50 Gbps to 60 Gbps */ + 0, /* 400 Gbps to unlimited */ + 0, /* 600 Gbps to unlimited */ }; static uint8_t ah_attr_to_mlx5_rate(enum ibv_rate ah_static_rate)