app/eventdev: add ethernet device tear down
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Mon, 11 Dec 2017 15:13:43 +0000 (20:43 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Add ethernet device destroy functions to stop and close ethdev ports
if they are configured when prod_type_ethdev option is enabled.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
app/test-eventdev/test_perf_atq.c
app/test-eventdev/test_perf_common.c
app/test-eventdev/test_perf_common.h
app/test-eventdev/test_perf_queue.c

index a5e2837..4beb8b3 100644 (file)
@@ -258,6 +258,7 @@ static const struct evt_test_ops perf_atq =  {
        .launch_lcores      = perf_atq_launch_lcores,
        .eventdev_destroy   = perf_eventdev_destroy,
        .mempool_destroy    = perf_mempool_destroy,
+       .ethdev_destroy     = perf_ethdev_destroy,
        .test_result        = perf_test_result,
        .test_destroy       = perf_test_destroy,
 };
index 32749a6..7379539 100644 (file)
@@ -444,6 +444,19 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
        return 0;
 }
 
+void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
+{
+       int i;
+       RTE_SET_USED(test);
+
+       if (opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
+               for (i = 0; i < rte_eth_dev_count(); i++) {
+                       rte_eth_dev_stop(i);
+                       rte_eth_dev_close(i);
+               }
+       }
+}
+
 int
 perf_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
index b6758a9..d81ea9a 100644 (file)
@@ -139,6 +139,7 @@ int perf_launch_lcores(struct evt_test *test, struct evt_options *opt,
 void perf_opt_dump(struct evt_options *opt, uint8_t nb_queues);
 void perf_test_destroy(struct evt_test *test, struct evt_options *opt);
 void perf_eventdev_destroy(struct evt_test *test, struct evt_options *opt);
+void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt);
 void perf_mempool_destroy(struct evt_test *test, struct evt_options *opt);
 
 #endif /* _TEST_PERF_COMMON_ */
index 41b70ad..7aa0aea 100644 (file)
@@ -270,6 +270,7 @@ static const struct evt_test_ops perf_queue =  {
        .launch_lcores      = perf_queue_launch_lcores,
        .eventdev_destroy   = perf_eventdev_destroy,
        .mempool_destroy    = perf_mempool_destroy,
+       .ethdev_destroy     = perf_ethdev_destroy,
        .test_result        = perf_test_result,
        .test_destroy       = perf_test_destroy,
 };