From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D1C96A00C5;
	Fri, 29 May 2020 22:56:16 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 22A881DA35;
	Fri, 29 May 2020 22:56:15 +0200 (CEST)
Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com
 [209.85.210.53]) by dpdk.org (Postfix) with ESMTP id 1F3ED1DA30
 for <dev@dpdk.org>; Fri, 29 May 2020 22:56:13 +0200 (CEST)
Received: by mail-ot1-f53.google.com with SMTP id u23so2995263otq.10
 for <dev@dpdk.org>; Fri, 29 May 2020 13:56:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=radio-canada-ca.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=CiAGKIc1gy7KET6NugOj0JaV032w/oJQhIin35lHOMo=;
 b=EK2sKiTMG6/gKxvn5T3y8BplFAOInaPJXPTpPGje6nDPL+xHhx+UoD1oKL9iw6WcfC
 JrVmezEsw98ADZwiAvKbiqaWS/YgRqWdIszDskPWCa9fM4gKrLwLbbAH33vEoCLB8AS3
 Byo0aaUQ7Au+mNM/w8ekq1D68I3m+wYPG1q2t5yx55gIQ3ubXyV2MBC/0g6e0bnmR+bt
 36i+McGDxCsvb9Jrr+cS1nVPvyuyVNO6aLIRRtRi69/4N2zP9+jO0Uz6r1lcbzvwkr4b
 L7ys1rzIWZfoxV/nKQH4ctUkIrcN54Kr13aEc7Q8k/r8DFLiQnxT8VKLIWG8vL0QZgug
 LkyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=CiAGKIc1gy7KET6NugOj0JaV032w/oJQhIin35lHOMo=;
 b=HE0qWh0/k7mgPUVpELRn0S8LQzew36IxtHeX1lV9r74PnNCuzeRasbPkgCJrebClBk
 M9MDGv7BLVw0We5tuuMWSf/LS6N9zFqd+vGay+3jZL5LIMVjJ+Ng/lZlmzzj/tttViFq
 5jXciinZUkZ7hIg5vT+o4e5tAop7fBCBBfJZsuak/W4+Yy7Dfnd+cjjmhkEfmFDEbJjA
 wmGb3/sTAlETBPpXAHyeev6lirR5vgIchpFXtyy/S+8xK1SvYGoCvsvHVyxznFxwh/9I
 GCO/DYAV2sIPHUt3+SHJqitaCTTcdAE91ecyz60Sz8E6G4DadMF0sPjFt08mgLgNlAs3
 7mIA==
X-Gm-Message-State: AOAM531KYByluOWp/J1moom68w0N/jnWLlDpRem2NwahDRBjSEmbX8UL
 4OpOcp4ByKdqTv7HYxz4/uDtqYrdYPg9zR2uTkI3Rg==
X-Google-Smtp-Source: ABdhPJzMMEYhfeARpFxN0p7w4ZgkzvWYVH1Zg5N2FBpfxK0fHj2aW2a1x7MUo2J9anmFwoJ1Rv+GujC9uYEHRfWEIcY=
X-Received: by 2002:a9d:65d7:: with SMTP id z23mr2270864oth.319.1590785771748; 
 Fri, 29 May 2020 13:56:11 -0700 (PDT)
MIME-Version: 1.0
References: <CALEF-=A1qHi_9fdi6MQpMQrmhnjxsnEA9dMfviApU2mgnMddCQ@mail.gmail.com>
 <3986292.sUUuQTochr@thomas>
 <CALEF-=Bft3byhx6w7HL-fq_s4Y3VcJ1u6BGN6B5aMCVWam=P8g@mail.gmail.com>
 <2766519.SlWGiteSXv@thomas>
 <CALEF-=AGL=rCSYhZyWYcD8G7Z1d5r+fUX_NZWpp9FzH6UDuwiw@mail.gmail.com>
 <AM4PR05MB3265F9A5814408F1E961ECDED2B00@AM4PR05MB3265.eurprd05.prod.outlook.com>
In-Reply-To: <AM4PR05MB3265F9A5814408F1E961ECDED2B00@AM4PR05MB3265.eurprd05.prod.outlook.com>
From: PATRICK KEROULAS <patrick.keroulas@radio-canada.ca>
Date: Fri, 29 May 2020 16:56:00 -0400
Message-ID: <CALEF-=D-qtmO-urE4WB3xJCPO1d086a4T=0isk3xhd=90RpJcQ@mail.gmail.com>
To: Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Vivien Didelot <vivien.didelot@gmail.com>, 
 Shahaf Shuler <shahafs@mellanox.com>,
 Raslan Darawsheh <rasland@mellanox.com>, Matan Azrad <matan@mellanox.com>
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Subject: Re: [dpdk-dev] mlx5 & pdump: convert HW timestamps to nanoseconds
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, May 26, 2020 at 12:00 PM Slava Ovsiienko <viacheslavo@mellanox.com>
wrote:
>> Hi, Patrick
>
> ConnectX HW timestamp is the captured value of internal 64-bit counter
running at the frequency,
> reported in the device_frequency_khz field of struct
mlx5_ifc_cmd_hca_cap_bits{}.
> This structure is queried in mlx5_devx_cmd_query_hca_attr() routine.
> So, with known frequency it is possible to recalculate timestamp ticks to
desired units.

Hello Slava,

Assuming that the NIC clock is already synced thanks to a PTP client,
does the bit counter give an absolute time value (0 => 1 January 1970
00:00:00)? Or do I need to calculate a time duration from the process
start time?

I just want to validate the path from mlx5 eth dev(Rx) to eth pcap (Tx) :
- query the oscillator frequency at the mlx5_eth_dev init step
  (mlx5_devx_cmd_query_hca_attr())
- store the freq with other hca_attr, carried by dev config which should
  be shared with the secondary process
- in eth_pcap_tx_dumper(), retrieve the freq from the dev given by
  mbuf->port
- convert all the incoming mbuf->timestamp using this freq whose
  variation should be negligible over the capture duration

Last question: what is your opinion about this other method?
https://github.com/linux-rdma/rdma-core/blob/7af01c79e00555207dee6132d72e7bfc1bb5485e/providers/mlx5/mlx5dv.h#L1201

Thanks a lot!