From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8CA65A050D; Tue, 26 Apr 2022 23:14:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30B4141109; Tue, 26 Apr 2022 23:14:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id CB34D40691 for ; Tue, 26 Apr 2022 23:14:21 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 23QF5Mws013079 for ; Tue, 26 Apr 2022 14:14:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=cLcDxaZ2pRswYbZ8XEuzU85J1m7n4aAbLe63ZUuo6DQ=; b=Qj6TEJoDEHCnUQL02SrLTaHfMgkZB2K7PKA4EDymRPxEud88WuyLdI+Ywp9A/57B+ZOI ik6OZuw4VTnaCdGZAchcfHSjSVPTD5sYNh6eRnztiK+Wiz5pvqEssUSgpWKhsoumkRKZ Sgq9j5TvfqodgGKOnTpKOiO0gXbtI2iT0AaKF/V/yyaBibwu1F3tLgOKPo+gfXs7jUE3 jRzAbXLsUiAh/02jjOkfzX1NvB0l5vGHoZQr5O5tS67s062iX8U1HN9sgsSHxq/KQNzc w6Zs/6nUJAOAlBcKhVZ8oHYydwFp/QFFfjE5TD4+gIH6s5fRy4e44ICViEpzL8LhUTiK 8w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fpaxv3fs0-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 26 Apr 2022 14:14:19 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 26 Apr 2022 14:14:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 26 Apr 2022 14:14:18 -0700 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.193.69.50]) by maili.marvell.com (Postfix) with ESMTP id 090863F709F; Tue, 26 Apr 2022 14:14:15 -0700 (PDT) From: Pavan Nikhilesh To: CC: , Pavan Nikhilesh Subject: [PATCH 1/6] app/eventdev: simplify signal handling and teardown Date: Wed, 27 Apr 2022 02:44:07 +0530 Message-ID: <20220426211412.6138-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: d3tjrvrM2vCfz1FDTfDstcESAj9scSBH X-Proofpoint-GUID: d3tjrvrM2vCfz1FDTfDstcESAj9scSBH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-26_06,2022-04-26_02,2022-02-23_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove rte_*_dev calls from signal handler callback. Split ethernet device teardown into Rx and Tx sections, wait for workers to finish processing after disabling Rx to allow workers to complete processing currently held packets. Signed-off-by: Pavan Nikhilesh --- app/test-eventdev/evt_main.c | 58 +++++++++--------------- app/test-eventdev/evt_test.h | 3 ++ app/test-eventdev/test_perf_atq.c | 1 + app/test-eventdev/test_perf_common.c | 20 +++++++- app/test-eventdev/test_perf_common.h | 4 +- app/test-eventdev/test_perf_queue.c | 1 + app/test-eventdev/test_pipeline_atq.c | 1 + app/test-eventdev/test_pipeline_common.c | 19 +++++++- app/test-eventdev/test_pipeline_common.h | 5 +- app/test-eventdev/test_pipeline_queue.c | 1 + 10 files changed, 72 insertions(+), 41 deletions(-) diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c index a7d6b0c1cf..c5d63061bf 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -19,11 +19,7 @@ struct evt_test *test; static void signal_handler(int signum) { - int i; - static uint8_t once; - - if ((signum == SIGINT || signum == SIGTERM) && !once) { - once = true; + if (signum == SIGINT || signum == SIGTERM) { printf("\nSignal %d received, preparing to exit...\n", signum); @@ -31,36 +27,7 @@ signal_handler(int signum) /* request all lcores to exit from the main loop */ *(int *)test->test_priv = true; rte_wmb(); - - if (test->ops.ethdev_destroy) - test->ops.ethdev_destroy(test, &opt); - - if (test->ops.cryptodev_destroy) - test->ops.cryptodev_destroy(test, &opt); - - rte_eal_mp_wait_lcore(); - - if (test->ops.test_result) - test->ops.test_result(test, &opt); - - if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) { - RTE_ETH_FOREACH_DEV(i) - rte_eth_dev_close(i); - } - - if (test->ops.eventdev_destroy) - test->ops.eventdev_destroy(test, &opt); - - if (test->ops.mempool_destroy) - test->ops.mempool_destroy(test, &opt); - - if (test->ops.test_destroy) - test->ops.test_destroy(test, &opt); } - - /* exit with the expected status */ - signal(signum, SIG_DFL); - kill(getpid(), signum); } } @@ -189,10 +156,29 @@ main(int argc, char **argv) } } + if (test->ops.ethdev_rx_stop) + test->ops.ethdev_rx_stop(test, &opt); + + if (test->ops.cryptodev_destroy) + test->ops.cryptodev_destroy(test, &opt); + rte_eal_mp_wait_lcore(); - /* Print the test result */ - ret = test->ops.test_result(test, &opt); + if (test->ops.test_result) + test->ops.test_result(test, &opt); + + if (test->ops.ethdev_destroy) + test->ops.ethdev_destroy(test, &opt); + + if (test->ops.eventdev_destroy) + test->ops.eventdev_destroy(test, &opt); + + if (test->ops.mempool_destroy) + test->ops.mempool_destroy(test, &opt); + + if (test->ops.test_destroy) + test->ops.test_destroy(test, &opt); + nocap: if (ret == EVT_TEST_SUCCESS) { printf("Result: "CLGRN"%s"CLNRM"\n", "Success"); diff --git a/app/test-eventdev/evt_test.h b/app/test-eventdev/evt_test.h index 50fa474ec2..1049f99ddc 100644 --- a/app/test-eventdev/evt_test.h +++ b/app/test-eventdev/evt_test.h @@ -41,6 +41,8 @@ typedef void (*evt_test_eventdev_destroy_t) (struct evt_test *test, struct evt_options *opt); typedef void (*evt_test_ethdev_destroy_t) (struct evt_test *test, struct evt_options *opt); +typedef void (*evt_test_ethdev_rx_stop_t)(struct evt_test *test, + struct evt_options *opt); typedef void (*evt_test_cryptodev_destroy_t) (struct evt_test *test, struct evt_options *opt); typedef void (*evt_test_mempool_destroy_t) @@ -60,6 +62,7 @@ struct evt_test_ops { evt_test_launch_lcores_t launch_lcores; evt_test_result_t test_result; evt_test_eventdev_destroy_t eventdev_destroy; + evt_test_ethdev_rx_stop_t ethdev_rx_stop; evt_test_ethdev_destroy_t ethdev_destroy; evt_test_cryptodev_destroy_t cryptodev_destroy; evt_test_mempool_destroy_t mempool_destroy; diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c index 67ff681666..bac3ea602f 100644 --- a/app/test-eventdev/test_perf_atq.c +++ b/app/test-eventdev/test_perf_atq.c @@ -343,6 +343,7 @@ static const struct evt_test_ops perf_atq = { .test_setup = perf_test_setup, .ethdev_setup = perf_ethdev_setup, .cryptodev_setup = perf_cryptodev_setup, + .ethdev_rx_stop = perf_ethdev_rx_stop, .mempool_setup = perf_mempool_setup, .eventdev_setup = perf_atq_eventdev_setup, .launch_lcores = perf_atq_launch_lcores, diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 9d1f4a4567..e93b0e7272 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -1087,7 +1087,8 @@ 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) +void +perf_ethdev_rx_stop(struct evt_test *test, struct evt_options *opt) { uint16_t i; RTE_SET_USED(test); @@ -1095,6 +1096,23 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt) 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); + rte_eth_dev_rx_queue_stop(i, 0); + } + } +} + +void +perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt) +{ + uint16_t i; + RTE_SET_USED(test); + + if (opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) { + RTE_ETH_FOREACH_DEV (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); } } diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index ea0907d61a..e504bb1df9 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -12,10 +12,11 @@ #include #include #include -#include #include #include +#include #include +#include #include #include #include @@ -181,6 +182,7 @@ 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_cryptodev_destroy(struct evt_test *test, struct evt_options *opt); void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt); +void perf_ethdev_rx_stop(struct evt_test *test, struct evt_options *opt); void perf_mempool_destroy(struct evt_test *test, struct evt_options *opt); #endif /* _TEST_PERF_COMMON_ */ diff --git a/app/test-eventdev/test_perf_queue.c b/app/test-eventdev/test_perf_queue.c index dcf6d82947..108f1742a7 100644 --- a/app/test-eventdev/test_perf_queue.c +++ b/app/test-eventdev/test_perf_queue.c @@ -360,6 +360,7 @@ static const struct evt_test_ops perf_queue = { .mempool_setup = perf_mempool_setup, .ethdev_setup = perf_ethdev_setup, .cryptodev_setup = perf_cryptodev_setup, + .ethdev_rx_stop = perf_ethdev_rx_stop, .eventdev_setup = perf_queue_eventdev_setup, .launch_lcores = perf_queue_launch_lcores, .eventdev_destroy = perf_eventdev_destroy, diff --git a/app/test-eventdev/test_pipeline_atq.c b/app/test-eventdev/test_pipeline_atq.c index 84dd4f44e3..79218502ba 100644 --- a/app/test-eventdev/test_pipeline_atq.c +++ b/app/test-eventdev/test_pipeline_atq.c @@ -772,6 +772,7 @@ static const struct evt_test_ops pipeline_atq = { .ethdev_setup = pipeline_ethdev_setup, .eventdev_setup = pipeline_atq_eventdev_setup, .launch_lcores = pipeline_atq_launch_lcores, + .ethdev_rx_stop = pipeline_ethdev_rx_stop, .eventdev_destroy = pipeline_eventdev_destroy, .mempool_destroy = pipeline_mempool_destroy, .ethdev_destroy = pipeline_ethdev_destroy, diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index ddaa9f3fdb..d994c91678 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -505,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) { @@ -513,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); } } diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index d69e2f8a3e..c979c33772 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -12,16 +12,16 @@ #include #include -#include #include #include +#include #include #include #include #include -#include #include #include +#include #include "evt_common.h" #include "evt_options.h" @@ -186,6 +186,7 @@ void pipeline_opt_dump(struct evt_options *opt, uint8_t nb_queues); void pipeline_test_destroy(struct evt_test *test, struct evt_options *opt); void pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt); void pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt); +void pipeline_ethdev_rx_stop(struct evt_test *test, struct evt_options *opt); void pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt); #endif /* _TEST_PIPELINE_COMMON_ */ diff --git a/app/test-eventdev/test_pipeline_queue.c b/app/test-eventdev/test_pipeline_queue.c index f6cc3e358e..343f8f3b1d 100644 --- a/app/test-eventdev/test_pipeline_queue.c +++ b/app/test-eventdev/test_pipeline_queue.c @@ -798,6 +798,7 @@ static const struct evt_test_ops pipeline_queue = { .ethdev_setup = pipeline_ethdev_setup, .eventdev_setup = pipeline_queue_eventdev_setup, .launch_lcores = pipeline_queue_launch_lcores, + .ethdev_rx_stop = pipeline_ethdev_rx_stop, .eventdev_destroy = pipeline_eventdev_destroy, .mempool_destroy = pipeline_mempool_destroy, .ethdev_destroy = pipeline_ethdev_destroy, -- 2.25.1