DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aakash Sasidharan <asasidharan@marvell.com>
To: Ankur Dwivedi <adwivedi@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>
Cc: <gakhil@marvell.com>, <jerinj@marvell.com>,
	<vvelumuri@marvell.com>, <asasidharan@marvell.com>,
	<dev@dpdk.org>
Subject: [PATCH 06/12] crypto/cnxk: use NEON for Rx inject inst preparation
Date: Thu, 20 Jun 2024 20:28:42 +0530	[thread overview]
Message-ID: <20240620145848.3461844-7-asasidharan@marvell.com> (raw)
In-Reply-To: <20240620145848.3461844-1-asasidharan@marvell.com>

From: Anoob Joseph <anoobj@marvell.com>

Use NEON instructions for Rx inject instruction preparation.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 57 +++++++++++++++++------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index f2980399c5..d36516735a 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -7,6 +7,7 @@
 #include <rte_event_crypto_adapter.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
+#include <rte_vect.h>
 
 #include <ethdev_driver.h>
 
@@ -1390,15 +1391,17 @@ cn10k_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 	return i;
 }
 
+#if defined(RTE_ARCH_ARM64)
 uint16_t __rte_hot
 cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct rte_mbuf **pkts,
 				  struct rte_security_session **sess, uint16_t nb_pkts)
 {
-	uint16_t l2_len, pf_func, lmt_id, count = 0;
-	uint64_t lmt_base, lmt_arg, io_addr;
+	uint64_t lmt_base, lmt_arg, io_addr, u64_0, u64_1, l2_len, pf_func;
+	uint64x2_t inst_01, inst_23, inst_45, inst_67;
 	struct cn10k_sec_session *sec_sess;
 	struct rte_cryptodev *cdev = dev;
 	union cpt_res_s *hw_res = NULL;
+	uint16_t lmt_id, count = 0;
 	struct cpt_inst_s *inst;
 	union cpt_fc_write_s fc;
 	struct cnxk_cpt_vf *vf;
@@ -1456,26 +1459,38 @@ cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct rte_mbuf **pkts,
 		hw_res = RTE_PTR_ALIGN_CEIL(hw_res, 16);
 
 		/* Prepare CPT instruction */
-		inst->w0.u64 = 0;
-		inst->w2.u64 = 0;
-		inst->w2.s.rvu_pf_func = pf_func;
-		inst->w3.u64 = (((uint64_t)m + sizeof(struct rte_mbuf)) >> 3) << 3 | 1;
 
-		inst->w4.u64 = sec_sess->inst.w4 | (rte_pktmbuf_pkt_len(m));
+		/* Word 0 and 1 */
+		u64_0 = pf_func << 48 | *(vf->rx_chan_base + m->port) << 4 | (l2_len - 2) << 24 |
+			l2_len << 16;
+		inst_01 = vsetq_lane_u64(u64_0, inst_01, 0);
+		inst_01 = vsetq_lane_u64((uint64_t)hw_res, inst_01, 1);
+		vst1q_u64(&inst->w0.u64, inst_01);
+
+		/* Word 2 and 3 */
+		inst_23 = vdupq_n_u64(0);
+		u64_1 = (((uint64_t)m + sizeof(struct rte_mbuf)) >> 3) << 3 | 1;
+		inst_23 = vsetq_lane_u64(u64_1, inst_23, 1);
+		vst1q_u64(&inst->w2.u64, inst_23);
+
+		/* Word 4 and 5 */
+		u64_0 = sec_sess->inst.w4 | (rte_pktmbuf_pkt_len(m));
+		inst_45 = vsetq_lane_u64(u64_0, inst_45, 0);
 		dptr = (uint64_t)rte_pktmbuf_iova(m);
-		inst->dptr = dptr;
-		inst->rptr = dptr;
+		u64_1 = dptr;
+		inst_45 = vsetq_lane_u64(u64_1, inst_45, 1);
+		vst1q_u64(&inst->w4.u64, inst_45);
 
-		inst->w0.hw_s.chan = *(vf->rx_chan_base + m->port);
-		inst->w0.hw_s.l2_len = l2_len;
-		inst->w0.hw_s.et_offset = l2_len - 2;
+		/* Word 6 and 7 */
+		u64_0 = dptr;
+		u64_1 = sec_sess->inst.w7;
+		inst_67 = vsetq_lane_u64(u64_0, inst_67, 0);
+		inst_67 = vsetq_lane_u64(u64_1, inst_67, 1);
+		vst1q_u64(&inst->w6.u64, inst_67);
 
-		inst->res_addr = (uint64_t)hw_res;
 		rte_atomic_store_explicit((unsigned long __rte_atomic *)&hw_res->u64[0], res.u64[0],
 					  rte_memory_order_relaxed);
 
-		inst->w7.u64 = sec_sess->inst.w7;
-
 		inst += 2;
 	}
 
@@ -1503,6 +1518,18 @@ cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct rte_mbuf **pkts,
 exit:
 	return count + i;
 }
+#else
+uint16_t __rte_hot
+cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct rte_mbuf **pkts,
+				  struct rte_security_session **sess, uint16_t nb_pkts)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(pkts);
+	RTE_SET_USED(sess);
+	RTE_SET_USED(nb_pkts);
+	return 0;
+}
+#endif
 
 void
 cn10k_cpt_set_enqdeq_fns(struct rte_cryptodev *dev, struct cnxk_cpt_vf *vf)
-- 
2.25.1


  parent reply	other threads:[~2024-06-20 14:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 14:58 [PATCH 00/12] fixes and improvements to CNXK crypto PMD Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 01/12] common/cnxk: add comments to denote skipped entries Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 02/12] crypto/cnxk: update version map file with PMD APIs Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 03/12] common/cnxk: make inline dev PF func get as idev API Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 04/12] crypto/cnxk: add flow control in Rx inject path Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 05/12] crypto/cnxk: use SSO PF func of inline device in inst Aakash Sasidharan
2024-06-20 14:58 ` Aakash Sasidharan [this message]
2024-06-20 14:58 ` [PATCH 07/12] crypto/cnxk: remove init of CPT result field in packet Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 08/12] crypto/cnxk: add dual submission in Rx inject Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 09/12] crypto/cnxk: update sess pointer for next iteration Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 10/12] crypto/cnxk: fix aes-gcm zero len input cases Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 11/12] crypto/cnxk: make pack IV variable as const Aakash Sasidharan
2024-06-20 14:58 ` [PATCH 12/12] crypto/cnxk: enable dual submission to CPT Aakash Sasidharan
2024-06-24  6:23 ` [PATCH v2 00/12] fixes and improvements to CNXK crypto PMD Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 01/12] common/cnxk: add comments to denote skipped entries Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 02/12] crypto/cnxk: update version map file with PMD APIs Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 03/12] common/cnxk: make inline dev PF func get as idev API Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 04/12] crypto/cnxk: add flow control in Rx inject path Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 05/12] crypto/cnxk: use SSO PF func of inline device in inst Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 06/12] crypto/cnxk: use NEON for Rx inject inst preparation Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 07/12] crypto/cnxk: remove init of CPT result field in packet Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 08/12] crypto/cnxk: add dual submission in Rx inject Aakash Sasidharan
2024-06-26  6:41     ` Akhil Goyal
2024-06-24  6:23   ` [PATCH v2 09/12] crypto/cnxk: update sess pointer for next iteration Aakash Sasidharan
2024-06-24  6:23   ` [PATCH v2 10/12] crypto/cnxk: fix aes-gcm zero len input cases Aakash Sasidharan
2024-06-24  6:24   ` [PATCH v2 11/12] crypto/cnxk: make pack IV variable as const Aakash Sasidharan
2024-06-24  6:24   ` [PATCH v2 12/12] crypto/cnxk: enable dual submission to CPT Aakash Sasidharan
2024-06-26 10:55   ` [PATCH v3 00/12] Fixes and improvements to CNXK crypto PMD Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 01/12] common/cnxk: add comments to denote skipped entries Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 02/12] crypto/cnxk: update version map file with PMD APIs Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 03/12] common/cnxk: make inline dev PF func get as idev API Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 04/12] crypto/cnxk: add flow control in Rx inject path Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 05/12] crypto/cnxk: use SSO PF func of inline device in inst Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 06/12] crypto/cnxk: use NEON for Rx inject inst preparation Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 07/12] crypto/cnxk: remove init of CPT result field in packet Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 08/12] crypto/cnxk: add dual submission in Rx inject Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 09/12] crypto/cnxk: update sess pointer for next iteration Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 10/12] crypto/cnxk: fix aes-gcm zero len input cases Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 11/12] crypto/cnxk: make pack IV variable as const Aakash Sasidharan
2024-06-26 10:55     ` [PATCH v3 12/12] crypto/cnxk: enable dual submission to CPT Aakash Sasidharan
2024-06-27  5:11     ` [PATCH v3 00/12] Fixes and improvements to CNXK crypto PMD Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240620145848.3461844-7-asasidharan@marvell.com \
    --to=asasidharan@marvell.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=ktejasree@marvell.com \
    --cc=vvelumuri@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).