security: remove redundant cast
PATCH 1/4 security: remove redundant cast
The API 'rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.
--- lib/security/rte_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/security/rte_security.c +1 -1
@@ -385,7 +385,7 @@ security_capabilities_from_dev_id(int dev_id, const void **caps)if (rte_cryptodev_is_valid_dev (dev_id) ==0 )return -EINVAL ; - sec_ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx (dev_id); + sec_ctx =rte_cryptodev_get_sec_ctx (dev_id);RTE_PTR_OR_ERR_RET (sec_ctx, -EINVAL ); capabilities =rte_security_capabilities_get (sec_ctx);
Signature · 1 line
2.25.1
PATCH 2/4 test/crypto: remove redundant cast
The API 'rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.
--- app/test/test_cryptodev.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
app/test/test_cryptodev.c +12 -17
@@ -8920,15 +8920,12 @@ security_proto_supported(enum rte_security_session_action_type action, enum rte_security_session_protocol proto) {struct crypto_testsuite_params *ts_params = &testsuite_params; -const struct rte_security_capability *capabilities;const struct rte_security_capability *capability; +struct rte_security_ctx *ctx;uint16_t i =0 ; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - ts_params->valid_devs[0 ]); - + ctx =rte_cryptodev_get_sec_ctx (ts_params->valid_devs[0 ]); capabilities =rte_security_capabilities_get (ctx);
@@ -8967,12 +8964,12 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,struct crypto_unittest_params *ut_params = &unittest_params;uint8_t *plaintext;int ret =TEST_SUCCESS ; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - ts_params->valid_devs[0 ]);struct rte_cryptodev_info dev_info; +struct rte_security_ctx *ctx;uint64_t feat_flags; + ctx =rte_cryptodev_get_sec_ctx (ts_params->valid_devs[0 ]); +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); feat_flags = dev_info.feature_flags;
@@ -9174,11 +9171,11 @@ test_pdcp_proto_SGL(int i, int oop,unsigned int trn_data =0 ;struct rte_cryptodev_info dev_info;uint64_t feat_flags; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - ts_params->valid_devs[0 ]); +struct rte_security_ctx *ctx;struct rte_mbuf *temp_mbuf; + ctx =rte_cryptodev_get_sec_ctx (ts_params->valid_devs[0 ]); +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); feat_flags = dev_info.feature_flags;
@@ -10898,6 +10895,7 @@ test_docsis_proto_uplink(const void *data)const struct docsis_test_data *d_td = data;struct crypto_testsuite_params *ts_params = &testsuite_params;struct crypto_unittest_params *ut_params = &unittest_params; +struct rte_security_ctx *ctx;uint8_t *plaintext =NULL ;uint8_t *ciphertext =NULL ;uint8_t *iv_ptr;
@@ -10905,9 +10903,7 @@ test_docsis_proto_uplink(const void *data)uint32_t crc_data_len;int ret =TEST_SUCCESS ; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - ts_params->valid_devs[0 ]); + ctx =rte_cryptodev_get_sec_ctx (ts_params->valid_devs[0 ]);/* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx;
@@ -11083,15 +11079,14 @@ test_docsis_proto_downlink(const void *data)const struct docsis_test_data *d_td = data;struct crypto_testsuite_params *ts_params = &testsuite_params;struct crypto_unittest_params *ut_params = &unittest_params; +struct rte_security_ctx *ctx;uint8_t *plaintext =NULL ;uint8_t *ciphertext =NULL ;uint8_t *iv_ptr;int32_t cipher_len, crc_len;int ret =TEST_SUCCESS ; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - ts_params->valid_devs[0 ]); + ctx =rte_cryptodev_get_sec_ctx (ts_params->valid_devs[0 ]);/* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx;
Signature · 1 line
2.25.1
PATCH 3/4 app/crypto-perf: remove redundant cast
In reply to Anoob JosephThe API 'rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.
--- app/test-crypto-perf/cperf_ops.c | 12 ++++++------ app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 4 +--- app/test-crypto-perf/cperf_test_throughput.c | 4 +--- 3 files changed, 8 insertions(+), 12 deletions(-)
app/test-crypto-perf/cperf_ops.c +6 -6
@@ -647,6 +647,7 @@ create_ipsec_session(struct rte_mempool *sess_mp,struct rte_crypto_sym_xform auth_xform = {0 };struct rte_crypto_sym_xform *crypto_xform;struct rte_crypto_sym_xform xform = {0 }; +struct rte_security_ctx *ctx;if (options->aead_algo !=0 ) {/* Setup AEAD Parameters */
@@ -749,8 +750,7 @@ create_ipsec_session(struct rte_mempool *sess_mp,else sess_conf.ipsec.direction =RTE_SECURITY_IPSEC_SA_DIR_INGRESS ; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx (dev_id); + ctx =rte_cryptodev_get_sec_ctx (dev_id);/* Create security session */ return (void *)rte_security_session_create (ctx, &sess_conf, sess_mp);
@@ -766,6 +766,7 @@ cperf_create_session(struct rte_mempool *sess_mp,struct rte_crypto_sym_xform cipher_xform;struct rte_crypto_sym_xform auth_xform;struct rte_crypto_sym_xform aead_xform; +struct rte_security_ctx *ctx;void *sess =NULL ;void *asym_sess =NULL ;struct rte_crypto_asym_xform xform = {0 };
@@ -853,8 +854,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .crypto_xform = &cipher_xform }; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx (dev_id); + ctx =rte_cryptodev_get_sec_ctx (dev_id);/* Create security session */ return (void *)rte_security_session_create (ctx, &sess_conf, sess_mp);
@@ -901,8 +901,8 @@ cperf_create_session(struct rte_mempool *sess_mp, } }, .crypto_xform = &cipher_xform }; -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx (dev_id); + + ctx =rte_cryptodev_get_sec_ctx (dev_id);/* Create security session */ return (void *)rte_security_session_create (ctx, &sess_conf, sess_mp);
app/test-crypto-perf/cperf_test_pmd_cyclecount.c +1 -3
@@ -67,9 +67,7 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)#ifdef RTE_LIB_SECURITY if (ctx->options->op_type ==CPERF_PDCP || ctx->options->op_type ==CPERF_DOCSIS ) { -struct rte_security_ctx *sec_ctx = - (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx (ctx->dev_id); +struct rte_security_ctx *sec_ctx =rte_cryptodev_get_sec_ctx (ctx->dev_id);rte_security_session_destroy (sec_ctx, (void *)ctx->sess); }else
app/test-crypto-perf/cperf_test_throughput.c +1 -3
@@ -44,9 +44,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)else if (ctx->options->op_type ==CPERF_PDCP || ctx->options->op_type ==CPERF_DOCSIS || ctx->options->op_type ==CPERF_IPSEC ) { -struct rte_security_ctx *sec_ctx = - (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx (ctx->dev_id); +struct rte_security_ctx *sec_ctx =rte_cryptodev_get_sec_ctx (ctx->dev_id);rte_security_session_destroy ( sec_ctx, (void *)ctx->sess);
Signature · 1 line
2.25.1
PATCH 4/4 examples/ipsec-secgw: remove redundant cast
In reply to Anoob JosephThe API 'rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.
--- examples/ipsec-secgw/ipsec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
examples/ipsec-secgw/ipsec.c +1 -3
@@ -327,9 +327,7 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[], };if (ips->type ==RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ) { -struct rte_security_ctx *ctx = (struct rte_security_ctx *) -rte_cryptodev_get_sec_ctx ( - cdev_id); +struct rte_security_ctx *ctx =rte_cryptodev_get_sec_ctx (cdev_id);/* Set IPsec parameters in conf */ set_ipsec_conf (sa, &(sess_conf.ipsec));
Signature · 1 line
2.25.1
Quoted 9 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Friday, September 8, 2023 6:40 AM
To: Akhil Goyal <[email protected]>; Power, Ciara <[email protected]>
Cc: Jerin Jacob <[email protected]>; [email protected]
Subject: [PATCH 1/4] security: remove redundant cast
Quoted 6 lines
The API '
rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.Signed-off-by Anoob Joseph <[email protected]>--- lib/security/rte_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Hi Anoob,
Quoted 7 lines
Subject: [PATCH 1/4] security: remove redundant cast
The API '
rte_cryptodev_get_sec_ctx' returns void *. Type cast is not required.Signed-off-by Anoob Joseph <[email protected]>---
The changes in the series are part of
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Hence dropping this series.