Skip to contentSkip to conversation

crypto/ccp: fix support scheduling CCP's on burst

PATCH In review [email protected] 1 participant 1 message Nov 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 4/5 crypto/ccp: fix support scheduling CCP's on burst

From: Amaranath Somalapuram <[email protected]>

CCP driver was scheduling only one CCP in a single burst(enqueue). Effective throughput was limited to 1 CCP performance. Scheduling multiple ccp within one burst will increase the ccp performance. this changes will divide the enqueue packets equally among the multiple CCP

Fixes e0d88a394e ("crypto/ccp: support run-time CPU based auth")
---
 drivers/crypto/ccp/ccp_crypto.c      | 22 +++++++----
 drivers/crypto/ccp/ccp_crypto.h      |  7 +++-
 drivers/crypto/ccp/ccp_dev.h         |  2 +-
 drivers/crypto/ccp/ccp_pmd_private.h |  2 +
 drivers/crypto/ccp/rte_ccp_pmd.c     | 57 +++++++++++++++++++---------
 5 files changed, 63 insertions(+), 27 deletions(-)
drivers/crypto/ccp/ccp_crypto.c +15 -7
index 1837c8543..4256734d1 100644
@@ -2680,7 +2680,9 @@ process_ops_to_enqueue(struct ccp_qp *qp,
 		       struct rte_crypto_op **op,
 		       struct ccp_queue *cmd_q,
 		       uint16_t nb_ops,
-		       int slots_req)
+		       uint16_t total_nb_ops,
+		       int slots_req,
+		       uint16_t b_idx)
 {
 	int i, result = 0;
 	struct ccp_batch_info *b_info;
@@ -2701,6 +2703,7 @@ process_ops_to_enqueue(struct ccp_qp *qp,
 
 	/* populate batch info necessary for dequeue */
 	b_info->op_idx = 0;
+	b_info->b_idx = 0;
 	b_info->lsb_buf_idx = 0;
 	b_info->desccnt = 0;
 	b_info->cmd_q = cmd_q;
@@ -2710,7 +2713,7 @@ process_ops_to_enqueue(struct ccp_qp *qp,
 
 	b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
 					 Q_DESC_SIZE);
-	for (i = 0; i < nb_ops; i++) {
+	for (i = b_idx; i < (nb_ops+b_idx); i++) {
 		session = (struct ccp_session *)get_sym_session_private_data(
 						 op[i]->sym->session,
 						 ccp_cryptodev_driver_id);
@@ -2762,6 +2765,8 @@ process_ops_to_enqueue(struct ccp_qp *qp,
 	}
 
 	b_info->opcnt = i;
+	b_info->b_idx = b_idx;
+	b_info->total_nb_ops = total_nb_ops;
 	b_info->tail_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx *
 					 Q_DESC_SIZE);
 
@@ -2776,7 +2781,7 @@ process_ops_to_enqueue(struct ccp_qp *qp,
 	rte_ring_enqueue(qp->processed_pkts, (void *)b_info);
 
 	EVP_MD_CTX_destroy(auth_ctx);
-	return i;
+	return i-b_idx;
 }
 
 static inline void ccp_auth_dq_prepare(struct rte_crypto_op *op)
@@ -2861,8 +2866,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
 	}
 	min_ops = RTE_MIN(nb_ops, b_info->opcnt);
 
-	for (i = 0; i < min_ops; i++) {
-		op_d[i] = b_info->op[b_info->op_idx++];
+	for (i =  b_info->b_idx; i < min_ops; i++) {
+		op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++];
 		session = (struct ccp_session *)get_sym_session_private_data(
 						 op_d[i]->sym->session,
 						ccp_cryptodev_driver_id);
@@ -2903,7 +2908,8 @@ ccp_prepare_ops(struct ccp_qp *qp,
 int
 process_ops_to_dequeue(struct ccp_qp *qp,
 		       struct rte_crypto_op **op,
-		       uint16_t nb_ops)
+		       uint16_t nb_ops,
+		       uint16_t *total_nb_ops)
 {
 	struct ccp_batch_info *b_info;
 	uint32_t cur_head_offset;
@@ -2918,6 +2924,7 @@ process_ops_to_dequeue(struct ccp_qp *qp,
 
 	if (b_info->auth_ctr == b_info->opcnt)
 		goto success;
+	*total_nb_ops = b_info->total_nb_ops;
 	cur_head_offset = CCP_READ_REG(b_info->cmd_q->reg_base,
 				       CMD_Q_HEAD_LO_BASE);
 
@@ -2927,7 +2934,7 @@ process_ops_to_dequeue(struct ccp_qp *qp,
 			qp->b_info = b_info;
 			return 0;
 		}
-	} else {
+	} else if (b_info->tail_offset != b_info->head_offset) {
 		if ((cur_head_offset >= b_info->head_offset) ||
 		    (cur_head_offset < b_info->tail_offset)) {
 			qp->b_info = b_info;
@@ -2937,6 +2944,7 @@ process_ops_to_dequeue(struct ccp_qp *qp,
 
 
 success:
+	*total_nb_ops = b_info->total_nb_ops;
 	nb_ops = ccp_prepare_ops(qp, op, b_info, nb_ops);
 	rte_atomic64_add(&b_info->cmd_q->free_slots, b_info->desccnt);
 	b_info->desccnt = 0;
drivers/crypto/ccp/ccp_crypto.h +5 -2
index 882b398ac..8e6d03efc 100644
@@ -353,7 +353,9 @@ int process_ops_to_enqueue(struct ccp_qp *qp,
 			   struct rte_crypto_op **op,
 			   struct ccp_queue *cmd_q,
 			   uint16_t nb_ops,
-			   int slots_req);
+			   uint16_t total_nb_ops,
+			   int slots_req,
+			   uint16_t b_idx);
 
 /**
  * process crypto ops to be dequeued
@@ -365,7 +367,8 @@ int process_ops_to_enqueue(struct ccp_qp *qp,
  */
 int process_ops_to_dequeue(struct ccp_qp *qp,
 			   struct rte_crypto_op **op,
-			   uint16_t nb_ops);
+			   uint16_t nb_ops,
+			   uint16_t *total_nb_ops);
 
 
 /**
drivers/crypto/ccp/ccp_dev.h +1 -1
index de3e4bcc6..f4ad9eafd 100644
@@ -59,7 +59,7 @@
 #define CMD_Q_RUN			0x1
 #define CMD_Q_SIZE			0x1F
 #define CMD_Q_SHIFT			3
-#define COMMANDS_PER_QUEUE		2048
+#define COMMANDS_PER_QUEUE		8192
 
 #define QUEUE_SIZE_VAL                  ((ffs(COMMANDS_PER_QUEUE) - 2) & \
 					 CMD_Q_SIZE)
drivers/crypto/ccp/ccp_pmd_private.h +2 -0
index 781050c31..1c4118ee3 100644
@@ -50,8 +50,10 @@ struct ccp_batch_info {
 	struct rte_crypto_op *op[CCP_MAX_BURST];
 	/**< optable populated at enque time from app*/
 	int op_idx;
+	uint16_t b_idx;
 	struct ccp_queue *cmd_q;
 	uint16_t opcnt;
+	uint16_t total_nb_ops;
 	/**< no. of crypto ops in batch*/
 	int desccnt;
 	/**< no. of ccp queue descriptors*/
drivers/crypto/ccp/rte_ccp_pmd.c +40 -17

92 lines not on this page · raw message

Signature · 1 line
2.17.1