Skip to contentSkip to conversation

security: introduce out of place support for inline ingress

RFC New Nithin Dabilpuram 7 participants 26 messages Mar 9, 2023 – Sep 21, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

RFC 1/2 security: introduce out of place support for inline ingress

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

In order to return the original encrypted packet mbuf, this patch adds a new mbuf dynamic field of 8B size containing pointer to original mbuf which will be populated for packets associated with Inline SA that has OOP enabled.

---
 devtools/libabigail.abignore       |  4 +++
 lib/security/rte_security.c        | 17 +++++++++++++
 lib/security/rte_security.h        | 39 +++++++++++++++++++++++++++++-
 lib/security/rte_security_driver.h |  8 ++++++
 lib/security/version.map           |  2 ++
 5 files changed, 69 insertions(+), 1 deletion(-)
devtools/libabigail.abignore +4 -0
index 7a93de3ba1..9f52ffbf2e 100644
@@ -34,3 +34,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Temporary exceptions till next major ABI version ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; Ignore change to reserved opts for new SA option
+[suppress_type]
+       name = rte_security_ipsec_sa_options
lib/security/rte_security.c +17 -0
index e102c55e55..c2199dd8db 100644
@@ -27,7 +27,10 @@
 } while (0)
 
 #define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+#define RTE_SECURITY_OOP_DYNFIELD_NAME "rte_security_oop_dynfield_metadata"
+
 int rte_security_dynfield_offset = -1;
+int rte_security_oop_dynfield_offset = -1;
 
 int
 rte_security_dynfield_register(void)
@@ -42,6 +45,20 @@ rte_security_dynfield_register(void)
 	return rte_security_dynfield_offset;
 }
 
+int
+rte_security_oop_dynfield_register(void)
+{
+	static const struct rte_mbuf_dynfield dynfield_desc = {
+		.name = RTE_SECURITY_OOP_DYNFIELD_NAME,
+		.size = sizeof(rte_security_oop_dynfield_t),
+		.align = __alignof__(rte_security_oop_dynfield_t),
+	};
+
+	rte_security_oop_dynfield_offset =
+		rte_mbuf_dynfield_register(&dynfield_desc);
+	return rte_security_oop_dynfield_offset;
+}
+
 void *
 rte_security_session_create(struct rte_security_ctx *instance,
 			    struct rte_security_session_conf *conf,
lib/security/rte_security.h +38 -1
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t ip_reassembly_en : 1;
 
+	/** Enable out of place processing on inline inbound packets.
+	 *
+	 * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+	 *      inbound SA if supported by driver. PMD need to register mbuf
+	 *      dynamic field using rte_security_oop_dynfield_register()
+	 *      and security session creation would fail if dynfield is not
+	 *      registered successfully.
+	 * * 0: Disable OOP processing for this session (default).
+	 */
+	uint32_t ingress_oop : 1;
+
 	/** Reserved bit fields for future extension
 	 *
 	 * User should ensure reserved_opts is cleared as it may change in
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
 	 *
 	 * Note: Reduce number of bits in reserved_opts for every new option.
 	 */
-	uint32_t reserved_opts : 17;
+	uint32_t reserved_opts : 16;
 };
 
 /** IPSec security association direction */
@@ -812,6 +823,13 @@ typedef uint64_t rte_security_dynfield_t;
 /** Dynamic mbuf field for device-specific metadata */
 extern int rte_security_dynfield_offset;
 
+/** Out-of-Place(OOP) processing field type */
+typedef struct rte_mbuf *rte_security_oop_dynfield_t;
+/** Dynamic mbuf field for pointer to original mbuf for
+ * OOP processing session.
+ */
+extern int rte_security_oop_dynfield_offset;
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
@@ -834,6 +852,25 @@ rte_security_dynfield(struct rte_mbuf *mbuf)
 		rte_security_dynfield_t *);
 }
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for original mbuf pointer when
+ * Out-Of-Place(OOP) processing is enabled in security session.
+ *
+ * @param       mbuf    packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_oop_dynfield_t *
+rte_security_oop_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+			rte_security_oop_dynfield_offset,
+			rte_security_oop_dynfield_t *);
+}
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
lib/security/rte_security_driver.h +8 -0
index 421e6f7780..91e7786ab7 100644
@@ -190,6 +190,14 @@ typedef int (*security_macsec_sa_stats_get_t)(void *device, uint16_t sa_id,
 __rte_internal
 int rte_security_dynfield_register(void);
 
+/**
+ * @internal
+ * Register mbuf dynamic field for Security inline ingress Out-of-Place(OOP)
+ * processing.
+ */
+__rte_internal
+int rte_security_oop_dynfield_register(void);
+
 /**
  * Update the mbuf with provided metadata.
  *
lib/security/version.map +2 -0
index 07dcce9ffb..59a95f40bd 100644
@@ -23,10 +23,12 @@ EXPERIMENTAL {
 	rte_security_macsec_sc_stats_get;
 	rte_security_session_stats_get;
 	rte_security_session_update;
+	rte_security_oop_dynfield_offset;
 };
 
 INTERNAL {
 	global:
 
 	rte_security_dynfield_register;
+	rte_security_oop_dynfield_register;
 };
Signature · 1 line
2.25.1
#1 lore raw

RFC 2/2 test/security: add unittest for inline ingress oop

Add unittest for inline ingress out-of-place processing.

---
 app/test/test_cryptodev_security_ipsec.c |  8 +++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 app/test/test_security_inline_proto.c    | 85 ++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
app/test/test_cryptodev_security_ipsec.c +8 -0
index 221edaa98d..f11bacb4d2 100644
@@ -213,6 +213,14 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
 		}
 	}
 
+	if (ipsec_xform->options.ingress_oop == 1 &&
+	    sec_cap->ipsec.options.ingress_oop == 0) {
+		if (!silent)
+			RTE_LOG(INFO, USER1,
+				"Inline Ingress OOP processing is not supported\n");
+		return -ENOTSUP;
+	}
+
 	return 0;
 }
 
app/test/test_cryptodev_security_ipsec.h +1 -0
index 92e641ba0b..5606ec056d 100644
@@ -110,6 +110,7 @@ struct ipsec_test_flags {
 	bool ah;
 	uint32_t plaintext_len;
 	int nb_segs_in_mbuf;
+	bool inb_oop;
 };
 
 struct crypto_param {
app/test/test_security_inline_proto.c +85 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/3 security: introduce out of place support for inline ingress

In reply to Nithin Dabilpuram

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

---
 devtools/libabigail.abignore       |  4 +++
 lib/security/rte_security.c        | 17 +++++++++++++
 lib/security/rte_security.h        | 39 +++++++++++++++++++++++++++++-
 lib/security/rte_security_driver.h |  8 ++++++
 lib/security/version.map           |  2 ++
 5 files changed, 69 insertions(+), 1 deletion(-)
devtools/libabigail.abignore +4 -0
index 3ff51509de..414baac060 100644
@@ -40,3 +40,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Temporary exceptions till next major ABI version ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; Ignore change to reserved opts for new SA option
+[suppress_type]
+       name = rte_security_ipsec_sa_options
lib/security/rte_security.c +17 -0
index e102c55e55..c2199dd8db 100644
@@ -27,7 +27,10 @@
 } while (0)
 
 #define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+#define RTE_SECURITY_OOP_DYNFIELD_NAME "rte_security_oop_dynfield_metadata"
+
 int rte_security_dynfield_offset = -1;
+int rte_security_oop_dynfield_offset = -1;
 
 int
 rte_security_dynfield_register(void)
@@ -42,6 +45,20 @@ rte_security_dynfield_register(void)
 	return rte_security_dynfield_offset;
 }
 
+int
+rte_security_oop_dynfield_register(void)
+{
+	static const struct rte_mbuf_dynfield dynfield_desc = {
+		.name = RTE_SECURITY_OOP_DYNFIELD_NAME,
+		.size = sizeof(rte_security_oop_dynfield_t),
+		.align = __alignof__(rte_security_oop_dynfield_t),
+	};
+
+	rte_security_oop_dynfield_offset =
+		rte_mbuf_dynfield_register(&dynfield_desc);
+	return rte_security_oop_dynfield_offset;
+}
+
 void *
 rte_security_session_create(struct rte_security_ctx *instance,
 			    struct rte_security_session_conf *conf,
lib/security/rte_security.h +38 -1
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t ip_reassembly_en : 1;
 
+	/** Enable out of place processing on inline inbound packets.
+	 *
+	 * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+	 *      inbound SA if supported by driver. PMD need to register mbuf
+	 *      dynamic field using rte_security_oop_dynfield_register()
+	 *      and security session creation would fail if dynfield is not
+	 *      registered successfully.
+	 * * 0: Disable OOP processing for this session (default).
+	 */
+	uint32_t ingress_oop : 1;
+
 	/** Reserved bit fields for future extension
 	 *
 	 * User should ensure reserved_opts is cleared as it may change in
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
 	 *
 	 * Note: Reduce number of bits in reserved_opts for every new option.
 	 */
-	uint32_t reserved_opts : 17;
+	uint32_t reserved_opts : 16;
 };
 
 /** IPSec security association direction */
@@ -812,6 +823,13 @@ typedef uint64_t rte_security_dynfield_t;
 /** Dynamic mbuf field for device-specific metadata */
 extern int rte_security_dynfield_offset;
 
+/** Out-of-Place(OOP) processing field type */
+typedef struct rte_mbuf *rte_security_oop_dynfield_t;
+/** Dynamic mbuf field for pointer to original mbuf for
+ * OOP processing session.
+ */
+extern int rte_security_oop_dynfield_offset;
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
@@ -834,6 +852,25 @@ rte_security_dynfield(struct rte_mbuf *mbuf)
 		rte_security_dynfield_t *);
 }
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for original mbuf pointer when
+ * Out-Of-Place(OOP) processing is enabled in security session.
+ *
+ * @param       mbuf    packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_oop_dynfield_t *
+rte_security_oop_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+			rte_security_oop_dynfield_offset,
+			rte_security_oop_dynfield_t *);
+}
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
lib/security/rte_security_driver.h +8 -0
index 421e6f7780..91e7786ab7 100644
@@ -190,6 +190,14 @@ typedef int (*security_macsec_sa_stats_get_t)(void *device, uint16_t sa_id,
 __rte_internal
 int rte_security_dynfield_register(void);
 
+/**
+ * @internal
+ * Register mbuf dynamic field for Security inline ingress Out-of-Place(OOP)
+ * processing.
+ */
+__rte_internal
+int rte_security_oop_dynfield_register(void);
+
 /**
  * Update the mbuf with provided metadata.
  *
lib/security/version.map +2 -0
index 07dcce9ffb..59a95f40bd 100644
@@ -23,10 +23,12 @@ EXPERIMENTAL {
 	rte_security_macsec_sc_stats_get;
 	rte_security_session_stats_get;
 	rte_security_session_update;
+	rte_security_oop_dynfield_offset;
 };
 
 INTERNAL {
 	global:
 
 	rte_security_dynfield_register;
+	rte_security_oop_dynfield_register;
 };
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/3 net/cnxk: support inline ingress out of place session

Add support for inline ingress session with out-of-place support.

---

Depends-on: series-27660 ("common/cnxk: allocate dynamic BPIDs)

 drivers/event/cnxk/cn10k_worker.h   |  28 ++++-
 drivers/net/cnxk/cn10k_ethdev.c     |  13 +-
 drivers/net/cnxk/cn10k_ethdev_sec.c |  43 +++++++
 drivers/net/cnxk/cn10k_rx.h         | 185 ++++++++++++++++++++++------
 drivers/net/cnxk/cn10k_rxtx.h       |   1 +
 drivers/net/cnxk/cnxk_ethdev.h      |   9 ++
 6 files changed, 233 insertions(+), 46 deletions(-)
drivers/event/cnxk/cn10k_worker.h +22 -6
index 07f0dad97d..75244638d2 100644
@@ -16,7 +16,7 @@
 static __rte_always_inline void
 cn10k_wqe_to_mbuf(uint64_t wqe, const uint64_t __mbuf, uint8_t port_id,
 		  const uint32_t tag, const uint32_t flags,
-		  const void *const lookup_mem)
+		  const void *const lookup_mem, uintptr_t cpth)
 {
 	const uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
 				   (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
@@ -27,7 +27,7 @@ cn10k_wqe_to_mbuf(uint64_t wqe, const uint64_t __mbuf, uint8_t port_id,
 
 	cn10k_nix_cqe_to_mbuf((struct nix_cqe_hdr_s *)wqe, tag,
 			      (struct rte_mbuf *)mbuf, lookup_mem,
-			      mbuf_init | ((uint64_t)port_id) << 48, flags);
+			      mbuf_init | ((uint64_t)port_id) << 48, cpth, flags);
 }
 
 static void
@@ -62,6 +62,7 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 	uint16_t lmt_id, d_off;
 	struct rte_mbuf **wqe;
 	struct rte_mbuf *mbuf;
+	uintptr_t cpth = 0;
 	uint8_t loff = 0;
 	uint64_t sa_base;
 	int i;
@@ -125,13 +126,20 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 			const uint64_t cq_w1 = *((const uint64_t *)cqe + 1);
 			const uint64_t cq_w5 = *((const uint64_t *)cqe + 5);
 
+			cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
+
+			/* Update mempool pointer for full mode pkt */
+			if ((flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				mbuf->pool = mp;
+
 			mbuf = nix_sec_meta_to_mbuf_sc(cq_w1, cq_w5, sa_base, laddr,
 						       &loff, mbuf, d_off,
 						       flags, mbuf_init);
 		}
 
 		cn10k_nix_cqe_to_mbuf(cqe, cqe->tag, mbuf, lookup_mem,
-				      mbuf_init, flags);
+				      mbuf_init, cpth, flags);
 
 		if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
 			cn10k_sso_process_tstamp((uint64_t)wqe[0],
@@ -162,6 +170,7 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
 		u64[1] = cn10k_cpt_crypto_adapter_vector_dequeue(u64[1]);
 	} else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV) {
 		uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
+		uintptr_t cpth = 0;
 		uint64_t mbuf;
 
 		mbuf = u64[1] - sizeof(struct rte_mbuf);
@@ -191,12 +200,19 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
 			sa_base = cnxk_nix_sa_base_get(port, ws->lookup_mem);
 			sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
 
+			cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
+			mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
+			meta_aura = mp ? mp->pool_id : m->pool->pool_id;
+
+			/* Update mempool pointer for full mode pkt */
+			if ((flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				((struct rte_mbuf *)mbuf)->pool = mp;
+
 			mbuf = (uint64_t)nix_sec_meta_to_mbuf_sc(
 				cq_w1, cq_w5, sa_base, (uintptr_t)&iova, &loff,
 				(struct rte_mbuf *)mbuf, d_off, flags,
 				mbuf_init | ((uint64_t)port) << 48);
-			mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
-			meta_aura = mp ? mp->pool_id : m->pool->pool_id;
 
 			if (loff)
 				roc_npa_aura_op_free(meta_aura, 0, iova);
@@ -204,7 +220,7 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
 
 		u64[0] = CNXK_CLR_SUB_EVENT(u64[0]);
 		cn10k_wqe_to_mbuf(u64[1], mbuf, port, u64[0] & 0xFFFFF, flags,
-				  ws->lookup_mem);
+				  ws->lookup_mem, cpth);
 		if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
 			cn10k_sso_process_tstamp(u64[1], mbuf,
 						 ws->tstamp[port]);
drivers/net/cnxk/cn10k_ethdev.c +9 -4
index 2b4ab8b772..c33646846e 100644
@@ -352,11 +352,13 @@ cn10k_nix_rx_queue_meta_aura_update(struct rte_eth_dev *eth_dev)
 		rq = &dev->rqs[i];
 		rxq = eth_dev->data->rx_queues[i];
 		rxq->meta_aura = rq->meta_aura_handle;
+		rxq->meta_pool = dev->nix.meta_mempool;
 		/* Assume meta packet from normal aura if meta aura is not setup
 		 */
 		if (!rxq->meta_aura) {
 			rxq_sp = cnxk_eth_rxq_to_sp(rxq);
 			rxq->meta_aura = rxq_sp->qconf.mp->pool_id;
+			rxq->meta_pool = (uintptr_t)rxq_sp->qconf.mp;
 		}
 	}
 	/* Store mempool in lookup mem */
@@ -623,14 +625,17 @@ cn10k_nix_reassembly_conf_set(struct rte_eth_dev *eth_dev,
 
 	if (!conf->flags) {
 		/* Clear offload flags on disable */
-		dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		if (!dev->inb.nb_oop)
+			dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		dev->inb.reass_en = false;
 		return 0;
 	}
 
-	rc = roc_nix_reassembly_configure(conf->timeout_ms,
-				conf->max_frags);
-	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+	rc = roc_nix_reassembly_configure(conf->timeout_ms, conf->max_frags);
+	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
 		dev->rx_offload_flags |= NIX_RX_REAS_F;
+		dev->inb.reass_en = true;
+	}
 
 	return rc;
 }
drivers/net/cnxk/cn10k_ethdev_sec.c +43 -0

97 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +149 -36

352 lines not on this page · raw message

drivers/net/cnxk/cn10k_rxtx.h +1 -0
index c256d54307..b5d8345270 100644
@@ -77,6 +77,7 @@ struct cn10k_eth_rxq {
 	uint64_t sa_base;
 	uint64_t lmt_base;
 	uint64_t meta_aura;
+	uintptr_t meta_pool;
 	uint16_t rq;
 	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
drivers/net/cnxk/cnxk_ethdev.h +9 -0
index 85287dd66c..2b89ebb9bc 100644
@@ -217,6 +217,9 @@ struct cnxk_eth_sec_sess {
 
 	/* Inbound session on inl dev */
 	bool inl_dev;
+
+	/* Out-Of-Place processing */
+	bool inb_oop;
 };
 
 TAILQ_HEAD(cnxk_eth_sec_sess_list, cnxk_eth_sec_sess);
@@ -244,6 +247,12 @@ struct cnxk_eth_dev_sec_inb {
 	/* DPTR for WRITE_SA microcode op */
 	void *sa_dptr;
 
+	/* Number of oop sessions */
+	uint16_t nb_oop;
+
+	/* Reassembly enabled */
+	bool reass_en;
+
 	/* Lock to synchronize sa setup/release */
 	rte_spinlock_t lock;
 };
Signature · 1 line
2.25.1
#4 lore raw

PATCH 3/3 test/security: add unittest for inline ingress oop

In reply to Nithin Dabilpuram

Add unittest for inline ingress out-of-place processing.

---
 app/test/test_cryptodev_security_ipsec.c |  8 +++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 app/test/test_security_inline_proto.c    | 85 ++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
app/test/test_cryptodev_security_ipsec.c +8 -0
index 7a8688c692..be9e246bfe 100644
@@ -213,6 +213,14 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
 		}
 	}
 
+	if (ipsec_xform->options.ingress_oop == 1 &&
+	    sec_cap->ipsec.options.ingress_oop == 0) {
+		if (!silent)
+			RTE_LOG(INFO, USER1,
+				"Inline Ingress OOP processing is not supported\n");
+		return -ENOTSUP;
+	}
+
 	return 0;
 }
 
app/test/test_cryptodev_security_ipsec.h +1 -0
index 92e641ba0b..5606ec056d 100644
@@ -110,6 +110,7 @@ struct ipsec_test_flags {
 	bool ah;
 	uint32_t plaintext_len;
 	int nb_segs_in_mbuf;
+	bool inb_oop;
 };
 
 struct crypto_param {
app/test/test_security_inline_proto.c +85 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw
In reply to Nithin Dabilpuram
Quoted 23 lines · On Tue, 11 Apr 2023 15:34:07 +0530 Nithin Dabilpuram <[email protected]>…
lib/security/rte_security.h +11 -0
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t ip_reassembly_en : 1;
 
+	/** Enable out of place processing on inline inbound packets.
+	 *
+	 * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+	 *      inbound SA if supported by driver. PMD need to register mbuf
+	 *      dynamic field using rte_security_oop_dynfield_register()
+	 *      and security session creation would fail if dynfield is not
+	 *      registered successfully.
+	 * * 0: Disable OOP processing for this session (default).
+	 */
+	uint32_t ingress_oop : 1;
+
 	/** Reserved bit fields for future extension
 	 *
 	 * User should ensure reserved_opts is cleared as it may change in

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 6 lines
lib/security/rte_security.h +1 -1
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
 	 *
 	 * Note: Reduce number of bits in reserved_opts for every new option.
 	 */
-	uint32_t reserved_opts : 17;
+	uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

#6 lore raw
Quoted 37 lines · Stephen Hemminger
Quoted 23 lines · On Tue, 11 Apr 2023 15:34:07 +0530 Nithin Dabilpuram <[email protected]>…
lib/security/rte_security.h +11 -0
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
       */
      uint32_t ip_reassembly_en : 1;
 
+     /** Enable out of place processing on inline inbound packets.
+      *
+      * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+      *      inbound SA if supported by driver. PMD need to register mbuf
+      *      dynamic field using rte_security_oop_dynfield_register()
+      *      and security session creation would fail if dynfield is not
+      *      registered successfully.
+      * * 0: Disable OOP processing for this session (default).
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may change in

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 6 lines
lib/security/rte_security.h +1 -1
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every new option.
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Quoted 4 lines

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

Quoted 2 lines
#7 lore raw

18/04/2023 10:33, Jerin Jacob:

Quoted 47 lines
Quoted 37 lines · Stephen Hemminger
Quoted 23 lines · On Tue, 11 Apr 2023 15:34:07 +0530 Nithin Dabilpuram <[email protected]>…
lib/security/rte_security.h +11 -0
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
       */
      uint32_t ip_reassembly_en : 1;
 
+     /** Enable out of place processing on inline inbound packets.
+      *
+      * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+      *      inbound SA if supported by driver. PMD need to register mbuf
+      *      dynamic field using rte_security_oop_dynfield_register()
+      *      and security session creation would fail if dynfield is not
+      *      registered successfully.
+      * * 0: Disable OOP processing for this session (default).
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may change in

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 6 lines
lib/security/rte_security.h +1 -1
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every new option.
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Quoted 4 lines

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

Quoted 7 lines

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

RTE_NEXT_ABI is described in the ABI policy. We are not doing it currently, but I think we could when it is not too much complicate in the code.

The only problems I see are:
- more #ifdef clutter
- 2 binary versions to test
- CI and checks must handle RTE_NEXT_ABI version

#8 lore raw
Quoted 57 lines · Thomas Monjalon

18/04/2023 10:33, Jerin Jacob:

Quoted 47 lines
Quoted 37 lines · Stephen Hemminger
Quoted 23 lines · On Tue, 11 Apr 2023 15:34:07 +0530 Nithin Dabilpuram <[email protected]>…
lib/security/rte_security.h +11 -0
index 4bacf9fcd9..866cd4e8ee 100644
@@ -275,6 +275,17 @@ struct rte_security_ipsec_sa_options {
       */
      uint32_t ip_reassembly_en : 1;
 
+     /** Enable out of place processing on inline inbound packets.
+      *
+      * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+      *      inbound SA if supported by driver. PMD need to register mbuf
+      *      dynamic field using rte_security_oop_dynfield_register()
+      *      and security session creation would fail if dynfield is not
+      *      registered successfully.
+      * * 0: Disable OOP processing for this session (default).
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may change in

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 6 lines
lib/security/rte_security.h +1 -1
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every new option.
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Quoted 4 lines

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

Quoted 7 lines

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

Quoted 8 lines

RTE_NEXT_ABI is described in the ABI policy. We are not doing it currently, but I think we could when it is not too much complicate in the code.

The only problems I see are:
- more #ifdef clutter
- 2 binary versions to test
- CI and checks must handle RTE_NEXT_ABI version

I think, we have two buckets of ABI breakages via RTE_NEXT_ABI

1) Changes that introduces compilation failures like adding new argument to API or change API name etc
2) Structure size change which won't affect the compilation but breaks the ABI for shared library usage.

I think, (1) is very distributive, and I don't see recently such changes. I think, we should avoid (1) for non XX.11 releases.(or two or three-year cycles if we decide that path)

The (2) comes are very common due to the fact HW features are evolving. I think, to address the (2), we have two options
a) Have reserved fields and have _init() function to initialize the structures
b) Follow YAGNI style and introduce RTE_NEXT_ABI for structure size change.

The above concerns[1] can greatly reduce with option b OR option a.

[1]
1) more #ifdef clutter
For option (a) this is not needed or option (b) the clutter will be limited, it will be around structure which add the new filed and around the FULL block where new functions are added (not inside the functions)

2) 2 binary versions to test
For option (a) this is not needed, for option (b) it is limited as for new features only one needs to test another binary (rather than NOT adding a new feature).

3) CI and checks must handle RTE_NEXT_ABI version

I think, it is cheap to add this, at least for compilation test.

IMO, We need to change the API break release to 3 year kind of time frame to have very good end user experience
and allow ABI related change to get in every release and force _rebuild_ shared objects in major LTS release.

I think, in this major LTS version(23.11) if we can decide (a) vs (b) then we can align the code accordingly . e.s.p for (a) we need to add _init() functions.

Thoughts?

#9 lore raw
Quoted 81 lines
Quoted 33 lines
Quoted 25 lines
Quoted 17 lines

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 13 lines
lib/security/rte_security.h +4 -1
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may change in
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every new option.
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Quoted 4 lines

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

Quoted 7 lines

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

Quoted 8 lines

RTE_NEXT_ABI is described in the ABI policy. We are not doing it currently, but I think we could when it is not too much complicate in the code.

The only problems I see are:
- more #ifdef clutter
- 2 binary versions to test
- CI and checks must handle RTE_NEXT_ABI version

I think, we have two buckets of ABI breakages via RTE_NEXT_ABI

1) Changes that introduces compilation failures like adding new argument to API or change API name etc
2) Structure size change which won't affect the compilation but breaks the ABI for shared library usage.

I think, (1) is very distributive, and I don't see recently such changes. I think, we should avoid (1) for non XX.11 releases.(or two or three-year cycles if we decide that path)

The (2) comes are very common due to the fact HW features are evolving. I think, to address the (2), we have two options
a) Have reserved fields and have _init() function to initialize the structures
b) Follow YAGNI style and introduce RTE_NEXT_ABI for structure size change.

The above concerns[1] can greatly reduce with option b OR option a.

[1]
1) more #ifdef clutter
For option (a) this is not needed or option (b) the clutter will be limited, it will be around structure which add the new filed and around the FULL block where new functions are added (not inside the functions)

2) 2 binary versions to test
For option (a) this is not needed, for option (b) it is limited as for new features only one needs to test another binary (rather than NOT adding a new feature).

3) CI and checks must handle RTE_NEXT_ABI version

I think, it is cheap to add this, at least for compilation test.

IMO, We need to change the API break release to 3 year kind of time frame to have very good end user experience
and allow ABI related change to get in every release and force _rebuild_ shared objects in major LTS release.

Quoted 5 lines

I think, in this major LTS version(23.11) if we can decide (a) vs (b) then we can align the code accordingly . e.s.p for (a) we need to add _init() functions.

Thoughts?

Not much input from mailing list. Can we discuss this next TB meeting? Especially how to align with next LTS release on
-YAGNI vs reserved fileds with init()
-What it takes to Extend the API breaking release more than a year as first step.

#10 lore raw

30/05/2023 11:23, Jerin Jacob:

Quoted 91 lines
Quoted 81 lines
Quoted 33 lines
Quoted 25 lines
Quoted 17 lines

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 297

Quoted 13 lines
lib/security/rte_security.h +4 -1
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may change in
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every new option.
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Quoted 4 lines

Reserved space is not usable without ABI breakage unless the existing code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not enough.

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

Quoted 7 lines

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

Quoted 8 lines

RTE_NEXT_ABI is described in the ABI policy. We are not doing it currently, but I think we could when it is not too much complicate in the code.

The only problems I see are:
- more #ifdef clutter
- 2 binary versions to test
- CI and checks must handle RTE_NEXT_ABI version

I think, we have two buckets of ABI breakages via RTE_NEXT_ABI

1) Changes that introduces compilation failures like adding new argument to API or change API name etc
2) Structure size change which won't affect the compilation but breaks the ABI for shared library usage.

I think, (1) is very distributive, and I don't see recently such changes. I think, we should avoid (1) for non XX.11 releases.(or two or three-year cycles if we decide that path)

The (2) comes are very common due to the fact HW features are evolving. I think, to address the (2), we have two options
a) Have reserved fields and have _init() function to initialize the structures
b) Follow YAGNI style and introduce RTE_NEXT_ABI for structure size change.

The above concerns[1] can greatly reduce with option b OR option a.

[1]
1) more #ifdef clutter
For option (a) this is not needed or option (b) the clutter will be limited, it will be around structure which add the new filed and around the FULL block where new functions are added (not inside the functions)

2) 2 binary versions to test
For option (a) this is not needed, for option (b) it is limited as for new features only one needs to test another binary (rather than NOT adding a new feature).

3) CI and checks must handle RTE_NEXT_ABI version

I think, it is cheap to add this, at least for compilation test.

IMO, We need to change the API break release to 3 year kind of time frame to have very good end user experience
and allow ABI related change to get in every release and force _rebuild_ shared objects in major LTS release.

Quoted 5 lines

I think, in this major LTS version(23.11) if we can decide (a) vs (b) then we can align the code accordingly . e.s.p for (a) we need to add _init() functions.

Thoughts?

Not much input from mailing list. Can we discuss this next TB meeting? Especially how to align with next LTS release on

(quoted diff) +0 -2
-YAGNI vs reserved fileds with init()
-What it takes to Extend the API breaking release more than a year as
Quoted 1 line

first step.

Yes I agree it should be discussed interactively in techboard meeting.

#11 lore raw
Quoted 57 lines

From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, 30 May 2023 15.52

30/05/2023 11:23, Jerin Jacob:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
(quoted diff) +3 -0
+      */
+     uint32_t ingress_oop : 1;
+
      /** Reserved bit fields for future extension
       *
       * User should ensure reserved_opts is cleared as it may

change in

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review struct rte_security_ipsec_sa_options { · line 294

Quoted 3 lines
(quoted diff) +0 -0
@@ -282,7 +293,7 @@ struct rte_security_ipsec_sa_options {
       *
       * Note: Reduce number of bits in reserved_opts for every

new option.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Review struct rte_security_ipsec_sa_options { · line 297

Quoted 4 lines
(quoted diff) +1 -1
       */
-     uint32_t reserved_opts : 17;
+     uint32_t reserved_opts : 16;
 };

NAK
Let me repeat the reserved bit rant. YAGNI

Reserved space is not usable without ABI breakage unless the

existing

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

code enforces that reserved space has to be zero.

Just saying "User should ensure reserved_opts is cleared" is not

enough.

Quoted 28 lines
Quoted 28 lines
Quoted 12 lines
Quoted 11 lines

Yes. I think, we need to enforce to have _init functions for the structures which is using reserved filed.

On the same note on YAGNI, I am wondering why NOT introduce RTE_NEXT_ABI marco kind of scheme to compile out ABI breaking changes. By keeping RTE_NEXT_ABI disable by default, enable explicitly if user wants it to avoid waiting for one year any ABI breaking changes. There are a lot of "fixed appliance" customers (not OS distribution driven customer) they are willing to recompile DPDK for new feature. What we are loosing with this scheme?

Quoted 8 lines

RTE_NEXT_ABI is described in the ABI policy. We are not doing it currently, but I think we could when it is not too much complicate in the code.

The only problems I see are:
- more #ifdef clutter
- 2 binary versions to test
- CI and checks must handle RTE_NEXT_ABI version

I think, we have two buckets of ABI breakages via RTE_NEXT_ABI

1) Changes that introduces compilation failures like adding new argument to API or change API name etc
2) Structure size change which won't affect the compilation but breaks the ABI for shared library usage.

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

I think, (1) is very distributive, and I don't see recently such changes. I think, we should avoid (1) for non XX.11 releases.(or two or three-year cycles if we decide that path)

The (2) comes are very common due to the fact HW features are evolving. I think, to address the (2), we have two options
a) Have reserved fields and have _init() function to initialize the

structures

High probability that (a) is not going to work: There will not be enough reserved fields, and/or they will be in the wrong places in the structures.

Also, (a) is really intrusive on existing applications: They MUST be rewritten to call the _init() function instead of using pre-initialized structures, or the library will behave unexpectedly. Extreme example, to prove my point: A new field "allow_ingress" (don't drop all packets on ingress) is introduced, and _init() sets it to true. If the application doesn't call _init(), it will not receive any packets.

Are _init() functions required on all structures, or only some? And how about structures containing other structures?

How does the application developer know which structures have _init() functions, and which do not?

<irony>
We could also switch to C++, where the _init() function comes native in the form of an object constructor. </irony>

Quoted 2 lines
Quoted 1 line
Quoted 1 line

b) Follow YAGNI style and introduce RTE_NEXT_ABI for structure size

change.

+1 for (b), because (a) is too problematic.

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

The above concerns[1] can greatly reduce with option b OR option a.

[1]
1) more #ifdef clutter
For option (a) this is not needed or option (b) the clutter will be limited, it will be around structure which add the new filed and around the FULL block where new functions are added (not inside the functions)

2) 2 binary versions to test
For option (a) this is not needed, for option (b) it is limited as for new features only one needs to test another binary (rather than NOT adding a new feature).

3) CI and checks must handle RTE_NEXT_ABI version

I think, it is cheap to add this, at least for compilation test.

IMO, We need to change the API break release to 3 year kind of time frame to have very good end user experience
and allow ABI related change to get in every release and force _rebuild_ shared objects in major LTS release.

I think, in this major LTS version(23.11) if we can decide (a) vs (b) then we can align the code accordingly . e.s.p for (a) we need to add _init() functions.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Thoughts?

Not much input from mailing list. Can we discuss this next TB meeting? Especially how to align with next LTS release on
-YAGNI vs reserved fileds with init()

Whichever decision is made on this, remember to also consider if it has any consequences regarding older LTS versions and possibly backporting.

Quoted 2 lines
Quoted 2 lines

-What it takes to Extend the API breaking release more than a year as first step.

Others might disagree, but in my personal opinion, DPDK is still evolving much too rapidly to lock down its ABI/API for more than one year. For reference, consider what has been changed within the last three years, i.e. since DPDK 20.05, and if those changes could have been done within the DPDK 20.05 ABI/API without requiring a substantial additional effort, and while still providing clean and understandable APIs (and not a bunch of weird hacks to shoehorn the new features into the existing APIs).

If you want continuity, use an LTS release. If we lock down the ABI/API for multiple years at a time, what is the point of the LTS releases?

PS: If we start using the RTE_NEXT_ABI concept more, we should remember to promote the additions with each ABI/API breaking release. And we should probably have a rule of thumb to choose between using RTE_NEXT_ABI and using "experimental" marking.

Quoted 2 lines

Yes I agree it should be discussed interactively in techboard meeting.

I'm unable to participate in today's techboard meeting, so I have provided my opinions in this email.

-Morten

#12 lore raw

PATCH 1/1 doc: announce addition of new security IPsec SA option

In reply to Nithin Dabilpuram

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index 8e1cdd677a..20ce0a51af 100644
@@ -156,3 +156,8 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* security: New sa option ``ingress_oop`` would be added in structure
+  ``rte_security_ipsec_sa_options`` to support out of place processing
+  for inline inbound SA's. ``reserved_opts`` size would be reduced by
+  1 bit from DPDK 23.11.
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#13 lore raw

RE: [PATCH] doc: announce addition of new security IPsec SA option

Quoted 16 lines

Subject: [PATCH] doc: announce addition of new security IPsec SA option

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +0 -0
index 8e1cdd677a..20ce0a51af 100644

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 163

Quoted 8 lines
doc/guides/rel_notes/deprecation.rst +5 -0
@@ -156,3 +156,8 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* security: New sa option ``ingress_oop`` would be added in structure
+  ``rte_security_ipsec_sa_options`` to support out of place processing
+  for inline inbound SA's. ``reserved_opts`` size would be reduced by
+  1 bit from DPDK 23.11.

As discussed in techboard meetings, reserved fields should not be added. Hence we can update the above note to remove reserved_opts as well.

With that fixed.

++ more people for acks.

#14 lore raw

PATCH v2 1/1 doc: announce addition of new security IPsec SA option

In reply to Nithin Dabilpuram

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

---

v2:
- Modified deprication notice to include reserved opts removal.

 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index 8e1cdd677a..c46cc49812 100644
@@ -156,3 +156,8 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* security: New sa option ``ingress_oop`` would be added in structure
+  ``rte_security_ipsec_sa_options`` to support out of place processing
+  for inline inbound SA's from DPDK 23.11. ``reserved_opts`` field in the
+  same struct would be removed as discussed in techboard meeting.
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#15 lore raw

Re: [PATCH v2] doc: announce addition of new security IPsec SA option

Quoted 6 lines · Nithin Dabilpuram

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

Quoted 24 lines

---

v2:
- Modified deprication notice to include reserved opts removal.

 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -1
index 8e1cdd677a..c46cc49812 100644
@@ -156,3 +156,8 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* security: New sa option ``ingress_oop`` would be added in structure
+  ``rte_security_ipsec_sa_options`` to support out of place processing
+  for inline inbound SA's from DPDK 23.11. ``reserved_opts`` field in the
+  same struct would be removed as discussed in techboard meeting.
--

2.25.1

Acked-by Kai Ji Applied
#16 lore raw

RE: [EXT] Re: [PATCH v2] doc: announce addition of new security IPsec SA option

Quoted 6 lines

Subject: [EXT] Re: [PATCH v2] doc: announce addition of new security IPsec SA option

Quoted 1 line · Nithin Dabilpuram
Quoted 7 lines
Quoted 5 lines

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

Copied Kai's ack from v1 of this patch.

Applied to dpdk-next-crypto
Thanks.

Acked-by on v1 1/1
#17 lore raw

Re: [PATCH] doc: announce addition of new security IPsec SA option

In reply to Nithin Dabilpuram

________________________________
From: Nithin Dabilpuram <[email protected]>
Sent: 01 July 2023 08:15
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; Nithin Dabilpuram <[email protected]>
Subject: [PATCH] doc: announce addition of new security IPsec SA option

Announce addition of new security IPsec SA option to enable out of place processing in Ingress Inline inbound SA's.

---
 doc/guides/rel_notes/deprecation.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index 8e1cdd677a..20ce0a51af 100644
@@ -156,3 +156,8 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* security: New sa option ``ingress_oop`` would be added in structure
+  ``rte_security_ipsec_sa_options`` to support out of place processing
+  for inline inbound SA's. ``reserved_opts`` size would be reduced by
+  1 bit from DPDK 23.11.

--
2.25.1

#18 lore raw

PATCH 1/3 security: introduce out of place support for inline ingress

In reply to Nithin Dabilpuram

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

Also remove reserved_opts field from the rte_security_ipsec_sa_options struct as mentioned in deprecation notice.

---
v1:
- Removed reserved_opts field from sa_options struct

 lib/pipeline/rte_swx_ipsec.c       |  1 -
 lib/security/rte_security.c        | 17 +++++++++++++
 lib/security/rte_security.h        | 40 +++++++++++++++++++++++++-----
 lib/security/rte_security_driver.h |  8 ++++++
 lib/security/version.map           |  2 ++
 5 files changed, 61 insertions(+), 7 deletions(-)
lib/pipeline/rte_swx_ipsec.c +0 -1
index 6c217ee797..28576c2a48 100644
@@ -1555,7 +1555,6 @@ ipsec_xform_get(struct rte_swx_ipsec_sa_params *p,
 	ipsec_xform->options.ip_csum_enable = 0;
 	ipsec_xform->options.l4_csum_enable = 0;
 	ipsec_xform->options.ip_reassembly_en = 0;
-	ipsec_xform->options.reserved_opts = 0;
 
 	ipsec_xform->direction = p->encrypt ?
 		RTE_SECURITY_IPSEC_SA_DIR_EGRESS :
lib/security/rte_security.c +17 -0
index c4d64bb8e9..2391cd0aa2 100644
@@ -27,7 +27,10 @@
 } while (0)
 
 #define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+#define RTE_SECURITY_OOP_DYNFIELD_NAME "rte_security_oop_dynfield_metadata"
+
 int rte_security_dynfield_offset = -1;
+int rte_security_oop_dynfield_offset = -1;
 
 int
 rte_security_dynfield_register(void)
@@ -42,6 +45,20 @@ rte_security_dynfield_register(void)
 	return rte_security_dynfield_offset;
 }
 
+int
+rte_security_oop_dynfield_register(void)
+{
+	static const struct rte_mbuf_dynfield dynfield_desc = {
+		.name = RTE_SECURITY_OOP_DYNFIELD_NAME,
+		.size = sizeof(rte_security_oop_dynfield_t),
+		.align = __alignof__(rte_security_oop_dynfield_t),
+	};
+
+	rte_security_oop_dynfield_offset =
+		rte_mbuf_dynfield_register(&dynfield_desc);
+	return rte_security_oop_dynfield_offset;
+}
+
 void *
 rte_security_session_create(struct rte_security_ctx *instance,
 			    struct rte_security_session_conf *conf,
lib/security/rte_security.h +34 -6
index 3b2df526ba..3996ab21a1 100644
@@ -274,14 +274,16 @@ struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t ip_reassembly_en : 1;
 
-	/** Reserved bit fields for future extension
+	/** Enable out of place processing on inline inbound packets.
 	 *
-	 * User should ensure reserved_opts is cleared as it may change in
-	 * subsequent releases to support new options.
-	 *
-	 * Note: Reduce number of bits in reserved_opts for every new option.
+	 * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+	 *      inbound SA if supported by driver. PMD need to register mbuf
+	 *      dynamic field using rte_security_oop_dynfield_register()
+	 *      and security session creation would fail if dynfield is not
+	 *      registered successfully.
+	 * * 0: Disable OOP processing for this session (default).
 	 */
-	uint32_t reserved_opts : 17;
+	uint32_t ingress_oop : 1;
 };
 
 /** IPSec security association direction */
@@ -821,6 +823,13 @@ typedef uint64_t rte_security_dynfield_t;
 /** Dynamic mbuf field for device-specific metadata */
 extern int rte_security_dynfield_offset;
 
+/** Out-of-Place(OOP) processing field type */
+typedef struct rte_mbuf *rte_security_oop_dynfield_t;
+/** Dynamic mbuf field for pointer to original mbuf for
+ * OOP processing session.
+ */
+extern int rte_security_oop_dynfield_offset;
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
@@ -843,6 +852,25 @@ rte_security_dynfield(struct rte_mbuf *mbuf)
 		rte_security_dynfield_t *);
 }
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for original mbuf pointer when
+ * Out-Of-Place(OOP) processing is enabled in security session.
+ *
+ * @param       mbuf    packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_oop_dynfield_t *
+rte_security_oop_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+			rte_security_oop_dynfield_offset,
+			rte_security_oop_dynfield_t *);
+}
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
lib/security/rte_security_driver.h +8 -0
index 31444a05d3..d5602650c2 100644
@@ -197,6 +197,14 @@ typedef int (*security_macsec_sa_stats_get_t)(void *device, uint16_t sa_id,
 __rte_internal
 int rte_security_dynfield_register(void);
 
+/**
+ * @internal
+ * Register mbuf dynamic field for Security inline ingress Out-of-Place(OOP)
+ * processing.
+ */
+__rte_internal
+int rte_security_oop_dynfield_register(void);
+
 /**
  * Update the mbuf with provided metadata.
  *
lib/security/version.map +2 -0
index b2097a969d..86f976a302 100644
@@ -23,10 +23,12 @@ EXPERIMENTAL {
 	rte_security_macsec_sc_stats_get;
 	rte_security_session_stats_get;
 	rte_security_session_update;
+	rte_security_oop_dynfield_offset;
 };
 
 INTERNAL {
 	global:
 
 	rte_security_dynfield_register;
+	rte_security_oop_dynfield_register;
 };
Signature · 1 line
2.25.1
#19 lore raw

PATCH 2/3 net/cnxk: support inline ingress out of place session

Add support for inline ingress session with out-of-place support.

---
 drivers/event/cnxk/cn10k_worker.h   |  12 +-
 drivers/net/cnxk/cn10k_ethdev.c     |  13 +-
 drivers/net/cnxk/cn10k_ethdev_sec.c |  43 +++++++
 drivers/net/cnxk/cn10k_rx.h         | 181 ++++++++++++++++++++++++----
 drivers/net/cnxk/cn10k_rxtx.h       |   1 +
 drivers/net/cnxk/cnxk_ethdev.h      |   9 ++
 6 files changed, 229 insertions(+), 30 deletions(-)
drivers/event/cnxk/cn10k_worker.h +11 -1
index b4ee023723..46bfa9dd9d 100644
@@ -59,9 +59,9 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 	uint16_t lmt_id, d_off;
 	struct rte_mbuf **wqe;
 	struct rte_mbuf *mbuf;
+	uint64_t sa_base = 0;
 	uintptr_t cpth = 0;
 	uint8_t loff = 0;
-	uint64_t sa_base;
 	int i;
 
 	mbuf_init |= ((uint64_t)port_id) << 48;
@@ -125,6 +125,11 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 
 			cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
 
+			/* Update mempool pointer for full mode pkt */
+			if ((flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				mbuf->pool = mp;
+
 			mbuf = nix_sec_meta_to_mbuf_sc(cq_w1, cq_w5, sa_base, laddr,
 						       &loff, mbuf, d_off,
 						       flags, mbuf_init);
@@ -199,6 +204,11 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
 			mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
 			meta_aura = mp ? mp->pool_id : m->pool->pool_id;
 
+			/* Update mempool pointer for full mode pkt */
+			if (mp && (flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				((struct rte_mbuf *)mbuf)->pool = mp;
+
 			mbuf = (uint64_t)nix_sec_meta_to_mbuf_sc(
 				cq_w1, cq_w5, sa_base, (uintptr_t)&iova, &loff,
 				(struct rte_mbuf *)mbuf, d_off, flags,
drivers/net/cnxk/cn10k_ethdev.c +9 -4
index 4c4acc7cf0..f1504a6873 100644
@@ -355,11 +355,13 @@ cn10k_nix_rx_queue_meta_aura_update(struct rte_eth_dev *eth_dev)
 		rq = &dev->rqs[i];
 		rxq = eth_dev->data->rx_queues[i];
 		rxq->meta_aura = rq->meta_aura_handle;
+		rxq->meta_pool = dev->nix.meta_mempool;
 		/* Assume meta packet from normal aura if meta aura is not setup
 		 */
 		if (!rxq->meta_aura) {
 			rxq_sp = cnxk_eth_rxq_to_sp(rxq);
 			rxq->meta_aura = rxq_sp->qconf.mp->pool_id;
+			rxq->meta_pool = (uintptr_t)rxq_sp->qconf.mp;
 		}
 	}
 	/* Store mempool in lookup mem */
@@ -639,14 +641,17 @@ cn10k_nix_reassembly_conf_set(struct rte_eth_dev *eth_dev,
 
 	if (!conf->flags) {
 		/* Clear offload flags on disable */
-		dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		if (!dev->inb.nb_oop)
+			dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		dev->inb.reass_en = false;
 		return 0;
 	}
 
-	rc = roc_nix_reassembly_configure(conf->timeout_ms,
-				conf->max_frags);
-	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+	rc = roc_nix_reassembly_configure(conf->timeout_ms, conf->max_frags);
+	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
 		dev->rx_offload_flags |= NIX_RX_REAS_F;
+		dev->inb.reass_en = true;
+	}
 
 	return rc;
 }
drivers/net/cnxk/cn10k_ethdev_sec.c +43 -0

97 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +156 -25

295 lines not on this page · raw message

drivers/net/cnxk/cn10k_rxtx.h +1 -0
index b4287e2864..aeffc4ac92 100644
@@ -78,6 +78,7 @@ struct cn10k_eth_rxq {
 	uint64_t sa_base;
 	uint64_t lmt_base;
 	uint64_t meta_aura;
+	uintptr_t meta_pool;
 	uint16_t rq;
 	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
drivers/net/cnxk/cnxk_ethdev.h +9 -0
index ed531fb277..2b9ff11a6a 100644
@@ -219,6 +219,9 @@ struct cnxk_eth_sec_sess {
 
 	/* Inbound session on inl dev */
 	bool inl_dev;
+
+	/* Out-Of-Place processing */
+	bool inb_oop;
 };
 
 TAILQ_HEAD(cnxk_eth_sec_sess_list, cnxk_eth_sec_sess);
@@ -246,6 +249,12 @@ struct cnxk_eth_dev_sec_inb {
 	/* DPTR for WRITE_SA microcode op */
 	void *sa_dptr;
 
+	/* Number of oop sessions */
+	uint16_t nb_oop;
+
+	/* Reassembly enabled */
+	bool reass_en;
+
 	/* Lock to synchronize sa setup/release */
 	rte_spinlock_t lock;
 };
Signature · 1 line
2.25.1
#20 lore raw

PATCH 3/3 test/security: add unittest for inline ingress oop

In reply to Nithin Dabilpuram

Add unittest for inline ingress out-of-place processing.

---
 app/test/test_cryptodev_security_ipsec.c |  8 +++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 app/test/test_security_inline_proto.c    | 85 ++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
app/test/test_cryptodev_security_ipsec.c +8 -0
index 7a8688c692..be9e246bfe 100644
@@ -213,6 +213,14 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
 		}
 	}
 
+	if (ipsec_xform->options.ingress_oop == 1 &&
+	    sec_cap->ipsec.options.ingress_oop == 0) {
+		if (!silent)
+			RTE_LOG(INFO, USER1,
+				"Inline Ingress OOP processing is not supported\n");
+		return -ENOTSUP;
+	}
+
 	return 0;
 }
 
app/test/test_cryptodev_security_ipsec.h +1 -0
index 92e641ba0b..5606ec056d 100644
@@ -110,6 +110,7 @@ struct ipsec_test_flags {
 	bool ah;
 	uint32_t plaintext_len;
 	int nb_segs_in_mbuf;
+	bool inb_oop;
 };
 
 struct crypto_param {
app/test/test_security_inline_proto.c +85 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#21 lore raw
In reply to Nithin Dabilpuram
Quoted 14 lines

Subject: [PATCH 1/3] security: introduce out of place support for inline ingress

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

Quoted 7 lines

Also remove reserved_opts field from the rte_security_ipsec_sa_options struct as mentioned in deprecation notice.

---
v1:
- Removed reserved_opts field from sa_options struct

Please update release notes and deprecation notice for this change.

#22 lore raw

PATCH v2 1/3 security: introduce out of place support for inline ingress

In reply to Nithin Dabilpuram

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

Also remove reserved_opts field from the rte_security_ipsec_sa_options struct as mentioned in deprecation notice.

---

v2:
- Fix documentation issue in 1/3 and update release notes

v1:
- Removed reserved_opts field from sa_options struct

 doc/guides/rel_notes/deprecation.rst   |  5 ----
 doc/guides/rel_notes/release_23_11.rst |  8 ++++++
 lib/pipeline/rte_swx_ipsec.c           |  1 -
 lib/security/rte_security.c            | 17 +++++++++++
 lib/security/rte_security.h            | 40 ++++++++++++++++++++++----
 lib/security/rte_security_driver.h     |  8 ++++++
 lib/security/version.map               |  2 ++
 7 files changed, 69 insertions(+), 12 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -5
index bcd02e7762..8311035f2d 100644
@@ -147,11 +147,6 @@ Deprecation Notices
 * security: Hide structures ``rte_security_ops`` and ``rte_security_ctx``
   as these are internal to DPDK library and drivers.
 
-* security: New SA option ``ingress_oop`` would be added in structure
-  ``rte_security_ipsec_sa_options`` to support out of place processing
-  for inline inbound SA from DPDK 23.11. ``reserved_opts`` field in the
-  same struct would be removed as discussed in techboard meeting.
-
 * eventdev: The single-event (non-burst) enqueue and dequeue operations,
   used by static inline burst enqueue and dequeue functions in ``rte_eventdev.h``,
   will be removed in DPDK 23.11.
doc/guides/rel_notes/release_23_11.rst +8 -0
index 55ba7c16ae..85d4a929b0 100644
@@ -86,6 +86,10 @@ New Features
 
   Enabled support for QAT 2.0c (4944) devices in QAT crypto driver.
 
+* **Added out of place processing support for inline ingress security session.**
+
+  Similar to out of place processing support for lookaside security session, added
+  the same support for inline ingress security session.
 
 Removed Items
 -------------
@@ -109,6 +113,8 @@ Removed Items
   ``rte_crypto_auth_algorithm_strings``, ``rte_crypto_aead_algorithm_strings`` and
   ``rte_crypto_asym_xform_strings``.
 
+* security: Removed deprecated field ``reserved_opts`` from struct
+  ``rte_security_ipsec_sa_options``.
 
 API Changes
 -----------
@@ -141,6 +147,8 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* security: struct ``rte_security_ipsec_sa_options`` was updated due to inline
+  out-of-place feature addition.
 
 Known Issues
 ------------
lib/pipeline/rte_swx_ipsec.c +0 -1
index 6c217ee797..28576c2a48 100644
@@ -1555,7 +1555,6 @@ ipsec_xform_get(struct rte_swx_ipsec_sa_params *p,
 	ipsec_xform->options.ip_csum_enable = 0;
 	ipsec_xform->options.l4_csum_enable = 0;
 	ipsec_xform->options.ip_reassembly_en = 0;
-	ipsec_xform->options.reserved_opts = 0;
 
 	ipsec_xform->direction = p->encrypt ?
 		RTE_SECURITY_IPSEC_SA_DIR_EGRESS :
lib/security/rte_security.c +17 -0
index 2d729b735b..42af4a2c35 100644
@@ -27,7 +27,10 @@
 } while (0)
 
 #define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+#define RTE_SECURITY_OOP_DYNFIELD_NAME "rte_security_oop_dynfield_metadata"
+
 int rte_security_dynfield_offset = -1;
+int rte_security_oop_dynfield_offset = -1;
 
 int
 rte_security_dynfield_register(void)
@@ -42,6 +45,20 @@ rte_security_dynfield_register(void)
 	return rte_security_dynfield_offset;
 }
 
+int
+rte_security_oop_dynfield_register(void)
+{
+	static const struct rte_mbuf_dynfield dynfield_desc = {
+		.name = RTE_SECURITY_OOP_DYNFIELD_NAME,
+		.size = sizeof(rte_security_oop_dynfield_t),
+		.align = __alignof__(rte_security_oop_dynfield_t),
+	};
+
+	rte_security_oop_dynfield_offset =
+		rte_mbuf_dynfield_register(&dynfield_desc);
+	return rte_security_oop_dynfield_offset;
+}
+
 void *
 rte_security_session_create(struct rte_security_ctx *instance,
 			    struct rte_security_session_conf *conf,
lib/security/rte_security.h +34 -6
index 439bbb957f..da58fe1f14 100644
@@ -273,14 +273,16 @@ struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t ip_reassembly_en : 1;
 
-	/** Reserved bit fields for future extension
+	/** Enable out of place processing on inline inbound packets.
 	 *
-	 * User should ensure reserved_opts is cleared as it may change in
-	 * subsequent releases to support new options.
-	 *
-	 * Note: Reduce number of bits in reserved_opts for every new option.
+	 * * 1: Enable driver to perform Out-of-place(OOP) processing for this inline
+	 *      inbound SA if supported by driver. PMD need to register mbuf
+	 *      dynamic field using rte_security_oop_dynfield_register()
+	 *      and security session creation would fail if dynfield is not
+	 *      registered successfully.
+	 * * 0: Disable OOP processing for this session (default).
 	 */
-	uint32_t reserved_opts : 17;
+	uint32_t ingress_oop : 1;
 };
 
 /** IPSec security association direction */
@@ -825,6 +827,13 @@ typedef uint64_t rte_security_dynfield_t;
 /** Dynamic mbuf field for device-specific metadata */
 extern int rte_security_dynfield_offset;
 
+/** Out-of-Place(OOP) processing field type */
+typedef struct rte_mbuf *rte_security_oop_dynfield_t;
+/** Dynamic mbuf field for pointer to original mbuf for
+ * OOP processing session.
+ */
+extern int rte_security_oop_dynfield_offset;
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
@@ -847,6 +856,25 @@ rte_security_dynfield(struct rte_mbuf *mbuf)
 		rte_security_dynfield_t *);
 }
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for original mbuf pointer when
+ * Out-Of-Place(OOP) processing is enabled in security session.
+ *
+ * @param       mbuf    packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_oop_dynfield_t *
+rte_security_oop_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+			rte_security_oop_dynfield_offset,
+			rte_security_oop_dynfield_t *);
+}
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
lib/security/rte_security_driver.h +8 -0
index 31444a05d3..1e6a6ef8e3 100644
@@ -197,6 +197,14 @@ typedef int (*security_macsec_sa_stats_get_t)(void *device, uint16_t sa_id,
 __rte_internal
 int rte_security_dynfield_register(void);
 
+/**
+ * @internal
+ * Register mbuf dynamic field for security inline ingress Out-of-Place(OOP)
+ * processing.
+ */
+__rte_internal
+int rte_security_oop_dynfield_register(void);
+
 /**
  * Update the mbuf with provided metadata.
  *
lib/security/version.map +2 -0
index b2097a969d..86f976a302 100644
@@ -23,10 +23,12 @@ EXPERIMENTAL {
 	rte_security_macsec_sc_stats_get;
 	rte_security_session_stats_get;
 	rte_security_session_update;
+	rte_security_oop_dynfield_offset;
 };
 
 INTERNAL {
 	global:
 
 	rte_security_dynfield_register;
+	rte_security_oop_dynfield_register;
 };
Signature · 1 line
2.25.1
#23 lore raw

PATCH v2 2/3 net/cnxk: support inline ingress out of place session

Add support for inline ingress session with out-of-place support.

---
 drivers/event/cnxk/cn10k_worker.h   |  12 +-
 drivers/net/cnxk/cn10k_ethdev.c     |  13 +-
 drivers/net/cnxk/cn10k_ethdev_sec.c |  43 +++++++
 drivers/net/cnxk/cn10k_rx.h         | 181 ++++++++++++++++++++++++----
 drivers/net/cnxk/cn10k_rxtx.h       |   1 +
 drivers/net/cnxk/cnxk_ethdev.h      |   9 ++
 6 files changed, 229 insertions(+), 30 deletions(-)
drivers/event/cnxk/cn10k_worker.h +11 -1
index b4ee023723..46bfa9dd9d 100644
@@ -59,9 +59,9 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 	uint16_t lmt_id, d_off;
 	struct rte_mbuf **wqe;
 	struct rte_mbuf *mbuf;
+	uint64_t sa_base = 0;
 	uintptr_t cpth = 0;
 	uint8_t loff = 0;
-	uint64_t sa_base;
 	int i;
 
 	mbuf_init |= ((uint64_t)port_id) << 48;
@@ -125,6 +125,11 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struc
 
 			cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
 
+			/* Update mempool pointer for full mode pkt */
+			if ((flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				mbuf->pool = mp;
+
 			mbuf = nix_sec_meta_to_mbuf_sc(cq_w1, cq_w5, sa_base, laddr,
 						       &loff, mbuf, d_off,
 						       flags, mbuf_init);
@@ -199,6 +204,11 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
 			mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
 			meta_aura = mp ? mp->pool_id : m->pool->pool_id;
 
+			/* Update mempool pointer for full mode pkt */
+			if (mp && (flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
+			    !((*(uint64_t *)cpth) & BIT(15)))
+				((struct rte_mbuf *)mbuf)->pool = mp;
+
 			mbuf = (uint64_t)nix_sec_meta_to_mbuf_sc(
 				cq_w1, cq_w5, sa_base, (uintptr_t)&iova, &loff,
 				(struct rte_mbuf *)mbuf, d_off, flags,
drivers/net/cnxk/cn10k_ethdev.c +9 -4
index 4c4acc7cf0..f1504a6873 100644
@@ -355,11 +355,13 @@ cn10k_nix_rx_queue_meta_aura_update(struct rte_eth_dev *eth_dev)
 		rq = &dev->rqs[i];
 		rxq = eth_dev->data->rx_queues[i];
 		rxq->meta_aura = rq->meta_aura_handle;
+		rxq->meta_pool = dev->nix.meta_mempool;
 		/* Assume meta packet from normal aura if meta aura is not setup
 		 */
 		if (!rxq->meta_aura) {
 			rxq_sp = cnxk_eth_rxq_to_sp(rxq);
 			rxq->meta_aura = rxq_sp->qconf.mp->pool_id;
+			rxq->meta_pool = (uintptr_t)rxq_sp->qconf.mp;
 		}
 	}
 	/* Store mempool in lookup mem */
@@ -639,14 +641,17 @@ cn10k_nix_reassembly_conf_set(struct rte_eth_dev *eth_dev,
 
 	if (!conf->flags) {
 		/* Clear offload flags on disable */
-		dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		if (!dev->inb.nb_oop)
+			dev->rx_offload_flags &= ~NIX_RX_REAS_F;
+		dev->inb.reass_en = false;
 		return 0;
 	}
 
-	rc = roc_nix_reassembly_configure(conf->timeout_ms,
-				conf->max_frags);
-	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
+	rc = roc_nix_reassembly_configure(conf->timeout_ms, conf->max_frags);
+	if (!rc && dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
 		dev->rx_offload_flags |= NIX_RX_REAS_F;
+		dev->inb.reass_en = true;
+	}
 
 	return rc;
 }
drivers/net/cnxk/cn10k_ethdev_sec.c +43 -0

97 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +156 -25

295 lines not on this page · raw message

drivers/net/cnxk/cn10k_rxtx.h +1 -0
index b4287e2864..aeffc4ac92 100644
@@ -78,6 +78,7 @@ struct cn10k_eth_rxq {
 	uint64_t sa_base;
 	uint64_t lmt_base;
 	uint64_t meta_aura;
+	uintptr_t meta_pool;
 	uint16_t rq;
 	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
drivers/net/cnxk/cnxk_ethdev.h +9 -0
index ed531fb277..2b9ff11a6a 100644
@@ -219,6 +219,9 @@ struct cnxk_eth_sec_sess {
 
 	/* Inbound session on inl dev */
 	bool inl_dev;
+
+	/* Out-Of-Place processing */
+	bool inb_oop;
 };
 
 TAILQ_HEAD(cnxk_eth_sec_sess_list, cnxk_eth_sec_sess);
@@ -246,6 +249,12 @@ struct cnxk_eth_dev_sec_inb {
 	/* DPTR for WRITE_SA microcode op */
 	void *sa_dptr;
 
+	/* Number of oop sessions */
+	uint16_t nb_oop;
+
+	/* Reassembly enabled */
+	bool reass_en;
+
 	/* Lock to synchronize sa setup/release */
 	rte_spinlock_t lock;
 };
Signature · 1 line
2.25.1
#24 lore raw

PATCH v2 3/3 test/security: add unittest for inline ingress oop

In reply to Nithin Dabilpuram

Add unittest for inline ingress out-of-place processing.

---
 app/test/test_cryptodev_security_ipsec.c |  8 +++
 app/test/test_cryptodev_security_ipsec.h |  1 +
 app/test/test_security_inline_proto.c    | 85 ++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
app/test/test_cryptodev_security_ipsec.c +8 -0
index 7a8688c692..be9e246bfe 100644
@@ -213,6 +213,14 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
 		}
 	}
 
+	if (ipsec_xform->options.ingress_oop == 1 &&
+	    sec_cap->ipsec.options.ingress_oop == 0) {
+		if (!silent)
+			RTE_LOG(INFO, USER1,
+				"Inline Ingress OOP processing is not supported\n");
+		return -ENOTSUP;
+	}
+
 	return 0;
 }
 
app/test/test_cryptodev_security_ipsec.h +1 -0
index 92e641ba0b..5606ec056d 100644
@@ -110,6 +110,7 @@ struct ipsec_test_flags {
 	bool ah;
 	uint32_t plaintext_len;
 	int nb_segs_in_mbuf;
+	bool inb_oop;
 };
 
 struct crypto_param {
app/test/test_security_inline_proto.c +85 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
Applied
#25 lore raw
In reply to Nithin Dabilpuram
Quoted 15 lines

Subject: [PATCH v2 1/3] security: introduce out of place support for inline ingress

Similar to out of place(OOP) processing support that exists for Lookaside crypto/security sessions, Inline ingress security sessions may also need out of place processing in usecases where original encrypted packet needs to be retained for post processing. So for NIC's which have such a kind of HW support, a new SA option is provided to indicate whether OOP needs to be enabled on that Inline ingress security session or not.

Since for inline ingress sessions, packet is not received by CPU until the processing is done, we can only have per-SA option and not per-packet option like Lookaside sessions.

Quoted 8 lines

Also remove reserved_opts field from the rte_security_ipsec_sa_options struct as mentioned in deprecation notice.

---

v2:
- Fix documentation issue in 1/3 and update release notes

Applied to dpdk-next-crypto
Thanks.