[v3,3/3] app/test-pipeline: add dev close operation
Checks
Commit Message
For test-pipeline, there is dev start operation, but when thread need to
exit, there is no dev close operation. This is not safe, to fix this,
add dev close operation.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test-pipeline/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
@@ -55,6 +55,7 @@ int
main(int argc, char **argv)
{
uint32_t lcore;
+ uint32_t i;
int ret;
/* Init EAL */
@@ -85,6 +86,24 @@ main(int argc, char **argv)
return -1;
}
+ /*Close ports */
+ for (i = 0; i < app.n_ports; i++) {
+ uint16_t port;
+ int ret;
+
+ port = app.ports[i];
+ printf("Closing port %d...", port);
+ ret = rte_eth_dev_stop(port);
+ if (ret != 0)
+ printf("rte_eth_dev_stop: err=%d, port=%u\n",
+ ret, port);
+ rte_eth_dev_close(port);
+ printf("Done\n");
+ }
+
+ /* Clean up the EAL */
+ rte_eal_cleanup();
+
return 0;
}