app/eventdev: simplify signal handling and teardown
[dpdk.git] / app / test-eventdev / test_pipeline_common.c
index 2775e72..29b6401 100644 (file)
@@ -176,12 +176,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
        struct rte_eth_rxconf rx_conf;
        struct rte_eth_conf port_conf = {
                .rxmode = {
-                       .mq_mode = ETH_MQ_RX_RSS,
+                       .mq_mode = RTE_ETH_MQ_RX_RSS,
                },
                .rx_adv_conf = {
                        .rss_conf = {
                                .rss_key = NULL,
-                               .rss_hf = ETH_RSS_IP,
+                               .rss_hf = RTE_ETH_RSS_IP,
                        },
                },
        };
@@ -223,7 +223,7 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 
                if (!(caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT))
                        local_port_conf.rxmode.offloads |=
-                               DEV_RX_OFFLOAD_RSS_HASH;
+                               RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
                ret = rte_eth_dev_info_get(i, &dev_info);
                if (ret != 0) {
@@ -233,9 +233,9 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
                }
 
                /* Enable mbuf fast free if PMD has the capability. */
-               if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+               if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
-                               DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+                               RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
                rx_conf = dev_info.default_rxconf;
                rx_conf.offloads = port_conf.rxmode.offloads;
@@ -331,7 +331,6 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
        uint16_t prod;
        struct rte_mempool *vector_pool = NULL;
        struct rte_event_eth_rx_adapter_queue_conf queue_conf;
-       struct rte_event_eth_rx_adapter_event_vector_config vec_conf;
 
        memset(&queue_conf, 0,
                        sizeof(struct rte_event_eth_rx_adapter_queue_conf));
@@ -397,8 +396,12 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
                        }
 
                        if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR) {
+                               queue_conf.vector_sz = opt->vector_size;
+                               queue_conf.vector_timeout_ns =
+                                       opt->vector_tmo_nsec;
                                queue_conf.rx_queue_flags |=
                                RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR;
+                               queue_conf.vector_mp = vector_pool;
                        } else {
                                evt_err("Rx adapter doesn't support event vector");
                                return -EINVAL;
@@ -418,17 +421,6 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
                        return ret;
                }
 
-               if (opt->ena_vector) {
-                       vec_conf.vector_sz = opt->vector_size;
-                       vec_conf.vector_timeout_ns = opt->vector_tmo_nsec;
-                       vec_conf.vector_mp = vector_pool;
-                       if (rte_event_eth_rx_adapter_queue_event_vector_config(
-                                   prod, prod, -1, &vec_conf) < 0) {
-                               evt_err("Failed to configure event vectorization for Rx adapter");
-                               return -EINVAL;
-                       }
-               }
-
                if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) {
                        uint32_t service_id = -1U;
 
@@ -513,6 +505,22 @@ pipeline_event_tx_adapter_setup(struct evt_options *opt,
        return ret;
 }
 
+void
+pipeline_ethdev_rx_stop(struct evt_test *test, struct evt_options *opt)
+{
+       uint16_t i, j;
+       RTE_SET_USED(test);
+
+       if (opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
+               RTE_ETH_FOREACH_DEV(i) {
+                       rte_event_eth_rx_adapter_stop(i);
+                       rte_event_eth_rx_adapter_queue_del(i, i, -1);
+                       for (j = 0; j < opt->eth_queues; j++)
+                               rte_eth_dev_rx_queue_stop(i, j);
+               }
+       }
+}
+
 void
 pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
 {
@@ -521,8 +529,9 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
        RTE_SET_USED(opt);
 
        RTE_ETH_FOREACH_DEV(i) {
-               rte_event_eth_rx_adapter_stop(i);
                rte_event_eth_tx_adapter_stop(i);
+               rte_event_eth_tx_adapter_queue_del(i, i, -1);
+               rte_eth_dev_tx_queue_stop(i, 0);
                rte_eth_dev_stop(i);
        }
 }