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 4CE20A052A; Fri, 10 Jul 2020 17:11:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A8721D699; Fri, 10 Jul 2020 17:11:18 +0200 (CEST) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by dpdk.org (Postfix) with ESMTP id 470FC1D694 for ; Fri, 10 Jul 2020 17:11:16 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id D654F5805F2; Fri, 10 Jul 2020 11:11:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 10 Jul 2020 11:11:15 -0400 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=fm1; bh= f9rhLiTT+/GoR/iurukfI4Jp0ZifQJ8TyGUsgtZocPE=; b=QCMguWIAhgEpCpsR 54LMtFLGcxmwwtSCQZIF9Q8P8ewP/kY3rg8RM/ectTpw8GNfLVJyjhyLT8xvFBWK akIVohTXDegE6BvE7Gae0VUn7gq3RtwhWwSbVeAUOEU/craLnuNcID84avVwVa5D +DNIgMCzfWwY3w9bXZVawpBzB45nloqmQ2R+rTpS8ntI2RiSTiTETS9yfnP/sWxo R/sn7Rr7ix+aoQopk6RbzMnW0MAxY7Hnp2G7A/DynD2+dFFllz/Cq9IEd1SCTlBx FocjZimzPpqWnrg1h6bQ0CKGUE36uAvMPgPUsMkd1fPLAmMYAH3Qnwgn3xSWRsMO 6KZ/Gw== 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=fm3; bh=f9rhLiTT+/GoR/iurukfI4Jp0ZifQJ8TyGUsgtZoc PE=; b=eYfXaWN878YKdRo93p9lSK8Rhhh8w1Lgl9ARHY4OXMAH/zl/tU012FGY1 iRo28AUI3PirKR43OubV4eyrDFnUf9zCi2ZMsBj7nbD44ZQGOMK9LxBQyWRSJnIU Kg1L3+9aP2VZhkKXC9NwaTaXI4biS56jbA2HlfUa7Vh9svJfCJLIx75mp0Pk6RM8 oL8nKBcJd4o+G0eZ6tEoVa08bLA1gsYhxofqHvPaU6nYoLrJeXm+CLcSOqMiKe6H Bg22tlWWj+GVTztumKIzA+zP6RfiqjJYSXskUoLHEUowa9EIRovAJ48bmfFdH3qH wJ9/huJcFDjZ19Nq/+K74Cj0rtdDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrvddugdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgjfhgggfgtsehtufertd dttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepudeggfdvfeduffdtfeegle fghfeukefgfffhueejtdetuedtjeeuieeivdffgeehnecukfhppeejjedrudefgedrvddt fedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 140CC3280059; Fri, 10 Jul 2020 11:11:10 -0400 (EDT) From: Thomas Monjalon To: i.dyukov@samsung.com Cc: dev@dpdk.org, v.kuramshin@samsung.com, david.marchand@redhat.com, ferruh.yigit@intel.com, arybchenko@solarflare.com, wei.zhao1@intel.com, jia.guo@intel.com, beilei.xing@intel.com, qiming.yang@intel.com, wenzhuo.lu@intel.com, mb@smartsharesystems.com, stephen@networkplumber.org, nicolas.chautru@intel.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, cristian.dumitrescu@intel.com, radu.nicolau@intel.com, akhil.goyal@nxp.com, declan.doherty@intel.com, skori@marvell.com, pbhagavatula@marvell.com, jerinj@marvell.com, kirankumark@marvell.com, david.hunt@intel.com, anatoly.burakov@intel.com, xiaoyun.li@intel.com, jingjing.wu@intel.com, john.mcnamara@intel.com, jasvinder.singh@intel.com, byron.marohn@intel.com, yipeng1.wang@intel.com Date: Fri, 10 Jul 2020 17:11:10 +0200 Message-ID: <3229826.fCaP5pnNZJ@thomas> In-Reply-To: <20200710070226.6045-3-i.dyukov@samsung.com> References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200710070226.6045-3-i.dyukov@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v7 02/25] ethdev: add a link status text representation 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" 10/07/2020 09:02, Ivan Dyukov: > This commit add function which treat link status structure > and format it to text representation. It is missing an explanation about why it is required. Which problem is it solving? > Signed-off-by: Ivan Dyukov I'm surprised there is not so much review on this patch. [...] > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > +/** > + * print formatted link status to stdout. This function threats all > + * special values like ETH_SPEED_NUM_UNKNOWN, ETH_LINK_DOWN etc. and convert > + * them to textual representation. I don't understand the need for this function. If needed, the application can send the output of rte_eth_link_strf() to fprintf or a log function. > + * > + * @param fmt > + * Format string which allow to format link status. If NULL is provided > + * , default formatting will be applied. > + * Following specifiers are available: > + * - '%M' link speed in Mbits/s > + * - '%G' link speed in Gbits/s > + * - '%S' link status. e.g. Up or Down > + * - '%A' link autonegotiation state > + * - '%D' link duplex state > + * @param link > + * Link status provided by rte_eth_link_get function > + * @return > + * - Number of bytes written to stdout. In case of error, -1 is returned. > + * > + */ > +__rte_experimental > +int rte_eth_link_printf(const char *const fmt, > + const struct rte_eth_link *link); > + > +/** > + * Format link status to textual representation. This function threats all not "threats" > + * special values like ETH_SPEED_NUM_UNKNOWN, ETH_LINK_DOWN etc. and convert > + * them to textual representation. > + * > + * @param str > + * A pointer to a string to be filled with textual representation of > + * device status. > + * @param len > + * Length of available memory at 'str' string. > + * @param fmt > + * Format string which allow to format link status. If NULL is provided > + * , default formatting will be applied. Please do not start a line with a comma, it should be ending the previous line, like here ;) Even better: start the new sentence on a new line. > + * Following specifiers are available: > + * - '%M' link speed in Mbits/s > + * - '%G' link speed in Gbits/s > + * - '%S' link status. e.g. Up or Down > + * - '%A' link autonegotiation state > + * - '%D' link duplex state These specifiers look OK. > + * @param link > + * Link status provided by rte_eth_link_get function > + * @return > + * - Number of bytes written to str array. In case of error, -1 is returned. Better to have error case on a separate line. > + * > + */ > +__rte_experimental > +int rte_eth_link_strf(char *str, size_t len, const char *const fmt, > + const struct rte_eth_link *eth_link);