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 BC410A10DA for ; Fri, 2 Aug 2019 11:00:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F78E1C238; Fri, 2 Aug 2019 11:00:43 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 9FE7C1C236 for ; Fri, 2 Aug 2019 11:00:42 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id z1so76337205wru.13 for ; Fri, 02 Aug 2019 02:00:42 -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:in-reply-to:references; bh=jB5imSYxXuVCdBBkww1X9ah/FpgNAEE242/nHoCl9N8=; b=LGXeY8b+dpQ7+OGjBPgyoCc9OD87T1S228Y7zJ8S5xGqigMUqPXcz4w85IAsZaFh29 JqQyqmzGdHHWm4aTFdDvpYksnmvzWzimOYMnpix46icToakUSPnxByBIfVWteTZ69HgX IlFm6l2OTTXFspjncWNKfHBMBygNkgKYixdx7g0s/FU3nGh3XOkZ/On4NA/hAMv14Hz8 9unhd8YM0SeR6KgREBuzH/AJCMRULhB8eBm34wZ2HNj4HX8sqmsvSVBxMjqtzRBGQXY+ OBeS9DaxjmrhNYHMTvxiZrRBcoVj1ifopehVYxMcggbzTEX0rQQBmEodlGtqca+eH2UM l6cA== 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; bh=jB5imSYxXuVCdBBkww1X9ah/FpgNAEE242/nHoCl9N8=; b=WiKeaW1o9A/MQXeY6iO8nqTjT2pM6UXMj1oLLqZ0/gGDQRSpMIiA+iWk2Dx2EI6WSW wfjc1heR4QFAOw119aIhal1zSd4ZWnEAXyDkV+/NNil3dotJTmZD6C0tvi8wP6gIebI/ ntNLTH/OGaEi2c9QP0y3hcC54AHM5SbDiqiXSLM9QFULUdrYRmH7WiiYWwfd/s1DJ9V0 I5d6vFztWiK2xVFjY5rQkH11ZMdXcQuEccStnvqvlA0cq5+TkvyOrnuXcxn8LHoq4+Gt pGkzzXsNYOAV54M796TJ3gic+93gq45e3gysrOrqgWriqIlXXx0uFP0XTZ0Za8XW7l8J KwZw== X-Gm-Message-State: APjAAAVAc24IfBhEY5qIr94mgNYBvQY3/Lbzhak/s4JfnUdUtsLZyQ8E fODFWTD8TpGP9LYRf2YtgQzGGOu1YXe2EA== X-Google-Smtp-Source: APXvYqxeQj9grDzyUPxh7y4LkzRUdZQ4+Ihn4XQyh5w2Fu5hM1LCsYHDpL5bnbvG2XqgIvLllSLvKw== X-Received: by 2002:adf:ed11:: with SMTP id a17mr58058424wro.112.1564736442451; Fri, 02 Aug 2019 02:00:42 -0700 (PDT) Received: from cyrodiil.nexatech.local (128.60.136.77.rev.sfr.net. [77.136.60.128]) by smtp.googlemail.com with ESMTPSA id o20sm191996296wrh.8.2019.08.02.02.00.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Aug 2019 02:00:41 -0700 (PDT) From: Sylvain Rodon X-Google-Original-From: Sylvain Rodon To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Sylvain Rodon Date: Fri, 2 Aug 2019 10:57:24 +0200 Message-Id: <1564736244-5906-2-git-send-email-s.rodon@mail.nexatech.local> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1564736244-5906-1-git-send-email-s.rodon@mail.nexatech.local> References: <1564586321-22818-1-git-send-email-s.rodon@mail.nexatech.local> <1564736244-5906-1-git-send-email-s.rodon@mail.nexatech.local> Subject: [dpdk-dev] [PATCH v2] net/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, where the timestamp is not the current time). 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..5489010 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