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 496E6A0521; Tue, 3 Nov 2020 13:26:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E5C0CA50; Tue, 3 Nov 2020 13:22:43 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id D296FCA48 for ; Tue, 3 Nov 2020 13:22:40 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 8C7A5C57; Tue, 3 Nov 2020 07:22:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 07:22:39 -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=WZXddc6PtJFIABd5rfy1FE1/kLN0T Jx+r2J8dLBxMMIjXgItxxpAtilTH7pdJOjbmUjZHRJz1adauQpMeUUUvOw6wL/7U DQspIuvL94jenRBS6aHYm+fMHefrEap86nF3qa2IuxHIUuQeViLcAqdbxPQYEMXf U+OHCr59NOlJZI1cueyNBqb5BhF9ICAbuMKC5/082QOeR+1ROCuw/zs/r39JFb4O fUciaPc+HSqHsD/wrZDGSyHiIBDImoPw9VB32RIrzQF/5DAqwn/46G5ihKb2K9/V cAQDrlo7QVipxelXbK+E6vgM85A7Aw1KNeby7xTVnmzZj1NFpFrsDcd4A== 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=i3dA1Twt bo+CfhMgV6EQLLWcvN1dtbozPI974seX0RhbWxqC9bYIoNT+J3lrPIatRTuOWIMD 4jwfpYM9psRvoNmhhItKEFz1On1wYr7Y/NtkOfE3LvrXE6qMO4wQ/Kjp3aNcmoEI xFrcoG0c9kPsFRLb4y6tM+72xQ3ZeoSWqVEOwNDS90BoD89NVoeOrPIUzwKbveJg vZXT7pDK10k2QXnJE6iObRdkBLq9JHIUL0J85O9JknVe7W+FqQBOftcybkeoNCvv 6cIOUYA1VrYJbIyj7VitQL07goXdL560R5jMoAj90c2UWxP8/BuPpyURKl0YH+dz TE0t2X4KX3dvrQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgfeelucetufdoteggodetrfdotf 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 28A543064683; Tue, 3 Nov 2020 07:22:37 -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 13:21:59 +0100 Message-Id: <20201103122205.183472-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103122205.183472-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103122205.183472-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 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