From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4A4B1A04A5; Sun, 24 May 2020 03:38:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 036171D62C; Sun, 24 May 2020 03:38:16 +0200 (CEST) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id 199BB1D628 for ; Sun, 24 May 2020 03:38:13 +0200 (CEST) Received: by mail-pj1-f65.google.com with SMTP id n15so6779797pjt.4 for ; Sat, 23 May 2020 18:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+e7av1WX978N+MV7OFM3WySu6N4nry/om15amvkDSds=; b=Nn3YXh8+zBkLlub60O6ChLRNR6g0dOFyk+2HbZbG30jmLkyJ49HX3ctaruy+AxGcEO zUzutp6yG/SxgDeBbSWzp+XUSvUQAcB0UgFralMC2XLYvyLuyoXMQD0MbMjyAKNheSXv h7EYj4cjFi/mmK4RUqnbq0dRhYNgiawZ/9pZFX8zXHWjzIQgLlvAN7xlY2ffDlinSCL+ I5PL7dPPJs8DmRaWcPzni7jZZ44Q/u1mdk5jTyHFXHhQSE0OlYsgrGNCywtmbytQia/e 9GY09hwvsfFzkchTatrwZRYoSTg/+6nfM1Zig9aNkn/GZh+MOgxhw0my1jCNpZEcbie1 EbfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+e7av1WX978N+MV7OFM3WySu6N4nry/om15amvkDSds=; b=nrZbdEE1SHWrYcOMi1Stjxv6q1RSAJiErfcrYBnIfLinnIejLhiY3Mwwub+E0QsN40 egv//H8bY3q+pwlxDRlBDAtcWUGxkgBJYOx0fN5MuVfz79p97ZROly7zR31xv8M2xdJu Ad3MZb0JP3XTZBZ04AWjz2/iGE628HYLrcqaMaiujZprhVFTdnVaoCx+jrYbHVweE5tt 1vSkEcgHzwraU0APc6ouoPxznLeWQhGhWlE//xE66q3O/43B8juw1th+I73pi7sbIEaV gYjkBXsDlptQrWviU0/oS1mh3Sr0OIiDn6LNRTsBGxdzMpeGjmIAfsE97TYvHfkSe9Ov CnFw== X-Gm-Message-State: AOAM533IwS20OCCIDyW3JkCGFwwxwssMaiNXpMYHAd4dQSQ2MP6OGhKn gE5WHUGESSeK0m2/57WVFXGIEQ== X-Google-Smtp-Source: ABdhPJz0rWIHjLmJPezZmxLNcZTFTjujS4XPptq5xwOCFdSNUK22tiPELhmNhpjpP/L0EBeoP/zyDg== X-Received: by 2002:a17:90a:cc05:: with SMTP id b5mr12976151pju.102.1590284293030; Sat, 23 May 2020 18:38:13 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id v1sm9156423pgl.11.2020.05.23.18.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 18:38:12 -0700 (PDT) Date: Sat, 23 May 2020 18:38:04 -0700 From: Stephen Hemminger To: Vivien Didelot Cc: dev@dpdk.org, patrick.keroulas@radio-canada.ca, thomas@monjalon.net Message-ID: <20200523183804.0887b17c@hermes.lan> In-Reply-To: <20200523172130.2285380-2-vivien.didelot@gmail.com> References: <20200523172130.2285380-1-vivien.didelot@gmail.com> <20200523172130.2285380-2-vivien.didelot@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] net/pcap: add TODO for writing Tx HW timestamp X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, 23 May 2020 13:21:30 -0400 Vivien Didelot wrote: > In order to write a packet with hardware timestamp enabled into a > PCAP file, we need to convert its device specific raw timestamp first. > > This might not be trivial since querying the raw clock value from > the device is still experimental, and derivating the frequency would > ideally require an additional alarm thread. > > As a first step, pass the mbuf to the timestamp calculation function > since mbuf->port and mbuf->timestamp would be needed, and add a TODO > note. No functional changes. > > Signed-off-by: Vivien Didelot > --- > drivers/net/pcap/rte_eth_pcap.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c > index 68588c3d7..f205a28e0 100644 > --- a/drivers/net/pcap/rte_eth_pcap.c > +++ b/drivers/net/pcap/rte_eth_pcap.c > @@ -290,10 +290,16 @@ eth_null_rx(void *queue __rte_unused, > #define NSEC_PER_SEC 1e9 > > static inline void > -calculate_timestamp(struct timeval *ts) { > +calculate_timestamp(const struct rte_mbuf *mbuf, struct timeval *ts) { > uint64_t cycles; > struct timeval cur_time; > > + if (mbuf->ol_flags & PKT_RX_TIMESTAMP) { > + /* TODO: convert mbuf->timestamp into nanoseconds instead. > + * See rte_eth_read_clock(). > + */ > + } > + > cycles = rte_get_timer_cycles() - start_cycles; > cur_time.tv_sec = cycles / hz; > cur_time.tv_usec = (cycles % hz) * NSEC_PER_SEC / hz; > @@ -339,7 +345,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > caplen = sizeof(temp_data); > } > > - calculate_timestamp(&header.ts); > + calculate_timestamp(mbuf, &header.ts); > header.len = len; > header.caplen = caplen; > /* rte_pktmbuf_read() returns a pointer to the data directly > -- NAK What is the point of this patch. Most projects do not accept speculative patches. Instead incorporate this patch in when you have code that uses it.