From patchwork Wed Apr 5 15:19:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9664473 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 43A3060353 for ; Wed, 5 Apr 2017 15:26:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 344B72852E for ; Wed, 5 Apr 2017 15:26:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28B9B2856D; Wed, 5 Apr 2017 15:26:31 +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 A951B2852E for ; Wed, 5 Apr 2017 15:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932636AbdDEP0Y (ORCPT ); Wed, 5 Apr 2017 11:26:24 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52611 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755627AbdDEPYu (ORCPT ); Wed, 5 Apr 2017 11:24:50 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 5 Apr 2017 18:19:54 +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 v35FJrki006110; Wed, 5 Apr 2017 18:19:53 +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 v35FJrQN019833; Wed, 5 Apr 2017 18:19:53 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v35FJrAC019831; Wed, 5 Apr 2017 18:19:53 +0300 From: Yishai Hadas To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, artemyko@mellanox.com, yishaih@mellanox.com, maorg@mellanox.com, majd@mellanox.com, Moses Reuben Subject: [PATCH rdma-core 4/5] ibverbs: Add support for reading flow tag from a CQ Date: Wed, 5 Apr 2017 18:19:23 +0300 Message-Id: <1491405564-19735-5-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1491405564-19735-1-git-send-email-yishaih@mellanox.com> References: <1491405564-19735-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: Artemy Kovalyov Each steering flow may be marked with a tag which exposed in the completion. Extend the poll_cq_ex mechanism with read_flow_tag callback which reads the flow tag from the work completion. Signed-off-by: Moses Reuben Signed-off-by: Artemy Kovalyov Reviewed-by: Maor Gottlieb Reviewed-by: Yishai Hadas --- libibverbs/man/ibv_create_cq_ex.3 | 4 ++++ libibverbs/verbs.h | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3 index 020bbb4..7dfbef2 100644 --- a/libibverbs/man/ibv_create_cq_ex.3 +++ b/libibverbs/man/ibv_create_cq_ex.3 @@ -42,6 +42,7 @@ enum ibv_wc_flags_ex { IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 6, /* Require dlid path bits in WC */ IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 7, /* Require completion timestamp in WC /* IBV_WC_EX_WITH_CVLAN = 1 << 8, /* Require VLAN info in WC */ + IBV_WC_EX_WITH_FLOW_TAG = 1 << 9, /* Require flow tag in WC */ }; enum ibv_cq_init_attr_mask { @@ -133,6 +134,9 @@ Below members and functions are used in order to poll the current completion. Th .BI "uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex " "*cq"); \c Get the CVLAN field from the current completion. +.BI "uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex " "*cq"); \c + Get flow tag from the current completion. + .SH "RETURN VALUE" .B ibv_create_cq_ex() returns a pointer to the CQ, or NULL if the request fails. diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 5a4dcbc..b27dfd1 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -437,6 +437,7 @@ enum ibv_create_cq_wc_flags { IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 6, IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 7, IBV_WC_EX_WITH_CVLAN = 1 << 8, + IBV_WC_EX_WITH_FLOW_TAG = 1 << 9, }; enum { @@ -452,7 +453,8 @@ enum { enum { IBV_CREATE_CQ_SUP_WC_FLAGS = IBV_WC_STANDARD_FLAGS | IBV_WC_EX_WITH_COMPLETION_TIMESTAMP | - IBV_WC_EX_WITH_CVLAN + IBV_WC_EX_WITH_CVLAN | + IBV_WC_EX_WITH_FLOW_TAG }; enum ibv_wc_flags { @@ -1100,6 +1102,7 @@ struct ibv_cq_ex { uint8_t (*read_dlid_path_bits)(struct ibv_cq_ex *current); uint64_t (*read_completion_ts)(struct ibv_cq_ex *current); uint16_t (*read_cvlan)(struct ibv_cq_ex *current); + uint32_t (*read_flow_tag)(struct ibv_cq_ex *current); }; static inline struct ibv_cq *ibv_cq_ex_to_cq(struct ibv_cq_ex *cq) @@ -1183,6 +1186,11 @@ static inline uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex *cq) return cq->read_cvlan(cq); } +static inline uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex *cq) +{ + return cq->read_flow_tag(cq); +} + static inline int ibv_post_wq_recv(struct ibv_wq *wq, struct ibv_recv_wr *recv_wr, struct ibv_recv_wr **bad_recv_wr)