From patchwork Wed Sep 6 14:38:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9940907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4531C60350 for ; Wed, 6 Sep 2017 14:39:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29CFB201B0 for ; Wed, 6 Sep 2017 14:39:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CB10205AB; Wed, 6 Sep 2017 14:39:21 +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=-6.9 required=2.0 tests=BAYES_00, 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 8B340201B0 for ; Wed, 6 Sep 2017 14:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932565AbdIFOjR (ORCPT ); Wed, 6 Sep 2017 10:39:17 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:46854 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932558AbdIFOjQ (ORCPT ); Wed, 6 Sep 2017 10:39:16 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Sep 2017 17:39:12 +0300 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 v86EdCif017362; Wed, 6 Sep 2017 17:39:12 +0300 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 v86EdCUt015339; Wed, 6 Sep 2017 17:39:12 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v86EdCS3015338; Wed, 6 Sep 2017 17:39:12 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 1/3] verbs: Enable creating QP with a given source QP number Date: Wed, 6 Sep 2017 17:38:47 +0300 Message-Id: <1504708729-15249-2-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1504708729-15249-1-git-send-email-yishaih@mellanox.com> References: <1504708729-15249-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 Enable QP creation with a given source QP number. The created QP will use the source QPN as its wire QP number. This comes as a pre-patch for downstream patches in this series to allow user space applications to accelerate traffic which is typically handled by IPoIB ULP. In the IPoIB use case, the source QPN can be achieved by using some networking tool as of ifconfig, ip link show on the interface and use the value of 3 bytes from the hardware address starting after the first byte. Signed-off-by: Yishai Hadas --- libibverbs/cmd.c | 6 +++++- libibverbs/kern-abi.h | 2 +- libibverbs/man/ibv_create_qp_ex.3 | 1 + libibverbs/verbs.h | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 7a266ee..9d2140f 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -927,7 +927,8 @@ static void create_qp_handle_resp_common(struct ibv_context *context, enum { CREATE_QP_EX2_SUP_CREATE_FLAGS = IBV_QP_CREATE_BLOCK_SELF_MCAST_LB | IBV_QP_CREATE_SCATTER_FCS | - IBV_QP_CREATE_CVLAN_STRIPPING, + IBV_QP_CREATE_CVLAN_STRIPPING | + IBV_QP_CREATE_SOURCE_QPN, }; int ibv_cmd_create_qp_ex2(struct ibv_context *context, @@ -967,6 +968,9 @@ int ibv_cmd_create_qp_ex2(struct ibv_context *context, sizeof(qp_attr->create_flags)) return EINVAL; cmd->create_flags = qp_attr->create_flags; + + if (qp_attr->create_flags & IBV_QP_CREATE_SOURCE_QPN) + cmd->source_qpn = qp_attr->source_qpn; } if (qp_attr->comp_mask & IBV_QP_INIT_ATTR_IND_TABLE) { diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h index 8d42faf..3a0e02a 100644 --- a/libibverbs/kern-abi.h +++ b/libibverbs/kern-abi.h @@ -679,7 +679,7 @@ struct ibv_create_qp_ex { __u32 comp_mask; __u32 create_flags; __u32 ind_tbl_handle; - __u32 reserved1; + __u32 source_qpn; }; struct ibv_create_qp_resp_ex { diff --git a/libibverbs/man/ibv_create_qp_ex.3 b/libibverbs/man/ibv_create_qp_ex.3 index 99ae497..3272c09 100644 --- a/libibverbs/man/ibv_create_qp_ex.3 +++ b/libibverbs/man/ibv_create_qp_ex.3 @@ -38,6 +38,7 @@ enum ibv_qp_create_flags create_flags; /* Creation flags for this QP */ uint16_t max_tso_header; /* Maximum TSO header size */ struct ibv_rwq_ind_table *rwq_ind_tbl; /* Indirection table to be associated with the QP */ struct ibv_rx_hash_conf rx_hash_conf; /* RX hash configuration to be used */ +uint32_t source_qpn; /* Source QP number, creation flag IBV_QP_CREATE_SOURCE_QPN should be set */ .in -8 }; .sp diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 922a011..3c8b2c9 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -790,6 +790,7 @@ enum ibv_qp_create_flags { IBV_QP_CREATE_BLOCK_SELF_MCAST_LB = 1 << 1, IBV_QP_CREATE_SCATTER_FCS = 1 << 8, IBV_QP_CREATE_CVLAN_STRIPPING = 1 << 9, + IBV_QP_CREATE_SOURCE_QPN = 1 << 10, }; struct ibv_rx_hash_conf { @@ -817,6 +818,7 @@ struct ibv_qp_init_attr_ex { uint16_t max_tso_header; struct ibv_rwq_ind_table *rwq_ind_tbl; struct ibv_rx_hash_conf rx_hash_conf; + uint32_t source_qpn; }; enum ibv_qp_open_attr_mask {