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 6DDACA0528; Sat, 11 Jul 2020 12:46:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C69CB1D9C0; Sat, 11 Jul 2020 12:45:03 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 3EE8C1D983 for ; Sat, 11 Jul 2020 12:45:03 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200711104503euoutp027df2dac9056ec0584cfca5f73fd1247e~grNX3NCzR1781617816euoutp02a; Sat, 11 Jul 2020 10:45:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200711104503euoutp027df2dac9056ec0584cfca5f73fd1247e~grNX3NCzR1781617816euoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594464303; bh=iuIgHhL58RT/qRhYxgk8qZcH/dfnsAboJDNEGh69aTU=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=Jkiap9wkmx3Bn3AJB10lxdYOUsESR649y+tU7KxCD1kigkIP5fCSVdZjkMB4SS705 kYJDAbTZKgyYszVv34A4lJUHiklKRvUqqH7WQLojwV5lfHqzny/enIGo8h8Hm1bNC0 Va6lnAtERfOE3IPpDYkwfyq7kaBi1ccarA3dt69g= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200711104502eucas1p107b04a7cbc0e57a3a481c80bbbaf900f~grNW_gpbJ1619116191eucas1p1w; Sat, 11 Jul 2020 10:45:02 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CD.1F.05997.D28990F5; Sat, 11 Jul 2020 11:45:02 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200711104501eucas1p28c4f82e4a618c20c1e673afebb687468~grNWmHFVr1983519835eucas1p2w; Sat, 11 Jul 2020 10:45:01 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200711104501eusmtrp263559c1c32625252b5e34464ae8bb7bf~grNWlNhO71628816288eusmtrp2U; Sat, 11 Jul 2020 10:45:01 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-55-5f09982d0ad4 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 17.17.06314.D28990F5; Sat, 11 Jul 2020 11:45:01 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200711104459eusmtip1f9998416ad0b71653548f813b5343a79~grNUvtUNu1304313043eusmtip1k; Sat, 11 Jul 2020 10:44:59 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, i.dyukov@samsung.com, v.kuramshin@samsung.com, thomas@monjalon.net, 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: Sat, 11 Jul 2020 13:44:00 +0300 Message-Id: <20200711104414.15422-14-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200711104414.15422-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0yTVxjHfd57Gysv1YQT5rw0mYgJOC8fnhiiDjW+MWoMH52KVV6BSKtp wcFMTEcmwYoo9Y6mFojDIQarLcVOBjYZFwtViAw7nWNmREXHHVFWdC0vxm+/5385zznJEWjt aS5WyDRmyyajPkvHqZnapveBhMQLqtSvS6oprGmzAz5/VkFjz5k/OTw++COFj6vW4F3PZRZt f1koLLYNUei5ZuXwTU8+g/3DHgqf1vt5LO3M53HY94LHEw8uAb4I9dF40TEC+MDuZvH9PS+H A6FyBosnugBPuloAm4uGGDxzpw6wwCri4M+VPFY8nYfDPS0M+oO3eawe66DR3TYJWNJcA9he 8JFdu1CacFxlpYq7ryjpdFkHLTUFz/FSUaudkpz9dZQ08GsXJxW7qkC6//w4LV3/5x23Tb1d nZQmZ2Uekk1LV+9WZzQFGumD98Vc7w/nwQJnNVZQCURcSYLvrGAFtaAVrwEpK+xllGEUyB8W F6sMI0Dyxzu4TxW7b2i6UgnkifMYGzG04hiQE85NEebExcRfaKcioTmikyOeUDcVMWaL60mD 6+VUgRG/In2jFVOsEVeRvxsessqG+eT6zUY6wqqwPjnwkFYWzCPdV0anDiVim0COhUZopbCe 9NX2MwrPJn3NLl7hueTjnSuUwofJ+K1uXikXAnlWfnQ6tIa4XgfCLAi0GE9qvEsV+Rtyozfy fiHMs8jjf6MjMh1GW+15WpE1pLBAq6R1pLG1c1omZPK/mYoskaLiXzjl9vVAAg07TsH80s+r HABVECPnmA3psnm5Uf4u0aw3mHOM6Yl7DxhuQfir+j80j9aBN7THB6IAupkah15I1bL6Q+Y8 gw+IQOvmaJLb/bu0mjR93vey6UCqKSdLNvvgC4HRxWhWlL/aqRXT9dnyflk+K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KkeOVG14UKLCNrpenX 2DXH9atk/VDtkQXjs5O36fJclllvtBP7KnLjfL16tuZsWBZYGJu/2fdpysMtqetSGD41P70v 5Ywm6NLR82sbr7S7fGondy/M3tGfS0506F3G29ub7tuWl+adjUutnWM+2LOmhUuZu8G4iXOW 97qUhJSo5pfgBkn9DxfU0t0JAwAA X-CMS-MailID: 20200711104501eucas1p28c4f82e4a618c20c1e673afebb687468 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200711104501eucas1p28c4f82e4a618c20c1e673afebb687468 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200711104501eucas1p28c4f82e4a618c20c1e673afebb687468 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200711104414.15422-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v8 13/24] examples/kni: new link status print format X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: i.dyukov@samsung.com List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add usage of rte_eth_link_to_str function to example applications Signed-off-by: Ivan Dyukov --- examples/kni/main.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/examples/kni/main.c b/examples/kni/main.c index f5d12a5b8..679b158d4 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -661,6 +661,7 @@ check_all_ports_link_status(uint32_t port_mask) uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; int ret; + char link_status_text[60]; printf("\nChecking link status\n"); fflush(stdout); @@ -680,14 +681,9 @@ check_all_ports_link_status(uint32_t port_mask) } /* print link status if flag set */ if (print_flag == 1) { - if (link.link_status) - printf( - "Port%d Link Up - speed %uMbps - %s\n", - portid, link.link_speed, - (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex")); - else - printf("Port %d Link Down\n", portid); + rte_eth_link_to_str(link_status_text, 60, NULL, + &link); + printf("Port %d %s", portid, link_status_text); continue; } /* clear all_ports_up flag if any link down */ @@ -717,19 +713,15 @@ check_all_ports_link_status(uint32_t port_mask) static void log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link) { + char link_status_text[60]; if (kni == NULL || link == NULL) return; - if (prev == ETH_LINK_DOWN && link->link_status == ETH_LINK_UP) { - RTE_LOG(INFO, APP, "%s NIC Link is Up %d Mbps %s %s.\n", + rte_eth_link_to_str(link_status_text, 60, NULL, link); + if (prev != link->link_status) + RTE_LOG(INFO, APP, "%s NIC %s", rte_kni_get_name(kni), - link->link_speed, - link->link_autoneg ? "(AutoNeg)" : "(Fixed)", - link->link_duplex ? "Full Duplex" : "Half Duplex"); - } else if (prev == ETH_LINK_UP && link->link_status == ETH_LINK_DOWN) { - RTE_LOG(INFO, APP, "%s NIC Link is Down.\n", - rte_kni_get_name(kni)); - } + link_status_text); } /* -- 2.17.1