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 6FB17A0093;
	Thu, 21 May 2020 21:57:15 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5011D1D721;
	Thu, 21 May 2020 21:57:14 +0200 (CEST)
Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com
 [209.85.161.41]) by dpdk.org (Postfix) with ESMTP id 9C3081D708
 for <dev@dpdk.org>; Thu, 21 May 2020 21:57:12 +0200 (CEST)
Received: by mail-oo1-f41.google.com with SMTP id p67so1686667ooa.11
 for <dev@dpdk.org>; Thu, 21 May 2020 12:57: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=z1V75voSFTqYk5CThil1ICOjZyjf0dH14lQq38uGJ+Q=;
 b=sC06/IYLKIcPGcF1rZ/0exGu1pV7wI6eMa/LaYzaKCW4fQNjAuBVT4XW7PXbGvNQ0K
 o8uILCPxSWlUG4dl4xg21OOzkAP3WKHyo6yfJC9TQRBWvUCfWDp6KhrO6vaTailq1tzD
 P4xr1eCqP0/IX/HdnEpyQOYM0UQyIN1T2S1+yEiiyOqDHMIrhNDlMzpimpKS4VYDpRCt
 yEvZhi28S6m/4hpXbZGqlzTTCOonYitdZyI/xncVOASVXuS2n2hFJo+SVGLafOaZeyq4
 8WI2ZaOz3VjycT+e7nawgKh8Kaj8x5dZx7+vJ0uzz11VLw9d4N3mqcoYlbc/zW0Wsog+
 OK5A==
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=z1V75voSFTqYk5CThil1ICOjZyjf0dH14lQq38uGJ+Q=;
 b=WNfhCAEM7ZjDiY1bL8L29KQ3th4o+Nm8rAebHlzQw6wEhS2wZw/yH84v3PQJra4Px9
 Qj42BVboTKqaYGlyGQ69AikGVT9wuhjVGTQwB8NcgH6PZsLG88szCpdnFJlc7OqZebFD
 OrN2fgqQE/3f0y5qGjd+AWyKSH4lvi+H+SL3SE41q8Q7X7Ds/QlppFdxRh2EuCade88j
 pCg+8IzCo8bt//HHlIfbNfwW0WfRdDmPokV7qhbmvnHKszfLgAUQ4nyz0GlkxrZiiPw4
 J/NpM8g4ApExzfL/A9XmRu5Q5LHI3BFAh8j1iy6OxSrroCWX6i6CajNwUoNLWhNavkYC
 77Cw==
X-Gm-Message-State: AOAM530EvaTWP5YHO9UFIbionP4Op4YfTzXPTC4vs3dYWFLxKi19+oFh
 6m014FZYrHP+wZRQAEe1f4/VoivSC0afjk3ntiqt3w==
X-Google-Smtp-Source: ABdhPJyQclXJeyj0Rj/M66BPpG/2BFsTc2Dn9iNB6jfjfynX8XQ1GaBAuD+eJPQB0aHeSwcDWnV+SaOo6Jpmi5t8TSo=
X-Received: by 2002:a05:6820:229:: with SMTP id j9mr267229oob.32.1590091031744; 
 Thu, 21 May 2020 12:57:11 -0700 (PDT)
MIME-Version: 1.0
References: <CALEF-=A1qHi_9fdi6MQpMQrmhnjxsnEA9dMfviApU2mgnMddCQ@mail.gmail.com>
 <3986292.sUUuQTochr@thomas>
In-Reply-To: <3986292.sUUuQTochr@thomas>
From: PATRICK KEROULAS <patrick.keroulas@radio-canada.ca>
Date: Thu, 21 May 2020 15:57:00 -0400
Message-ID: <CALEF-=Bft3byhx6w7HL-fq_s4Y3VcJ1u6BGN6B5aMCVWam=P8g@mail.gmail.com>
To: Thomas Monjalon <thomas@monjalon.net>, dev@dpdk.org
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Content-Type: text/plain; charset="UTF-8"
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>

> > 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.
>
> Please could you describe how you use dpdk-pdump?
> Is it using the mlx5 PMD or pcap PMD?

We're actually using both:
# Rx, receive from NIC
CONFIG_RTE_LIBRTE_MLX5_PMD=y
# Tx, output to pcap file
CONFIG_RTE_LIBRTE_PMD_PCAP=y

$ sudo ./build/app/testpmd -w 0000:01:00.0 -w 0000:01:00.1 -n4 --
--enable-rx-timestamp
$ dpdk-pdump -- --pdump 'port=0,queue=*,rx-dev=capture.pcap'

We've sent this placeholder with the intention to start the discussion.
https://github.com/DPDK/dpdk/commit/bd371e1ba5bfc5b7092d712a01bbc28799fd58bc.patch
https://github.com/DPDK/dpdk/commit/e6f5c731c4ab27ab80b229af98c9b3d257e13843.patch

> > 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?
>
> The timestamp is carried in mbuf.
> Then the conversion must be done by the ethdev caller (application or
> any other upper layer).

What if the converter function needs a clock_info?
https://github.com/linux-rdma/rdma-core/blob/7af01c79e00555207dee6132d72e7bfc1bb5485e/providers/mlx5/mlx5dv.h#L1201
I'm affraid this info may change by the time the converter is called
by upper layer.

Thanks,
PK