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 5C65CA04B5; Thu, 10 Sep 2020 21:35:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 029D41C11D; Thu, 10 Sep 2020 21:34:37 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id B32881C123 for ; Thu, 10 Sep 2020 21:34:35 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200910193435euoutp02726a186659be4a7faf90973817058f72~zgyIuYlFB0500705007euoutp02V; Thu, 10 Sep 2020 19:34:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200910193435euoutp02726a186659be4a7faf90973817058f72~zgyIuYlFB0500705007euoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1599766475; bh=70Bc5Qf+Pjp25n3sxWMGseS0dIRRQUC1Jc8dQTJLpmQ=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=FYf0SPMrLTi7C7sCF9E5Kcb70/k0l8UN4l+MuqCBWsBxxOlp9ywidSxC3Yjnsu+2w oabEVhC6XHmJnNfjeJ2BWa3MB7P9Wqjz5caizJFgDTxHij7bjJTB9/q3nf6lSiqpyJ Vol3ypbuXUplyqxmGpTJXqDCKIBAOfpQ4CFGfgU8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200910193434eucas1p2f5adc0b3d6057585d8fee1213ab5fb3d~zgyHqXOUA1147811478eucas1p2j; Thu, 10 Sep 2020 19:34:34 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 39.D5.05997.ACF7A5F5; Thu, 10 Sep 2020 20:34:34 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200910193433eucas1p1e00176d14e73334d7b293b0aae8b7e4a~zgyGhZeKZ0322703227eucas1p1n; Thu, 10 Sep 2020 19:34:33 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200910193433eusmtrp269604593d7b1c0a3d3361f5a2348c2f9~zgyGgTjA71027210272eusmtrp2x; Thu, 10 Sep 2020 19:34:33 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-9e-5f5a7fcaf6f4 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8B.09.06314.8CF7A5F5; Thu, 10 Sep 2020 20:34:33 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200910193431eusmtip2070dc56d612b9c06fecbd7e9e58b4683~zgyEvQ06x1654016540eusmtip2_; Thu, 10 Sep 2020 19:34:31 +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: Thu, 10 Sep 2020 22:33:40 +0300 Message-Id: <20200910193400.15326-8-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200910193400.15326-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSX0xTdxTHc+5t7700VH8WomdqNHYzcyYD59w8Q51/spj7YuJ82AMJw05v wAjVtcKmWRwDpab8URAwg6VF0aHVDMFSoIGF1WDBFghuBLswZcTMyEQqYqZYRcqt2ds5n/P9 nu95OBJvqBAWS/vMhxSL2ZRlFHQaz43nfe/f/D41fc2d3+dTQ9ABNHqnjqeRir8EKgof4+i2 azO1t/ykpfK7eRyVlj/mqOWiXaCHI/kaejTZwtFwR0Ck6lv5Ik367otU0l8DdD8yxtOPtU+A +h3NWnr+m1egicg5DZVODwKddHcD+Ysfa6iirRWo0M4ofKlepLrhZTQ50q2hQOiaSFeeDvDU HHwJVOZvAOotnNFuWSFP117QynXtDzj59NkBXr4RqhLl4h4HJzc+auXkiV8HBbnU7QL55mgR L1++90zYqUvVbdyrZO3LVSzJn+7WZTa9mOIO5m/6tj1ihzwoWWOHOAnZOqzq+pO3g04ysIuA oarTWrWZAmxssnFq8wRwsK9S+8bybKAb1EE9YOSX8ZjlKWDB9TNCVCWwVRg44ZizJ7JGAVsi Q1x0kMC24vF+lxitNWwlXvWVzK3Vs0+wzeuKRSzHy1c7Z6+SpDiWgn8Pp0WxgS3DIefU3E5k QQlHAz5Q9Z9h5d1wzJuAY363qNZLcabNGTPYAMs810S1OTV7as14TLUZ3f/2idE0nr2HDd5k FW/Fmo7jcxjZPLw9viCK+dmy3HOGV7EeTxQaVLURO3tuxTDiyxfxKpYxHGjm1fM7AG2D807B 8ur/o2oBXLBIybFmZyjWtWblmySrKduaY85I2nMguwlmfzXwyj/VCt7IVz5gEhjj9Z0pqekG rSnXejjbByjxxkT9tt7Alwb9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cFVYSFjIJuCXynO4pv0KLlFjFI+I4lHR8N9HsB5+6ehUQPOXucKAxq4evX3nrnmfb+nO /kzffeq4dWkbQsv91NHW3O5pfFvdcHpb6NXzUSfX1vLvCkbPtL1NLi6qN/fRy5wxZv+Yri9W 2597R6IrQsoztYf3v9amDbFNHXvvBTgL7r8IjBH5Qefy6ciE0p/3K33zBj3Ssuceya3PfXdf beQpKUmjWk8aJM0/hjaw7QYDAAA= X-CMS-MailID: 20200910193433eucas1p1e00176d14e73334d7b293b0aae8b7e4a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200910193433eucas1p1e00176d14e73334d7b293b0aae8b7e4a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200910193433eucas1p1e00176d14e73334d7b293b0aae8b7e4a References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200910193400.15326-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v10 07/24] examples: 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: * ipv4_multicast * l2fwd-jobstats * l2fwd-keepalive * l3fwd * link_status_interrupt Signed-off-by: Ivan Dyukov --- examples/ipv4_multicast/main.c | 14 ++++++------- examples/l2fwd-jobstats/main.c | 13 +++++------- examples/l2fwd-keepalive/main.c | 13 +++++------- examples/l3fwd/main.c | 13 +++++------- examples/link_status_interrupt/main.c | 30 +++++++++++---------------- 5 files changed, 33 insertions(+), 50 deletions(-) diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 7e255c35a..a51b58412 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -572,6 +572,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"); fflush(stdout); @@ -591,14 +592,11 @@ 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 %u Mbps - %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 */ diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 47a3b0976..6e01b2e66 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -689,6 +689,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"); fflush(stdout); @@ -708,14 +709,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 %u Mbps - %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 */ diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index b2742633b..e2236a87b 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -453,6 +453,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"); fflush(stdout); @@ -472,14 +473,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 %u Mbps - %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 */ diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 24ede4290..0aeae216a 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -810,6 +810,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"); fflush(stdout); @@ -833,14 +834,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 %u Mbps -%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 */ diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9bbcadfcf..a06398eff 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -133,7 +133,7 @@ print_stats(void) link_get_err = rte_eth_link_get_nowait(portid, &link); printf("\nStatistics for port %u ------------------------------" "\nLink status: %25s" - "\nLink speed: %26u" + "\nLink speed: %26s" "\nLink duplex: %25s" "\nPackets sent: %24"PRIu64 "\nPackets received: %20"PRIu64 @@ -141,8 +141,8 @@ print_stats(void) portid, link_get_err < 0 ? "Link get failed" : (link.link_status ? "Link up" : "Link down"), - link_get_err < 0 ? 0 : - (unsigned int)link.link_speed, + link_get_err < 0 ? "0" : + rte_eth_link_speed_to_str(link.link_speed), link_get_err < 0 ? "Link get failed" : (link.link_duplex == ETH_LINK_FULL_DUPLEX ? \ "full-duplex" : "half-duplex"), @@ -445,6 +445,7 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, { struct rte_eth_link link; int ret; + char link_status_text[ETH_LINK_MAX_STR_LEN]; RTE_SET_USED(param); RTE_SET_USED(ret_param); @@ -457,13 +458,9 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, port_id, rte_strerror(-ret)); return ret; } - if (link.link_status) { - printf("Port %d Link Up - speed %u Mbps - %s\n\n", - port_id, (unsigned)link.link_speed, - (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex")); - } else - printf("Port %d Link Down\n\n", port_id); + rte_eth_link_to_str(link_status_text, sizeof(link_status_text), + NULL, &link); + printf("Port %d %s\n\n", port_id, link_status_text); return 0; } @@ -478,6 +475,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; struct rte_eth_link link; int ret; + char link_status_text[ETH_LINK_MAX_STR_LEN]; printf("\nChecking link status"); fflush(stdout); @@ -497,14 +495,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) } /* print link status if flag set */ if (print_flag == 1) { - if (link.link_status) - printf( - "Port%d Link Up. Speed %u Mbps - %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 */ -- 2.17.1