diff mbox series

[API-NEXT,v3,3/4] api: crypto: replace redundant packet_ prefixes from definitions

Message ID 1499983216-15415-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v3,1/4] validation: crypto: fix unitialized variable error | expand

Commit Message

Github ODP bot July 13, 2017, 10 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 74 (lumag:crypto-packet)
 ** https://github.com/Linaro/odp/pull/74
 ** Patch: https://github.com/Linaro/odp/pull/74.patch
 ** Base sha: f49ce736d461c3e8c2534ed216e8a70e8bee954e
 ** Merge commit sha: 668e2e51ec1fae14a324a67371babeeb8ecdaeda
 **/
 example/ipsec/odp_ipsec.c                          | 16 ++++-----
 example/ipsec/odp_ipsec_cache.c                    |  4 +--
 include/odp/api/spec/crypto.h                      | 30 ++++++++---------
 platform/linux-generic/odp_crypto.c                | 38 +++++++++++-----------
 test/common_plat/performance/odp_crypto.c          | 14 ++++----
 .../validation/api/crypto/odp_crypto_test_inp.c    | 18 +++++-----
 6 files changed, 60 insertions(+), 60 deletions(-)
diff mbox series

Patch

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 5df8f154..52a5fdcd 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -698,12 +698,12 @@  pkt_disposition_e do_ipsec_in_classify(odp_packet_t *pkt,
 	*skip = FALSE;
 	ctx->state = PKT_STATE_IPSEC_IN_FINISH;
 	if (entry->async) {
-		if (odp_crypto_packet_op_enq(pkt, &out_pkt, &params, 1))
+		if (odp_crypto_op_enq(pkt, &out_pkt, &params, 1))
 			abort();
 		return PKT_POSTED;
 	}
 
-	if (odp_crypto_packet_op(pkt, &out_pkt, &params, 1))
+	if (odp_crypto_op(pkt, &out_pkt, &params, 1))
 		abort();
 	*pkt = out_pkt;
 
@@ -727,7 +727,7 @@  pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt,
 	int hdr_len = ctx->ipsec.hdr_len;
 	int trl_len = 0;
 
-	odp_crypto_packet_result(&result, pkt);
+	odp_crypto_result(&result, pkt);
 
 	/* Check crypto result */
 	if (!result.ok) {
@@ -1001,14 +1001,14 @@  pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt,
 
 	/* Issue crypto request */
 	if (entry->async) {
-		if (odp_crypto_packet_op_enq(pkt, &out_pkt,
-					     &ctx->ipsec.params, 1))
+		if (odp_crypto_op_enq(pkt, &out_pkt,
+				      &ctx->ipsec.params, 1))
 			abort();
 		return PKT_POSTED;
 	}
 
-	if (odp_crypto_packet_op(pkt, &out_pkt,
-				 &ctx->ipsec.params, 1))
+	if (odp_crypto_op(pkt, &out_pkt,
+			  &ctx->ipsec.params, 1))
 		abort();
 	*pkt = out_pkt;
 
@@ -1030,7 +1030,7 @@  pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
 	odph_ipv4hdr_t *ip;
 	odp_crypto_packet_result_t result;
 
-	odp_crypto_packet_result(&result, pkt);
+	odp_crypto_result(&result, pkt);
 
 	/* Check crypto result */
 	if (!result.ok) {
diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 18a98a29..2a1416b0 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -66,12 +66,12 @@  int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 	params.op = (in) ? ODP_CRYPTO_OP_DECODE : ODP_CRYPTO_OP_ENCODE;
 	params.auth_cipher_text = TRUE;
 	if (CRYPTO_API_SYNC == api_mode) {
-		params.packet_op_mode = ODP_CRYPTO_SYNC;
+		params.op_mode = ODP_CRYPTO_SYNC;
 		params.compl_queue = ODP_QUEUE_INVALID;
 		params.output_pool = ODP_POOL_INVALID;
 		entry->async = FALSE;
 	} else {
-		params.packet_op_mode = ODP_CRYPTO_ASYNC;
+		params.op_mode = ODP_CRYPTO_ASYNC;
 		params.compl_queue = completionq;
 		params.output_pool = out_pool;
 		entry->async = TRUE;
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 013507f9..1cd09afd 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -278,7 +278,7 @@  typedef struct odp_crypto_session_param_t {
 	odp_crypto_op_mode_t ODP_DEPRECATE(pref_mode);
 
 	/** Operation mode when using packet interface: sync or async */
-	odp_crypto_op_mode_t packet_op_mode;
+	odp_crypto_op_mode_t op_mode;
 
 	/** Cipher algorithm
 	 *
@@ -315,7 +315,7 @@  typedef struct odp_crypto_session_param_t {
 
 	/** Async mode completion event queue
 	 *
-	 *  The completion queue is used to return odp_crypto_packet_op_enq()
+	 *  The completion queue is used to return odp_crypto_op_enq()
 	 *  results to the application.
 	 */
 	odp_queue_t compl_queue;
@@ -544,10 +544,10 @@  typedef struct odp_crypto_capability_t {
 	uint32_t max_sessions;
 
 	/** Supported packet operation in SYNC mode */
-	odp_support_t packet_sync_mode;
+	odp_support_t sync_mode;
 
 	/** Supported packet operation in ASYNC mode */
-	odp_support_t packet_async_mode;
+	odp_support_t async_mode;
 
 	/** Supported cipher algorithms */
 	odp_crypto_cipher_algos_t ciphers;
@@ -785,7 +785,7 @@  void odp_crypto_session_param_init(odp_crypto_session_param_t *param);
  *
  * Get packet handle to an crypto processed packet event. Event subtype must be
  * ODP_EVENT_PACKET_CRYPTO. Crypto operation results can be examined with
- * odp_crypto_packet_result().
+ * odp_crypto_result().
  *
  * Note: any invalid parameters will cause undefined behavior and may cause
  * the application to abort or crash.
@@ -822,8 +822,8 @@  odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt);
  * @retval  0     On success
  * @retval <0     On failure
  */
-int odp_crypto_packet_result(odp_crypto_packet_result_t *result,
-			     odp_packet_t packet);
+int odp_crypto_result(odp_crypto_packet_result_t *result,
+		      odp_packet_t packet);
 
 /**
  * Crypto packet operation
@@ -841,10 +841,10 @@  int odp_crypto_packet_result(odp_crypto_packet_result_t *result,
  * @return Number of input packets consumed (0 ... num_pkt)
  * @retval <0 on failure
  */
-int odp_crypto_packet_op(const odp_packet_t pkt_in[],
-			 odp_packet_t pkt_out[],
-			 const odp_crypto_packet_op_param_t param[],
-			 int num_pkt);
+int odp_crypto_op(const odp_packet_t pkt_in[],
+		  odp_packet_t pkt_out[],
+		  const odp_crypto_packet_op_param_t param[],
+		  int num_pkt);
 
 /**
  * Crypto packet operation
@@ -863,10 +863,10 @@  int odp_crypto_packet_op(const odp_packet_t pkt_in[],
  * @return Number of input packets consumed (0 ... num_pkt)
  * @retval <0 on failure
  */
-int odp_crypto_packet_op_enq(const odp_packet_t pkt_in[],
-			     const odp_packet_t pkt_out[],
-			     const odp_crypto_packet_op_param_t param[],
-			     int num_pkt);
+int odp_crypto_op_enq(const odp_packet_t pkt_in[],
+		      const odp_packet_t pkt_out[],
+		      const odp_crypto_packet_op_param_t param[],
+		      int num_pkt);
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 792c2eca..80ff6f59 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -866,11 +866,11 @@  odp_crypto_operation(odp_crypto_op_param_t *param,
 	packet_param.cipher_range = param->cipher_range;
 	packet_param.auth_range = param->auth_range;
 
-	rc = odp_crypto_packet_op(&param->pkt, &out_pkt, &packet_param, 1);
+	rc = odp_crypto_op(&param->pkt, &out_pkt, &packet_param, 1);
 	if (rc < 0)
 		return rc;
 
-	rc = odp_crypto_packet_result(&packet_result, out_pkt);
+	rc = odp_crypto_result(&packet_result, out_pkt);
 	if (rc < 0)
 		return rc;
 
@@ -1101,8 +1101,8 @@  odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt)
 	return &hdr->crypto_op_result;
 }
 
-int odp_crypto_packet_result(odp_crypto_packet_result_t *result,
-			     odp_packet_t packet)
+int odp_crypto_result(odp_crypto_packet_result_t *result,
+		      odp_packet_t packet)
 {
 	odp_crypto_packet_result_t *op_result;
 
@@ -1117,9 +1117,9 @@  int odp_crypto_packet_result(odp_crypto_packet_result_t *result,
 }
 
 static
-int odp_crypto_op(odp_packet_t pkt_in,
-		  odp_packet_t *pkt_out,
-		  const odp_crypto_packet_op_param_t *param)
+int odp_crypto_int(odp_packet_t pkt_in,
+		   odp_packet_t *pkt_out,
+		   const odp_crypto_packet_op_param_t *param)
 {
 	odp_crypto_alg_err_t rc_cipher = ODP_CRYPTO_ALG_ERR_NONE;
 	odp_crypto_alg_err_t rc_auth = ODP_CRYPTO_ALG_ERR_NONE;
@@ -1197,19 +1197,19 @@  int odp_crypto_op(odp_packet_t pkt_in,
 	return -1;
 }
 
-int odp_crypto_packet_op(const odp_packet_t pkt_in[],
-			 odp_packet_t pkt_out[],
-			 const odp_crypto_packet_op_param_t param[],
-			 int num_pkt)
+int odp_crypto_op(const odp_packet_t pkt_in[],
+		  odp_packet_t pkt_out[],
+		  const odp_crypto_packet_op_param_t param[],
+		  int num_pkt)
 {
 	int i, rc;
 	odp_crypto_generic_session_t *session;
 
 	session = (odp_crypto_generic_session_t *)(intptr_t)param->session;
-	ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.packet_op_mode);
+	ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode);
 
 	for (i = 0; i < num_pkt; i++) {
-		rc = odp_crypto_op(pkt_in[i], &pkt_out[i], &param[i]);
+		rc = odp_crypto_int(pkt_in[i], &pkt_out[i], &param[i]);
 		if (rc < 0)
 			break;
 	}
@@ -1217,10 +1217,10 @@  int odp_crypto_packet_op(const odp_packet_t pkt_in[],
 	return i;
 }
 
-int odp_crypto_packet_op_enq(const odp_packet_t pkt_in[],
-			     const odp_packet_t pkt_out[],
-			     const odp_crypto_packet_op_param_t param[],
-			     int num_pkt)
+int odp_crypto_op_enq(const odp_packet_t pkt_in[],
+		      const odp_packet_t pkt_out[],
+		      const odp_crypto_packet_op_param_t param[],
+		      int num_pkt)
 {
 	odp_packet_t pkt;
 	odp_event_t event;
@@ -1228,12 +1228,12 @@  int odp_crypto_packet_op_enq(const odp_packet_t pkt_in[],
 	int i, rc;
 
 	session = (odp_crypto_generic_session_t *)(intptr_t)param->session;
-	ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.packet_op_mode);
+	ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode);
 	ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue);
 
 	for (i = 0; i < num_pkt; i++) {
 		pkt = pkt_out[i];
-		rc = odp_crypto_op(pkt_in[i], &pkt, &param[i]);
+		rc = odp_crypto_int(pkt_in[i], &pkt, &param[i]);
 		if (rc < 0)
 			break;
 
diff --git a/test/common_plat/performance/odp_crypto.c b/test/common_plat/performance/odp_crypto.c
index a129ec98..27d4fd30 100644
--- a/test/common_plat/performance/odp_crypto.c
+++ b/test/common_plat/performance/odp_crypto.c
@@ -443,10 +443,10 @@  create_session_from_config(odp_crypto_session_t *session,
 			return -1;
 		}
 		params.compl_queue = out_queue;
-		params.packet_op_mode = ODP_CRYPTO_ASYNC;
+		params.op_mode = ODP_CRYPTO_ASYNC;
 	} else {
 		params.compl_queue = ODP_QUEUE_INVALID;
-		params.packet_op_mode   = ODP_CRYPTO_SYNC;
+		params.op_mode = ODP_CRYPTO_SYNC;
 	}
 	if (odp_crypto_session_create(&params, session,
 				      &ses_create_rc)) {
@@ -554,8 +554,8 @@  run_measure_one(crypto_args_t *cargs,
 			}
 
 			if (cargs->schedule || cargs->poll) {
-				rc = odp_crypto_packet_op_enq(&pkt, &out_pkt,
-							      &params, 1);
+				rc = odp_crypto_op_enq(&pkt, &out_pkt,
+						       &params, 1);
 				if (rc <= 0) {
 					app_err("failed odp_crypto_packet_op_enq: rc = %d\n",
 						rc);
@@ -563,8 +563,8 @@  run_measure_one(crypto_args_t *cargs,
 				}
 				packets_sent += rc;
 			} else {
-				rc = odp_crypto_packet_op(&pkt, &out_pkt,
-							  &params, 1);
+				rc = odp_crypto_op(&pkt, &out_pkt,
+						   &params, 1);
 				if (rc <= 0) {
 					app_err("failed odp_crypto_packet_op: rc = %d\n",
 						rc);
@@ -603,7 +603,7 @@  run_measure_one(crypto_args_t *cargs,
 
 			while (ev != ODP_EVENT_INVALID) {
 				out_pkt = odp_crypto_packet_from_event(ev);
-				odp_crypto_packet_result(&result, out_pkt);
+				odp_crypto_result(&result, out_pkt);
 
 				if (cargs->debug_packets) {
 					mem = odp_packet_data(out_pkt);
diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
index 716bd952..ac59744f 100644
--- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
@@ -15,7 +15,7 @@ 
 
 struct suite_context_s {
 	odp_bool_t packet;
-	odp_crypto_op_mode_t packet_op_mode;
+	odp_crypto_op_mode_t op_mode;
 	odp_pool_t pool;
 	odp_queue_t queue;
 };
@@ -165,7 +165,7 @@  static int alg_packet_op(odp_packet_t pkt,
 
 	op_params.hash_result_offset = plaintext_len;
 
-	rc = odp_crypto_packet_op(&pkt, &out_pkt, &op_params, 1);
+	rc = odp_crypto_op(&pkt, &out_pkt, &op_params, 1);
 	if (rc < 0) {
 		CU_FAIL("Failed odp_crypto_packet_op()");
 		return rc;
@@ -180,7 +180,7 @@  static int alg_packet_op(odp_packet_t pkt,
 		  odp_event_types(odp_packet_to_event(pkt), &subtype));
 	CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
 
-	rc = odp_crypto_packet_result(&result, pkt);
+	rc = odp_crypto_result(&result, pkt);
 	if (rc < 0) {
 		CU_FAIL("Failed odp_crypto_packet_result()");
 		return rc;
@@ -233,7 +233,7 @@  static int alg_packet_op_enq(odp_packet_t pkt,
 
 	op_params.hash_result_offset = plaintext_len;
 
-	rc = odp_crypto_packet_op_enq(&pkt, &pkt, &op_params, 1);
+	rc = odp_crypto_op_enq(&pkt, &pkt, &op_params, 1);
 	if (rc < 0) {
 		CU_FAIL("Failed odp_crypto_op_enq()");
 		return rc;
@@ -260,7 +260,7 @@  static int alg_packet_op_enq(odp_packet_t pkt,
 		  odp_event_types(odp_packet_to_event(pkt), &subtype));
 	CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
 
-	rc = odp_crypto_packet_result(&result, pkt);
+	rc = odp_crypto_result(&result, pkt);
 	if (rc < 0) {
 		CU_FAIL("Failed odp_crypto_packet_result()");
 		return rc;
@@ -402,7 +402,7 @@  static void alg_test(odp_crypto_op_t op,
 	odp_crypto_session_param_init(&ses_params);
 	ses_params.op = op;
 	ses_params.auth_cipher_text = false;
-	ses_params.packet_op_mode = suite_context.packet_op_mode;
+	ses_params.op_mode = suite_context.op_mode;
 	ses_params.cipher_alg = cipher_alg;
 	ses_params.auth_alg = auth_alg;
 	ses_params.compl_queue = suite_context.queue;
@@ -433,7 +433,7 @@  static void alg_test(odp_crypto_op_t op,
 		rc = alg_op(pkt, &ok, session, op_iv_ptr,
 			    cipher_range, auth_range, aad, aad_len,
 			    plaintext_len);
-	else if (ODP_CRYPTO_ASYNC == suite_context.packet_op_mode)
+	else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
 		rc = alg_packet_op_enq(pkt, &ok, session, op_iv_ptr,
 				       cipher_range, auth_range, aad, aad_len,
 				       plaintext_len);
@@ -1684,7 +1684,7 @@  int crypto_suite_sync_init(void)
 int crypto_suite_packet_sync_init(void)
 {
 	suite_context.packet = true;
-	suite_context.packet_op_mode = ODP_CRYPTO_SYNC;
+	suite_context.op_mode = ODP_CRYPTO_SYNC;
 
 	suite_context.pool = odp_pool_lookup("packet_pool");
 	if (suite_context.pool == ODP_POOL_INVALID)
@@ -1697,7 +1697,7 @@  int crypto_suite_packet_sync_init(void)
 int crypto_suite_packet_async_init(void)
 {
 	suite_context.packet = true;
-	suite_context.packet_op_mode = ODP_CRYPTO_ASYNC;
+	suite_context.op_mode = ODP_CRYPTO_ASYNC;
 
 	suite_context.pool = odp_pool_lookup("packet_pool");
 	if (suite_context.pool == ODP_POOL_INVALID)