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 9E2CAA0093;
	Tue, 19 May 2020 20:20:28 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id AA7F51D17E;
	Tue, 19 May 2020 20:20:27 +0200 (CEST)
Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com
 [209.85.167.182]) by dpdk.org (Postfix) with ESMTP id 9E9581C0D4
 for <dev@dpdk.org>; Tue, 19 May 2020 20:20:26 +0200 (CEST)
Received: by mail-oi1-f182.google.com with SMTP id 19so578084oiy.8
 for <dev@dpdk.org>; Tue, 19 May 2020 11:20:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=radio-canada-ca.20150623.gappssmtp.com; s=20150623;
 h=mime-version:from:date:message-id:subject:to;
 bh=9B0n6dh6ZJn7svX/bzT7RALs5C4lGpGzG+Xi6YUlhHk=;
 b=wydztfLiDkpQfqESM9qXjGPqKEAslvkOfNDn9gZdlX7wEUMLjgySG1UaKRydxGOt8Q
 wlKkLaYmiXFewdnI8kEzRNrGAM+F112xca8NyMwm0GAXqBoDDEIRyqXPT6NLCYvGkEF2
 YLbHwqPbUmRJxbP6usMURzumk3aaU+ld991ndbDa6HwUMXm+WftKYwLTd2TiaI6OIcmA
 HhF6l6T4KauXmuiLFAjAZwSZzzgLs7Uq5QanlXpkZG4yxxTzCbPJ+DoI+stKhbkaq/Uk
 bHd9nZZIAFp3Kawx7KWnMbLWMKTEEf8stKrMnDDVk5+akBq9ajfUSBJjx6MCnd8HLiaO
 Q7Pg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=9B0n6dh6ZJn7svX/bzT7RALs5C4lGpGzG+Xi6YUlhHk=;
 b=B35P8NfHQxAoQLufADh8wGseEqHR18bM3wbdIc0FGdACijSQM4hbkBDpqBqFhFTowQ
 pO+t9Hfz9Bwzef5eNH6uR/EzsdR7fNBMu0eeaeV7WJ5V6fmWby+4RBDaJDw30e289Lvo
 tZwKAFkBy5brmxpfdWEqUQE72GBonno0vcys5IYe7g64sa+Xs6ZtxRJZKur/k4T7DwEl
 RmdlIyzX2nYU7OQ2rHoDDEfyL8LSAAxGmqtRIsXCk2f9mO/ToOr/nYlY0zBBkp+CKKuZ
 f81rfaeyhfUQIwn5pqgIQ0cmi+g2CzEsMo3XjDaLZbis5BGwV/Ewjix64M1dW/TPzOaT
 vTrw==
X-Gm-Message-State: AOAM530o3cj7Zwo2R7JqJXXGsQ66xjCVKQ/zet2AIzmwQhDjxJG/dEXd
 GOBnujWBmGmJ+UvrK3QtIuOTRRG4FhgYmpgokgs8boQr
X-Google-Smtp-Source: ABdhPJxKCqCUqqRWbZjDbqA24PIcUbqtZDgcMF4BJ2ysbky0jKSx606draiuAQauwW/8ZoCblcZyp6/dpeIuX4c2ybM=
X-Received: by 2002:a54:468e:: with SMTP id k14mr550999oic.132.1589912424663; 
 Tue, 19 May 2020 11:20:24 -0700 (PDT)
MIME-Version: 1.0
From: PATRICK KEROULAS <patrick.keroulas@radio-canada.ca>
Date: Tue, 19 May 2020 14:20:13 -0400
Message-ID: <CALEF-=A1qHi_9fdi6MQpMQrmhnjxsnEA9dMfviApU2mgnMddCQ@mail.gmail.com>
To: dev@dpdk.org
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Subject: [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>

Hello,

I'm trying to build an accurate capture device based on Mellanox
Connect-X5 with following requirements:
- capture every incoming packets with hardware timestamps
- output: pcap with timestamps in nanoseconds
My problem is that the packets forwarded to `dpdk-pdump` carry raw
timestamps from NIC clock.

mlx5 part of libibverbs includes a ts-to-ns converter which takes the
instantaneous clock info. It's unused in dpdk so far. I've tested it in the
device/port init routine and the result looks reliable. Since this approach
looks very simple, compared to the time sync mechanism, I'm trying to
integrate.

The conversion should occur in the primary process (testpmd) I suppose.
1) The needed clock info derives from ethernet device. Is it possible to
   access that struct from a rx callback?
2) how to attach the nanosecond to mbuf so that `pdump` catches it?
   (workaround: copy `mbuf->udata64` in forwarded packets.)
3) any other idea?

Regards,

Patrick