From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74DF3A04F5 for ; Wed, 11 Dec 2019 22:29:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A1E91BE84; Wed, 11 Dec 2019 22:29:13 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id C575D374C for ; Wed, 11 Dec 2019 22:29:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576099751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Nj9AHSnFc5PlhWG/6Zzo0kMrvJQzfdIfSiBCmIBz8s=; b=b1gYYDIRVCTHqjZJYPhgl6wjsPlj2D8FtTV+cbzawxt4jrnuGEMwevV7rfQ9CFtH+606SU ed0XVvWqGYo++Hi5Bdg5UKP4JiqIgJoQbuCZvINywGN9tXUDbXAyFUfpQNGaC2XfCfBzqz LkrHh1eeRpFjiU2i3Mi8TFrimZrNYYs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-l7xjRgZ4NYWCS877L0BKqw-1; Wed, 11 Dec 2019 16:29:08 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3581800D4E; Wed, 11 Dec 2019 21:29:06 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B45C10013A1; Wed, 11 Dec 2019 21:29:05 +0000 (UTC) From: Kevin Traynor To: Amaranath Somalapuram Cc: dpdk stable Date: Wed, 11 Dec 2019 21:26:48 +0000 Message-Id: <20191211212702.27851-56-ktraynor@redhat.com> In-Reply-To: <20191211212702.27851-1-ktraynor@redhat.com> References: <20191211212702.27851-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: l7xjRgZ4NYWCS877L0BKqw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'crypto/ccp: fix scheduling of burst' has been queued to LTS release 18.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/17/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/c84bea128755abc12e= 7684eede9b4821da8fa7cf Thanks. Kevin. --- >From c84bea128755abc12e7684eede9b4821da8fa7cf Mon Sep 17 00:00:00 2001 From: Amaranath Somalapuram Date: Fri, 22 Nov 2019 12:17:17 +0530 Subject: [PATCH] crypto/ccp: fix scheduling of burst [ upstream commit 727758576714ea4de4df01bca53978f321ae323a ] 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") Signed-off-by: Amaranath Somalapuram --- 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(-) diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypt= o.c index 1837c8543..4256734d1 100644 --- a/drivers/crypto/ccp/ccp_crypto.c +++ b/drivers/crypto/ccp/ccp_crypto.c @@ -2681,5 +2681,7 @@ process_ops_to_enqueue(struct ccp_qp *qp, =09=09 struct ccp_queue *cmd_q, =09=09 uint16_t nb_ops, -=09=09 int slots_req) +=09=09 uint16_t total_nb_ops, +=09=09 int slots_req, +=09=09 uint16_t b_idx) { =09int i, result =3D 0; @@ -2702,4 +2704,5 @@ process_ops_to_enqueue(struct ccp_qp *qp, =09/* populate batch info necessary for dequeue */ =09b_info->op_idx =3D 0; +=09b_info->b_idx =3D 0; =09b_info->lsb_buf_idx =3D 0; =09b_info->desccnt =3D 0; @@ -2711,5 +2714,5 @@ process_ops_to_enqueue(struct ccp_qp *qp, =09b_info->head_offset =3D (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx= * =09=09=09=09=09 Q_DESC_SIZE); -=09for (i =3D 0; i < nb_ops; i++) { +=09for (i =3D b_idx; i < (nb_ops+b_idx); i++) { =09=09session =3D (struct ccp_session *)get_sym_session_private_data( =09=09=09=09=09=09 op[i]->sym->session, @@ -2763,4 +2766,6 @@ process_ops_to_enqueue(struct ccp_qp *qp, =20 =09b_info->opcnt =3D i; +=09b_info->b_idx =3D b_idx; +=09b_info->total_nb_ops =3D total_nb_ops; =09b_info->tail_offset =3D (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx= * =09=09=09=09=09 Q_DESC_SIZE); @@ -2777,5 +2782,5 @@ process_ops_to_enqueue(struct ccp_qp *qp, =20 =09EVP_MD_CTX_destroy(auth_ctx); -=09return i; +=09return i-b_idx; } =20 @@ -2862,6 +2867,6 @@ ccp_prepare_ops(struct ccp_qp *qp, =09min_ops =3D RTE_MIN(nb_ops, b_info->opcnt); =20 -=09for (i =3D 0; i < min_ops; i++) { -=09=09op_d[i] =3D b_info->op[b_info->op_idx++]; +=09for (i =3D b_info->b_idx; i < min_ops; i++) { +=09=09op_d[i] =3D b_info->op[b_info->b_idx + b_info->op_idx++]; =09=09session =3D (struct ccp_session *)get_sym_session_private_data( =09=09=09=09=09=09 op_d[i]->sym->session, @@ -2904,5 +2909,6 @@ int process_ops_to_dequeue(struct ccp_qp *qp, =09=09 struct rte_crypto_op **op, -=09=09 uint16_t nb_ops) +=09=09 uint16_t nb_ops, +=09=09 uint16_t *total_nb_ops) { =09struct ccp_batch_info *b_info; @@ -2919,4 +2925,5 @@ process_ops_to_dequeue(struct ccp_qp *qp, =09if (b_info->auth_ctr =3D=3D b_info->opcnt) =09=09goto success; +=09*total_nb_ops =3D b_info->total_nb_ops; =09cur_head_offset =3D CCP_READ_REG(b_info->cmd_q->reg_base, =09=09=09=09 CMD_Q_HEAD_LO_BASE); @@ -2928,5 +2935,5 @@ process_ops_to_dequeue(struct ccp_qp *qp, =09=09=09return 0; =09=09} -=09} else { +=09} else if (b_info->tail_offset !=3D b_info->head_offset) { =09=09if ((cur_head_offset >=3D b_info->head_offset) || =09=09 (cur_head_offset < b_info->tail_offset)) { @@ -2938,4 +2945,5 @@ process_ops_to_dequeue(struct ccp_qp *qp, =20 success: +=09*total_nb_ops =3D b_info->total_nb_ops; =09nb_ops =3D ccp_prepare_ops(qp, op, b_info, nb_ops); =09rte_atomic64_add(&b_info->cmd_q->free_slots, b_info->desccnt); diff --git a/drivers/crypto/ccp/ccp_crypto.h b/drivers/crypto/ccp/ccp_crypt= o.h index 882b398ac..8e6d03efc 100644 --- a/drivers/crypto/ccp/ccp_crypto.h +++ b/drivers/crypto/ccp/ccp_crypto.h @@ -354,5 +354,7 @@ int process_ops_to_enqueue(struct ccp_qp *qp, =09=09=09 struct ccp_queue *cmd_q, =09=09=09 uint16_t nb_ops, -=09=09=09 int slots_req); +=09=09=09 uint16_t total_nb_ops, +=09=09=09 int slots_req, +=09=09=09 uint16_t b_idx); =20 /** @@ -366,5 +368,6 @@ int process_ops_to_enqueue(struct ccp_qp *qp, int process_ops_to_dequeue(struct ccp_qp *qp, =09=09=09 struct rte_crypto_op **op, -=09=09=09 uint16_t nb_ops); +=09=09=09 uint16_t nb_ops, +=09=09=09 uint16_t *total_nb_ops); =20 =20 diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h index de3e4bcc6..f4ad9eafd 100644 --- a/drivers/crypto/ccp/ccp_dev.h +++ b/drivers/crypto/ccp/ccp_dev.h @@ -60,5 +60,5 @@ #define CMD_Q_SIZE=09=09=090x1F #define CMD_Q_SHIFT=09=09=093 -#define COMMANDS_PER_QUEUE=09=092048 +#define COMMANDS_PER_QUEUE=09=098192 =20 #define QUEUE_SIZE_VAL ((ffs(COMMANDS_PER_QUEUE) - 2) & \ diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_= pmd_private.h index 2a2a6ba54..6704e39ab 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -51,6 +51,8 @@ struct ccp_batch_info { =09/**< optable populated at enque time from app*/ =09int op_idx; +=09uint16_t b_idx; =09struct ccp_queue *cmd_q; =09uint16_t opcnt; +=09uint16_t total_nb_ops; =09/**< no. of crypto ops in batch*/ =09int desccnt; diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_= pmd.c index 92d8a9559..6065ad0f7 100644 --- a/drivers/crypto/ccp/rte_ccp_pmd.c +++ b/drivers/crypto/ccp/rte_ccp_pmd.c @@ -22,4 +22,5 @@ static unsigned int ccp_pmd_init_done; uint8_t ccp_cryptodev_driver_id; +uint8_t cryptodev_cnt; =20 struct ccp_pmd_init_params { @@ -201,4 +202,5 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_cryp= to_op **ops, =09struct rte_cryptodev *dev =3D qp->dev; =09uint16_t i, enq_cnt =3D 0, slots_req =3D 0; +=09uint16_t tmp_ops =3D nb_ops, b_idx, cur_ops =3D 0; =20 =09if (nb_ops =3D=3D 0) @@ -207,22 +209,37 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_cr= ypto_op **ops, =09if (unlikely(rte_ring_full(qp->processed_pkts) !=3D 0)) =09=09return 0; +=09if (tmp_ops >=3D cryptodev_cnt) +=09=09cur_ops =3D nb_ops / cryptodev_cnt + (nb_ops)%cryptodev_cnt; +=09else +=09=09cur_ops =3D tmp_ops; +=09while (tmp_ops)=09{ +=09=09b_idx =3D nb_ops - tmp_ops; +=09=09slots_req =3D 0; +=09=09if (cur_ops <=3D tmp_ops) { +=09=09=09tmp_ops -=3D cur_ops; +=09=09} else { +=09=09=09cur_ops =3D tmp_ops; +=09=09=09tmp_ops =3D 0; +=09=09} +=09=09for (i =3D 0; i < cur_ops; i++) { +=09=09=09sess =3D get_ccp_session(qp, ops[i + b_idx]); +=09=09=09if (unlikely(sess =3D=3D NULL) && (i =3D=3D 0)) { +=09=09=09=09qp->qp_stats.enqueue_err_count++; +=09=09=09=09return 0; +=09=09=09} else if (sess =3D=3D NULL) { +=09=09=09=09cur_ops =3D i; +=09=09=09=09break; +=09=09=09} +=09=09=09slots_req +=3D ccp_compute_slot_count(sess); +=09=09} =20 -=09for (i =3D 0; i < nb_ops; i++) { -=09=09sess =3D get_ccp_session(qp, ops[i]); -=09=09if (unlikely(sess =3D=3D NULL) && (i =3D=3D 0)) { -=09=09=09qp->qp_stats.enqueue_err_count++; +=09=09cmd_q =3D ccp_allot_queue(dev, slots_req); +=09=09if (unlikely(cmd_q =3D=3D NULL)) =09=09=09return 0; -=09=09} else if (sess =3D=3D NULL) { -=09=09=09nb_ops =3D i; -=09=09=09break; -=09=09} -=09=09slots_req +=3D ccp_compute_slot_count(sess); +=09=09enq_cnt +=3D process_ops_to_enqueue(qp, ops, cmd_q, cur_ops, +=09=09=09=09nb_ops, slots_req, b_idx); +=09=09i++; =09} =20 -=09cmd_q =3D ccp_allot_queue(dev, slots_req); -=09if (unlikely(cmd_q =3D=3D NULL)) -=09=09return 0; - -=09enq_cnt =3D process_ops_to_enqueue(qp, ops, cmd_q, nb_ops, slots_req); =09qp->qp_stats.enqueued_count +=3D enq_cnt; =09return enq_cnt; @@ -234,7 +251,14 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_cry= pto_op **ops, { =09struct ccp_qp *qp =3D queue_pair; -=09uint16_t nb_dequeued =3D 0, i; +=09uint16_t nb_dequeued =3D 0, i, total_nb_ops; =20 -=09nb_dequeued =3D process_ops_to_dequeue(qp, ops, nb_ops); +=09nb_dequeued =3D process_ops_to_dequeue(qp, ops, nb_ops, &total_nb_ops); + +=09if (total_nb_ops) { +=09=09while (nb_dequeued !=3D total_nb_ops) { +=09=09=09nb_dequeued =3D process_ops_to_dequeue(qp, +=09=09=09=09=09ops, nb_ops, &total_nb_ops); +=09=09} +=09} =20 =09/* Free session if a session-less crypto op */ @@ -289,5 +313,4 @@ cryptodev_ccp_create(const char *name, =09struct rte_cryptodev *dev; =09struct ccp_private *internals; -=09uint8_t cryptodev_cnt =3D 0; =20 =09if (init_params->def_p.name[0] =3D=3D '\0') --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-11 21:24:17.105754270 +0000 +++ 0056-crypto-ccp-fix-scheduling-of-burst.patch=092019-12-11 21:24:12.720= 650122 +0000 @@ -1 +1 @@ -From 727758576714ea4de4df01bca53978f321ae323a Mon Sep 17 00:00:00 2001 +From c84bea128755abc12e7684eede9b4821da8fa7cf Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 727758576714ea4de4df01bca53978f321ae323a ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -132 +133 @@ -index 781050c31..1c4118ee3 100644 +index 2a2a6ba54..6704e39ab 100644 @@ -145 +146 @@ -index 4810d799c..38cb1fe3d 100644 +index 92d8a9559..6065ad0f7 100644 @@ -148 +149 @@ -@@ -23,4 +23,5 @@ +@@ -22,4 +22,5 @@ @@ -154 +155 @@ -@@ -202,4 +203,5 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_cry= pto_op **ops, +@@ -201,4 +202,5 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_cry= pto_op **ops, @@ -160 +161 @@ -@@ -208,22 +210,37 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_c= rypto_op **ops, +@@ -207,22 +209,37 @@ ccp_pmd_enqueue_burst(void *queue_pair, struct rte_c= rypto_op **ops, @@ -212 +213 @@ -@@ -235,7 +252,14 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_cr= ypto_op **ops, +@@ -234,7 +251,14 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_cr= ypto_op **ops, @@ -229 +230 @@ -@@ -297,5 +321,4 @@ cryptodev_ccp_create(const char *name, +@@ -289,5 +313,4 @@ cryptodev_ccp_create(const char *name,