summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorIgor Romanov <igor.romanov@oktetlabs.ru>2019-09-10 09:25:47 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-07 15:00:54 +0200
commit844949eceb8e58978d6ae41eb2345d280351bbf0 (patch)
tree1aeeda76f796022df879da7e1c3686d5860269a1 /app
parent2dc3131f4c41922db69b5db13db0da2b81a94f80 (diff)
downloaddpdk-844949eceb8e58978d6ae41eb2345d280351bbf0.zip
dpdk-844949eceb8e58978d6ae41eb2345d280351bbf0.tar.gz
dpdk-844949eceb8e58978d6ae41eb2345d280351bbf0.tar.xz
app: check status of getting link info
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>
Diffstat (limited to 'app')
-rw-r--r--app/proc-info/main.c19
-rw-r--r--app/test/test_link_bonding.c12
-rw-r--r--app/test/test_pmd_perf.c11
-rw-r--r--app/test/test_pmd_ring.c8
4 files changed, 39 insertions, 11 deletions
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 94e808d..a3f854b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -678,13 +678,18 @@ show_port(void)
printf(" - generic config\n");
printf("\t -- Socket %d\n", rte_eth_dev_socket_id(i));
- rte_eth_link_get(i, &link);
- 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);
+ ret = rte_eth_link_get(i, &link);
+ if (ret < 0) {
+ 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);
+ }
printf("\t -- promiscuous (%d)\n",
rte_eth_promiscuous_get(i));
ret = rte_eth_dev_get_mtu(i, &mtu);
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index cbbbc98..d0d6fc2 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 85ef118..36b06ce 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 65ab6e7..02873f2 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;
}