DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: Jerin Jacob <jerinj@marvell.com>, dpdk-dev <dev@dpdk.org>
Subject: Re: [PATCH v2 1/6] app/eventdev: simplify signal handling and teardown
Date: Mon, 16 May 2022 22:16:12 +0530	[thread overview]
Message-ID: <CALBAE1NXLtXg4vTYEyjBxNf41kx7nHL+9Ld_SYEEZPn82javQw@mail.gmail.com> (raw)
In-Reply-To: <20220513160719.10558-1-pbhagavatula@marvell.com>

On Fri, May 13, 2022 at 9:37 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Remove rte_*_dev calls from signal handler callback as signal handlers
> are supposed to be light weight.
>
> 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.
>
> Verified SW event device on ARM64 using the following command:
>
> ./build/app/dpdk-test-eventdev -l 7-23 -s 0xf00 --vdev=event_sw0
>  -a 0002:02:00.0 -- --prod_type_ethdev --nb_pkts=0 --verbose 2
>  --test=pipeline_queue --stlist=o --wlcores 16-23

Series Acked-by: Jerin Jacob <jerinj@marvell.com>
Series applied to dpdk-next-net-eventdev/for-main. Thanks


>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  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..4cf16b4267 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 <rte_cryptodev.h>
>  #include <rte_cycles.h>
>  #include <rte_ethdev.h>
> -#include <rte_eventdev.h>
>  #include <rte_event_crypto_adapter.h>
>  #include <rte_event_eth_rx_adapter.h>
> +#include <rte_event_eth_tx_adapter.h>
>  #include <rte_event_timer_adapter.h>
> +#include <rte_eventdev.h>
>  #include <rte_lcore.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
> @@ -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..29b64014d7 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 <rte_cycles.h>
>  #include <rte_ethdev.h>
> -#include <rte_eventdev.h>
>  #include <rte_event_eth_rx_adapter.h>
>  #include <rte_event_eth_tx_adapter.h>
> +#include <rte_eventdev.h>
>  #include <rte_lcore.h>
>  #include <rte_malloc.h>
>  #include <rte_mempool.h>
>  #include <rte_prefetch.h>
> -#include <rte_spinlock.h>
>  #include <rte_service.h>
>  #include <rte_service_component.h>
> +#include <rte_spinlock.h>
>
>  #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
>

      parent reply	other threads:[~2022-05-16 16:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 21:14 [PATCH " Pavan Nikhilesh
2022-04-26 21:14 ` [PATCH 2/6] app/eventdev: clean up worker state before exit Pavan Nikhilesh
2022-05-13 13:40   ` Jerin Jacob
2022-04-26 21:14 ` [PATCH 3/6] examples/eventdev: " Pavan Nikhilesh
2022-04-26 21:14 ` [PATCH 4/6] examples/l3fwd: " Pavan Nikhilesh
2022-04-26 21:14 ` [PATCH 5/6] examples/l2fwd-event: " Pavan Nikhilesh
2022-04-26 21:14 ` [PATCH 6/6] examples/ipsec-secgw: cleanup " Pavan Nikhilesh
2022-05-13 13:41   ` Jerin Jacob
2022-05-13 11:49 ` [PATCH 1/6] app/eventdev: simplify signal handling and teardown Jerin Jacob
2022-05-13 13:39 ` Jerin Jacob
2022-05-13 16:07 ` [PATCH v2 " pbhagavatula
2022-05-13 16:07   ` [PATCH v2 2/6] app/eventdev: clean up worker state before exit pbhagavatula
2022-05-13 16:07   ` [PATCH v2 3/6] examples/eventdev: " pbhagavatula
2022-05-13 16:07   ` [PATCH v2 4/6] examples/l3fwd: " pbhagavatula
2022-05-13 16:07   ` [PATCH v2 5/6] examples/l2fwd-event: " pbhagavatula
2022-05-13 16:07   ` [PATCH v2 6/6] examples/ipsec-secgw: cleanup " pbhagavatula
2022-05-16 16:46   ` Jerin Jacob [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALBAE1NXLtXg4vTYEyjBxNf41kx7nHL+9Ld_SYEEZPn82javQw@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).