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 66658A0526; Fri, 10 Jul 2020 09:05:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C7221DDE6; Fri, 10 Jul 2020 09:03:16 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id E12721DDE1 for ; Fri, 10 Jul 2020 09:03:14 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200710070314euoutp024ee6f412886bf339f86119ccbcbea720~gUibNp6o91730917309euoutp02f; Fri, 10 Jul 2020 07:03:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200710070314euoutp024ee6f412886bf339f86119ccbcbea720~gUibNp6o91730917309euoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594364594; bh=Gr1Jcl7miAeWLUh9GahLeLAq7ORJTSLyxj+MvXGXDw4=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=uZKPs8BgaHnSAXAAyyNHiVBiZ7eOEvj7JI5z67mByB4YWq3XULtuj0AL9dEkfLD0V cgCts4kwsv4pcj7wWuQu5zGWVUAvEGWqSHg0Wqg9Oo10a9sVXQARfr3M/2ilXsgC6C 9DRD/bX4uGrJzTiK66GGqOW+FqLae7Gtwvbfnz5k= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200710070314eucas1p1a8337ac28dfad7a9de580bd1d6867391~gUiavneiS1964419644eucas1p1L; Fri, 10 Jul 2020 07:03:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 98.41.06318.2B2180F5; Fri, 10 Jul 2020 08:03:14 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200710070313eucas1p2cbf741d65b0e6dbf25b06db2a490b4b5~gUiaZj1nB1919219192eucas1p2q; Fri, 10 Jul 2020 07:03:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710070313eusmtrp1c55b51ef500f9d9f2534ac89dfadecc0~gUiaYtMP51176811768eusmtrp1Y; Fri, 10 Jul 2020 07:03:13 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-c7-5f0812b2462a Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 94.14.06017.1B2180F5; Fri, 10 Jul 2020 08:03:13 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710070311eusmtip1e2fd607af9220719126191583ed7c0bd~gUiYm623v1602516025eusmtip1N; Fri, 10 Jul 2020 07:03:11 +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: Fri, 10 Jul 2020 10:02:12 +0300 Message-Id: <20200710070226.6045-15-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710070226.6045-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSYUxTZxSG8917e++lsdvnhcUzNBpvgpEZ0UVizhYmzpjs/jRxfzSZ2MkN GiliS1GnWRonDSldUZA1do4hbII4h2KxgMg6Ni2uIgM1QALSGDYmaFGQbUDR0d6a/XvPc95z 3pMvn8hKFXyyuC+vQDXnGXNlXs9duzXTvbZRErPWR4p4bLhTSfDRwxoWQ6eHeCx5doLB/vpM bPOd1WHZsI1BV9lzBn11Dh6fhI5zGJ70MTh4Iyigp/e4gJMdowJ+2f01wdHIGItnqqYIdlc2 6XDm51YeJyLVHLpmHxAs9XYSDDifc3i6pZmg3UHx2YVaAWsGl+NkqJPD4MBVAX+Y7mGx6c48 wVOBBoJd9le6zSuV2arvdUpN22NGKT/Xwyq3Br4SFOftSka5Em5mlIn2B7zi8tYT5bdHJaxy ceRffpt+pz4jW83dV6ia123ard9733mXz/+VHm4pmxNspNTgIAki0HTo+aWFcRC9KNE6Arab 1+PFCwI/2t2CVkwRuOr9Tng9Uuc5z2mNWgJhfyDumibgnu1noy6eroZgcWVsVxK9woMv0sdE G4l0K7T6wySqOZoCIxUlsQEDfQ/KO2tYLWIFXLzsj+mEBV7kqI5FS3Q59H37IrYU6O8iTNyY id+0FSqaxommE2Es4I3zZRAsd3KaPgr/NPYJ2nAxgYfVRXFTJnjH7y5oUWRpKjS0rtPwh9Ae 6uOjGOgb0P90cRSzC7LsmpvVsAGK7ZLmlsF/uzeOAebnFmlYge7Sxvj7tBEYHypiT5IVnv+z qgipJ0tUq8WUo1o25KmH0ixGk8Wal5O254CpkSx81uDLwHQzaY982kGoSORFht3zfJakMxZa jpg6CIisnGTY0hXcJRmyjUc+U80HsszWXNXSQZaKn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8sb/fQTj5JGA/I+sc2/P+XTsx7Ox/lRz6DZx c1rI+bK6mg5NfHL13eULsy+2j3wg5+wuSdx+bGgfW/7pfolX/nr78CqfoYPhY3sjGgfVYVjX EdwS1f9muNZ6wXP2hwmXjRUBZkuLx4a9c9O95flH73W7fF28wbv1yJbCTb1Uxt2Ct832z6FZ Q/ut1RIFJei0qiWkUdD+Ba7pJ88JAwAA X-CMS-MailID: 20200710070313eucas1p2cbf741d65b0e6dbf25b06db2a490b4b5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200710070313eucas1p2cbf741d65b0e6dbf25b06db2a490b4b5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710070313eucas1p2cbf741d65b0e6dbf25b06db2a490b4b5 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200710070226.6045-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v7 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