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 96342A04C7; Tue, 15 Sep 2020 21:09:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9AD7E1C1BA; Tue, 15 Sep 2020 21:08:19 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 1CF901C1B8 for ; Tue, 15 Sep 2020 21:08:17 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200915190816euoutp0296aa8abcdf0b1855cf5ef190a28afb6e~1Cpl6KJce0661006610euoutp02k; Tue, 15 Sep 2020 19:08:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200915190816euoutp0296aa8abcdf0b1855cf5ef190a28afb6e~1Cpl6KJce0661006610euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600196896; bh=V+UhUmI0wX9EPRjnOZ4RF5aTByD1DePKpjF9zRdOzyY=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=Nofk31wuw2ORZVac2G2xITm3gIO/57UT/NVXe2/JwMjTCeGCyoJOuQyTiVBvubLdK dCit5GhnVgTchlJ1e5q9VTkzLdKiL+qekt23WXtO3KF38RDBKkyVc9Sor/4m62mJEP 7Io+W3f6uY2ByCYddvon/LIOuTRJMtb64L2UIRtM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200915190816eucas1p2e5f9915b5e961c37a4b852febf798b23~1Cplci9r11274512745eucas1p21; Tue, 15 Sep 2020 19:08:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 52.56.06318.021116F5; Tue, 15 Sep 2020 20:08:16 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200915190815eucas1p1c027e0f5e4f5b2cb5c179ccad5cd4456~1CplBN_Cc0048000480eucas1p1c; Tue, 15 Sep 2020 19:08:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200915190815eusmtrp1dfc783da02ced0b719e236b11ffecb14~1CplAcEJj2872428724eusmtrp1c; Tue, 15 Sep 2020 19:08:15 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-82-5f6111208328 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F9.EB.06314.F11116F5; Tue, 15 Sep 2020 20:08:15 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200915190814eusmtip2745c272ab7b74b1058e5483587fe796b~1CpjOVtFK1759817598eusmtip2O; Tue, 15 Sep 2020 19:08:13 +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: Tue, 15 Sep 2020 22:07:08 +0300 Message-Id: <20200915190728.18143-14-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200915190728.18143-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0wTaRSG881MZ6bVmnEw8URX1BqT1Si6cX+cuLrezSRqYmKMkUSx6oi6 UE0Lrhg328hFrVgF8QamgiiyYKwKFIqXQBNFLJRIlijhsg1rgqhFWmDXQgtSBuO/5zznvOck Xz6eFnPYGfwhQ5JsNOgTdKyGcbwIehbPmaqPW1rkFtHeYCPY1VlIozeng8VzfWkUvi1ZhU8q b6gw+x8zhdZsP4WVxRYWP3lPMdgbqKSw/ambw9zmUxwGXN0cnm/KI9gd+kDj9fx+gk22ChUG a6tZ/By6xaB1qIXghfKXBOsy/QzmOKsIZlgE7PvrLoeF7dEY8L5k0N1axuG9wdc0VjSECWbV 2Qk2ZoyqVs+VhvLvqKTCJz2UdKngNS29aL3CSZn1Nkp62FtFSZ+ftbCStbyESK+6ztFS6bsv 7FZNrGbFfjnh0DHZuOTXPZqD4bJfjv4vHPfer2DNxKW1EDUPws/QZG5mLETDi0IxgfpwPasU AwTK+tI5pegn0NXuJ98ivf4RLsKicJfAFS+vDA0SCHZEdql5VvgR3GdsVKQxTXjIQmXoDRVp RAkbwJ8aGmdGmA/pdud4QCsshwaHmVUuzIbSBzV0hNVjvtnZMnEtGt7cHBhfCkIDDy2+B5QS WA83Si2MwlHwoa6cU/gHcF/KZJTAaQJZjjJOKS4SSM3zTUytgvKPnjHmeVpYAPbqJYpeAxfS Wsc1CFPgrW9qRNNjmO24SitaC2cyRGVaBzX1zRMaIDw8WdESdI5YJ973KYGOHit9kczO/X4r n5ASMl1ONiXGy6ZlBvn3GJM+0ZRsiI/ZdyTxERn7q+6RusEq8iy010UEnugma/Pb9sSJKv0x U0qiiwBP66Zp1za6d4va/fqUE7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RMikrPnea4DE73v44Qefrmoug2U6xGceqqcs9xj94Rq7pT WTmaGZIfk4ZLtiduXK1I9ous39Xw1/Y7cMSb9/bITOyXRFXG5x2KWzuTZX/5Y2Z8dj764Mlz 4sres++2WMyumZbTQZ/qTVYU/a3ubeGoMeBIew/y63I5Vzk9tsWULPr7B5+DK2rHGYNyf3Jc To6U4lNV8kBSx6v+AVQSCvUIAwAA X-CMS-MailID: 20200915190815eucas1p1c027e0f5e4f5b2cb5c179ccad5cd4456 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200915190815eucas1p1c027e0f5e4f5b2cb5c179ccad5cd4456 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200915190815eucas1p1c027e0f5e4f5b2cb5c179ccad5cd4456 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200915190728.18143-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v11 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