From patchwork Tue Oct 27 16:52:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 7498881 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AA6859F6CD for ; Tue, 27 Oct 2015 16:55:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF7C8208D1 for ; Tue, 27 Oct 2015 16:55:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E12AC2086C for ; Tue, 27 Oct 2015 16:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932594AbbJ0QzQ (ORCPT ); Tue, 27 Oct 2015 12:55:16 -0400 Received: from [193.47.165.129] ([193.47.165.129]:51760 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932543AbbJ0QzP (ORCPT ); Tue, 27 Oct 2015 12:55:15 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Oct 2015 18:54:46 +0200 Received: from rsws33.mtr.labs.mlnx (dev-r-vrt-064.mtr.labs.mlnx [10.212.64.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t9RGsjLg018926; Tue, 27 Oct 2015 18:54:46 +0200 From: Matan Barak To: Yishai Hadas Cc: linux-rdma@vger.kernel.org, Matan Barak , Eran Ben Elisha , Jason Gunthorpe , Christoph Lameter Subject: [PATCH libibverbs 4/7] Add timestmap support to extended poll_cq verb Date: Tue, 27 Oct 2015 18:52:32 +0200 Message-Id: <1445964755-13371-5-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445964755-13371-1-git-send-email-matanb@mellanox.com> References: <1445964755-13371-1-git-send-email-matanb@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adding support to the extended version of poll_cq verb to read completion timestamp. Reading timestamp isn't supported with reading IBV_WC_EX_WITH_SL and IBV_WC_EX_WITH_SLID. Signed-off-by: Matan Barak --- src/cq.c | 10 ++++++++++ src/mlx4.h | 25 ++++++++++++++++++++----- src/verbs.c | 3 ++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/cq.c b/src/cq.c index c86e824..7f40f12 100644 --- a/src/cq.c +++ b/src/cq.c @@ -399,6 +399,16 @@ static inline int _mlx4_poll_one_ex(struct mlx4_cq *cq, if (err != CQ_CONTINUE) return err; + if (wc_flags & IBV_WC_EX_WITH_COMPLETION_TIMESTAMP) { + uint16_t timestamp_0_15 = cqe->timestamp_0_7 | + cqe->timestamp_8_15 << 8; + + wc_flags_out |= IBV_WC_EX_WITH_COMPLETION_TIMESTAMP; + *wc_buffer.b64++ = (((uint64_t)ntohl(cqe->timestamp_16_47) + + !timestamp_0_15) << 16) | + (uint64_t)timestamp_0_15; + } + if (is_send) { switch (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) { case MLX4_OPCODE_RDMA_WRITE_IMM: diff --git a/src/mlx4.h b/src/mlx4.h index e22f879..2465298 100644 --- a/src/mlx4.h +++ b/src/mlx4.h @@ -312,14 +312,29 @@ struct mlx4_cqe { uint32_t vlan_my_qpn; uint32_t immed_rss_invalid; uint32_t g_mlpath_rqpn; - uint8_t sl_vid; - uint8_t reserved1; - uint16_t rlid; - uint32_t status; + union { + struct { + union { + struct { + uint8_t sl_vid; + uint8_t reserved1; + uint16_t rlid; + }; + uint32_t timestamp_16_47; + }; + uint32_t status; + }; + struct { + uint16_t reserved2; + uint8_t smac[6]; + }; + }; uint32_t byte_cnt; uint16_t wqe_index; uint16_t checksum; - uint8_t reserved3[3]; + uint8_t reserved3; + uint8_t timestamp_8_15; + uint8_t timestamp_0_7; uint8_t owner_sr_opcode; }; diff --git a/src/verbs.c b/src/verbs.c index 0dcdc87..a8d6bd7 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -286,7 +286,8 @@ enum { }; enum { - CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS + CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS | + IBV_WC_EX_WITH_COMPLETION_TIMESTAMP }; static struct ibv_cq *create_cq(struct ibv_context *context,