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 3E1EEA04A4; Tue, 26 May 2020 21:11:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F6D71D70F; Tue, 26 May 2020 21:10:57 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 080A11D6F4 for ; Tue, 26 May 2020 21:10:54 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200526191053euoutp01e8fc75f9d75b6d1e4874aa8c58fbe00b~Sqb5mKbfB0044500445euoutp01L for ; Tue, 26 May 2020 19:10:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200526191053euoutp01e8fc75f9d75b6d1e4874aa8c58fbe00b~Sqb5mKbfB0044500445euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1590520253; bh=GknZngFdpOIDKYIYJ7vyk3o8XkbRCfaGhuuZlaIUVOA=; h=From:To:Subject:Date:In-Reply-To:Reply-To:References:From; b=LwqGFZebre/Xm3NUe9xnjZlw1fQZmY56eFP5USW5E/kMa2H+tXcfyl8z7YMkD7o4u NsCJHUON/+EDtXC9BxdNZ94LSZuIgQtRnOoK4Nq/9KyRZG9jVit64yqHDfJlbbMLHS VYZ08QtRAZbxwPPydNWv1ISJRZ/gMWjD/zKLkhjY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200526191053eucas1p194958ea29d5ffe2c5fe992dbbdc5960e~Sqb5JiMEk2409924099eucas1p1O; Tue, 26 May 2020 19:10:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.A7.60698.DB96DCE5; Tue, 26 May 2020 20:10:53 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200526191052eucas1p2c53ca292499647dce2360fbe328c4521~Sqb4uFs-L0108001080eucas1p2r; Tue, 26 May 2020 19:10:52 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200526191052eusmtrp2b32efa152c4396564c4d838a17cc4deb~Sqb4tHWRB0921709217eusmtrp22; Tue, 26 May 2020 19:10:52 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-e0-5ecd69bdd8ca Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C1.F4.08375.CB96DCE5; Tue, 26 May 2020 20:10:52 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200526191051eusmtip1fda29d76733778478fc6816cee86a422~Sqb35KHK-1925619256eusmtip1z; Tue, 26 May 2020 19:10:51 +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 Date: Tue, 26 May 2020 22:10:06 +0300 Message-Id: <20200526191033.16459-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200526191033.16459-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFKsWRmVeSWpSXmKPExsWy7djP87p7M8/GGWyfzGbxYMpdNovuDy1M FttXdLFZvPu0ncnizt7T7BazLjWxWzz/84rZYsr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Ss+mKL+0JFUhI7+4xFYp2tDC SM/Q0kLPyMRSz9DYPNbKyFRJ384mJTUnsyy1SN8uQS/j/OsnjAV3zSom7b3B1MC4RqeLkZND QsBE4u+vc2xdjFwcQgJLGSWOXNrJ2MXIAZSQkHj9hBmiRljiz7UuqJrPjBKT3v9iBEmwCWhI nO6YxwSSEBFYwiSxd9U5sISwgI3Ezl1LwWwWAVWJJatvgtm8ApYSy3onQk2Vl1i94QCYzSlg JfHmy3IWEFtIIFNi/Z35bBC2nMT1+V+YJjDyLWBkWMUoklpanJueW2yoV5yYW1yal66XnJ+7 iREY8tuO/dy8g/HSxuBDjAIcjEo8vAm/z8QJsSaWFVfmHmKU4GBWEuF1Ons6Tog3JbGyKrUo P76oNCe1+BCjKdCBE5mlRJPzgfGYVxJvaGpobmFpaG5sbmxmoSTO2yFwMEZIID2xJDU7NbUg tQimj4mDU6qB0fZ29sklyaJ2jFofCz9/uCJqtUSZ38dJXTVrdVfG3GULN9r+bDz9bfL3e0w1 LvOe/beb6mPFf7fsocBMqZK3ksGhkVHOd778K378wMS9JGGBaZt1zm7dupyJazier7zwKPqy +29Hi4J4j6BIQR6Oonnu9u+FtvE+zvv+vziqIzwmt53tUupTJZbijERDLeai4kQAyt0VA48C AAA= X-CMS-MailID: 20200526191052eucas1p2c53ca292499647dce2360fbe328c4521 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200526191052eucas1p2c53ca292499647dce2360fbe328c4521 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200526191052eucas1p2c53ca292499647dce2360fbe328c4521 References: <20200427095737.11082-1-i.dyukov@samsung.com> <20200526191033.16459-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v2 3/7] app: UNKNOWN link speed 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_prepare_text function to example applications Signed-off-by: Ivan Dyukov --- app/proc-info/main.c | 15 +++++++++------ app/test-pipeline/init.c | 11 ++++++----- app/test-pmd/config.c | 20 ++++++++++++-------- app/test-pmd/testpmd.c | 10 ++++++---- app/test/test_pmd_perf.c | 10 ++++++---- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index abeca4aab..d8506cbb2 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -669,6 +669,7 @@ show_port(void) RTE_ETH_FOREACH_DEV(i) { uint16_t mtu = 0; struct rte_eth_link link; + struct rte_eth_link_text link_text; struct rte_eth_dev_info dev_info; struct rte_eth_rxq_info queue_info; struct rte_eth_rss_conf rss_conf; @@ -685,12 +686,14 @@ show_port(void) printf("Link get failed (port %u): %s\n", i, rte_strerror(-ret)); } else { - printf("\t -- link speed %d duplex %d," - " auto neg %d status %d\n", - link.link_speed, - link.link_duplex, - link.link_autoneg, - link.link_status); + rte_eth_link_prepare_text(&link, + ETH_SPEED_UNIT_MBPS, &link_text); + printf("\t -- link speed: %s, duplex: %s," + " auto neg: %s, status: %s\n", + link_text.link_speed, + link_text.link_duplex, + link_text.link_autoneg, + link_text.link_status); } printf("\t -- promiscuous (%d)\n", rte_eth_promiscuous_get(i)); diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 67d54ae05..920023825 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -160,6 +160,7 @@ app_ports_check_link(void) for (i = 0; i < app.n_ports; i++) { struct rte_eth_link link; + struct rte_eth_link_text link_text; uint16_t port; int ret; @@ -173,12 +174,12 @@ app_ports_check_link(void) all_ports_up = 0; continue; } - - RTE_LOG(INFO, USER1, "Port %u (%u Gbps) %s\n", + rte_eth_link_prepare_text(&link, + ETH_SPEED_UNIT_GBPS, &link_text); + RTE_LOG(INFO, USER1, "Port %u (%s Gbps) %s\n", port, - link.link_speed / 1000, - link.link_status ? "UP" : "DOWN"); - + link_text.link_speed, + link_text.link_status); if (link.link_status == ETH_LINK_DOWN) all_ports_up = 0; } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 5381207cc..722f57c12 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -552,6 +552,7 @@ port_infos_display(portid_t port_id) struct rte_port *port; struct rte_ether_addr mac_addr; struct rte_eth_link link; + struct rte_eth_link_text link_text; struct rte_eth_dev_info dev_info; int vlan_offload; struct rte_mempool * mp; @@ -600,10 +601,10 @@ port_infos_display(portid_t port_id) } else printf("\nmemory allocation on the socket: %u",port->socket_id); - printf("\nLink status: %s\n", (link.link_status) ? ("up") : ("down")); - printf("Link speed: %u Mbps\n", (unsigned) link.link_speed); - printf("Link duplex: %s\n", (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex")); + rte_eth_link_prepare_text(&link, ETH_SPEED_UNIT_MBPS, &link_text); + printf("\nLink status: %s\n", link_text.link_status); + printf("Link speed: %s Mbps\n", link_text.link_speed); + printf("Link duplex: %s\n", link_text.link_duplex); if (!rte_eth_dev_get_mtu(port_id, &mtu)) printf("MTU: %u\n", mtu); @@ -724,6 +725,7 @@ port_summary_display(portid_t port_id) { struct rte_ether_addr mac_addr; struct rte_eth_link link; + struct rte_eth_link_text link_text; struct rte_eth_dev_info dev_info; char name[RTE_ETH_NAME_MAX_LEN]; int ret; @@ -746,12 +748,14 @@ port_summary_display(portid_t port_id) if (ret != 0) return; - printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n", + rte_eth_link_prepare_text(&link, ETH_SPEED_UNIT_GBPS, + &link_text); + printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %sMbps\n", port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1], mac_addr.addr_bytes[2], mac_addr.addr_bytes[3], mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name, - dev_info.driver_name, (link.link_status) ? ("up") : ("down"), - (unsigned int) link.link_speed); + dev_info.driver_name, link_text.link_status, + link_text.link_speed); } void @@ -3897,7 +3901,7 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate) ret = eth_link_get_nowait_print_err(port_id, &link); if (ret < 0) return 1; - if (rate > link.link_speed) { + if (link.link_speed != UINT32_MAX && rate > link.link_speed) { printf("Invalid rate value:%u bigger than link speed: %u\n", rate, link.link_speed); return 1; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9cbe6e9f6..fd78e1cea 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2987,6 +2987,7 @@ check_all_ports_link_status(uint32_t port_mask) portid_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + struct rte_eth_link_text link_text; int ret; printf("Checking link statuses...\n"); @@ -3007,12 +3008,13 @@ check_all_ports_link_status(uint32_t port_mask) } /* print link status if flag set */ if (print_flag == 1) { + rte_eth_link_prepare_text(&link, + ETH_SPEED_UNIT_MBPS, &link_text); 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")); + "Port%d Link Up. speed %s Mbps- %s\n", + portid, link_text.link_speed, + link_text.link_duplex); else printf("Port %d Link Down\n", portid); continue; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 352cd4715..9a275287b 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -125,6 +125,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + struct rte_eth_link_text link_text; int ret; printf("Checking link statuses...\n"); @@ -147,11 +148,12 @@ 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) { + rte_eth_link_prepare_text(&link, + ETH_SPEED_UNIT_MBPS, &link_text); 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")); + "Port%d Link Up. Speed %s Mbps - %s\n", + portid, link_text.link_speed, + link_text.link_duplex); if (link_mbps == 0) link_mbps = link.link_speed; } else -- 2.17.1