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 D748CA0521; Tue, 3 Nov 2020 15:13:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F1AE5CBA9; Tue, 3 Nov 2020 15:10:06 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id A5E62CB83 for ; Tue, 3 Nov 2020 15:10:03 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 457DAD3C; Tue, 3 Nov 2020 09:10:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 09:10:02 -0500 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=h6Huw/0aDP/Vp cVwFE9SFJniYo682AG4QRYD3mdSgXE=; b=UZ8YlyylaTyGtPj8noAhYe1nt8BRP OC4yKH/tNQOWwW5vBmnGDDHSz+xM/WxlYmDc1kas7pm71yb/zxs7izqXx0bX+j/r amjVD4YAPODsExM7X8QWr7WvborjN+Aq5VWuyY92XryDX4T/0UN7FhPedfrbarLE P6Idy4NIyf6EYazKfSLLg3SxSCVG1o4NxJRgSizSQNnSgfg3I4j2av1qQ1RoVG7s c5g6AGVV1T+zGbiA/aOLxo+7ePxbFf88dw8XuDOyv2TxKtEh35yh/Wiru4gAXfbC nciB3PgDees5IH8gPUNl5/85Nw26C78EBGLtyhr0bfEOqTFEwf1XY6PJg== 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=h6Huw/0aDP/VpcVwFE9SFJniYo682AG4QRYD3mdSgXE=; b=B52CCQ3H hbg81am5ASW1bLucNAuzTx3HF9It+XBKf5GH58P47bXdV3kAgwvs3hFjxGkNPjJO B6QsQS6x0Ml6KcAHT/mNQ01Fx+XkP7SJeOTksJjo/PfShw4/sKeZy33pnoNa5QWW JRqqh4i7igdDEISDYLRS+vB8imRvKTy6Jr9kS9ncNTe6op+R3ZuDB1R25PSWHi60 c1YS/8Se4kHQR1Yl2Z4lTFdUPyEAc7JUh5ypiJiBXRfPxKV2MdShvWDcOVPmHrrQ hKto2+dOIz4y1YlJNlRtfYf3W+Xw8Wn97nsuwYOvwenCu2pAAnU19aD8xWarSBqI yGh/5k1mo4crRQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpeelveduleeggeduvdevue etueehffegieduveduvdfftdevtedutdehtdeitefgleenucffohhmrghinhepthhsrdht vhenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgv th 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 A5BBA3280064; Tue, 3 Nov 2020 09:10:00 -0500 (EST) 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: Tue, 3 Nov 2020 15:09:25 +0100 Message-Id: <20201103140931.488700-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103140931.488700-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103140931.488700-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 10/16] net/pcap: switch Rx 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 Acked-by: David Marchand --- drivers/net/pcap/rte_eth_pcap.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 34e82317b1..4e6d49370e 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -51,6 +51,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 +268,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 +661,15 @@ eth_dev_stop(struct rte_eth_dev *dev) static int eth_dev_configure(struct rte_eth_dev *dev __rte_unused) { + int ret; + + ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset, + ×tamp_rx_dynflag); + if (ret != 0) { + PMD_LOG(ERR, "Failed to register Rx timestamp field/flag"); + return -rte_errno; + } + return 0; } -- 2.28.0