DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, olivier.matz@6wind.com,
	Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH v2 3/7] ipsec: change the order in filling crypto op
Date: Wed, 20 Mar 2019 17:24:35 +0000	[thread overview]
Message-ID: <1553102679-23576-4-git-send-email-konstantin.ananyev@intel.com> (raw)
Message-ID: <20190320172435.kXwkcjrAeBQWNLR0pKZQXdF-40r6weYEbd_Hu9Fm4BE@z> (raw)
In-Reply-To: <1551381661-21078-1-git-send-email-konstantin.ananyev@intel.com>

Right now we first fill crypto_sym_op part of crypto_op,
then in a separate cycle we fill crypto op fields.
It makes more sense to fill whole crypto-op in one go instead.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ipsec/sa.c | 46 ++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/lib/librte_ipsec/sa.c b/lib/librte_ipsec/sa.c
index 31548e968..74ed3b41e 100644
--- a/lib/librte_ipsec/sa.c
+++ b/lib/librte_ipsec/sa.c
@@ -425,20 +425,17 @@ mbuf_bulk_copy(struct rte_mbuf *dst[], struct rte_mbuf * const src[],
  * setup crypto ops for LOOKASIDE_NONE (pure crypto) type of devices.
  */
 static inline void
-lksd_none_cop_prepare(const struct rte_ipsec_session *ss,
-	struct rte_mbuf *mb[], struct rte_crypto_op *cop[], uint16_t num)
+lksd_none_cop_prepare(struct rte_crypto_op *cop,
+	struct rte_cryptodev_sym_session *cs, struct rte_mbuf *mb)
 {
-	uint32_t i;
 	struct rte_crypto_sym_op *sop;
 
-	for (i = 0; i != num; i++) {
-		sop = cop[i]->sym;
-		cop[i]->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
-		cop[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
-		cop[i]->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
-		sop->m_src = mb[i];
-		__rte_crypto_sym_op_attach_sym_session(sop, ss->crypto.ses);
-	}
+	sop = cop->sym;
+	cop->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
+	cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
+	cop->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
+	sop->m_src = mb;
+	__rte_crypto_sym_op_attach_sym_session(sop, cs);
 }
 
 /*
@@ -603,11 +600,13 @@ outb_tun_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 	uint64_t sqn;
 	rte_be64_t sqc;
 	struct rte_ipsec_sa *sa;
+	struct rte_cryptodev_sym_session *cs;
 	union sym_op_data icv;
 	uint64_t iv[IPSEC_MAX_IV_QWORD];
 	struct rte_mbuf *dr[num];
 
 	sa = ss->sa;
+	cs = ss->crypto.ses;
 
 	n = num;
 	sqn = esn_outb_update_sqn(sa, &n);
@@ -625,10 +624,10 @@ outb_tun_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 
 		/* success, setup crypto op */
 		if (rc >= 0) {
-			mb[k] = mb[i];
 			outb_pkt_xprepare(sa, sqc, &icv);
+			lksd_none_cop_prepare(cop[k], cs, mb[i]);
 			esp_outb_cop_prepare(cop[k], sa, iv, &icv, 0, rc);
-			k++;
+			mb[k++] = mb[i];
 		/* failure, put packet into the death-row */
 		} else {
 			dr[i - k] = mb[i];
@@ -636,9 +635,6 @@ outb_tun_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 		}
 	}
 
-	/* update cops */
-	lksd_none_cop_prepare(ss, mb, cop, k);
-
 	 /* copy not prepared mbufs beyond good ones */
 	if (k != n && k != 0)
 		mbuf_bulk_copy(mb + k, dr, n - k);
@@ -739,11 +735,13 @@ outb_trs_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 	uint64_t sqn;
 	rte_be64_t sqc;
 	struct rte_ipsec_sa *sa;
+	struct rte_cryptodev_sym_session *cs;
 	union sym_op_data icv;
 	uint64_t iv[IPSEC_MAX_IV_QWORD];
 	struct rte_mbuf *dr[num];
 
 	sa = ss->sa;
+	cs = ss->crypto.ses;
 
 	n = num;
 	sqn = esn_outb_update_sqn(sa, &n);
@@ -765,10 +763,10 @@ outb_trs_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 
 		/* success, setup crypto op */
 		if (rc >= 0) {
-			mb[k] = mb[i];
 			outb_pkt_xprepare(sa, sqc, &icv);
+			lksd_none_cop_prepare(cop[k], cs, mb[i]);
 			esp_outb_cop_prepare(cop[k], sa, iv, &icv, l2 + l3, rc);
-			k++;
+			mb[k++] = mb[i];
 		/* failure, put packet into the death-row */
 		} else {
 			dr[i - k] = mb[i];
@@ -776,9 +774,6 @@ outb_trs_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 		}
 	}
 
-	/* update cops */
-	lksd_none_cop_prepare(ss, mb, cop, k);
-
 	/* copy not prepared mbufs beyond good ones */
 	if (k != n && k != 0)
 		mbuf_bulk_copy(mb + k, dr, n - k);
@@ -926,11 +921,13 @@ inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 	int32_t rc;
 	uint32_t i, k, hl;
 	struct rte_ipsec_sa *sa;
+	struct rte_cryptodev_sym_session *cs;
 	struct replay_sqn *rsn;
 	union sym_op_data icv;
 	struct rte_mbuf *dr[num];
 
 	sa = ss->sa;
+	cs = ss->crypto.ses;
 	rsn = rsn_acquire(sa);
 
 	k = 0;
@@ -938,9 +935,11 @@ inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 
 		hl = mb[i]->l2_len + mb[i]->l3_len;
 		rc = esp_inb_tun_pkt_prepare(sa, rsn, mb[i], hl, &icv);
-		if (rc >= 0)
+		if (rc >= 0) {
+			lksd_none_cop_prepare(cop[k], cs, mb[i]);
 			rc = esp_inb_tun_cop_prepare(cop[k], sa, mb[i], &icv,
 				hl, rc);
+		}
 
 		if (rc == 0)
 			mb[k++] = mb[i];
@@ -952,9 +951,6 @@ inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
 
 	rsn_release(sa, rsn);
 
-	/* update cops */
-	lksd_none_cop_prepare(ss, mb, cop, k);
-
 	/* copy not prepared mbufs beyond good ones */
 	if (k != num && k != 0)
 		mbuf_bulk_copy(mb + k, dr, num - k);
-- 
2.17.1


  parent reply	other threads:[~2019-03-20 17:25 UTC|newest]

Thread overview: 163+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 19:20 [dpdk-dev] [PATCH 0/6] Few small improvements for ipsec library Konstantin Ananyev
2019-02-28 19:20 ` [dpdk-dev] [PATCH 1/6] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-02-28 19:20 ` [dpdk-dev] [PATCH 2/6] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-02-28 19:20 ` [dpdk-dev] [PATCH 3/6] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-02-28 19:20 ` [dpdk-dev] [PATCH 4/6] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-02-28 19:21 ` [dpdk-dev] [PATCH 5/6] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-02-28 19:21 ` [dpdk-dev] [PATCH 6/6] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 0/7] Few small improvements for ipsec library Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 1/7] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:53   ` Wiles, Keith
2019-03-20 17:53     ` Wiles, Keith
2019-03-22 17:37     ` Ananyev, Konstantin
2019-03-22 17:37       ` Ananyev, Konstantin
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 2/7] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:24 ` Konstantin Ananyev [this message]
2019-03-20 17:24   ` [dpdk-dev] [PATCH v2 3/7] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 4/7] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 5/7] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 6/7] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 17:24 ` [dpdk-dev] [PATCH v2 7/7] ipsec: reorder packet process " Konstantin Ananyev
2019-03-20 17:24   ` Konstantin Ananyev
2019-03-20 18:46 ` [dpdk-dev] [PATCH v2 0/7] Few small improvements for ipsec library Konstantin Ananyev
2019-03-20 18:46   ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 1/7] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-21  3:33     ` Jerin Jacob Kollanukkaran
2019-03-21  3:33       ` Jerin Jacob Kollanukkaran
2019-03-21  6:04     ` Shahaf Shuler
2019-03-21  6:04       ` Shahaf Shuler
2019-03-21 13:51       ` Ananyev, Konstantin
2019-03-21 13:51         ` Ananyev, Konstantin
2019-03-24  8:00         ` Shahaf Shuler
2019-03-24  8:00           ` Shahaf Shuler
2019-03-26 15:43     ` [dpdk-dev] [PATCH v3 0/8] Few small improvements for ipsec library Konstantin Ananyev
2019-03-26 15:43       ` Konstantin Ananyev
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 1/8] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28  8:16         ` Akhil Goyal
2019-03-28  8:16           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 2/8] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28  8:52         ` Akhil Goyal
2019-03-28  8:52           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 3/8] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28  9:02         ` Akhil Goyal
2019-03-28  9:02           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 4/8] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28 10:52         ` Akhil Goyal
2019-03-28 10:52           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 5/8] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28 11:20         ` Akhil Goyal
2019-03-28 11:20           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 6/8] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28 11:27         ` Akhil Goyal
2019-03-28 11:27           ` Akhil Goyal
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 7/8] ipsec: reorder packet process " Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-26 15:43       ` [dpdk-dev] [PATCH v3 8/8] ipsec: de-duplicate crypto op prepare code-path Konstantin Ananyev
2019-03-26 15:43         ` Konstantin Ananyev
2019-03-28 11:35         ` Akhil Goyal
2019-03-28 11:35           ` Akhil Goyal
2019-03-28 11:21       ` [dpdk-dev] [PATCH v3 0/8] Few small improvements for ipsec library Akhil Goyal
2019-03-28 11:21         ` Akhil Goyal
2019-03-28 11:49         ` Ananyev, Konstantin
2019-03-28 11:49           ` Ananyev, Konstantin
2019-03-29 10:27       ` [dpdk-dev] [PATCH v4 0/9] " Konstantin Ananyev
2019-03-29 10:27         ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 1/9] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 12:54           ` Olivier Matz
2019-03-29 12:54             ` Olivier Matz
2019-03-30 14:20             ` Ananyev, Konstantin
2019-03-30 14:20               ` Ananyev, Konstantin
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 2/9] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 3/9] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 4/9] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 5/9] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 6/9] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 7/9] ipsec: reorder packet process " Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 8/9] ipsec: de-duplicate crypto op prepare code-path Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 10:27         ` [dpdk-dev] [PATCH v4 9/9] doc: add ipsec lib into shared libraries list Konstantin Ananyev
2019-03-29 10:27           ` Konstantin Ananyev
2019-03-29 16:03           ` Akhil Goyal
2019-03-29 16:03             ` Akhil Goyal
2019-04-01 12:56         ` [dpdk-dev] [PATCH v5 0/9] Few small improvements for ipsec library Konstantin Ananyev
2019-04-01 12:56           ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 1/9] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 13:18             ` Akhil Goyal
2019-04-01 13:18               ` Akhil Goyal
2019-04-01 13:22             ` Olivier Matz
2019-04-01 13:22               ` Olivier Matz
2019-04-01 13:55               ` Ananyev, Konstantin
2019-04-01 13:55                 ` Ananyev, Konstantin
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 2/9] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 3/9] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 4/9] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 5/9] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 6/9] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 7/9] ipsec: reorder packet process " Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 8/9] ipsec: de-duplicate crypto op prepare code-path Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-01 12:56           ` [dpdk-dev] [PATCH v5 9/9] doc: add ipsec lib into shared libraries list Konstantin Ananyev
2019-04-01 12:56             ` Konstantin Ananyev
2019-04-02  8:34           ` [dpdk-dev] [PATCH v6 0/9] Few small improvements for ipsec library Konstantin Ananyev
2019-04-02  8:34             ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 1/9] mbuf: new function to generate raw Tx offload value Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:49               ` Olivier Matz
2019-04-02  8:49                 ` Olivier Matz
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 2/9] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 3/9] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 4/9] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 5/9] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 6/9] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 7/9] ipsec: reorder packet process " Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 8/9] ipsec: de-duplicate crypto op prepare code-path Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02  8:34             ` [dpdk-dev] [PATCH v6 9/9] doc: add ipsec lib into shared libraries list Konstantin Ananyev
2019-04-02  8:34               ` Konstantin Ananyev
2019-04-02 15:36             ` [dpdk-dev] [PATCH v6 0/9] Few small improvements for ipsec library Akhil Goyal
2019-04-02 15:36               ` Akhil Goyal
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 2/7] ipsec: add Tx offload template into SA Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 3/7] ipsec: change the order in filling crypto op Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 4/7] ipsec: change the way unprocessed mbufs are accounted Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 5/7] ipsec: move inbound and outbound code into different files Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 6/7] ipsec: reorder packet check for esp inbound Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev
2019-03-20 18:46   ` [dpdk-dev] [PATCH v2 7/7] ipsec: reorder packet process " Konstantin Ananyev
2019-03-20 18:46     ` Konstantin Ananyev

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=1553102679-23576-4-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.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).