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 33FEAA2EEB for ; Tue, 10 Sep 2019 10:27:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E13521EDD6; Tue, 10 Sep 2019 10:26:41 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id EC5021ECD5 for ; Tue, 10 Sep 2019 10:26:21 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 7A0451C005F; Tue, 10 Sep 2019 08:26:20 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 10 Sep 2019 01:26:17 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 10 Sep 2019 01:26:17 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x8A8QGnW002257; Tue, 10 Sep 2019 09:26:16 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 1700A1613D1; Tue, 10 Sep 2019 09:26:16 +0100 (BST) From: Andrew Rybchenko To: Chas Williams , Bruce Richardson CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:48 +0100 Message-ID: <1568103959-25572-9-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-2.709700-4.000000-10 X-TMASE-MatchedRID: eHJXlKx9HErDOgXZFRFV83CO70QAsBdCWw/S0HB7eoOBzO52zKOpBSEP i3T0m113qtmwPAUfwvIQlFkmdk3VOiHhSBQfglfsA9lly13c/gHVoHA9HwvQm2tEzrC9eANpRlS qJpn6jyev2DHFCgS4xJEOYQ7YFMsPjxXQnG46XeIc9jA4mLo8uQRryDXHx6oXpzG+Ju2gKretbj X4EGqr77FGJJSB7R5RIHa4I0zrQ8s+DMYP1Y4Xz54CIKY/Hg3AGdQnQSTrKGPEQdG7H66TyJ8TM nmE+d0ZAz/lYxXNEFqHraWnC6j4F/4tWfskNCmPNLuH3gey2cww/BY1UT9ThGlVJDYcmX9HPyIN IEpr9PNl7mVH48l/0SUfX8/+25d2k3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fvN+d4ahMo5NWXGv UUmKP2w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.709700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-Lez92GbLo9zX Subject: [dpdk-dev] [PATCH 08/18] app/test: check status of getting link info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test/test_link_bonding.c | 12 ++++++++++-- app/test/test_pmd_perf.c | 11 ++++++++++- app/test/test_pmd_ring.c | 8 +++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index cbbbc98a1..d0d6fc23d 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -554,6 +554,7 @@ test_start_bonded_device(void) int current_slave_count, current_bonding_mode, primary_port; uint16_t slaves[RTE_MAX_ETHPORTS]; + int retval; /* Add slave to bonded device*/ TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), @@ -590,7 +591,10 @@ test_start_bonded_device(void) "Primary port (%d) is not expected value (%d).", primary_port, test_params->slave_port_ids[0]); - rte_eth_link_get(test_params->bonded_port_id, &link_status); + retval = rte_eth_link_get(test_params->bonded_port_id, &link_status); + TEST_ASSERT(retval >= 0, + "Bonded port (%d) link get failed: %s\n", + test_params->bonded_port_id, rte_strerror(-retval)); TEST_ASSERT_EQUAL(link_status.link_status, 1, "Bonded port (%d) status (%d) is not expected value (%d).\n", test_params->bonded_port_id, link_status.link_status, 1); @@ -605,10 +609,14 @@ test_stop_bonded_device(void) uint16_t slaves[RTE_MAX_ETHPORTS]; struct rte_eth_link link_status; + int retval; rte_eth_dev_stop(test_params->bonded_port_id); - rte_eth_link_get(test_params->bonded_port_id, &link_status); + retval = rte_eth_link_get(test_params->bonded_port_id, &link_status); + TEST_ASSERT(retval >= 0, + "Bonded port (%d) link get failed: %s\n", + test_params->bonded_port_id, rte_strerror(-retval)); TEST_ASSERT_EQUAL(link_status.link_status, 0, "Bonded port (%d) status (%d) is not expected value (%d).", test_params->bonded_port_id, link_status.link_status, 0); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 85ef11899..36b06ce5d 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; + int ret; printf("Checking link statuses...\n"); fflush(stdout); @@ -134,7 +135,15 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } + /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) { diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 65ab6e7e0..02873f26a 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -24,6 +24,7 @@ test_ethdev_configure_port(int port) { struct rte_eth_conf null_conf; struct rte_eth_link link; + int ret; memset(&null_conf, 0, sizeof(struct rte_eth_conf)); @@ -54,7 +55,12 @@ test_ethdev_configure_port(int port) return -1; } - rte_eth_link_get(port, &link); + ret = rte_eth_link_get(port, &link); + if (ret < 0) { + printf("Link get failed for port %u: %s", + port, rte_strerror(-ret)); + return -1; + } return 0; } -- 2.17.1