[v3,1/7] app/test-crypto-perf: support SDAP for PDCP operations

Message ID 20220520042104.3784908-2-g.singh@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series Crypto related changes in sample/test apps |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gagandeep Singh May 20, 2022, 4:20 a.m. UTC
  Add a command line option "--enable-sdap" to enable
Service Data Adaptation Protocol.

example command:
./dpdk-test-crypto-perf -c 0xc  --log-level=8 --
--devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr
--cipher-op encrypt --auth-algo zuc-eia3 --auth-op generate
--auth-key-sz 16 --ptest throughput --total-ops 100000 --burst-sz 64
--buffer-sz 64,390,1512  --pool-sz 4096 --silent --pdcp-sn-sz 12
--pdcp-domain control --enable-sdap

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 app/test-crypto-perf/cperf_ops.c             |  1 +
 app/test-crypto-perf/cperf_options.h         |  2 ++
 app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++
 doc/guides/tools/cryptoperf.rst              |  4 ++++
 4 files changed, 19 insertions(+)
  

Comments

Akhil Goyal May 26, 2022, 1:52 p.m. UTC | #1
> Add a command line option "--enable-sdap" to enable
> Service Data Adaptation Protocol.
> 
> example command:
> ./dpdk-test-crypto-perf -c 0xc  --log-level=8 --
> --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr
> --cipher-op encrypt --auth-algo zuc-eia3 --auth-op generate
> --auth-key-sz 16 --ptest throughput --total-ops 100000 --burst-sz 64
> --buffer-sz 64,390,1512  --pool-sz 4096 --silent --pdcp-sn-sz 12
> --pdcp-domain control --enable-sdap
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  app/test-crypto-perf/cperf_ops.c             |  1 +
>  app/test-crypto-perf/cperf_options.h         |  2 ++
>  app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++
>  doc/guides/tools/cryptoperf.rst              |  4 ++++
>  4 files changed, 19 insertions(+)
> 
> diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
> index cbefce8d6c..4295656a0b 100644
> --- a/app/test-crypto-perf/cperf_ops.c
> +++ b/app/test-crypto-perf/cperf_ops.c
> @@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
>  				.hfn = options->pdcp_ses_hfn_en ?
>  					PDCP_DEFAULT_HFN : 0,
>  				.hfn_threshold = 0x70C0A,
> +				.sdap_enabled = options->pdcp_sdap,
>  				.hfn_ovrd = !(options->pdcp_ses_hfn_en),
>  			} },
>  			.crypto_xform = &cipher_xform
> diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-
> perf/cperf_options.h
> index 09caefde22..613d6d31e2 100644
> --- a/app/test-crypto-perf/cperf_options.h
> +++ b/app/test-crypto-perf/cperf_options.h
> @@ -14,6 +14,7 @@
>  #define CPERF_PTEST_TYPE	("ptest")
>  #define CPERF_MODEX_LEN		("modex-len")
>  #define CPERF_SILENT		("silent")
> +#define CPERF_ENABLE_SDAP	("enable-sdap")
> 
>  #define CPERF_POOL_SIZE		("pool-sz")
>  #define CPERF_TOTAL_OPS		("total-ops")
> @@ -129,6 +130,7 @@ struct cperf_options {
>  #ifdef RTE_LIB_SECURITY
>  	uint16_t pdcp_sn_sz;
>  	uint16_t pdcp_ses_hfn_en;
> +	uint16_t pdcp_sdap;
>  	enum rte_security_pdcp_domain pdcp_domain;
>  	uint16_t docsis_hdr_sz;
>  #endif
> diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-
> perf/cperf_options_parsing.c
> index 09c98121c8..28680347f1 100644
> --- a/app/test-crypto-perf/cperf_options_parsing.c
> +++ b/app/test-crypto-perf/cperf_options_parsing.c
> @@ -64,6 +64,7 @@ usage(char *progname)
>  		" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n"
>  		" --pdcp-domain DOMAIN: set PDCP domain <control/user>\n"
>  		" --pdcp-ses-hfn-en: enable session based fixed HFN\n"
> +		" --enable-sdap: enable sdap\n"
>  		" --docsis-hdr-sz: set DOCSIS header size\n"
>  #endif
>  		" -h: prints this help\n",
> @@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,
>  	return 0;
>  }
> 
> +static int
> +parse_enable_sdap(struct cperf_options *opts,
> +		const char *arg __rte_unused)
> +{
> +	opts->pdcp_sdap = 1;
> +
> +	return 0;
> +}

You should also set a default value of this flag.
  
Gagandeep Singh May 30, 2022, 4:31 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, May 26, 2022 7:23 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP
> operations
> 
> > Add a command line option "--enable-sdap" to enable Service Data
> > Adaptation Protocol.
> >
> > example command:
> > ./dpdk-test-crypto-perf -c 0xc  --log-level=8 -- --devtype
> > crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op
> > encrypt --auth-algo zuc-eia3 --auth-op generate --auth-key-sz 16
> > --ptest throughput --total-ops 100000 --burst-sz 64 --buffer-sz
> > 64,390,1512  --pool-sz 4096 --silent --pdcp-sn-sz 12 --pdcp-domain
> > control --enable-sdap
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >  app/test-crypto-perf/cperf_ops.c             |  1 +
> >  app/test-crypto-perf/cperf_options.h         |  2 ++
> >  app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++
> >  doc/guides/tools/cryptoperf.rst              |  4 ++++
> >  4 files changed, 19 insertions(+)
> >
> > diff --git a/app/test-crypto-perf/cperf_ops.c
> > b/app/test-crypto-perf/cperf_ops.c
> > index cbefce8d6c..4295656a0b 100644
> > --- a/app/test-crypto-perf/cperf_ops.c
> > +++ b/app/test-crypto-perf/cperf_ops.c
> > @@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp,
> >  				.hfn = options->pdcp_ses_hfn_en ?
> >  					PDCP_DEFAULT_HFN : 0,
> >  				.hfn_threshold = 0x70C0A,
> > +				.sdap_enabled = options->pdcp_sdap,
> >  				.hfn_ovrd = !(options->pdcp_ses_hfn_en),
> >  			} },
> >  			.crypto_xform = &cipher_xform
> > diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-
> > perf/cperf_options.h index 09caefde22..613d6d31e2 100644
> > --- a/app/test-crypto-perf/cperf_options.h
> > +++ b/app/test-crypto-perf/cperf_options.h
> > @@ -14,6 +14,7 @@
> >  #define CPERF_PTEST_TYPE	("ptest")
> >  #define CPERF_MODEX_LEN		("modex-len")
> >  #define CPERF_SILENT		("silent")
> > +#define CPERF_ENABLE_SDAP	("enable-sdap")
> >
> >  #define CPERF_POOL_SIZE		("pool-sz")
> >  #define CPERF_TOTAL_OPS		("total-ops")
> > @@ -129,6 +130,7 @@ struct cperf_options {  #ifdef RTE_LIB_SECURITY
> >  	uint16_t pdcp_sn_sz;
> >  	uint16_t pdcp_ses_hfn_en;
> > +	uint16_t pdcp_sdap;
> >  	enum rte_security_pdcp_domain pdcp_domain;
> >  	uint16_t docsis_hdr_sz;
> >  #endif
> > diff --git a/app/test-crypto-perf/cperf_options_parsing.c
> > b/app/test-crypto- perf/cperf_options_parsing.c index
> > 09c98121c8..28680347f1 100644
> > --- a/app/test-crypto-perf/cperf_options_parsing.c
> > +++ b/app/test-crypto-perf/cperf_options_parsing.c
> > @@ -64,6 +64,7 @@ usage(char *progname)
> >  		" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n"
> >  		" --pdcp-domain DOMAIN: set PDCP domain <control/user>\n"
> >  		" --pdcp-ses-hfn-en: enable session based fixed HFN\n"
> > +		" --enable-sdap: enable sdap\n"
> >  		" --docsis-hdr-sz: set DOCSIS header size\n"
> >  #endif
> >  		" -h: prints this help\n",
> > @@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,
> >  	return 0;
> >  }
> >
> > +static int
> > +parse_enable_sdap(struct cperf_options *opts,
> > +		const char *arg __rte_unused)
> > +{
> > +	opts->pdcp_sdap = 1;
> > +
> > +	return 0;
> > +}
> 
> You should also set a default value of this flag.

Default functionality is disable SDAP. Application is defining the cperf options with all values 0s in its main(): "struct cperf_options opts = {0};". Is n't it sufficient?
  
Akhil Goyal May 30, 2022, 6:04 a.m. UTC | #3
> > > Add a command line option "--enable-sdap" to enable Service Data
> > > Adaptation Protocol.
> > >
> > > example command:
> > > ./dpdk-test-crypto-perf -c 0xc  --log-level=8 -- --devtype
> > > crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op
> > > encrypt --auth-algo zuc-eia3 --auth-op generate --auth-key-sz 16
> > > --ptest throughput --total-ops 100000 --burst-sz 64 --buffer-sz
> > > 64,390,1512  --pool-sz 4096 --silent --pdcp-sn-sz 12 --pdcp-domain
> > > control --enable-sdap
> > >
> > > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > > ---
> > >  app/test-crypto-perf/cperf_ops.c             |  1 +
> > >  app/test-crypto-perf/cperf_options.h         |  2 ++
> > >  app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++
> > >  doc/guides/tools/cryptoperf.rst              |  4 ++++
> > >  4 files changed, 19 insertions(+)
> > >
> > > diff --git a/app/test-crypto-perf/cperf_ops.c
> > > b/app/test-crypto-perf/cperf_ops.c
> > > index cbefce8d6c..4295656a0b 100644
> > > --- a/app/test-crypto-perf/cperf_ops.c
> > > +++ b/app/test-crypto-perf/cperf_ops.c
> > > @@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool
> *sess_mp,
> > >  				.hfn = options->pdcp_ses_hfn_en ?
> > >  					PDCP_DEFAULT_HFN : 0,
> > >  				.hfn_threshold = 0x70C0A,
> > > +				.sdap_enabled = options->pdcp_sdap,
> > >  				.hfn_ovrd = !(options->pdcp_ses_hfn_en),
> > >  			} },
> > >  			.crypto_xform = &cipher_xform
> > > diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-
> > > perf/cperf_options.h index 09caefde22..613d6d31e2 100644
> > > --- a/app/test-crypto-perf/cperf_options.h
> > > +++ b/app/test-crypto-perf/cperf_options.h
> > > @@ -14,6 +14,7 @@
> > >  #define CPERF_PTEST_TYPE	("ptest")
> > >  #define CPERF_MODEX_LEN		("modex-len")
> > >  #define CPERF_SILENT		("silent")
> > > +#define CPERF_ENABLE_SDAP	("enable-sdap")
> > >
> > >  #define CPERF_POOL_SIZE		("pool-sz")
> > >  #define CPERF_TOTAL_OPS		("total-ops")
> > > @@ -129,6 +130,7 @@ struct cperf_options {  #ifdef RTE_LIB_SECURITY
> > >  	uint16_t pdcp_sn_sz;
> > >  	uint16_t pdcp_ses_hfn_en;
> > > +	uint16_t pdcp_sdap;
> > >  	enum rte_security_pdcp_domain pdcp_domain;
> > >  	uint16_t docsis_hdr_sz;
> > >  #endif
> > > diff --git a/app/test-crypto-perf/cperf_options_parsing.c
> > > b/app/test-crypto- perf/cperf_options_parsing.c index
> > > 09c98121c8..28680347f1 100644
> > > --- a/app/test-crypto-perf/cperf_options_parsing.c
> > > +++ b/app/test-crypto-perf/cperf_options_parsing.c
> > > @@ -64,6 +64,7 @@ usage(char *progname)
> > >  		" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n"
> > >  		" --pdcp-domain DOMAIN: set PDCP domain <control/user>\n"
> > >  		" --pdcp-ses-hfn-en: enable session based fixed HFN\n"
> > > +		" --enable-sdap: enable sdap\n"
> > >  		" --docsis-hdr-sz: set DOCSIS header size\n"
> > >  #endif
> > >  		" -h: prints this help\n",
> > > @@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,
> > >  	return 0;
> > >  }
> > >
> > > +static int
> > > +parse_enable_sdap(struct cperf_options *opts,
> > > +		const char *arg __rte_unused)
> > > +{
> > > +	opts->pdcp_sdap = 1;
> > > +
> > > +	return 0;
> > > +}
> >
> > You should also set a default value of this flag.
> 
> Default functionality is disable SDAP. Application is defining the cperf options
> with all values 0s in its main(): "struct cperf_options opts = {0};". Is n't it
> sufficient?
It would be good to initialize that with other options. It will help in debugging and
Improve code readability.
Please add it in cperf_options_default() as it is done for other PDCP options.
  
Akhil Goyal May 31, 2022, 6:14 p.m. UTC | #4
> > > You should also set a default value of this flag.
> >
> > Default functionality is disable SDAP. Application is defining the cperf options
> > with all values 0s in its main(): "struct cperf_options opts = {0};". Is n't it
> > sufficient?
> It would be good to initialize that with other options. It will help in debugging
> and
> Improve code readability.
> Please add it in cperf_options_default() as it is done for other PDCP options.
> 
Please send v4 of this patch as standalone patch. The rest of the patches have been
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index cbefce8d6c..4295656a0b 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -861,6 +861,7 @@  cperf_create_session(struct rte_mempool *sess_mp,
 				.hfn = options->pdcp_ses_hfn_en ?
 					PDCP_DEFAULT_HFN : 0,
 				.hfn_threshold = 0x70C0A,
+				.sdap_enabled = options->pdcp_sdap,
 				.hfn_ovrd = !(options->pdcp_ses_hfn_en),
 			} },
 			.crypto_xform = &cipher_xform
diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h
index 09caefde22..613d6d31e2 100644
--- a/app/test-crypto-perf/cperf_options.h
+++ b/app/test-crypto-perf/cperf_options.h
@@ -14,6 +14,7 @@ 
 #define CPERF_PTEST_TYPE	("ptest")
 #define CPERF_MODEX_LEN		("modex-len")
 #define CPERF_SILENT		("silent")
+#define CPERF_ENABLE_SDAP	("enable-sdap")
 
 #define CPERF_POOL_SIZE		("pool-sz")
 #define CPERF_TOTAL_OPS		("total-ops")
@@ -129,6 +130,7 @@  struct cperf_options {
 #ifdef RTE_LIB_SECURITY
 	uint16_t pdcp_sn_sz;
 	uint16_t pdcp_ses_hfn_en;
+	uint16_t pdcp_sdap;
 	enum rte_security_pdcp_domain pdcp_domain;
 	uint16_t docsis_hdr_sz;
 #endif
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 09c98121c8..28680347f1 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -64,6 +64,7 @@  usage(char *progname)
 		" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n"
 		" --pdcp-domain DOMAIN: set PDCP domain <control/user>\n"
 		" --pdcp-ses-hfn-en: enable session based fixed HFN\n"
+		" --enable-sdap: enable sdap\n"
 		" --docsis-hdr-sz: set DOCSIS header size\n"
 #endif
 		" -h: prints this help\n",
@@ -548,6 +549,15 @@  parse_silent(struct cperf_options *opts,
 	return 0;
 }
 
+static int
+parse_enable_sdap(struct cperf_options *opts,
+		const char *arg __rte_unused)
+{
+	opts->pdcp_sdap = 1;
+
+	return 0;
+}
+
 static int
 parse_cipher_algo(struct cperf_options *opts, const char *arg)
 {
@@ -879,6 +889,7 @@  static struct option lgopts[] = {
 	{ CPERF_PDCP_SN_SZ, required_argument, 0, 0 },
 	{ CPERF_PDCP_DOMAIN, required_argument, 0, 0 },
 	{ CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 },
+	{ CPERF_ENABLE_SDAP, no_argument, 0, 0 },
 	{ CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 },
 #endif
 	{ CPERF_CSV, no_argument, 0, 0},
@@ -994,6 +1005,7 @@  cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
 		{ CPERF_PDCP_SN_SZ,	parse_pdcp_sn_sz },
 		{ CPERF_PDCP_DOMAIN,	parse_pdcp_domain },
 		{ CPERF_PDCP_SES_HFN_EN,	parse_pdcp_ses_hfn_en },
+		{ CPERF_ENABLE_SDAP,	parse_enable_sdap },
 		{ CPERF_DOCSIS_HDR_SZ,	parse_docsis_hdr_sz },
 #endif
 		{ CPERF_CSV,		parse_csv_friendly},
diff --git a/doc/guides/tools/cryptoperf.rst b/doc/guides/tools/cryptoperf.rst
index cf3b147213..c77e253417 100644
--- a/doc/guides/tools/cryptoperf.rst
+++ b/doc/guides/tools/cryptoperf.rst
@@ -332,6 +332,10 @@  The following are the application command-line options:
 
         Enable fixed session based HFN instead of per packet HFN.
 
+* ``--enable-sdap``
+
+        Enable Service Data Adaptation Protocol.
+
 * ``--modex-len <n>``
 
         Set modex length for asymmetric crypto perf test.