From patchwork Mon Jun 12 06:42:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artemy Kovalyov X-Patchwork-Id: 9780487 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 A5FB5602DA for ; Mon, 12 Jun 2017 06:42:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95D8227CAF for ; Mon, 12 Jun 2017 06:42:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A565284C3; Mon, 12 Jun 2017 06:42:58 +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 F258327CAF for ; Mon, 12 Jun 2017 06:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbdFLGm4 (ORCPT ); Mon, 12 Jun 2017 02:42:56 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45595 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752373AbdFLGmz (ORCPT ); Mon, 12 Jun 2017 02:42:55 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from artemyko@mellanox.com) with ESMTPS (AES256-SHA encrypted); 12 Jun 2017 09:42:48 +0300 Received: from hpchead.mtr.labs.mlnx. (hpchead.mtr.labs.mlnx [10.209.44.59]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v5C6glRH025263; Mon, 12 Jun 2017 09:42:47 +0300 From: Artemy Kovalyov To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, liranl@mellanox.com, yosefe@mellanox.com, leonro@mellanox.com, anag@mellanox.com, Artemy Kovalyov Subject: [RFC 3/5] verbs: Tag matching list manipulation interface Date: Mon, 12 Jun 2017 09:42:45 +0300 Message-Id: <1497249767-15353-4-git-send-email-artemyko@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1497249767-15353-1-git-send-email-artemyko@mellanox.com> References: <1497249767-15353-1-git-send-email-artemyko@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 TM-SRQ shows demand of robust offload configuration primitive. This patch introduced a new verb named ibv_post_srq_ops() to supply an API to perform such operations like tag matching list manipulations. Change-Id: I9fd8df2152b12f06b6b1545afec9ea1a259c0f58 Signed-off-by: Artemy Kovalyov Reviewed-by: Yishai Hadas --- libibverbs/verbs.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 120471a..42d7967 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -420,7 +420,8 @@ enum ibv_wc_status { IBV_WC_INV_EEC_STATE_ERR, IBV_WC_FATAL_ERR, IBV_WC_RESP_TIMEOUT_ERR, - IBV_WC_GENERAL_ERR + IBV_WC_GENERAL_ERR, + IBV_WC_TM_ERR }; const char *ibv_wc_status_str(enum ibv_wc_status status); @@ -438,7 +439,11 @@ enum ibv_wc_opcode { * receive by testing (opcode & IBV_WC_RECV). */ IBV_WC_RECV = 1 << 7, - IBV_WC_RECV_RDMA_WITH_IMM + IBV_WC_RECV_RDMA_WITH_IMM, + + IBV_WC_TM_ADD, + IBV_WC_TM_DEL, + IBV_WC_TM_SYNC }; enum { @@ -479,7 +484,8 @@ enum ibv_wc_flags { IBV_WC_GRH = 1 << 0, IBV_WC_WITH_IMM = 1 << 1, IBV_WC_IP_CSUM_OK = 1 << IBV_WC_IP_CSUM_OK_SHIFT, - IBV_WC_WITH_INV = 1 << 3 + IBV_WC_WITH_INV = 1 << 3, + IBV_WC_TM_SYNC_REQ = 1 << 4 }; struct ibv_wc { @@ -1011,6 +1017,35 @@ struct ibv_recv_wr { int num_sge; }; +enum ibv_ops_wr_opcode { + IBV_WR_TAG_ADD, + IBV_WR_TAG_DEL, + IBV_WR_TAG_SYNC +}; + +enum ibv_ops_flags { + IBV_OPS_SIGNALED = 1 << 0, + IBV_OPS_TM_SYNC = 1 << 1 +}; + +struct ibv_ops_wr { + uint64_t wr_id; + struct ibv_ops_wr *next; + enum ibv_ops_wr_opcode opcode; + int flags; + struct { + uint32_t unexpected_cnt; + uint32_t handle; + struct { + uint64_t recv_wr_id; + struct ibv_sge *sg_list; + int num_sge; + uint64_t tag; + uint64_t mask; + } add; + } tm; +}; + struct ibv_mw_bind { uint64_t wr_id; int send_flags; @@ -1540,6 +1575,9 @@ enum verbs_context_mask { struct verbs_context { /* "grows up" - new fields go here */ + int (*post_srq_ops)(struct ibv_srq *srq, + struct ibv_ops_wr *op, + struct ibv_ops_wr **bad_op); int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table); struct ibv_rwq_ind_table *(*create_rwq_ind_table)(struct ibv_context *context, struct ibv_rwq_ind_table_init_attr *init_attr); @@ -2038,6 +2076,20 @@ static inline int ibv_post_srq_recv(struct ibv_srq *srq, return srq->context->ops.post_srq_recv(srq, recv_wr, bad_recv_wr); } +static inline int ibv_post_srq_ops(struct ibv_srq *srq, + struct ibv_ops_wr *op, + struct ibv_ops_wr **bad_op) +{ + struct verbs_context *vctx; + + vctx = verbs_get_ctx_op(srq->context, post_srq_ops); + if (!vctx) { + *bad_op = op; + return ENOSYS; + } + return vctx->post_srq_ops(srq, op, bad_op); +} + /** * ibv_create_qp - Create a queue pair. */