From patchwork Wed Apr 5 15:19:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9664471 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 2219360353 for ; Wed, 5 Apr 2017 15:26:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12BED28500 for ; Wed, 5 Apr 2017 15:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 077F028533; Wed, 5 Apr 2017 15:26: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=-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 6871628500 for ; Wed, 5 Apr 2017 15:26:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932113AbdDEP0W (ORCPT ); Wed, 5 Apr 2017 11:26:22 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52617 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755628AbdDEPYu (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 v35FJrJB006113; Wed, 5 Apr 2017 18:19:54 +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 v35FJrO2019837; 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 v35FJrq4019836; 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 5/5] mlx5: Add read_flow_tag implementation Date: Wed, 5 Apr 2017 18:19:24 +0300 Message-Id: <1491405564-19735-6-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. Implement read_flow_tag which allows reading 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 --- providers/mlx5/cq.c | 9 +++++++++ providers/mlx5/mlx5.h | 4 ++++ providers/mlx5/verbs.c | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/providers/mlx5/cq.c b/providers/mlx5/cq.c index 85d0c33..2e8b584 100644 --- a/providers/mlx5/cq.c +++ b/providers/mlx5/cq.c @@ -1196,6 +1196,13 @@ static inline uint16_t mlx5_cq_read_wc_cvlan(struct ibv_cq_ex *ibcq) return be16toh(cq->cqe64->vlan_info); } +static inline uint32_t mlx5_cq_read_flow_tag(struct ibv_cq_ex *ibcq) +{ + struct mlx5_cq *cq = to_mcq(ibv_cq_ex_to_cq(ibcq)); + + return be32toh(cq->cqe64->sop_drop_qpn) & MLX5_FLOW_TAG_MASK; +} + #define BIT(i) (1UL << (i)) #define SINGLE_THREADED BIT(0) @@ -1270,6 +1277,8 @@ void mlx5_cq_fill_pfns(struct mlx5_cq *cq, const struct ibv_cq_init_attr_ex *cq_ cq->ibv_cq.read_completion_ts = mlx5_cq_read_wc_completion_ts; if (cq_attr->wc_flags & IBV_WC_EX_WITH_CVLAN) cq->ibv_cq.read_cvlan = mlx5_cq_read_wc_cvlan; + if (cq_attr->wc_flags & IBV_WC_EX_WITH_FLOW_TAG) + cq->ibv_cq.read_flow_tag = mlx5_cq_read_flow_tag; } int mlx5_arm_cq(struct ibv_cq *ibvcq, int solicited) diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h index bb383d4..0de40a8 100644 --- a/providers/mlx5/mlx5.h +++ b/providers/mlx5/mlx5.h @@ -184,6 +184,10 @@ enum mlx5_vendor_cap_flags { MLX5_VENDOR_CAP_FLAGS_MPW = 1 << 0, }; +enum { + MLX5_FLOW_TAG_MASK = 0x000fffff, +}; + struct mlx5_resource { enum mlx5_rsc_type type; uint32_t rsn; diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index b7a8502..f0e4aab 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -328,7 +328,8 @@ static int qp_sig_enabled(void) enum { CREATE_CQ_SUPPORTED_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 {