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 E0518A00C5; Mon, 6 Jul 2020 22:40:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B3D9B1DD92; Mon, 6 Jul 2020 22:38:32 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id DDC371DD88 for ; Mon, 6 Jul 2020 22:38:30 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200706203830euoutp011d6afa2433af703dea249ea53beafe9d~fRFGszTAK0553305533euoutp01k; Mon, 6 Jul 2020 20:38:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200706203830euoutp011d6afa2433af703dea249ea53beafe9d~fRFGszTAK0553305533euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594067910; bh=Gr1Jcl7miAeWLUh9GahLeLAq7ORJTSLyxj+MvXGXDw4=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=HuPFTpQcsQHVbxML9rsUG4aKO26Wa2seHgA+SlpZNn5Lg0YGwp3dUYVBl9M4CpU39 Qt9fLxJBwo9d3QdDcQGj2MIhpqxN1oM6rk0fMzb41Xy7otQPbbvNIgSt7LZ9D28oWb uXsmzgfWt6cKfUKDmcOcGHOtlUXrwf4ctVW7qqvQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200706203830eucas1p2f2f6f6c4d4b70a4c7f1ffad28fdd3b6e~fRFGbnfWN1728517285eucas1p2_; Mon, 6 Jul 2020 20:38:30 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 3B.C9.05997.6CB830F5; Mon, 6 Jul 2020 21:38:30 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200706203829eucas1p287744dd5ed850265d94669971a98abab~fRFFlXFHK2126821268eucas1p2B; Mon, 6 Jul 2020 20:38:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200706203829eusmtrp27113bd53a9a9304be0ce419a46a48bd8~fRFFklvYl0640206402eusmtrp22; Mon, 6 Jul 2020 20:38:29 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-c9-5f038bc65307 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AC.DF.06314.5CB830F5; Mon, 6 Jul 2020 21:38:29 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200706203827eusmtip19ba5b429d752dbf2fc49aff8b5a0b22c~fRFDxXd6-1791017910eusmtip1n; Mon, 6 Jul 2020 20:38:27 +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:37:28 +0300 Message-Id: <20200706203743.29416-15-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706203743.29416-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSbUxTdxTGc+7/9t5LY9m1ungCRmIzE12iTt2Hk8XINjW5X7aRGZdlcbJO 71BXkLTixPmBMCQNMOqq8XUURnUqrwN5KYgL1o2XFUQRBmWgjdnWAK4VRFRe5qgXs2/P8zvP OU/yz19iRqcQI+1NOaBaU8wWk6Dn61qeda1uyWWJb/SXv0qVHS6g+3fdjAInhgTKfZjFUX9J PDXVf68j570MjvKdYxzVX8oR6EEgk6fQeD1Hg9d8Ip3tzhRp3BsU6duuc0DBmRFGZ4oeAXW5 anX07HqjQOGZYp7yp3qBHDVtQK15YzydaPAAZefI9PDyRZHcg8toPNDGk89/RaSyx7cZ1XbM An3XWgnUmf1c9/ZyZarogk5xNw1zyvEfbjOlxX9SVPLaXZxSFfJwSvjnXkHJrykB5bf7uUwp /fOpkKD/RL9xt2rZe1C1rt30mX5PT95NIfUX+VCDc1rMAIchB6IklN/EpqCb5YBeMsqXAEPT FaCZCcD245nz5hGgo/uO8HKlYPQBrw0uAt4Lj4maeQx4rqyOi6QEeSX67C4uMlgsVwlYP9M3 ZyRpkbwFXRfiIhleXoFPB0ZeXDXIb2FZgRe0hjgs/amZReJRc7zg15gINsrLsK9w4sVJlHsk 9LcPiFp+C2bdadBpehGOtNbM86X4vKGQ0/TX+KS6T9SW7YB3i4/Oh+KxZvSmGClj8iqsbFyr 4XcwPDHERzDK0dj/z8IIZnPSWXeKadiA9myjljZhc3v3PEacnV6gSQV/nIrWHucaYHByCo5B 3Nn/q4oASmCJmmZLTlJt61PUr9bYzMm2tJSkNbv2J1fD3E/1/ds64YHGmc+9IEtgWmCwCyzR qDMftKUnewElZlpseLfTt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eFR4JKgCZPn0kx1yWq8z86k8n8Gb/ucwqZciGwWLm+LWKVPjxYWXJ+1b NEkBLbJMn8+Ti7Rb0fo9uzaUVCc+zpp7kyoeFU/4snPn7A0W/WO40IYznT8jGzSByt5Lvm1x xXonpW+rOzK8m7fFHAzS0WsV9tjWxvVT87yCzvrNhCgXvKwI2djX6DNiOZhw8UxAbtjWQJft wLn+ZZrDKkJI1rHBuEnQ/QXD6TuJBgMAAA== X-CMS-MailID: 20200706203829eucas1p287744dd5ed850265d94669971a98abab X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200706203829eucas1p287744dd5ed850265d94669971a98abab X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200706203829eucas1p287744dd5ed850265d94669971a98abab References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200706203743.29416-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v6 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