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 206BCA04B2; Sat, 2 May 2020 21:35:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 541D31D617; Sat, 2 May 2020 21:35:50 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id F19861D5EC for ; Sat, 2 May 2020 21:35:48 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200502193547euoutp01d59b00ac95b8e8fa4040b67a9f31e046~LTSygMCS21630216302euoutp01G for ; Sat, 2 May 2020 19:35:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200502193547euoutp01d59b00ac95b8e8fa4040b67a9f31e046~LTSygMCS21630216302euoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588448147; bh=FckBPd3JM47XlpwOPCCn/VfXW+yMwi2DtyRn70rW17c=; h=Subject:To:From:Date:In-Reply-To:References:From; b=OiX4zC9JRiBPbezUI1AkS3iH81oQIBcRE8JgdCEAeG0O8qXhO21feuoX0/C5MbduF MJcQnahxAE5Sq3w1o8RvFybAHM9N5Al6+RSD01l0w6jYfpx+K4Ci5pDPLzZbQ+5Zkt jXfe6/UWYDx2I9zKOaYd2/o+C6EUTtCGEKQM2m/U= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200502193547eucas1p13fd7e94724b5afefa1888dcde5831ccd~LTSyF4KNM0756907569eucas1p1t; Sat, 2 May 2020 19:35:47 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id E2.7A.60679.39BCDAE5; Sat, 2 May 2020 20:35:47 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200502193545eucas1p1d39284fd5c3be16a88ddf8f313ec33fa~LTSw90Er60756907569eucas1p1s; Sat, 2 May 2020 19:35:45 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200502193545eusmtrp25d317f43dbe96aa0dbc69b0f5879a2e5~LTSw9OrTV2321123211eusmtrp2k; Sat, 2 May 2020 19:35:45 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-9b-5eadcb937627 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A0.48.07950.19BCDAE5; Sat, 2 May 2020 20:35:45 +0100 (BST) Received: from [106.109.129.29] (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200502193545eusmtip10ac135a5177dcb4099c9d2f9fed31c43~LTSwZRMwZ3197531975eusmtip1y; Sat, 2 May 2020 19:35:45 +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: Date: Sat, 2 May 2020 22:35:37 +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: <33f1d60f-2c31-5449-7e52-80951065ee9b@solarflare.com> Content-Transfer-Encoding: 8bit Content-Language: ru-RU X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCKsWRmVeSWpSXmKPExsWy7djPc7qTT6+NM9g/ndPiwZS7bBbbV3Sx Wbz7tJ3J4s7e0+wWnx6cYLE4fXMzuwObx68FS1k9Fu95yeRx7OY0do/3+66yefRtWcXosfrJ D7YAtigum5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wERi0/6pzF2MXBxCAksZJV5u3MzWxcgBlJCQeP2EGaJG WOLPtS42EFtI4C2jxNdd5SC2sECQxKTVjSwgvSICWxkl/s44xQoxaDKTxL6ne8A62AQ0JE53 zGMCsXkF7CT2fNkAZrMIqEis2viWFcQWFYiQ+HzwCBtEjaDEyZlPWECO4BRwkpjzLAYkzCxg JjFv80NmCFteonnrbChbXOLD9oNsExgFZyHpnoWkZRaSlllIWhYwsqxiFEktLc5Nzy020itO zC0uzUvXS87P3cQIjKxtx35u2cHY9S74EKMAB6MSD++KaWvjhFgTy4orcw8xSnAwK4nwLuhf HSfEm5JYWZValB9fVJqTWnyI0RTot4nMUqLJ+cCozyuJNzQ1NLewNDQ3Njc2s1AS5+0QOBgj JJCeWJKanZpakFoE08fEwSnVwLjH+H1j+9kO1rkVNy7Xv73AdWNO4NPirCdps9YUea34Y3V2 z0RjRVP2JKk5F1VY5rR/v7NXWn9PguXpMwHfZh0Nm/7yYNHfd22SC0qVN8n7xk/6KdAS5sFi 6ivycfHdkl8pk3pjSw79u3vlUr2o7620wqxzxlmZHNnBX/jnS0tv7zjQZqjtHa3EUpyRaKjF XFScCAA9iaX5wgIAAA== X-CMS-MailID: 20200502193545eucas1p1d39284fd5c3be16a88ddf8f313ec33fa X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" 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> 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" 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"));