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 74132A04E6; Fri, 30 Oct 2020 18:33:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9E6472DE; Fri, 30 Oct 2020 18:30:22 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 4B3A85AA4 for ; Fri, 30 Oct 2020 18:30:10 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id F101E5C0228; Fri, 30 Oct 2020 13:30:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:30:09 -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=o8RzeXfUkj3XcQZGeQfE2LlmtGpCj oczo5uncCH1DUY72/w9wUTAs285YBLigMEUEv8H/e9j1iuHgEl3Y8qsM18VgRHXY T0l1/tMkMq6CmrGt9/PsndDmkcej2VZetdSLXRbmHIZK2ZTx3Vnb+AS+rRguqigs H8ToytzUozGY8COYTGp5X1Aw5AV349YC1/Fi25eXcQfGlOG8zlO0lIc9jlfjySL6 +2jNhJH2ZmMu3MLd2UyfpMId8MOWoRndWHA85zn7sr/cZ2b9vRcWI3+6LXuzP9Mb C+8H4jEdCv4ZCh6hqA4HTg1OsT5X904j6EiURSLWeljsyCK3YfqdMt7lg== 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=BCr0mTeg nfP7xibHiQrP0vC8RWj1rdGs+G+PP/DIdoi77UJVqEunXcAIsTWj+ZtFwrLe/s7x vPsmhihmlxTqm+z+lc7dPTM91jznEfo3UT+r4oddpujYUQW2ddsUuiqB+GRinHsj 2EFPjlV2syGim8EyFd/WSW5ww+spcCPKqyS/DP7EMKexL35hkrKKET+NY1Ta75Wf v6Bk6ChC+H8wcsd3h/EGZqVVo4807k+IvObrOrfrR3US8HI9UPrX9/zHB+mBbhnP +8J+oi/EMbQ6XXNBtz5krKenMVeutRR8qaChzOZ6tgysqxjMdVn1tXDqo0eGpBAN rZsiKyUL/NO/mw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdeliecutefuodetggdotefrodftvf 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 9CF8C3064674; Fri, 30 Oct 2020 13:30:08 -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, akhil.goyal@nxp.com, jerinj@marvell.com Date: Fri, 30 Oct 2020 18:29:36 +0100 Message-Id: <20201030172940.1073558-12-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030172940.1073558-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030172940.1073558-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 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