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 0EB0DA04E7; Mon, 2 Nov 2020 17:52:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E0E22C01; Mon, 2 Nov 2020 17:52:36 +0100 (CET) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by dpdk.org (Postfix) with ESMTP id CC3731E2B for ; Mon, 2 Nov 2020 17:52:34 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id D1986580272; Mon, 2 Nov 2020 11:52:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 02 Nov 2020 11:52:30 -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:content-type; s=fm2; bh= fgIbwnK7ac/MFQbti+sTxoP59l2KvQFz07cnUdoVshU=; b=NjBQgGk1+ujK/lwb hIos/laFrvWjxTCXkz9PHqSqkFAqDALQ0wVPSX03DIPqvE95RlfGI4QIcQa3SDGw Qx0xGzzM8mAXQtqaVhN8dWzIWMP2LK6gfFPqHdKQeCstRtBBbwuLjCcXkyw9Gbc7 f5/nIQ/fIqr+ADYnUkcn1zwTk0b4HVuVwcIAr/tYvH2e3Dk5zPOgtyHxxIi5p2BO l6oGLv0y4PgPX+zgaedbcnueSzmNd4I6DsHejz9V07EHi/qCmEGYZat/XXKdlH4A 7l5WWGzQu4tyA9a4GOuUYeCnoOgb9HNLV/miEKgdIjfO5p6khekG0xjdYH9BPEy3 5oa4eQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=fgIbwnK7ac/MFQbti+sTxoP59l2KvQFz07cnUdoVs hU=; b=pdLwNLUz7x3ot6i/FJNDixMHRKnxa9foS+Od1fpUH/L6GwtjBl8kPwpsr GF2agCxP7XhPYQG/XTRCLTNZdnKAQxfQSTbBXxsxrhwOnTmEYC0Kz5N5GqMmJSXh DcG2C/Ln5vT9PrxuquX2d3JT5LzT2ML/sgh93LKCzB9FXODjORC87AeRteUw6BFI 0IkJLmpjTrqnzX/gm3oyon0Yb1sUpaJx8zb3KC7WWw83HCvMg9oUTscKfBLCAW3M 0y3+eMFU+VqAoCfl+dfjJpwX2B49m5ZrYVw/1Xk3ay6Rlb+DcJued8Q1+jmtvde1 ktueVOGv/dWavDUEsyGH5WcPS8v1Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtuddgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 4A4F43280068; Mon, 2 Nov 2020 11:52:28 -0500 (EST) From: Thomas Monjalon To: Olivier Matz Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, viacheslavo@nvidia.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Matan Azrad , Shahaf Shuler Date: Mon, 02 Nov 2020 17:52:27 +0100 Message-ID: <2123271.7n3VZgQ50k@thomas> In-Reply-To: <20201102153943.GZ1898@platinum> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201101180626.2198868-4-thomas@monjalon.net> <20201102153943.GZ1898@platinum> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2 03/14] ethdev: register mbuf field and flags for timestamp 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" 02/11/2020 16:39, Olivier Matz: > On Sun, Nov 01, 2020 at 07:06:15PM +0100, Thomas Monjalon wrote: > > During port configure or queue setup, the offload flags > > DEV_RX_OFFLOAD_TIMESTAMP and DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP > > trigger the registration of the related mbuf field and flags. > > > > Previously, the Tx timestamp field and flag were registered in testpmd, > > as described in mlx5 guide. > > For the general usage of Rx and Tx timestamps, > > managing registrations inside ethdev is simpler and properly documented. > > > > Signed-off-by: Thomas Monjalon > > Reviewed-by: Andrew Rybchenko > > <...> > > > --- a/lib/librte_ethdev/rte_ethdev.c > > +++ b/lib/librte_ethdev/rte_ethdev.c > > +static inline int > > +eth_dev_timestamp_mbuf_register(uint64_t rx_offloads, uint64_t tx_offloads) > > +{ > > + static const struct rte_mbuf_dynfield field_desc = { > > + .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, > > + .size = sizeof(rte_mbuf_timestamp_t), > > + .align = __alignof__(rte_mbuf_timestamp_t), > > + }; > > + static const struct rte_mbuf_dynflag rx_flag_desc = { > > + .name = RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, > > + }; > > + static const struct rte_mbuf_dynflag tx_flag_desc = { > > + .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, > > + }; > > + bool todo_rx, todo_tx; > > + int offset; > > + > > + todo_rx = (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) != 0; > > + todo_tx = (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) != 0; > > + > > + if (todo_rx || todo_tx) { > > + offset = rte_mbuf_dynfield_register(&field_desc); > > + if (offset < 0) { > > + RTE_ETHDEV_LOG(ERR, > > + "Failed to register mbuf field for timestamp\n"); > > + return -rte_errno; > > + } > > + } > > + if (todo_rx) { > > + offset = rte_mbuf_dynflag_register(&rx_flag_desc); > > + if (offset < 0) { > > + RTE_ETHDEV_LOG(ERR, > > + "Failed to register mbuf flag for Rx timestamp\n"); > > + return -rte_errno; > > + } > > + } > > + if (todo_tx) { > > + offset = rte_mbuf_dynflag_register(&tx_flag_desc); > > + if (offset < 0) { > > + RTE_ETHDEV_LOG(ERR, > > + "Failed to register mbuf flag for Tx timestamp\n"); > > + return -rte_errno; > > + } > > + } > > + > > + return 0; > > +} > > The code that registers the dynamic fields and flags for timestamp is > more or less duplicated several times in the patchset. As discussed > privately, it would make sense to have helpers to register them in one > operation, without the need to redeclare the structures: > > int rte_mbuf_dyn_rx_timestamp_register(int *offset, uint64_t *rx_bitnum) > int rte_mbuf_dyn_tx_timestamp_register(int *offset, uint64_t *tx_bitnum) Yes we can have a function in rte_mbuf_dyn.h/c which is called to register field and flags from drivers or apps. Then no need to register at ethdev level.