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 8C585A04E7; Sun, 1 Nov 2020 21:10:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26E4A28EE; Sun, 1 Nov 2020 21:10:28 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by dpdk.org (Postfix) with ESMTP id 98B051E2B for ; Sun, 1 Nov 2020 21:10:26 +0100 (CET) Received: from [192.168.1.70] (unknown [188.170.76.110]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id E92E17F562; Sun, 1 Nov 2020 23:10:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru E92E17F562 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1604261425; bh=Vvm60zceJrscBdkYBpY5l7doRQzEpzlF2YNhgElDaps=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=vKc+E/YRyzKyP+Gg9EWtzFINj3VhfJ5ySkUhovk2W5CEucXjOw3Nsfog6ODLd/YqX qKa+Et7nlvKUmUYzC+pcPumHOILim4qpVq4ZaTQ4wFpWNd9FlfOma1bgOXpAe6UQlz wvLpAmCj/dJZyEOgV4SQrjQvdU2l+8VpXqxUQL9o= To: Thomas Monjalon , dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, akhil.goyal@nxp.com, jerinj@marvell.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030172940.1073558-1-thomas@monjalon.net> <20201030172940.1073558-4-thomas@monjalon.net> From: Andrew Rybchenko Message-ID: Date: Sun, 1 Nov 2020 23:10:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201030172940.1073558-4-thomas@monjalon.net> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v5 03/15] 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" On 10/30/20 8:29 PM, 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 A nit below, but regardless of outcome: Acked-by: Andrew Rybchenko [snip] > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index b12bb3854d..7c9aadb461 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1232,6 +1233,59 @@ eth_dev_check_lro_pkt_size(uint16_t port_id, uint32_t config_size, > return ret; > } > > +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, > + }; > + static bool done_rx, done_tx; Are these static fields remain by intention? May be I misunderstand the summary of the previous discussion. > + bool todo_rx, todo_tx; > + int offset; > + > + todo_rx = (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) != 0 > + && !done_rx; > + todo_tx = (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) != 0 > + && !done_tx; > + > + 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; > + } > + done_rx = true; > + } > + 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; > + } > + done_tx = true; > + } > + > + return 0; > +} > + > /* > * Validate offloads that are requested through rte_eth_dev_configure against > * the offloads successfully set by the ethernet device. [snip]