DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: Gagandeep Singh <g.singh@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: RE: [EXT] [PATCH v3 3/7] examples/l2fwd-crypto: add signal handler for exit
Date: Thu, 26 May 2022 13:55:39 +0000	[thread overview]
Message-ID: <CO6PR18MB4484F1E69D60F3DCB61148E5D8D99@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20220520042104.3784908-4-g.singh@nxp.com>

Hi Stephen,
> Handle SIGINT and SIGTERM signals.
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
Do you have more comments on this? If not, can you please ack?


>  examples/l2fwd-crypto/main.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
> index b1e2613ccf..bf4b862379 100644
> --- a/examples/l2fwd-crypto/main.c
> +++ b/examples/l2fwd-crypto/main.c
> @@ -18,6 +18,7 @@
>  #include <getopt.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> +#include <signal.h>
> 
>  #include <rte_string_fns.h>
>  #include <rte_branch_prediction.h>
> @@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics
> crypto_statistics[RTE_CRYPTO_MAX_DEVS];
>  #define MAX_TIMER_PERIOD 86400UL /* 1 day max */
>  #define DEFAULT_TIMER_PERIOD 10UL
> 
> +/* Global signal */
> +static volatile bool signal_received;
> +
>  /* Print out statistics on packets dropped */
>  static void
>  print_stats(void)
> @@ -922,6 +926,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options
> *options)
> 
>  			nb_rx = rte_eth_rx_burst(portid, 0,
>  						 pkts_burst, MAX_PKT_BURST);
> +			if (unlikely(signal_received))
> +				return;
> 
>  			port_statistics[portid].rx += nb_rx;
> 
> @@ -2760,6 +2766,13 @@ reserve_key_memory(struct l2fwd_crypto_options
> *options)
>  	options->aad.phys_addr = rte_malloc_virt2iova(options->aad.data);
>  }
> 
> +static void
> +raise_signal(int signum)
> +{
> +	if (signum == SIGINT || signum == SIGTERM)
> +		signal_received = true;
> +}
> +
>  int
>  main(int argc, char **argv)
>  {
> @@ -2772,6 +2785,9 @@ main(int argc, char **argv)
>  	int ret, enabled_cdevcount, enabled_portcount;
>  	uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = {0};
> 
> +	signal(SIGINT, raise_signal);
> +	signal(SIGTERM, raise_signal);
> +
>  	/* init EAL */
>  	ret = rte_eal_init(argc, argv);
>  	if (ret < 0)
> --
> 2.25.1


  reply	other threads:[~2022-05-26 13:56 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25  4:14 [PATCH 1/8] app/test-crypto-perf: improve dequeue logic Gagandeep Singh
2022-04-25  4:14 ` [PATCH 2/8] app/test-crypto-perf: support SDAP for PDCP operations Gagandeep Singh
2022-05-13  9:49   ` [EXT] " Akhil Goyal
2022-04-25  4:14 ` [PATCH 3/8] examples/ipsec-secgw: support XCBC-MAC/DES-CBC Gagandeep Singh
2022-05-13  9:54   ` [EXT] " Akhil Goyal
2022-05-16  9:45     ` Gagandeep Singh
2022-04-25  4:14 ` [PATCH 4/8] examples/l2fwd-crypto: add signal handler for exit Gagandeep Singh
2022-04-25  4:14 ` [PATCH 5/8] test/crypto: fix pmd name for dpaa raw buffer crypto driver Gagandeep Singh
2022-04-25  4:14 ` [PATCH 6/8] test/crypto: support raw buffer APIs for PDCP Gagandeep Singh
2022-04-25  4:14 ` [PATCH 7/8] test/crypto: add external buffer test case Gagandeep Singh
2022-05-13 10:26   ` [EXT] " Akhil Goyal
2022-05-16  7:25     ` Gagandeep Singh
2022-04-25  4:14 ` [PATCH 8/8] test/crypto: add short MAC-I test vector for zuc Gagandeep Singh
2022-05-13 10:46   ` [EXT] " Akhil Goyal
2022-05-16  7:27     ` Gagandeep Singh
2022-05-13  9:46 ` [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logic Akhil Goyal
2022-05-16  7:14   ` Gagandeep Singh
2022-05-16  7:26     ` Anoob Joseph
2022-05-16  7:54       ` Gagandeep Singh
2022-05-17  3:38 ` [PATCH v2 0/7] Crypto related changes in sample/test apps Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 1/7] app/test-crypto-perf: support SDAP for PDCP operations Gagandeep Singh
2022-05-20  4:20     ` [PATCH v3 0/7] Crypto related changes in sample/test apps Gagandeep Singh
2022-05-20  4:20       ` [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operations Gagandeep Singh
2022-05-26 13:52         ` [EXT] " Akhil Goyal
2022-05-30  4:31           ` Gagandeep Singh
2022-05-30  6:04             ` Akhil Goyal
2022-05-31 18:14               ` Akhil Goyal
2022-06-06  4:00         ` [PATCH v4] " Gagandeep Singh
2022-06-15 16:06           ` [EXT] " Akhil Goyal
2022-05-20  4:20       ` [PATCH v3 2/7] examples/ipsec-secgw: support XCBC-MAC/DES-CBC Gagandeep Singh
2022-05-26 13:54         ` [EXT] " Akhil Goyal
2022-05-20  4:21       ` [PATCH v3 3/7] examples/l2fwd-crypto: add signal handler for exit Gagandeep Singh
2022-05-26 13:55         ` Akhil Goyal [this message]
2022-05-20  4:21       ` [PATCH v3 4/7] test/crypto: fix PMD name for dpaa raw buffer crypto driver Gagandeep Singh
2022-05-26 13:56         ` [EXT] " Akhil Goyal
2022-05-20  4:21       ` [PATCH v3 5/7] test/crypto: support raw buffer APIs for PDCP Gagandeep Singh
2022-05-26 13:58         ` [EXT] " Akhil Goyal
2022-05-20  4:21       ` [PATCH v3 6/7] test/crypto: add short MAC-I test vector for zuc Gagandeep Singh
2022-05-26 13:59         ` [EXT] " Akhil Goyal
2022-05-20  4:21       ` [PATCH v3 7/7] doc: add missing authentication algorithm Gagandeep Singh
2022-05-26 14:00         ` [EXT] " Akhil Goyal
2022-05-17  3:38   ` [PATCH v2 2/7] examples/ipsec-secgw: support XCBC-MAC/DES-CBC Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exit Gagandeep Singh
2022-05-17 16:32     ` Stephen Hemminger
2022-05-18  4:23       ` Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 4/7] test/crypto: fix PMD name for dpaa raw buffer crypto driver Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 5/7] test/crypto: support raw buffer APIs for PDCP Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 6/7] test/crypto: add short MAC-I test vector for zuc Gagandeep Singh
2022-05-17  3:38   ` [PATCH v2 7/7] doc: add missing authentication algorithm Gagandeep Singh

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=CO6PR18MB4484F1E69D60F3DCB61148E5D8D99@CO6PR18MB4484.namprd18.prod.outlook.com \
    --to=gakhil@marvell.com \
    --cc=dev@dpdk.org \
    --cc=g.singh@nxp.com \
    --cc=stephen@networkplumber.org \
    /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).