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 7885AA04AE; Mon, 4 May 2020 17:46:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C9DA1D167; Mon, 4 May 2020 17:46:43 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 7002D1C2F5 for ; Mon, 4 May 2020 17:46:42 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200504154641euoutp02a3871a2d791a2ab1b13ae3dd5e7c60ff~L3dUrBO6q2796427964euoutp02X for ; Mon, 4 May 2020 15:46:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200504154641euoutp02a3871a2d791a2ab1b13ae3dd5e7c60ff~L3dUrBO6q2796427964euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588607201; bh=OIHLPs3PJ8ZOabj+FGSPFWZa6gguR0kJJIQwbfJi1LU=; h=Subject:To:From:Date:In-Reply-To:References:From; b=tJaZZavwG3pwZuQwltVcEhTY5vOAU4z6kWMX1Dnyl66X4ir81HIpBfpVK9PuCjtNm OufnK1lEY0qLaocgx+UGWZdcZ3ZL3ZX5ffb+vlrveoyN45jNOPZ/OaqpWJzaYg5bgf KXo9JEghoARCHuEj5D4UfycpFG5pMyi5Ll+TiPUM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200504154640eucas1p1831d8afe7d57897723777196fd21dd76~L3dUP44BY2132321323eucas1p1O; Mon, 4 May 2020 15:46:40 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 94.98.61286.0E830BE5; Mon, 4 May 2020 16:46:40 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200504154640eucas1p1d20630cb7a539f0fde68d8a12c3267e4~L3dTxGpPk1239612396eucas1p1h; Mon, 4 May 2020 15:46:40 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200504154640eusmtrp1cd76b9c82a6dd36c72d9ceaa7a2ca24c~L3dTwgk1l1077410774eusmtrp1T; Mon, 4 May 2020 15:46:40 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-b0-5eb038e05d59 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7B.CC.07950.0E830BE5; Mon, 4 May 2020 16:46:40 +0100 (BST) Received: from [106.109.129.29] (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200504154639eusmtip1be117c6a5416f29a77385d0becb8272d~L3dTWjrcN0652706527eusmtip1V; Mon, 4 May 2020 15:46:39 +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: <313dfabf-1e6c-b0a2-cde4-b19d0d4dbc84@samsung.com> Date: Mon, 4 May 2020 18:46:39 +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: Content-Transfer-Encoding: 8bit Content-Language: ru-RU X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOKsWRmVeSWpSXmKPExsWy7djP87oPLDbEGVybqWPxYMpdNovtK7rY LN592s5kcWfvaXaLTw9OsFicvrmZ3YHN49eCpawei/e8ZPI4dnMau8f7fVfZPPq2rGL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hPCHUxcnJICJhIbOr8xd7FyMUhJLCUUWLL9/8sXYwcQAkJiddPmCFq hCX+XOtig6h5yyix4tF5NpCEsECQxKTVjSwgCRGBrYwSf2ecYoWoamCW+LR1OhNIFZuAhsTp jnlgNq+AncTei1vAxrIIqEi0bjgEZosKREh8PniEDaJGUOLkzCdgV3AKOEkcmy4JEmYWMJOY t/khM4QtL9G8dTaULS7xYftBtgmMgrOQdM9C0jILScssJC0LGFlWMYqklhbnpucWG+kVJ+YW l+al6yXn525iBEbXtmM/t+xg7HoXfIhRgINRiYd3w9f1cUKsiWXFlbmHGCU4mJVEeBXNNsQJ 8aYkVlalFuXHF5XmpBYfYjQF+m0is5Rocj4w8vNK4g1NDc0tLA3Njc2NzSyUxHk7BA7GCAmk J5akZqemFqQWwfQxcXBKNTCWRxkLHta/FO1YWeH3+N+RvqfsHwL/XrcX0trxtjTu+Ut1LssL OZ27ixcUmBjEldtEty9YefwQs+7JNSqrVuoedmVSFBYW5Ql9e6aV1b60+s7y14c2bQv/wPft /wqt24ffMAYx9H8oLLPOuzrvqbHAY27fov8iXNuLmySTj0VvYN/k1S8UVKbEUpyRaKjFXFSc CABb3VNXxAIAAA== X-CMS-MailID: 20200504154640eucas1p1d20630cb7a539f0fde68d8a12c3267e4 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" 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. > > Please, wait more feedback before doing it. > >