DPDK patches and discussions
 help / color / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Chas Williams <chas3@att.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>, Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 08/18] app/test: check status of getting link info
Date: Tue, 10 Sep 2019 09:25:48 +0100
Message-ID: <1568103959-25572-9-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com>

From: Igor Romanov <igor.romanov@oktetlabs.ru>

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 <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 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


  parent reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10  8:25 [dpdk-dev] [PATCH 00/18] ethdev: change link status get functions return value to int Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 01/18] net/bonding: fix link speed update in broadcast mode Andrew Rybchenko
2019-09-10 23:01   ` Chas Williams
2019-09-10  8:25 ` [dpdk-dev] [PATCH 02/18] ethdev: change link status get functions return value to int Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 03/18] app/testpmd: check status of getting link info Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 04/18] net/bonding: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 05/18] net/ixgbe: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 06/18] net/memif: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 07/18] app/proc-info: " Andrew Rybchenko
2019-09-10  8:25 ` Andrew Rybchenko [this message]
2019-09-10  8:25 ` [dpdk-dev] [PATCH 09/18] app/pipeline: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 10/18] examples: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 11/18] examples/bbdev_app: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 12/18] examples/ip_pipeline: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 13/18] examples/ethtool: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 14/18] examples/flow_filtering: " Andrew Rybchenko
2019-09-12  5:16   ` Ori Kam
2019-09-10  8:25 ` [dpdk-dev] [PATCH 15/18] examples/link_status_interrupt: check status of getting link Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 16/18] examples/distributor: check status of getting link info Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 17/18] examples/qos_sched: " Andrew Rybchenko
2019-09-10  8:25 ` [dpdk-dev] [PATCH 18/18] examples/kni: " Andrew Rybchenko
2019-09-24 12:38 ` [dpdk-dev] [PATCH 00/18] ethdev: change link status get functions return value to int Ferruh Yigit

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568103959-25572-9-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=bruce.richardson@intel.com \
    --cc=chas3@att.com \
    --cc=dev@dpdk.org \
    --cc=igor.romanov@oktetlabs.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox