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 37484A04AE; Mon, 4 May 2020 20:31:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8283A1D167; Mon, 4 May 2020 20:31:16 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 15BBE1D160 for ; Mon, 4 May 2020 20:31:14 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200504183113euoutp016eb0d1d605bfdec514b667195df0d77f~L5s-Pla8_2618926189euoutp01x for ; Mon, 4 May 2020 18:31:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200504183113euoutp016eb0d1d605bfdec514b667195df0d77f~L5s-Pla8_2618926189euoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588617073; bh=B9RZVlkgHc60LejGcHv9JOpYAU04sd42IItEVNClCU4=; h=Subject:To:From:Date:In-Reply-To:References:From; b=a6cDvpky7MvqYzRDQvQ19+yZPlBUxhGlGBXytRuK+Sk78aFjSOC6LHsp36sm/1mdJ BD7OiGqau8w/2LfMr0kYd6cLSEhTnlOKykBqL0GxBt1dw3pfSweQvX3LcUJck59W0R GTwV7B1GsgXypCNelyH8jRtAr3dqlpEfBpVELUX8= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200504183112eucas1p147d52b1a19a996b1a7174c4935685c79~L5s_NHsQ80313703137eucas1p1j; Mon, 4 May 2020 18:31:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3C.E1.60698.07F50BE5; Mon, 4 May 2020 19:31:12 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200504183111eucas1p259980236ac30abdb2e64f49be357c952~L5s9FzD5s2057220572eucas1p2Y; Mon, 4 May 2020 18:31:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200504183111eusmtrp224361c3427eb7ab760247c15d35d1bcd~L5s9FN-vC1518315183eusmtrp2h; Mon, 4 May 2020 18:31:11 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-2d-5eb05f7038b0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6D.F7.08375.F6F50BE5; Mon, 4 May 2020 19:31:11 +0100 (BST) Received: from [106.109.129.29] (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200504183110eusmtip1ceff522cd7d7da8b568adc19e814212c~L5s8mJBff1584215842eusmtip1E; Mon, 4 May 2020 18:31:10 +0000 (GMT) To: Andrew Rybchenko , Thomas Monjalon , dev@dpdk.org, v.kuramshin@samsung.com, david.marchand@redhat.com, ferruh.yigit@intel.com From: Ivan Dyukov Message-ID: <844451fc-b882-f210-c2a5-21b8238867ab@samsung.com> Date: Mon, 4 May 2020 21:31:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <8d47d629-8008-f75b-b906-7945f2462d97@solarflare.com> Content-Language: ru-RU X-Brightmail-Tracker: H4sIAAAAAAAAA1WSaUgUYRjHfXfWmfFYG1fDJ5XKNfLAozJiozCzg/0gERYhmdqWk4ruKjse aRiKroiG1CJmaq1Z4VV45I1pLXm1kJF5pqFomYYpq1nmle6MYN9+z/P8n+P/8pKYMBW3JsPk 0bRCLo0Q4cb8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d/OJiU1J7MstUjfLkEv 496eiWwFtxwqVvR+Z25g3GjaxcjJISFgItG9fiNrFyMXh5DAUkaJc/NeADkcQAkJiddPmCFq hCX+XOtig6h5yyjx6t88JpCEsECQxKTVjSwgCRGBrYwSf2ecgpr0llni47LlrCBVbAIaEqc7 IDp4Bewkpr28yghiswioSLxYOY0dxBYViJD4fPAIG0SNoMTJmU9YQGxOASeJ23dvgZ3BLBAm cf7vBnYIW1ziw/aDbBMYBWYhaZmFpGwWkjII20xi3uaHzBC2vETz1tlANgeQrSaxrFUJWXgB I/sqRpHU0uLc9NxiQ73ixNzi0rx0veT83E2MwHjcduzn5h2MlzYGH2IU4GBU4uGN+Lw+Tog1 say4MvcQowQHs5IIr6LZhjgh3pTEyqrUovz4otKc1OJDjKZAP09klhJNzgemirySeENTQ3ML S0NzY3NjMwslcd4OgYMxQgLpiSWp2ampBalFMH1MHJxSDYxxj9smOv085MD9XNv52g2+E0XL GLh38a14PENn1n3TtSsPVZaZz1NmXKH24es8u32rtcKKb7/mM0t533u4/vHi5883vki5+O9U 5yM/7gNrmx4uzGlodpQ4uVTV1nmTzXuR0yfO/8zz4+oJsl2zO7ym7vYiY59JLM0+J7+nnJ5y 3qz/qnRW79p0JZbijERDLeai4kQAyk0Z0d0CAAA= X-CMS-MailID: 20200504183111eucas1p259980236ac30abdb2e64f49be357c952 X-Msg-Generator: CA X-RootMTR: 20200427095759eucas1p146d501188af3d1215707e664672076bf X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200427095759eucas1p146d501188af3d1215707e664672076bf References: <4816966.qqrk5fENW1@thomas> <20200427095737.11082-1-i.dyukov@samsung.com> <20200427095737.11082-6-i.dyukov@samsung.com> <33f1d60f-2c31-5449-7e52-80951065ee9b@solarflare.com> <313dfabf-1e6c-b0a2-cde4-b19d0d4dbc84@samsung.com> <8d47d629-8008-f75b-b906-7945f2462d97@solarflare.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v1 5/6] doc: update sample app with unknown speed 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" 04.05.2020 18:54, Andrew Rybchenko пишет: > On 5/4/20 6:46 PM, Ivan Dyukov wrote: >> 03.05.2020 16:57, Andrew Rybchenko пишет: >>> On 5/2/20 10:35 PM, Ivan Dyukov wrote: >>>> 01.05.2020 16:28, Andrew Rybchenko пишет: >>>>> On 4/27/20 12:57 PM, Ivan Dyukov wrote: >>>>>> Signed-off-by: Ivan Dyukov >>>>>> --- >>>>>>   doc/guides/sample_app_ug/link_status_intr.rst | 3 ++- >>>>>>   1 file changed, 2 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/doc/guides/sample_app_ug/link_status_intr.rst >>>>>> b/doc/guides/sample_app_ug/link_status_intr.rst >>>>>> index 5283be8b7..6ebc707b7 100644 >>>>>> --- a/doc/guides/sample_app_ug/link_status_intr.rst >>>>>> +++ b/doc/guides/sample_app_ug/link_status_intr.rst >>>>>> @@ -177,7 +177,8 @@ An example callback function that has been >>>>>> written as indicated below. >>>>>>               printf("Failed to get port %d link status: %s\n\n", >>>>>>                      port_id, rte_strerror(-ret)); >>>>>>           } else if (link.link_status) { >>>>>> -            printf("Port %d Link Up - speed %u Mbps - %s\n\n", >>>>>> port_id, (unsigned)link.link_speed, >>>>>> +            printf("Port %d Link Up - speed %u%s - %s\n\n", port_id, >>>>>> (unsigned)link.link_speed, >>>>>> +                  (link.link_speed == UINT32_MAX) ? ("(UNKNOWN)") : >>>>>> (" Mbps"), >>>>>>                     (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? >>>>>> ("full-duplex") : ("half-duplex")); >>>>>>           } else >>>>>>               printf("Port %d Link Down\n\n", port_id); >>>>>> >>>>> I think that 0 looks nicer than UINT32_MAX when printed as integer >>>>> keeping in mind that it is unknown. >>>>> >>>> zero will mislead developers about real value of the link_speed. >>>> therefore we should print real value of the speed or print nothing. e.g. >>>> >>>>    if (link.link_speed == UINT32_MAX) >>>> >>>>         printf("Port %d Link Up - speed UNKNOWN - %s\n\n", port_id, >>>>                    (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? >>>> ("full-duplex") : ("half-duplex")); >>>>    else >>>> >>>>         printf("Port %d Link Up - speed %u Mbps - %s\n\n", port_id, >>>> link.link_speed, >>>> >>>>                     (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? >>>> ("full-duplex") : ("half-duplex")); >>> I'm not sure about 0 to be misleading, but it could be. >>> Above definitely will look better in stdout. >>> The only problem is code duplication in many-many places. >>> May be add simple function in ethdev to do it and use it in >>> all examples? >> Also we can introduce new printf specifier using >> register_printf_specifier function or even rewrite %u which will print >> UNKNOWN in case of >> UINT32_MAX. > True, but it is too libc-specific as far as I know. Yep, it has portability issues. It's GNU C extension. https://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html > >>> Please, wait more feedback before doing it. >>> >>> >