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 D4C7AA0521; Tue, 3 Nov 2020 15:15:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BDC0CB76; Tue, 3 Nov 2020 15:10:20 +0100 (CET) Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by dpdk.org (Postfix) with ESMTP id 34C02CCC7 for ; Tue, 3 Nov 2020 15:10:17 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 963DED3C; Tue, 3 Nov 2020 09:10:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 09:10:15 -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=6nZgyWo3Wfrg0 9HGNGMHTF6N/bcByo0J/UuEgIYK2Gc=; b=aY9N9TtEsGVffCAQxHhqs6cMfl5HA ZXc1NES+BaLL9sGkmR16jdSiS5u53pM4FbQa+hbfSKHnGEosgY/gelbZP6viYMnN Ul3R9sdMLqcZItBQAjeCMElM5vfegYmyXl3IdyXl3lzWFdzUCQkVIUOAXQ5/H6uc ptm30QAY0Akkq1QS5y0fNmEW7jbIwU9Ow5wEqRXtoWqLzzklPs831nqqr+7lI+V4 NjqlbJtVPZVTautbIs7v2i1lt2xLSdVgiasY84mWDkjyoWzBMc+sKraC+giOjRNL JMT0wsbJgWmb8rkbgSkNBfTqRSaV75LETTp1LSWG4untN2m00Hl3RMKxQ== 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=6nZgyWo3Wfrg09HGNGMHTF6N/bcByo0J/UuEgIYK2Gc=; b=h8FE4hLI gWJbzfhapmqkQb1LGJSV2D1OmcriPyLyZAqAL9q3WQwPR+vpVa5pyJnPjvg0/My2 fKnJoHMgtrZnjtr4fyc8+DihhK6IcTsMrzHlPAYOD7Wyaytzg/r1lt0EjLfcCy0A TtJnsuyBAD4MRth/2cV7oPDeTE7jf1R6JnwGfA+dMiYqD3XMDufpz6zsOJMoXAxO 7XQb8mkpn2W/igJmx1xEq9zcmDBK+7PO/6gFQwLUpwktPHor50YLmVt7gn710/Iy lhfjvvCDzWYNcPCLZKWB7aChacH4DwGEQRgGJATyYcgydhM3I1uJJNEuLihJcdD4 e6SMdawfSFiV9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepjefhhffhvedvledtiedttdeigfejgeehvdfghfdvhfegvdehieel ieejhedvfeeknecuffhomhgrihhnpehrgihmohguvgdrmhhqnecukfhppeejjedrudefge drvddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 B93EC3280064; Tue, 3 Nov 2020 09:10:12 -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, Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Matan Azrad , Shahaf Shuler Date: Tue, 3 Nov 2020 15:09:31 +0100 Message-Id: <20201103140931.488700-17-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 16/16] ethdev: include mbuf registration in Tx timestamp API 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" Previously, the Tx timestamp field and flag were registered in testpmd, as described in mlx5 guide. For consistency between Rx and Tx timestamps, managing mbuf registrations inside the driver, as properly documented, is a simpler expectation. The only driver to support this feature (mlx5) is updated as well as the testpmd application. Signed-off-by: Thomas Monjalon Acked-by: Viacheslav Ovsiienko Acked-by: David Marchand Acked-by: Andrew Rybchenko --- app/test-pmd/config.c | 38 ---------------------------------- doc/guides/nics/mlx5.rst | 5 ++--- drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++- lib/librte_ethdev/rte_ethdev.h | 7 +++++-- 4 files changed, 14 insertions(+), 44 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1668ae3238..9a2baf16fe 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3955,44 +3955,6 @@ show_tx_pkt_times(void) void set_tx_pkt_times(unsigned int *tx_times) { - uint16_t port_id; - int offload_found = 0; - int offset; - int flag; - - static const struct rte_mbuf_dynfield desc_offs = { - .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, - .size = sizeof(uint64_t), - .align = __alignof__(uint64_t), - }; - static const struct rte_mbuf_dynflag desc_flag = { - .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, - }; - - RTE_ETH_FOREACH_DEV(port_id) { - struct rte_eth_dev_info dev_info = { 0 }; - int ret; - - ret = rte_eth_dev_info_get(port_id, &dev_info); - if (ret == 0 && dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) { - offload_found = 1; - break; - } - } - if (!offload_found) { - printf("No device supporting Tx timestamp scheduling found, " - "dynamic flag and field not registered\n"); - return; - } - offset = rte_mbuf_dynfield_register(&desc_offs); - if (offset < 0 && rte_errno != EEXIST) - printf("Dynamic timestamp field registration error: %d", - rte_errno); - flag = rte_mbuf_dynflag_register(&desc_flag); - if (flag < 0 && rte_errno != EEXIST) - printf("Dynamic timestamp flag registration error: %d", - rte_errno); tx_pkt_times_inter = tx_times[0]; tx_pkt_times_intra = tx_times[1]; } diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index afa65a1379..fa8b13dd1b 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -237,9 +237,8 @@ Limitations ``txq_inline_max`` and ``txq_inline_mpw`` devargs keys. - To provide the packet send scheduling on mbuf timestamps the ``tx_pp`` - parameter should be specified, RTE_MBUF_DYNFIELD_TIMESTAMP_NAME and - RTE_MBUF_DYNFLAG_TIMESTAMP_NAME should be registered by application. - When PMD sees the RTE_MBUF_DYNFLAG_TIMESTAMP_NAME set on the packet + parameter should be specified. + When PMD sees the RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME set on the packet being sent it tries to synchronize the time of packet appearing on the wire with the specified packet timestamp. It the specified one is in the past it should be ignored, if one is in the distant future diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 7631f644b2..76ef02664f 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -88,7 +88,13 @@ mlx5_dev_configure(struct rte_eth_dev *dev) if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; - + if ((dev->data->dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) && + rte_mbuf_dyn_tx_timestamp_register(NULL, NULL) != 0) { + DRV_LOG(ERR, "port %u cannot register Tx timestamp field/flag", + dev->data->port_id); + return -rte_errno; + } memcpy(priv->rss_conf.rss_key, use_app_rss_key ? dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key : diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 4988054cb2..f689550745 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1413,8 +1413,11 @@ struct rte_eth_conf { #define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000 /** Device supports outer UDP checksum */ #define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM 0x00100000 - -/** Device supports send on timestamp */ +/** + * Device sends on time read from RTE_MBUF_DYNFIELD_TIMESTAMP_NAME + * if RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME is set in ol_flags. + * The mbuf field and flag are registered when the offload is configured. + */ #define DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP 0x00200000 -- 2.28.0