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 45D0FA10DA for ; Wed, 31 Jul 2019 17:19:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F8951C06B; Wed, 31 Jul 2019 17:19:19 +0200 (CEST) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 9B24E1C011 for ; Wed, 31 Jul 2019 17:19:17 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id 31so70159488wrm.1 for ; Wed, 31 Jul 2019 08:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexatech-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=mFdNKdZm08SNuqgQm4EJzZSS8kGmgvNqCkyr/FJpXS4=; b=BkRGMoHfQ4ngML7Bdh8D7p3uEPbqj1z2MMr1JQI9e/BiwzR++M98XCNVimI9VA2gos B7D2Uq7DDM3z0oAtqE+11/J22/EDiVLBJpY+FEaHBOnbO5hKk6phIsLJxMvishN/N/k3 R5MbMKiWI12VfSQmPamAV3+Bko6nDssy4+2okc9UlbTQj0uCEbDdykPkWFYb/jFO9lYY U8iIrTRikBqzaB+LzYvgKbGkOmu2zx9NkCSnfglT9BbuQSQQaUhHotXePRGR1D86e3V0 J+QQbK20/sX17ec0YL98r/yX/DR68HYlMAR0LXm9NHvPUXpCYjGqHghtAoml+oLA8y4e 1xfA== 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; bh=mFdNKdZm08SNuqgQm4EJzZSS8kGmgvNqCkyr/FJpXS4=; b=XTG2+992zwsgJcA5zjZT/uBmqLM7v8sFjkNVW4amOE7j0HHLIipqAcQvNfR2x/noBg n68+EJI7fs/4ER/icD52hprsIONCr9H9t6xGG31o4P+69BIDDL0JkimOX4Gd3LCBywur 2wJtCqmXYUWUDeAsno4Q5Epc89t1Ak6wHUhNMWzQuJs32mKXaLo9Hmjt1ouRH2ij0p3q ac3UUvVP9m9wDnl7pXeM84UaFc3Udq+OOEDkiffpZv2vo+dfedsu+M6rsp1ZZAixoT1Y Lgt9ZE32wk5NxCH5k2fMQoGSFoLzR6u228f/WTcJ/J78hHNz8ojx9qC0RF8Gj9/k5JHD k2OQ== X-Gm-Message-State: APjAAAUJGWZucYQNFZJeeOF9hcsB4vLu+GoNv2eC1asGEgBr83ItmQ+V yZx9DgTi1B1Ddqb3m42hwVbKow== X-Google-Smtp-Source: APXvYqxi4m1qnVXq2pyhWM3C0XrqVJvb6I1xL7/eh4GDZdJAXDFfE3vDyy0A5I9W9wUzptgQQOtAEA== X-Received: by 2002:a5d:53c2:: with SMTP id a2mr57989322wrw.8.1564586357370; Wed, 31 Jul 2019 08:19:17 -0700 (PDT) Received: from cyrodiil.nexatech.local ([90.102.1.97]) by smtp.googlemail.com with ESMTPSA id y6sm83859174wmd.16.2019.07.31.08.19.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 08:19:16 -0700 (PDT) From: Sylvain Rodon X-Google-Original-From: Sylvain Rodon To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Sylvain Rodon Date: Wed, 31 Jul 2019 17:18:41 +0200 Message-Id: <1564586321-22818-1-git-send-email-s.rodon@mail.nexatech.local> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] pcap: propagate timestamp from pcap_pkthdr to mbuf 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" From: Sylvain Rodon Timestamp is always set in PCAP header, whether it reads a file or listen on an interface. This information can be important for some applications and it cannot be obtained otherwise (especially when reading a PCAP file). Timestamp here is the number of microseconds since epoch. Signed-off-by: Sylvain Rodon --- drivers/net/pcap/rte_eth_pcap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 95d4b5b..3e80f0c 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -265,6 +265,9 @@ struct pmd_devargs_all { } mbuf->pkt_len = (uint16_t)header.caplen; + mbuf->timestamp = (uint64_t)header.ts.tv_sec * 1000000 + + header.ts.tv_usec; + mbuf->ol_flags |= PKT_RX_TIMESTAMP; mbuf->port = pcap_q->port_id; bufs[num_rx] = mbuf; num_rx++; -- 1.9.1