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 C464EA00C5; Mon, 6 Jul 2020 22:29:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B57E1DCF4; Mon, 6 Jul 2020 22:27:20 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id AFFDB1DCF3 for ; Mon, 6 Jul 2020 22:27:19 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200706202719euoutp028f0153aa552b91f97d8ce4a1031d2453~fQ7Vm8lAE1760117601euoutp021; Mon, 6 Jul 2020 20:27:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200706202719euoutp028f0153aa552b91f97d8ce4a1031d2453~fQ7Vm8lAE1760117601euoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594067239; bh=Gr1Jcl7miAeWLUh9GahLeLAq7ORJTSLyxj+MvXGXDw4=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=Rlh4ZNW8lnAlxVGFn+D0ZV+3/hg0xLUeAXpFmP3Vq8VNwHUAi3TZJw9TrjgKVNdEy Owrkx9UPlW/7LzrP/u++rLwxV18sDtYTVAa4bRsqTw8Xd3tCjY5VAY1tlqajFR1kvq ugxFFT/CY2trH9nS6p9OkMnSa4KmqmalI/yNJHhE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200706202718eucas1p1869aa2ba51f9ec8dd06e6d093dd99f38~fQ7UlTqyE1287412874eucas1p1v; Mon, 6 Jul 2020 20:27:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 38.96.06318.629830F5; Mon, 6 Jul 2020 21:27:18 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200706202717eucas1p2d66b3ffebdd370ac1e2ecd9f398259d8~fQ7Tafw7D0500605006eucas1p2p; Mon, 6 Jul 2020 20:27:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200706202717eusmtrp235b6bd7a6f6eb24d612d16a13748a8ca~fQ7TZc8WW3205132051eusmtrp2u; Mon, 6 Jul 2020 20:27:17 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-32-5f038926067e Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2B.AF.06314.529830F5; Mon, 6 Jul 2020 21:27:17 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200706202715eusmtip12e6906245383229d2961bbe1a26b4968~fQ7RpzpFE1560515605eusmtip1Y; Mon, 6 Jul 2020 20:27:15 +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: Mon, 6 Jul 2020 23:26:04 +0300 Message-Id: <20200706202626.28628-15-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706202626.28628-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa1BMYRjH5z3n7DmnnY45NvKKEdu4FLmUyzPGNcycDz74IDOFsjhT6Da7 cokxjUmybYsVRpktNaYb3XVTjcJu2bRCqpE0MUNuKVJU2N2zxrf/83v+/+d55p2XJRWptAd7 IOqwqI5SRShpOVVh+mn1nXeODF16ts4dilqMCPp6sknoTX1FQ/LXBAI689dDbeV1GRhexxOg NwwSUJmrpeFT72kKvgxVEtBdZ2Eg7elpBoYa3zGQYk1H8G78AwnXMr8hsBrvyOBnQw0NA+NZ FOh/tSM4X96EwKwbpCC1ugpBopaHr3k5DGR3z4Kh3iYKLF1lDNwabiPhTssEgovmIgSPE//I NswRfmXelAnZtf2EcOlGGymYuq4wgq7ZSAglX6oIYaC+nRb05flIeNSXTAoFb0fpbfJg+Zr9 YsSBI6J6ybo98vDnulY65gF/rNowxsSj85wWubCYX46Lui5TWiRnFXwuwm2jFaRUfEc4s1CP pOIbwl2/c+h/kUedVqcrxxapf0ZIxTDC2hcm0u6i+QXYkmR0NKbwJTSuHO8g7A03fjP+YXpI 2TXFz8Uvm67ZAizL8avx7SubpA2euKD4nmOOiw0/GChzbFbws3BHxnfHTMy3sNiaMMFIgc3Y qtdSknbDH8zlTj4T/6nOICR9Ao+UdjBSOAnhnqwzTtN6XP6xlbEfQfLeuKhmiYQ34vQbTxy3 YX4S7vw82Y5JmzRUXHViDiclKiS3Et9rfurEGE+MuUpYwM3ZZc7nqUNY/6aauIA80/7vykQo H00TYzWRYaLGP0o8ulijitTERoUt3hcdWYpsf9Xy2zxcherH9zYinkVKV66XJUMVMtURzfHI RoRZUjmFC3hsCVFw+1XH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Hki2VJdPUBho7SGIWjghAnGP7vYZSHTyLKDJ5eu7RIu6sxQ171peV0qSrO 71Ply8Mq89dCPiyzyN7SHGFZMW7v/qw6XnN7v3JZdMJIYl5OvH2id6WyCtkKlU9q2jczASd8 ucb1/ntqArQJg5PJ2yuYeMqxOm/hB+97u0siEpqXPDd/n/xTGZpbeFJ/tUC918RMtXmEpZ6x JssJMVrDrcENouYfYOb7tQgDAAA= X-CMS-MailID: 20200706202717eucas1p2d66b3ffebdd370ac1e2ecd9f398259d8 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200706202717eucas1p2d66b3ffebdd370ac1e2ecd9f398259d8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200706202717eucas1p2d66b3ffebdd370ac1e2ecd9f398259d8 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200706202626.28628-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v5 14/25] 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_strf 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..8ad7fb532 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_strf(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_strf(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