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 3B82FA04E7; Tue, 3 Nov 2020 01:17:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C496ACA2; Tue, 3 Nov 2020 01:14:44 +0100 (CET) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id AC65DA9A0 for ; Tue, 3 Nov 2020 01:14:42 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 5E244B5F; Mon, 2 Nov 2020 19:14:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 02 Nov 2020 19:14:41 -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=npPLxBM8Rapeb eq8vDeeuLIiAFX3viqqqW6loG+n68c=; b=Z5Mc9xTkYZJK2mdFWKKBAunv3zz7y HKwUDnH29hVGO14/NTTtl9Rw8mFJl0uvg9SlyUG3rnXeLSa3tB9HzDyaVliU4+9l HcGUOTMuQLWd5a+OBN1mg9/V39VQo3smJNtkUCd0oxgVbO4MDt2JKmcMTcF8UC1l JYBgJ2nr1WZmwOvOj/ha2RathLLK0neceVDvq6KZf4C88XjQ1eoocFXIL9LpHdon 0kzZPU4XyvijK/DIY/5YaR9rPZcqYMyKij0pTnJrZE6Pf2HNbh216euQTbQVAeIQ UyHIcbiCs6s4m6oj5AJFd8/W7rXOef3F9daKAKC9IAfaneQPNS0xCyzyw== 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=npPLxBM8Rapebeq8vDeeuLIiAFX3viqqqW6loG+n68c=; b=DPhXoFi9 hnLLDXxBShexptlYZmloWVaMQr4lhzPIL3Ih4OdZBusUACGIf/mzUmmS5NUv0R11 lj5n1zqqoMK1p6EmDqiBkofr4yG6kmUy5YyTWpj+l/fo2YuBxtC7xRvszw00vrVL wLDPLAED6Pe2JJhBsDsF/3ZRX8RGz84s0do2eYqcpj5pjQKmKufxR1uTYZLXIXzR KWYwr6agOc23EvZW8GkpDtO4XtjY9/Bx/WwCDD6/3v9GrcBqBZeqP8pv51Vk9BS+ lylcq3Aj79f5vOzvl0GFQjXXi5v/lNtaC15PngbTfx5Vz98zVIgZ3ORt1sclmUr9 aQFdCEpaxRcNGA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtvddgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 832103064674; Mon, 2 Nov 2020 19:14:38 -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, Martin Spinler Date: Tue, 3 Nov 2020 01:13:59 +0100 Message-Id: <20201103001407.2931963-9-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103001407.2931963-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103001407.2931963-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 08/16] net/nfb: 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 --- drivers/net/nfb/nfb_rx.c | 15 ++++++++++++++- drivers/net/nfb/nfb_rx.h | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/net/nfb/nfb_rx.c b/drivers/net/nfb/nfb_rx.c index d97179f818..d6d4ba9663 100644 --- a/drivers/net/nfb/nfb_rx.c +++ b/drivers/net/nfb/nfb_rx.c @@ -9,6 +9,9 @@ #include "nfb_rx.h" #include "nfb.h" +uint64_t nfb_timestamp_rx_dynflag; +int nfb_timestamp_dynfield_offset = -1; + static int timestamp_check_handler(__rte_unused const char *key, const char *value, __rte_unused void *opaque) @@ -24,6 +27,7 @@ static int nfb_check_timestamp(struct rte_devargs *devargs) { struct rte_kvargs *kvlist; + int ret; if (devargs == NULL) return 0; @@ -38,6 +42,7 @@ nfb_check_timestamp(struct rte_devargs *devargs) } /* Timestamps are enabled when there is * key-value pair: enable_timestamp=1 + * TODO: timestamp should be enabled with DEV_RX_OFFLOAD_TIMESTAMP */ if (rte_kvargs_process(kvlist, TIMESTAMP_ARG, timestamp_check_handler, NULL) < 0) { @@ -46,6 +51,14 @@ nfb_check_timestamp(struct rte_devargs *devargs) } rte_kvargs_free(kvlist); + ret = rte_mbuf_dyn_rx_timestamp_register( + &nfb_timestamp_dynfield_offset, + &nfb_timestamp_rx_dynflag); + if (ret != 0) { + RTE_LOG(ERR, PMD, "Cannot register Rx timestamp field/flag\n"); + return -rte_errno; + } + return 1; } @@ -125,7 +138,7 @@ nfb_eth_rx_queue_setup(struct rte_eth_dev *dev, else rte_free(rxq); - if (nfb_check_timestamp(dev->device->devargs)) + if (nfb_check_timestamp(dev->device->devargs) > 0) rxq->flags |= NFB_TIMESTAMP_FLAG; return ret; diff --git a/drivers/net/nfb/nfb_rx.h b/drivers/net/nfb/nfb_rx.h index cf3899b2fb..e548226e0f 100644 --- a/drivers/net/nfb/nfb_rx.h +++ b/drivers/net/nfb/nfb_rx.h @@ -15,6 +15,16 @@ #define NFB_TIMESTAMP_FLAG (1 << 0) +extern uint64_t nfb_timestamp_rx_dynflag; +extern int nfb_timestamp_dynfield_offset; + +static inline rte_mbuf_timestamp_t * +nfb_timestamp_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + nfb_timestamp_dynfield_offset, rte_mbuf_timestamp_t *); +} + struct ndp_rx_queue { struct nfb_device *nfb; /* nfb dev structure */ struct ndp_queue *queue; /* rx queue */ @@ -191,15 +201,15 @@ nfb_eth_ndp_rx(void *queue, if (timestamping_enabled) { /* nanoseconds */ - mbuf->timestamp = + *nfb_timestamp_dynfield(mbuf) = rte_le_to_cpu_32(*((uint32_t *) (packets[i].header + 4))); - mbuf->timestamp <<= 32; + *nfb_timestamp_dynfield(mbuf) <<= 32; /* seconds */ - mbuf->timestamp |= + *nfb_timestamp_dynfield(mbuf) |= rte_le_to_cpu_32(*((uint32_t *) (packets[i].header + 8))); - mbuf->ol_flags |= PKT_RX_TIMESTAMP; + mbuf->ol_flags |= nfb_timestamp_rx_dynflag; } bufs[num_rx++] = mbuf; -- 2.28.0