[03/11] app: check eth dev stop status
Checks
Commit Message
From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
rte_eth_dev_stop() return value was changed from void to int,
so this patch modify usage of this function across app
according to new return type.
Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
app/test/test_pmd_perf.c | 6 +++++-
app/test/test_pmd_ring.c | 13 ++++++++++---
app/test/test_pmd_ring_perf.c | 3 ++-
3 files changed, 17 insertions(+), 5 deletions(-)
Comments
On 10/14/2020 2:28 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>
> rte_eth_dev_stop() return value was changed from void to int,
> so this patch modify usage of this function across app
> according to new return type.
>
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
> app/test/test_pmd_perf.c | 6 +++++-
> app/test/test_pmd_ring.c | 13 ++++++++++---
> app/test/test_pmd_ring_perf.c | 3 ++-
> 3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
> index d1240b76f9..85c932c6dc 100644
> --- a/app/test/test_pmd_perf.c
> +++ b/app/test/test_pmd_perf.c
> @@ -802,7 +802,11 @@ test_pmd_perf(void)
> if (socketid != rte_eth_dev_socket_id(portid))
> continue;
>
> - rte_eth_dev_stop(portid);
> + ret = rte_eth_dev_stop(portid);
> + if (ret != 0)
> + rte_exit(EXIT_FAILURE,
> + "rte_eth_dev_stop: err=%s, port=%d\n",
> + rte_strerror(-ret), portid);
This is in tear down, not sure if the app should exit on the stopping port
error, what do you think just log the error and continue?
> }
>
> return 0;
> diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
> index 02873f26a1..b7af8f4b70 100644
> --- a/app/test/test_pmd_ring.c
> +++ b/app/test/test_pmd_ring.c
> @@ -412,8 +412,14 @@ test_pmd_ring_pair_create_attach(void)
> return TEST_FAILED;
> }
>
> - rte_eth_dev_stop(rxtx_portd);
> - rte_eth_dev_stop(rxtx_porte);
> + if (rte_eth_dev_stop(rxtx_portd) != 0) {
> + printf("Error: failed to stop port %u\n", rxtx_portd);
> + return TEST_FAILED;
> + }
> + if (rte_eth_dev_stop(rxtx_porte) != 0) {
> + printf("Error: failed to stop port %u\n", rxtx_porte);
> + return TEST_FAILED;
> + }
>
> return TEST_SUCCESS;
> }
> @@ -522,7 +528,8 @@ test_command_line_ring_port(void)
> "test stats reset cmdl_port0 is failed");
> TEST_ASSERT((test_get_stats(cmdl_port0) < 0),
> "test get stats cmdl_port0 is failed");
> - rte_eth_dev_stop(cmdl_port0);
> + TEST_ASSERT((rte_eth_dev_stop(cmdl_port0) == 0),
> + "test stop cmdl_port0 is failed");
> }
> return TEST_SUCCESS;
> }
> diff --git a/app/test/test_pmd_ring_perf.c b/app/test/test_pmd_ring_perf.c
> index 3b2ff9cb4f..d249b7de5f 100644
> --- a/app/test/test_pmd_ring_perf.c
> +++ b/app/test/test_pmd_ring_perf.c
> @@ -155,7 +155,8 @@ test_ring_pmd_perf(void)
> test_bulk_enqueue_dequeue();
>
> /* release port and ring resources */
> - rte_eth_dev_stop(ring_ethdev_port);
> + if (rte_eth_dev_stop(ring_ethdev_port) != 0)
> + return -1;
Same here.
@@ -802,7 +802,11 @@ test_pmd_perf(void)
if (socketid != rte_eth_dev_socket_id(portid))
continue;
- rte_eth_dev_stop(portid);
+ ret = rte_eth_dev_stop(portid);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_stop: err=%s, port=%d\n",
+ rte_strerror(-ret), portid);
}
return 0;
@@ -412,8 +412,14 @@ test_pmd_ring_pair_create_attach(void)
return TEST_FAILED;
}
- rte_eth_dev_stop(rxtx_portd);
- rte_eth_dev_stop(rxtx_porte);
+ if (rte_eth_dev_stop(rxtx_portd) != 0) {
+ printf("Error: failed to stop port %u\n", rxtx_portd);
+ return TEST_FAILED;
+ }
+ if (rte_eth_dev_stop(rxtx_porte) != 0) {
+ printf("Error: failed to stop port %u\n", rxtx_porte);
+ return TEST_FAILED;
+ }
return TEST_SUCCESS;
}
@@ -522,7 +528,8 @@ test_command_line_ring_port(void)
"test stats reset cmdl_port0 is failed");
TEST_ASSERT((test_get_stats(cmdl_port0) < 0),
"test get stats cmdl_port0 is failed");
- rte_eth_dev_stop(cmdl_port0);
+ TEST_ASSERT((rte_eth_dev_stop(cmdl_port0) == 0),
+ "test stop cmdl_port0 is failed");
}
return TEST_SUCCESS;
}
@@ -155,7 +155,8 @@ test_ring_pmd_perf(void)
test_bulk_enqueue_dequeue();
/* release port and ring resources */
- rte_eth_dev_stop(ring_ethdev_port);
+ if (rte_eth_dev_stop(ring_ethdev_port) != 0)
+ return -1;
rte_eth_dev_get_name_by_port(ring_ethdev_port, name);
rte_vdev_uninit(name);
rte_ring_free(r);