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 2E283A04DD; Thu, 29 Oct 2020 10:31:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2C9DC972; Thu, 29 Oct 2020 10:28:34 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id CB49EC93A for ; Thu, 29 Oct 2020 10:28:27 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 86EBA9F3; Thu, 29 Oct 2020 05:28:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 05:28:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=zreLXuW/VQbq1 G/2toaLV/kjXG9nHBevfn/tWKO5IWE=; b=eujxcvGKzMqkH0XaVc4sJqU5ZFbpr 27FcxJkkm2eGFrZFa0JCTMYlB5ED5hr3eNnK8gi3baAEMDem9Z8yLZxx/8EnpWbd pxSO8pqqj5wnZ02XN3wYItOo3NjlvkD5IXrEo3jU2KlMsdZIfaA5sld4haqPUN+Q 4irWzUaMsIL9IjQoQj7dtKrOH+R6m//It/CFOqM5Xy6bhMD5yKvZXsAqEl40ceA7 ZjVu2dB0KjOxgdqWJi0koe/wHuWeMmRqZJGbCEBwYNtTbV9Gfmw6K0Jl1tVW7qGz w1zw915JInEu7AFy9NMUPqqYoIb3AjmGDALYNg0MWWgDVav3IY53bvZLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=zreLXuW/VQbq1G/2toaLV/kjXG9nHBevfn/tWKO5IWE=; b=Lku3PtUG dcm/eQWMrHTN3ctjDXrhcqwjJOs5EsJBMkfBc8NhDq1GzgPRmdQbhnODWtPpK5Y3 JcvrdHP2DlQfX5JATMGnICClUuGjYvhvkaRwnuFN8XByghp8NHrBq4krBTWOj1ot +IKDJBBEaI4WhqKokNRoooqwezrBTwcrnvcxcC32CrL84UNH1kabVAzi7sU8mSIk BK6PzBnOksy5IZFeHb62Ic8BiA+EHpUB2lyNUeW/ALlJt2KEGOM/dTjknG/chQws vO6GFBjkBKr6tYOCTHNjDrQp1x9gSpNoF9OkDx6F++DqViasl9lVaqUU85IZZkwJ ZgdvDu/AeXqBTA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepleevudelgeeguddvveeute euheffgeeiudevuddvffdtveetuddthedtieetgfelnecuffhomhgrihhnpehtshdrthhv necukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 21283328005E; Thu, 29 Oct 2020 05:28:24 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, viacheslavo@nvidia.com Date: Thu, 29 Oct 2020 10:27:46 +0100 Message-Id: <20201029092751.3837177-12-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029092751.3837177-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 11/15] net/pcap: switch timestamp to dynamic mbuf field 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" The mbuf timestamp is moved to a dynamic field in order to allow removal of the deprecated static field. The related mbuf flag is also replaced. Signed-off-by: Thomas Monjalon --- drivers/net/pcap/rte_eth_pcap.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 34e82317b1..b4b7a1839b 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -51,6 +52,9 @@ static uint64_t start_cycles; static uint64_t hz; static uint8_t iface_idx; +static uint64_t timestamp_rx_dynflag; +static int timestamp_dynfield_offset = -1; + struct queue_stat { volatile unsigned long pkts; volatile unsigned long bytes; @@ -265,9 +269,11 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } 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; + *RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset, + rte_mbuf_timestamp_t *) = + (uint64_t)header.ts.tv_sec * 1000000 + + header.ts.tv_usec; + mbuf->ol_flags |= timestamp_rx_dynflag; mbuf->port = pcap_q->port_id; bufs[num_rx] = mbuf; num_rx++; @@ -656,6 +662,23 @@ eth_dev_stop(struct rte_eth_dev *dev) static int eth_dev_configure(struct rte_eth_dev *dev __rte_unused) { + int timestamp_rx_dynflag_offset; + + timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (timestamp_dynfield_offset < 0) { + PMD_LOG(ERR, "Failed to lookup timestamp field"); + return -rte_errno; + } + timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup( + RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL); + if (timestamp_rx_dynflag_offset < 0) { + PMD_LOG(ERR, "Failed lookup Rx timestamp flag"); + return -rte_errno; + } + timestamp_rx_dynflag = + RTE_BIT64(timestamp_rx_dynflag_offset); + return 0; } -- 2.28.0