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 B0018A04A5; Sat, 23 May 2020 22:21:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 378791D685; Sat, 23 May 2020 22:21:32 +0200 (CEST) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by dpdk.org (Postfix) with ESMTP id 524B01B13C for ; Sat, 23 May 2020 19:21:50 +0200 (CEST) Received: by mail-qk1-f193.google.com with SMTP id f83so13845882qke.13 for ; Sat, 23 May 2020 10:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7BP5Krxau8MBsl/gZeTT3gn3tRfF/mYK6jvFipr0WLo=; b=RYOAG1I0btaBg0DTHHH2BzC/GjhyhQU8fzsAnNbOWaY+bXOCwn4XJioL6xhAWU1ErM lZxaV/sRDsfAokzjwybOTvjU8x90Z0RoA8Ii1/UnwyESrt4EvD2+dw4aLQcN7s1bRdEK xpRpmRCMcU1J9jF4AQoOBhjqrJvEcacGe8K8O/9eoJxnGL39UgPk3JUcB2Ep0f0sJvCp x/Hejt86VFSmUocijmyPi/gItwNgK1F8UprU6LeT2sa86L1o3bwl1ImkvyzfA3alSyzr RbcIpVXBIvKhqkx/DYdbrjCzyWkCvcA61C43Pv9TUTWOQnxyfY/YGpZKzab33ZGssX6i hA5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7BP5Krxau8MBsl/gZeTT3gn3tRfF/mYK6jvFipr0WLo=; b=glNtAMvlaU2bG7+EtlXXwJpoHP2PwHKtmBPDDKKfhGhGFfFLrNnVtVwPdhKER9mXFq sBEWnabSv2dgER0+kCarJ+makjqKVupjjlYb2YJ6CzuyFsFgXD76TjTIB8kidFPq8cBR V6hnzvC6i+IcopIePOvfTajS9j2fyLE4NCTQlMQPg3qft2XzOC4Pk+yT2hruXZlVsMnW w+6krZPDLCQavQxBH2NmqZISo/FXK1PtCJnWDvUgOeRii1OPcHMBHXhTwmTwfmR4CK/t 0A6FG6Wx+R8PxjHdUCnRQFZVdPwxeh3Z/8IP8M86DkLgFPJze3ysgHQDzeBECEiG7HM7 MHRg== X-Gm-Message-State: AOAM532ErmLeJVBxl8XmIPFWkTCk3O0jjki4yZGb9m8veZ1ZJoo5jB06 27QxunQAVcy7x2gmLHSd5gxKdxLN X-Google-Smtp-Source: ABdhPJyr1IeqxDs72vTNBv9tkLdkwL/fuvWf3kc5lHysn1bFqF5dxf5z/CEbYj5t8dGoypkoyFKXcw== X-Received: by 2002:a05:620a:13cc:: with SMTP id g12mr20042320qkl.4.1590254509220; Sat, 23 May 2020 10:21:49 -0700 (PDT) Received: from localhost (modemcable249.105-163-184.mc.videotron.ca. [184.163.105.249]) by smtp.gmail.com with ESMTPSA id x4sm3756930qtj.43.2020.05.23.10.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 10:21:48 -0700 (PDT) From: Vivien Didelot To: dev@dpdk.org Cc: patrick.keroulas@radio-canada.ca, thomas@monjalon.net, Vivien Didelot Date: Sat, 23 May 2020 13:21:30 -0400 Message-Id: <20200523172130.2285380-2-vivien.didelot@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200523172130.2285380-1-vivien.didelot@gmail.com> References: <20200523172130.2285380-1-vivien.didelot@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 23 May 2020 22:21:23 +0200 Subject: [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" 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 -- 2.26.2