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 773D3A04C3; Tue, 11 Aug 2020 10:56:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D1C941C1A7; Tue, 11 Aug 2020 10:53:28 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 838901C19B for ; Tue, 11 Aug 2020 10:53:27 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200811085327euoutp013c35d16e8397f8ccba15f61395af6ee4~qKryUqLKQ0826508265euoutp011; Tue, 11 Aug 2020 08:53:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200811085327euoutp013c35d16e8397f8ccba15f61395af6ee4~qKryUqLKQ0826508265euoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1597136007; bh=1HUBFNSbsGccIr2R0MvGSWz7oQhbKklL110HJB3GrNg=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=i+YrBUKckZG7+Rh3OLIlir82TuRnCMgUTSdC5W/AaSYy6XfKi9Pg+KAfmRXlExIB1 OAJZFOX3L7qnP85zrs+BB3NMPb+MW3gaUvw4rrZSrX1Km+WwLXtPWLLhdK/grh3LEW x1CKVBJ3sT7dm0sm/xzz1972HCy7aHeJjnYNUzbI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200811085326eucas1p224ca079f33a79ff13d229d8a123bb9de~qKrx04fbt0326603266eucas1p2I; Tue, 11 Aug 2020 08:53:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 79.2C.05997.68C523F5; Tue, 11 Aug 2020 09:53:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200811085326eucas1p2f064d67234e0adff5d7ddbf0a1bef2a9~qKrxe7z710122701227eucas1p22; Tue, 11 Aug 2020 08:53:26 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200811085326eusmtrp17efaffcde7eb4f977ef8c24b8d6af32b~qKrxd-2eF1667616676eusmtrp1d; Tue, 11 Aug 2020 08:53:26 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-d5-5f325c860401 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 68.5D.06017.68C523F5; Tue, 11 Aug 2020 09:53:26 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200811085324eusmtip1b9fce021e73a580d9651391e2ed03ce6~qKrvlekoo1748717487eusmtip1S; Tue, 11 Aug 2020 08:53:24 +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, 11 Aug 2020 11:52:32 +0300 Message-Id: <20200811085246.28735-14-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200811085246.28735-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSbUwTdxjPc3e9OxrOnIcvT9SANi7TGUXQD3/3JjN8uI9Llmg0c10dFzDQ QnoWJ/EDU1O1MLBFtygbVF4UgQUVbCuxpmC0YEGEhQhJVcZenJ34AnQDBDfK1ezb7/V5nvzz 52mpgl3B77ccUKwWU56B1TOeO9N9G+2fpxs3V7vWkZaeKiCjj2ppMnL6IUtKXh6jyFDjdnLD +4OOuB4XU6TM9Yoi3gYHS56NHGHI83EvRcL+EEfODRzhyHjnE45821cJ5MlshCZn3RNA+qqu 6ch0RztLXszWMKRsZhBIeVsXkGDpK4acvu4DYneI5OWlixypDSeT8ZEuhoSGWznSHO2nybWe OSDOYAuQXvu/uow18oy7XifX3nhKyRXn+2n5zvB3nFzaXUXJV577KPnFzUFWLmtrBPnuaAkt N/02xX6q36P/MEvJ21+oWFM//lKfU9rTzBWMiV9XPLzFFINfcEACj+JWvGePggP0vCQ2AIb9 NTqNTAL+U3yM08gE4PnyMPO28qjaE09dBKyf+obSSBTwdscAF0ux4joMnahaMJaIV1j0zj6g YkaSmIkTztvzIZ5nxHcwGEyIQUF8H0PlirYgBZsuB+gYTpiXmyofL2BJTMYH1ZMLI1G8z2N9 rY/TCpnoPzsavy4JI8G2uL4KQxWljFY4Duj0tHIaOQV4tHIsntqObX/dWziIFtdjS3tqDKL4 CU5HaQ0uwqGxxbEwPQ9dnu/jsoAn7JI2w4CB7oG4jDj3OlGTZZwIDMff0A/YHLgPpyDl3P+r 3ACNsFyxqeZsRU23KAc3qSazarNkb/oq33wV5r9q6E1w0gfts/s6QeTBkCgUfJBmlHSmQvWQ uROQpw1LhB29oS8kIct0qEix5huttjxF7YSVPGNYLm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13BGOS+W0//cwocjHgFKrq2eyLp5f3heuH+pZMeZp +Hpooms2JjnC532JyZ/bu2NVZnqNrQmZwrZ/vBET9RB/1drSW7+NqsLKO9qz1DXdvreP1C6K nou9MBz7rad2Q9GeS6J9lsrSV0G+GZmtHjXaRbsDjnupPsarrMeetm5NW5rhNXJlcUVp5eKT 5l3Ls51Sglcp5WtxLa/8C6CktJwHAwAA X-CMS-MailID: 20200811085326eucas1p2f064d67234e0adff5d7ddbf0a1bef2a9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200811085326eucas1p2f064d67234e0adff5d7ddbf0a1bef2a9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200811085326eucas1p2f064d67234e0adff5d7ddbf0a1bef2a9 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200811085246.28735-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v9 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..f1045b284 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[ETH_LINK_MAX_STR_LEN]; 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, + sizeof(link_status_text), 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