From patchwork Wed Jan 17 13:51:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10169299 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 EB5E5603B5 for ; Wed, 17 Jan 2018 13:52:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7371251F4 for ; Wed, 17 Jan 2018 13:52:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C931E28450; Wed, 17 Jan 2018 13:52:05 +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 5AB66251F4 for ; Wed, 17 Jan 2018 13:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753316AbeAQNwA (ORCPT ); Wed, 17 Jan 2018 08:52:00 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41458 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753349AbeAQNv6 (ORCPT ); Wed, 17 Jan 2018 08:51:58 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 Jan 2018 15:51:54 +0200 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 w0HDpsv0015500; Wed, 17 Jan 2018 15:51:54 +0200 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 w0HDpsCR020830; Wed, 17 Jan 2018 15:51:54 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w0HDpsZM020829; Wed, 17 Jan 2018 15:51:54 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, ferasda@mellanox.com, jgg@mellanox.com, majd@mellanox.com, valex@mellanox.com, Eitan Rabin Subject: [PATCH rdma-core 4/5] verbs: Add support to read completion's timestamp in wall clock nanoseconds Date: Wed, 17 Jan 2018 15:51:32 +0200 Message-Id: <1516197093-20699-5-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1516197093-20699-1-git-send-email-yishaih@mellanox.com> References: <1516197093-20699-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: Feras Daoud Add support to read completion timestamp and convert it from HCA clock units to wallclock nanoseconds. This commit revises the documentation for ibv_wc_read_completion_ts to clarify the return value time units. Signed-off-by: Feras Daoud Signed-off-by: Eitan Rabin Reviewed-by: Yishai Hadas --- libibverbs/man/ibv_create_cq_ex.3 | 9 +++++++-- libibverbs/verbs.h | 10 +++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3 index 23f867c..51a6eb5 100644 --- a/libibverbs/man/ibv_create_cq_ex.3 +++ b/libibverbs/man/ibv_create_cq_ex.3 @@ -40,9 +40,10 @@ enum ibv_wc_flags_ex { IBV_WC_EX_WITH_SLID = 1 << 4, /* Require slid in WC */ IBV_WC_EX_WITH_SL = 1 << 5, /* Require sl in WC */ 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_COMPLETION_TIMESTAMP = 1 << 7, /* Require completion device 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 */ + IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK = 1 << 11, /* Require completion wallclock timestamp in WC */ }; enum ibv_cq_init_attr_mask { @@ -132,7 +133,11 @@ Below members and functions are used in order to poll the current completion. Th Get the dlid_path_bits field from the current completion. .BI "uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex " "*cq"); \c - Get the completion timestamp from the current completion. + Get the completion timestamp from the current completion in HCA clock units. + +.BI "uint64_t ibv_wc_read_completion_wallclock_ns(struct ibv_cq_ex " *cq "); +Get the completion timestamp from the current completion and convert it +from HCA clock units to wall clock nanoseconds. .BI "uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex " "*cq"); \c Get the CVLAN field from the current completion. diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 997597a..ddda03b 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -466,6 +466,7 @@ enum ibv_create_cq_wc_flags { IBV_WC_EX_WITH_CVLAN = 1 << 8, IBV_WC_EX_WITH_FLOW_TAG = 1 << 9, IBV_WC_EX_WITH_TM_INFO = 1 << 10, + IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK = 1 << 11, }; enum { @@ -483,7 +484,8 @@ enum { IBV_WC_EX_WITH_COMPLETION_TIMESTAMP | IBV_WC_EX_WITH_CVLAN | IBV_WC_EX_WITH_FLOW_TAG | - IBV_WC_EX_WITH_TM_INFO + IBV_WC_EX_WITH_TM_INFO | + IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK }; enum ibv_wc_flags { @@ -1205,6 +1207,7 @@ struct ibv_cq_ex { uint32_t (*read_flow_tag)(struct ibv_cq_ex *current); void (*read_tm_info)(struct ibv_cq_ex *current, struct ibv_wc_tm_info *tm_info); + uint64_t (*read_completion_wallclock_ns)(struct ibv_cq_ex *current); }; static inline struct ibv_cq *ibv_cq_ex_to_cq(struct ibv_cq_ex *cq) @@ -1307,6 +1310,11 @@ static inline uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex *cq) return cq->read_completion_ts(cq); } +static inline uint64_t ibv_wc_read_completion_wallclock_ns(struct ibv_cq_ex *cq) +{ + return cq->read_completion_wallclock_ns(cq); +} + static inline uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex *cq) { return cq->read_cvlan(cq);