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 4D221A04C7; Tue, 15 Sep 2020 21:08:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8489B1C13A; Tue, 15 Sep 2020 21:08:03 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 589291C139 for ; Tue, 15 Sep 2020 21:08:02 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200915190802euoutp025f90da159a7a19f1433e1f28eb4bad1b~1CpYKVyim0661006610euoutp02g; Tue, 15 Sep 2020 19:08:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200915190802euoutp025f90da159a7a19f1433e1f28eb4bad1b~1CpYKVyim0661006610euoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600196882; bh=70Bc5Qf+Pjp25n3sxWMGseS0dIRRQUC1Jc8dQTJLpmQ=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=TeJ+uce1Yn+IYHM5UIWuUH7jds/W23pPwuaYyRJEPHZ0fWHa/rKHZwH+91PPzX3PY qdJJ/MG0MXQigwLa4NEvpbY1V0z12/vt9Nc4PpQX6H+6AmXFdDSVb5s0Mk0OgsaNkM Pl9p4W8I7qWj8chFWiUkiqGcg5jaoXlL6ER3BUfI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200915190801eucas1p1696ae567f943347db8f50c3547dea35e~1CpXIyBbr3106731067eucas1p1d; Tue, 15 Sep 2020 19:08:01 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3D.46.06318.011116F5; Tue, 15 Sep 2020 20:08:00 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200915190800eucas1p16c5aa3b72311b2aae8b4085732b35384~1CpWNe9kO3106731067eucas1p1c; Tue, 15 Sep 2020 19:08:00 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200915190800eusmtrp11e11f818536f83182d6650cb49ba084b~1CpWMplrF3148631486eusmtrp1K; Tue, 15 Sep 2020 19:08:00 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-6b-5f6111101e72 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 80.EB.06314.F01116F5; Tue, 15 Sep 2020 20:07:59 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200915190758eusmtip2b0d44c018082c978ca5ecfe65962718f~1CpUaB9FT0503405034eusmtip2h; Tue, 15 Sep 2020 19:07:58 +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:02 +0300 Message-Id: <20200915190728.18143-8-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: H4sIAAAAAAAAA0WSbUxTZxTHd+47DTXXyuKJM5g12ZuZisEPZwYHOD/cZH6YS0wWE4Fu3qAR qukV35IpdgRNQYbYzKhLZXSmgE4EC6VYjGsCFAoyiY0QUJlbfGEi71OgoJbrsm//5/c//+ec 8+SRWJNTWCbtsu5TbVZLjlkwcA2t07dWyYstmUnDkfVU0+kCenjfzdKg855ARaMFDPVWp1LA 9zNPZQ/yGSopG2PIV+kQ6NmgnaPn4z6GBprDIp3rsYs0Hnws0snu80CPo0MsnS2fAOp21fM0 /XuTQCPRCo5KZiJAP3pDQG3FYxw5/Y1AhQ6ZRqs8IrkHEml8MMRRuO+aSJenbrNU3zkHdKqt Bqir8BWf9r4yU36RV9yBp4xy+pfbrNLa95OoFLe7GKX2eSOjjNyICEqJtxqUjodFrHLp75fC V4ZthpQdas6u/aptzedZhp11s5PMXvuGg4GoA/LhZJID4iSU12G48hHnAINkkisBz7hG+Jhh kicB+90rdWMC0DfvBwdIC4n20Nc69wDa2+tF/TAFGOn2c7G0IH+M4RMuJmYkyLUC+qJ3mZix RE7HWa8dYpqTP8B7kd8W2hnlz/C+q5fRZ1qBl67eZGM6Tl6PPf6IqI+UiHcvTC5cinKnhGPz 9bwe2ISlF4+DrpfgUJtX1PVyDJ8u5vTAccBTDddE/VAK+MP54bdVqej955YYW46VP8GapjU6 Tsfr7iZO33kR9g4vjmH2jSxrOMPq2IgnCk16tRlvtve8xYhzs/E6VvDKEw+vP1AzYMd0H1cK K87936scoBqWqnlabraqJVvVA6s1S66WZ81e/d2e3Dp481fD821TjXAj+m0QZAnM8cby/qxM E2/Zrx3KDQJKrDnBuLErnGEy7rAcOqza9mTa8nJUL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N8g3SnLZzhNSNkFj4M/yfBqv/z9HMG6yTHS050dNhyzXK2Ik8vKOIevzbK8j 399FNcZHeyf/+DKSnTUXURK0vba+tNzonyYLq/RRzak8Z6cjZsk/TxtER7riM7aer1QffJVf 5WvzZOq8e2Fya1jQx2OysibfT7eOdQR0eZqHByPb7gZ8dvT/fGM9M8WXOvV+G83J7QcKH33z iJRTQqJGuYPUC5p/ZJi8IQcDAAA= X-CMS-MailID: 20200915190800eucas1p16c5aa3b72311b2aae8b4085732b35384 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200915190800eucas1p16c5aa3b72311b2aae8b4085732b35384 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200915190800eucas1p16c5aa3b72311b2aae8b4085732b35384 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200915190728.18143-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v11 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