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 65165A04B5; Thu, 10 Sep 2020 21:36:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DCA01C198; Thu, 10 Sep 2020 21:34:53 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id D54E31C198 for ; Thu, 10 Sep 2020 21:34:51 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200910193451euoutp020939410a1c0323d870120fe32e3aa63a~zgyXzt90T0500705007euoutp02Y; Thu, 10 Sep 2020 19:34:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200910193451euoutp020939410a1c0323d870120fe32e3aa63a~zgyXzt90T0500705007euoutp02Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1599766491; bh=V+UhUmI0wX9EPRjnOZ4RF5aTByD1DePKpjF9zRdOzyY=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=YXJTt42wX6NGUZaw4DhoGOz8vBwAe0rFSk83KxQcc1GED4o8H0t3risT8TvjzgDxo 3FNGPTI/tAuMyK2PnFe7m8UCy1DQU3d+UpEYxrDcRwg1mhEfMcgaFFNFrI/ecGzpoK LugusfzkOUVsr+3RHl3/1A0g+O2Eqgk5Mwlqw5Tg= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200910193451eucas1p166d28d4d1a506774a7e50b4e61e58a5b~zgyXVSqq60510805108eucas1p1r; Thu, 10 Sep 2020 19:34:51 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 17.1D.06456.BDF7A5F5; Thu, 10 Sep 2020 20:34:51 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200910193450eucas1p18f1f4f7ff450392368409b7e1fb236cf~zgyXAmNqM0308403084eucas1p1q; Thu, 10 Sep 2020 19:34:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200910193450eusmtrp1622afaddea1c40eb51a90e36de7f223d~zgyW-n7GU3165331653eusmtrp15; Thu, 10 Sep 2020 19:34:50 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-a6-5f5a7fdb9638 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 41.19.06314.ADF7A5F5; Thu, 10 Sep 2020 20:34:50 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200910193448eusmtip24bef514e9456b83245e9b20d34bdd681~zgyVKFlIN1532615326eusmtip2U; Thu, 10 Sep 2020 19:34:48 +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: Thu, 10 Sep 2020 22:33:46 +0300 Message-Id: <20200910193400.15326-14-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200910193400.15326-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfUwbdRjHfe6ud0dDza1bxuNmWGwylSVsEo15si3bNM5cjCGLfygSGNZx drO8pTc2mTEiGphQ6kaJC0NLB1l4M3SDQoEAY1XHxo0hJMhQUMSXZeDeCkRgMKXrLf73fD/f 7/N9kl9+Imt28xvEQ1mHFUeWNcPCG7m2S4uD8T9/nJz23EQVS76rHqCpX2pYmiyf4Knk7mcM XW/YTV2BrwxU9ms+Q66yewwF6op5+nuygKPboQBD492aQKeHCwQKBW8IVDpYCXRjeZqlCu8s 0KCn1UCLFzt5urNczZFraQToC/9loD7nPY7KO9qBCoslultfK1DNeCyFJi9zpI21CPTN/BBL rVdXgE72+YAGCv817HlKXvKeNcg1XTcZ2X1miJUvjX0pyM4rHkY+f7udke/0jPCyy98Acv9U CSs3/rHA7zMmG3emKxmHjiiObbveMR5cadmR84/0wWRTK58PQVMxRIkovYB/fl3OFoNRNEt1 gEWVdYaImAN0f9ehi1lAraxZeLQyGpqFiFELWFjl0sU8oGeh1hBO8dKzqB33MGFjnXSex8Dy KBM21kp7ccY5y4VnTtqM3ooaNjybpO3Y3eLVT2zCxnO9q1wUo1b5b+OpYWyWYnG0au5hJ0o/ iDhzv+BhBqVX8POOo5HVtTjd59drnkTN7eQi+SLAk20tQkScAPy08pae2o3+mWtCuIiV4tDX uS2CX8Lmn/r1/sfx+q01YcyujmVtp3RswuOF5kjagr1XhnWMuHI/OoJl/P2sX3/EbsDFhYBw Ajad/v+WF6ABYpRcNdOmqAlZytGtqjVTzc2ybT2QndkMq19Ve9AXaof54XeDIIlgiTb1bk9O MxusR9S8zCCgyFrWmV4e0PabTenWvGOKIzvNkZuhqEHYKHK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bbjl1v75KaXfVHtyW671UPS VrA8viPQ3iDq97jgpj5q3PKp8Kwtwx/Pkd4/JyQGDlg3J84v8Zlj9L8daTTtUOkEGlPEVvdD XXe0E+2S8Q7f47ntqXX750HGomdXrEW9l+3uW1+eN1lLtg0Ob2oJXTjN0T/3PNYeGY7MXabd WVEvpfh4hXwpqeEVfwG9UkgbBgMAAA== X-CMS-MailID: 20200910193450eucas1p18f1f4f7ff450392368409b7e1fb236cf X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200910193450eucas1p18f1f4f7ff450392368409b7e1fb236cf X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200910193450eucas1p18f1f4f7ff450392368409b7e1fb236cf References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200910193400.15326-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v10 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 | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/examples/kni/main.c b/examples/kni/main.c index f5d12a5b8..49d888064 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[RTE_ETH_LINK_MAX_STR_LEN]; printf("\nChecking link status\n"); fflush(stdout); @@ -680,14 +681,10 @@ 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, + sizeof(link_status_text), &link); + printf("Port %d %s\n", portid, + link_status_text); continue; } /* clear all_ports_up flag if any link down */ @@ -717,19 +714,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