Skip to contentSkip to conversation

net/cnxk: support for inline ipsec

PATCH Superseded Nithin Dabilpuram 3 participants 91 messages Sep 2, 2021 – Oct 6, 2021 Page 1 of 2

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

cover net/cnxk: support for inline ipsec

Support for inline ipsec in CN9K event mode and in Cn10K event mode and poll mode.

Depends-on: series-18524 ("Crypto adapter support for Marvell CNXK driver)
Depends-on: series-18262 ("security: Improve inline fast path routines")
Depends-on: series-18562 ("add lookaside IPsec additional features)

Kommula Shiva Shankar (1):
common/cnxk: add cq enable support in nix Tx path

Nithin Dabilpuram (17):
common/cnxk: add helper API to dump cpt parse header common/cnxk: allow reuse of SSO API for inline dev common/cnxk: change nix debug API and queue API interface common/cnxk: add nix inline device irq API common/cnxk: add nix inline device init and fini common/cnxk: add nix inline inbound and outbound support API common/cnxk: dump cpt lf registers on error intr common/cnxk: align cpt lf enable/disable sequence common/cnxk: restore nix sqb pool limit before destroy common/cnxk: setup aura bp conf based on nix net/cnxk: add inline security support for cn9k net/cnxk: add inline security support for cn10k net/cnxk: add cn9k Rx support for security offload net/cnxk: add cn9k Tx support for security offload net/cnxk: add cn10k Rx support for security offload net/cnxk: add cn10k Tx support for security offload net/cnxk: reflect globally enabled offloads in queue conf

Satheesh Paul (2):
common/cnxk: add inline IPsec support in rte flow net/cnxk: add devargs for configuring channel mask

Srujana Challa (7):
common/cnxk: add security support for cn9k fast path common/cnxk: add anti-replay check implementation for cn9k net/cnxk: add cn9k anti replay support for security offload net/cnxk: add cn10k IPsec transport mode support net/cnxk: update ethertype for mixed IPsec tunnel versions net/cnxk: allow zero udp6 checksum for non inline device net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

 doc/guides/nics/cnxk.rst                         |  122 +++
 doc/guides/rel_notes/release_21_11.rst           |    5 +
 drivers/common/cnxk/cnxk_security.c              |  212 +++++
 drivers/common/cnxk/cnxk_security.h              |   12 +
 drivers/common/cnxk/cnxk_security_ar.h           |  184 ++++
 drivers/common/cnxk/hw/cpt.h                     |   19 +
 drivers/common/cnxk/meson.build                  |    3 +
 drivers/common/cnxk/roc_api.h                    |   49 +-
 drivers/common/cnxk/roc_constants.h              |   58 ++
 drivers/common/cnxk/roc_cpt.c                    |   54 +-
 drivers/common/cnxk/roc_cpt.h                    |   10 +
 drivers/common/cnxk/roc_cpt_debug.c              |   63 +-
 drivers/common/cnxk/roc_cpt_priv.h               |    1 +
 drivers/common/cnxk/roc_idev.c                   |    2 +
 drivers/common/cnxk/roc_idev_priv.h              |    3 +
 drivers/common/cnxk/roc_io.h                     |    9 +
 drivers/common/cnxk/roc_io_generic.h             |    3 +-
 drivers/common/cnxk/roc_irq.c                    |    7 +-
 drivers/common/cnxk/roc_nix.c                    |    2 +-
 drivers/common/cnxk/roc_nix.h                    |    7 +
 drivers/common/cnxk/roc_nix_debug.c              |  168 +++-
 drivers/common/cnxk/roc_nix_fc.c                 |   23 +-
 drivers/common/cnxk/roc_nix_inl.c                |  739 ++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h                |  169 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c            |  547 ++++++++++++
 drivers/common/cnxk/roc_nix_inl_dev_irq.c        |  359 ++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h           |   62 ++
 drivers/common/cnxk/roc_nix_priv.h               |   31 +
 drivers/common/cnxk/roc_nix_queue.c              |   98 ++-
 drivers/common/cnxk/roc_npc.c                    |   27 +-
 drivers/common/cnxk/roc_npc_mcam.c               |   28 +-
 drivers/common/cnxk/roc_platform.h               |   11 +-
 drivers/common/cnxk/roc_priv.h                   |    3 +
 drivers/common/cnxk/roc_sso.c                    |   52 +-
 drivers/common/cnxk/roc_sso_priv.h               |    9 +
 drivers/common/cnxk/version.map                  |   33 +
 drivers/event/cnxk/cn10k_eventdev.c              |   93 +-
 drivers/event/cnxk/cn10k_worker.h                |  147 +++-
 drivers/event/cnxk/cn10k_worker_deq.c            |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c      |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c        |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c     |    2 +-
 drivers/event/cnxk/cn9k_eventdev.c               |  180 ++--
 drivers/event/cnxk/cn9k_worker.h                 |  171 +++-
 drivers/event/cnxk/cn9k_worker_deq.c             |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c       |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c         |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c        |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c  |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c    |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |    2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c         |   36 +-
 drivers/net/cnxk/cn10k_ethdev.c                  |   36 +-
 drivers/net/cnxk/cn10k_ethdev.h                  |   48 ++
 drivers/net/cnxk/cn10k_ethdev_sec.c              |  492 +++++++++++
 drivers/net/cnxk/cn10k_rx.c                      |   31 +-
 drivers/net/cnxk/cn10k_rx.h                      |  649 +++++++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_rx_vec.c                  |    4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c             |    4 +-
 drivers/net/cnxk/cn10k_tx.c                      |   31 +-
 drivers/net/cnxk/cn10k_tx.h                      | 1006 +++++++++++++++++++---
 drivers/net/cnxk/cn10k_tx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_tx_vec.c                  |    2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c             |    2 +-
 drivers/net/cnxk/cn9k_ethdev.c                   |   23 +
 drivers/net/cnxk/cn9k_ethdev.h                   |   64 ++
 drivers/net/cnxk/cn9k_ethdev_sec.c               |  382 ++++++++
 drivers/net/cnxk/cn9k_rx.c                       |   31 +-
 drivers/net/cnxk/cn9k_rx.h                       |  493 +++++++++--
 drivers/net/cnxk/cn9k_rx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cn9k_tx.c                       |   29 +-
 drivers/net/cnxk/cn9k_tx.h                       |  393 ++++++---
 drivers/net/cnxk/cn9k_tx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cnxk_ethdev.c                   |  221 ++++-
 drivers/net/cnxk/cnxk_ethdev.h                   |  124 ++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c           |   88 +-
 drivers/net/cnxk/cnxk_ethdev_sec.c               |  315 +++++++
 drivers/net/cnxk/cnxk_lookup.c                   |   50 +-
 drivers/net/cnxk/meson.build                     |    3 +
 drivers/net/cnxk/version.map                     |    5 +
 usertools/dpdk-devbind.py                        |    8 +-
 93 files changed, 7501 insertions(+), 896 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
Signature · 1 line
2.8.4
#1 lore raw

PATCH 1/27 common/cnxk: add security support for cn9k fast path

From: Srujana Challa <[email protected]>

Add security support to init cn9k fast path SA data for AES GCM and AES CBC + HMAC SHA1.

---
 drivers/common/cnxk/cnxk_security.c | 211 ++++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/cnxk_security.h |  12 ++
 drivers/common/cnxk/version.map     |   4 +
 3 files changed, 227 insertions(+)
drivers/common/cnxk/cnxk_security.c +211 -0
index 4f7fd1b..c25b3fd 100644
@@ -383,6 +383,217 @@ cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa)
 	return !!sa->w2.s.valid;
 }
 
+static inline int
+ipsec_xfrm_verify(struct rte_security_ipsec_xform *ipsec_xfrm,
+		  struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	if (crypto_xfrm->next == NULL)
+		return -EINVAL;
+
+	if (ipsec_xfrm->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_AUTH ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_CIPHER)
+			return -EINVAL;
+	} else {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_CIPHER ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_AUTH)
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int
+onf_ipsec_sa_common_param_fill(struct roc_ie_onf_sa_ctl *ctl, uint8_t *salt,
+			       uint8_t *cipher_key, uint8_t *hmac_opad_ipad,
+			       struct rte_security_ipsec_xform *ipsec_xfrm,
+			       struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_crypto_sym_xform *auth_xfrm, *cipher_xfrm;
+	int rc, length, auth_key_len;
+	const uint8_t *key = NULL;
+
+	/* Set direction */
+	switch (ipsec_xfrm->direction) {
+	case RTE_SECURITY_IPSEC_SA_DIR_INGRESS:
+		ctl->direction = ROC_IE_SA_DIR_INBOUND;
+		auth_xfrm = crypto_xfrm;
+		cipher_xfrm = crypto_xfrm->next;
+		break;
+	case RTE_SECURITY_IPSEC_SA_DIR_EGRESS:
+		ctl->direction = ROC_IE_SA_DIR_OUTBOUND;
+		cipher_xfrm = crypto_xfrm;
+		auth_xfrm = crypto_xfrm->next;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set protocol - ESP vs AH */
+	switch (ipsec_xfrm->proto) {
+	case RTE_SECURITY_IPSEC_SA_PROTO_ESP:
+		ctl->ipsec_proto = ROC_IE_SA_PROTOCOL_ESP;
+		break;
+	case RTE_SECURITY_IPSEC_SA_PROTO_AH:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set mode - transport vs tunnel */
+	switch (ipsec_xfrm->mode) {
+	case RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TRANSPORT;
+		break;
+	case RTE_SECURITY_IPSEC_SA_MODE_TUNNEL:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TUNNEL;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set encryption algorithm */
+	if (crypto_xfrm->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
+		length = crypto_xfrm->aead.key.length;
+
+		switch (crypto_xfrm->aead.algo) {
+		case RTE_CRYPTO_AEAD_AES_GCM:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_GCM;
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_NULL;
+			memcpy(salt, &ipsec_xfrm->salt, 4);
+			key = crypto_xfrm->aead.key.data;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+	} else {
+		rc = ipsec_xfrm_verify(ipsec_xfrm, crypto_xfrm);
+		if (rc)
+			return rc;
+
+		switch (cipher_xfrm->cipher.algo) {
+		case RTE_CRYPTO_CIPHER_AES_CBC:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_CBC;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+		switch (auth_xfrm->auth.algo) {
+		case RTE_CRYPTO_AUTH_SHA1_HMAC:
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_SHA1;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+		auth_key_len = auth_xfrm->auth.key.length;
+		if (auth_key_len < 20 || auth_key_len > 64)
+			return -ENOTSUP;
+
+		key = cipher_xfrm->cipher.key.data;
+		length = cipher_xfrm->cipher.key.length;
+
+		ipsec_hmac_opad_ipad_gen(auth_xfrm, hmac_opad_ipad);
+	}
+
+	switch (length) {
+	case ROC_CPT_AES128_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
+		break;
+	case ROC_CPT_AES192_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_192;
+		break;
+	case ROC_CPT_AES256_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_256;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	memcpy(cipher_key, key, length);
+
+	if (ipsec_xfrm->options.esn)
+		ctl->esn_en = 1;
+
+	ctl->spi = rte_cpu_to_be_32(ipsec_xfrm->spi);
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_security_ipsec_tunnel_param *tunnel = &ipsec_xfrm->tunnel;
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	/* Fill common params */
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	if (ipsec_xfrm->mode != RTE_SECURITY_IPSEC_SA_MODE_TUNNEL)
+		goto skip_tunnel_info;
+
+	/* Tunnel header info */
+	switch (tunnel->type) {
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV4:
+		memcpy(&sa->ip_src, &tunnel->ipv4.src_ip,
+		       sizeof(struct in_addr));
+		memcpy(&sa->ip_dst, &tunnel->ipv4.dst_ip,
+		       sizeof(struct in_addr));
+		break;
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV6:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+skip_tunnel_info:
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+bool
+cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
+bool
+cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
 uint8_t
 cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo,
 		     enum rte_crypto_auth_algorithm a_algo,
drivers/common/cnxk/cnxk_security.h +12 -0
index 602f583..db97887 100644
@@ -46,4 +46,16 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
 bool __roc_api cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa);
 bool __roc_api cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa);
 
+/* [CN9K, CN10K) */
+int __roc_api
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm);
+int __roc_api
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm);
+bool __roc_api cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa);
+bool __roc_api cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa);
+
 #endif /* _CNXK_SECURITY_H__ */
drivers/common/cnxk/version.map +4 -0
index 34a844b..7814b60 100644
@@ -14,6 +14,10 @@ INTERNAL {
 	cnxk_logtype_sso;
 	cnxk_logtype_tim;
 	cnxk_logtype_tm;
+	cnxk_onf_ipsec_inb_sa_fill;
+	cnxk_onf_ipsec_outb_sa_fill;
+	cnxk_onf_ipsec_inb_sa_valid;
+	cnxk_onf_ipsec_outb_sa_valid;
 	cnxk_ot_ipsec_inb_sa_fill;
 	cnxk_ot_ipsec_outb_sa_fill;
 	cnxk_ot_ipsec_inb_sa_valid;
Signature · 1 line
2.8.4
#2 lore raw

PATCH 2/27 common/cnxk: add helper API to dump cpt parse header

In reply to Nithin Dabilpuram

Add helper API to dump cpt parse header.

---
 drivers/common/cnxk/roc_cpt.h       |  2 ++
 drivers/common/cnxk/roc_cpt_debug.c | 31 +++++++++++++++++++++++++++++++
 drivers/common/cnxk/version.map     |  1 +
 3 files changed, 34 insertions(+)
drivers/common/cnxk/roc_cpt.h +2 -0
index f0f505a..9b55303 100644
@@ -154,4 +154,6 @@ void __roc_api roc_cpt_iq_enable(struct roc_cpt_lf *lf);
 int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
 				   struct roc_cpt_lmtline *lmtline, int lf_id);
 
+void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
+
 #endif /* _ROC_CPT_H_ */
drivers/common/cnxk/roc_cpt_debug.c +31 -0
index 9a9dcba..a6c9004 100644
@@ -5,6 +5,37 @@
 #include "roc_api.h"
 #include "roc_priv.h"
 
+void
+roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
+{
+	plt_print("CPT_PARSE \t0x%p:", cpth);
+
+	/* W0 */
+	plt_print("W0: cookie \t0x%x\t\tmatch_id \t0x%04x\t\terr_sum \t%u \t",
+		  cpth->w0.cookie, cpth->w0.match_id, cpth->w0.err_sum);
+	plt_print("W0: reas_sts \t0x%x\t\tet_owr \t%u\t\tpkt_fmt \t%u \t",
+		  cpth->w0.reas_sts, cpth->w0.et_owr, cpth->w0.pkt_fmt);
+	plt_print("W0: pad_len \t%u\t\tnum_frags \t%u\t\tpkt_out \t%u \t",
+		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
+
+	/* W1 */
+	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+
+	/* W2 */
+	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
+		  cpth->w2.frag_age, cpth->w2.orig_pf_func);
+	plt_print("W2: il3_off \t0x%x\t\tfi_pad \t0x%x\t\tfi_offset \t0x%x \t",
+		  cpth->w2.il3_off, cpth->w2.fi_pad, cpth->w2.fi_offset);
+
+	/* W3 */
+	plt_print("W3: hw_ccode \t0x%x\t\tuc_ccode \t0x%x\t\tspi \t0x%08x",
+		  cpth->w3.hw_ccode, cpth->w3.uc_ccode, cpth->w3.spi);
+
+	/* W4 */
+	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
+		  cpth->esn, cpth->frag1_wqe_ptr);
+}
+
 static int
 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
 {
drivers/common/cnxk/version.map +1 -0
index 7814b60..5dbb21c 100644
@@ -66,6 +66,7 @@ INTERNAL {
 	roc_cpt_lf_fini;
 	roc_cpt_lfs_print;
 	roc_cpt_lmtline_init;
+	roc_cpt_parse_hdr_dump;
 	roc_cpt_rxc_time_cfg;
 	roc_error_msg_get;
 	roc_hash_sha1_gen;
Signature · 1 line
2.8.4
#3 lore raw

PATCH 3/27 common/cnxk: allow reuse of SSO API for inline dev

In reply to Nithin Dabilpuram

Rework interface of sso internal functions to use for nix inline dev's sso LF's.

---
 drivers/common/cnxk/roc_sso.c      | 52 ++++++++++++++++++++++++--------------
 drivers/common/cnxk/roc_sso_priv.h |  9 +++++++
 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/common/cnxk/roc_sso.c +33 -19
index 1ccf262..bdf973f 100644
@@ -6,11 +6,10 @@
 #include "roc_priv.h"
 
 /* Private functions. */
-static int
-sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
+int
+sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
 	     void **rsp)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -41,10 +40,9 @@ sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
 	return 0;
 }
 
-static int
-sso_lf_free(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf)
+int
+sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -152,7 +150,7 @@ sso_rsrc_get(struct roc_sso *roc_sso)
 	return 0;
 }
 
-static void
+void
 sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		    uint16_t hwgrp[], uint16_t n, uint16_t enable)
 {
@@ -172,8 +170,10 @@ sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		k = k ? k : 4;
 		for (j = 0; j < k; j++) {
 			mask[j] = hwgrp[i + j] | enable << 14;
-			enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
-				 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			if (bmp) {
+				enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
+					 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			}
 			plt_sso_dbg("HWS %d Linked to HWGRP %d", hws,
 				    hwgrp[i + j]);
 		}
@@ -388,10 +388,8 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,
 }
 
 int
-roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
-			uint16_t hwgrps)
+sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	struct sso_hw_setconfig *req;
 	int rc = -ENOSPC;
 
@@ -406,9 +404,17 @@ roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
 }
 
 int
-roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
+			uint16_t hwgrps)
 {
 	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_alloc_xaq(dev, npa_aura_id, hwgrps);
+}
+
+int
+sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)
+{
 	struct sso_hw_xaq_release *req;
 
 	req = mbox_alloc_msg_sso_hw_release_xaq_aura(dev->mbox);
@@ -420,6 +426,14 @@ roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
 }
 
 int
+roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+{
+	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_release_xaq(dev, hwgrps);
+}
+
+int
 roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp,
 			   uint8_t weight, uint8_t affinity, uint8_t priority)
 {
@@ -468,13 +482,13 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 		goto hwgrp_atch_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWS, nb_hws, NULL);
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWS, nb_hws, NULL);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWS LFs");
 		goto hws_alloc_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp,
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp,
 			  (void **)&rsp_hwgrp);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWGRP Lfs");
@@ -503,9 +517,9 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 
 	return 0;
 sso_msix_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp);
 hwgrp_alloc_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, nb_hws);
 hws_alloc_fail:
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
 hwgrp_atch_fail:
@@ -523,8 +537,8 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)
 
 	sso_unregister_irqs_priv(roc_sso, &sso->pci_dev->intr_handle,
 				 roc_sso->nb_hws, roc_sso->nb_hwgrp);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
 
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWS);
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
drivers/common/cnxk/roc_sso_priv.h +9 -0
index 5361d4f..8dffa3f 100644
@@ -39,6 +39,15 @@ roc_sso_to_sso_priv(struct roc_sso *roc_sso)
 	return (struct sso *)&roc_sso->reserved[0];
 }
 
+/* SSO LF ops */
+int sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
+		 void **rsp);
+int sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf);
+void sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
+			 uint16_t hwgrp[], uint16_t n, uint16_t enable);
+int sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps);
+int sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps);
+
 /* SSO IRQ */
 int sso_register_irqs_priv(struct roc_sso *roc_sso,
 			   struct plt_intr_handle *handle, uint16_t nb_hws,
Signature · 1 line
2.8.4
#4 lore raw

PATCH 4/27 common/cnxk: change nix debug API and queue API interface

In reply to Nithin Dabilpuram

Change nix debug API and queue API interface for use by internal nix inline device initialization.

---
 drivers/common/cnxk/roc_nix.c       |   2 +-
 drivers/common/cnxk/roc_nix_debug.c | 118 +++++++++++++++++++++++++++---------
 drivers/common/cnxk/roc_nix_priv.h  |  16 +++++
 drivers/common/cnxk/roc_nix_queue.c |  89 +++++++++++++++------------
 4 files changed, 159 insertions(+), 66 deletions(-)
drivers/common/cnxk/roc_nix.c +1 -1
index 23d508b..3ab954e 100644
@@ -300,7 +300,7 @@ sdp_lbk_id_update(struct plt_pci_device *pci_dev, struct nix *nix)
 	}
 }
 
-static inline uint64_t
+uint64_t
 nix_get_blkaddr(struct dev *dev)
 {
 	uint64_t reg;
drivers/common/cnxk/roc_nix_debug.c +91 -27

283 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +16 -0
index 9dc0c88..79c15ea 100644
@@ -348,6 +348,12 @@ int nix_tm_sq_sched_conf(struct nix *nix, struct nix_tm_node *node,
 			 bool rr_quantum_only);
 int nix_tm_prepare_rate_limited_tree(struct roc_nix *roc_nix);
 
+int nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
+		    bool cfg, bool ena);
+int nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
+	       bool ena);
+int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable);
+
 /*
  * TM priv utils.
  */
@@ -393,4 +399,14 @@ void nix_tm_node_free(struct nix_tm_node *node);
 struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc(void);
 void nix_tm_shaper_profile_free(struct nix_tm_shaper_profile *profile);
 
+uint64_t nix_get_blkaddr(struct dev *dev);
+void nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx);
+int nix_lf_gen_reg_dump(uintptr_t nix_lf_base, uint64_t *data);
+int nix_lf_stat_reg_dump(uintptr_t nix_lf_base, uint64_t *data,
+			 uint8_t lf_tx_stats, uint8_t lf_rx_stats);
+int nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
+			uint16_t cints);
+int nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid,
+		  __io void **ctx_p);
+
 #endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_queue.c +51 -38

160 lines not on this page · raw message

Signature · 1 line
2.8.4
#5 lore raw

PATCH 5/27 common/cnxk: add nix inline device irq API

In reply to Nithin Dabilpuram

Add API to setup nix inline device IRQ's.

---
 drivers/common/cnxk/meson.build           |   1 +
 drivers/common/cnxk/roc_api.h             |   3 +
 drivers/common/cnxk/roc_irq.c             |   7 +-
 drivers/common/cnxk/roc_nix_inl.h         |  10 +
 drivers/common/cnxk/roc_nix_inl_dev_irq.c | 359 ++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h    |  57 +++++
 drivers/common/cnxk/roc_platform.h        |   9 +-
 drivers/common/cnxk/roc_priv.h            |   3 +
 8 files changed, 442 insertions(+), 7 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
drivers/common/cnxk/meson.build +1 -0
index 8a551d1..207ca00 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
         'roc_nix_npc.c',
drivers/common/cnxk/roc_api.h +3 -0
index 7dec845..c1af95e 100644
@@ -129,4 +129,7 @@
 /* HASH computation */
 #include "roc_hash.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl.h"
+
 #endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_irq.c +4 -3
index 4c2b4c3..28fe691 100644
@@ -138,9 +138,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
 		irq_init(intr_handle);
 	}
 
-	if (vec > intr_handle->max_intr) {
-		plt_err("Vector=%d greater than max_intr=%d", vec,
-			intr_handle->max_intr);
+	if (vec > intr_handle->max_intr || vec >= PLT_DIM(intr_handle->efds)) {
+		plt_err("Vector=%d greater than max_intr=%d or "
+			"max_efd=%" PRIu64,
+			vec, intr_handle->max_intr, PLT_DIM(intr_handle->efds));
 		return -EINVAL;
 	}
 
drivers/common/cnxk/roc_nix_inl.h new file +10 -0
new file mode 100644
index 0000000..1ec3dda
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _ROC_NIX_INL_H_
+#define _ROC_NIX_INL_H_
+
+/* Inline device SSO Work callback */
+typedef void (*roc_nix_inl_sso_work_cb_t)(uint64_t *gw, void *args);
+
+#endif /* _ROC_NIX_INL_H_ */
drivers/common/cnxk/roc_nix_inl_dev_irq.c new file +359 -0

359 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h new file +57 -0

57 lines not on this page · raw message

drivers/common/cnxk/roc_platform.h +5 -4
index 285b24b..177db3d 100644
@@ -113,10 +113,11 @@
 #define plt_write64(val, addr)                                                 \
 	rte_write64_relaxed((val), (volatile void *)(addr))
 
-#define plt_wmb() rte_wmb()
-#define plt_rmb() rte_rmb()
-#define plt_io_wmb() rte_io_wmb()
-#define plt_io_rmb() rte_io_rmb()
+#define plt_wmb()		rte_wmb()
+#define plt_rmb()		rte_rmb()
+#define plt_io_wmb()		rte_io_wmb()
+#define plt_io_rmb()		rte_io_rmb()
+#define plt_atomic_thread_fence rte_atomic_thread_fence
 
 #define plt_mmap       mmap
 #define PLT_PROT_READ  PROT_READ
drivers/common/cnxk/roc_priv.h +3 -0
index 7494b8d..f72bbd5 100644
@@ -38,4 +38,7 @@
 /* CPT */
 #include "roc_cpt_priv.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl_priv.h"
+
 #endif /* _ROC_PRIV_H_ */
Signature · 1 line
2.8.4
#6 lore raw

PATCH 6/27 common/cnxk: add nix inline device init and fini

In reply to Nithin Dabilpuram

Add support to init and fini nix inline device with NIX LF, SSO LF and SSOW LF for inline inbound IPSec in CN10K.

---
 drivers/common/cnxk/meson.build        |   1 +
 drivers/common/cnxk/roc_api.h          |   2 +
 drivers/common/cnxk/roc_cpt.c          |   7 +-
 drivers/common/cnxk/roc_idev.c         |   2 +
 drivers/common/cnxk/roc_idev_priv.h    |   3 +
 drivers/common/cnxk/roc_nix_debug.c    |  35 +++
 drivers/common/cnxk/roc_nix_inl.h      |  55 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c  | 544 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h |   2 +
 drivers/common/cnxk/roc_platform.h     |   2 +
 drivers/common/cnxk/version.map        |   3 +
 11 files changed, 653 insertions(+), 3 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
drivers/common/cnxk/meson.build +1 -0
index 207ca00..e8940d7 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
drivers/common/cnxk/roc_api.h +2 -0
index c1af95e..53f4e4b 100644
@@ -53,6 +53,8 @@
 #define PCI_DEVID_CNXK_RVU_SDP_PF     0xA0f6
 #define PCI_DEVID_CNXK_RVU_SDP_VF     0xA0f7
 #define PCI_DEVID_CNXK_BPHY	      0xA089
+#define PCI_DEVID_CNXK_RVU_NIX_INL_PF 0xA0F0
+#define PCI_DEVID_CNXK_RVU_NIX_INL_VF 0xA0F1
 
 #define PCI_DEVID_CN9K_CGX  0xA059
 #define PCI_DEVID_CN10K_RPM 0xA060
drivers/common/cnxk/roc_cpt.c +4 -3
index 5e35d1b..3222b3e 100644
@@ -381,11 +381,12 @@ cpt_lfs_alloc(struct dev *dev, uint8_t eng_grpmsk, uint8_t blkaddr,
 	if (blkaddr != RVU_BLOCK_ADDR_CPT0 && blkaddr != RVU_BLOCK_ADDR_CPT1)
 		return -EINVAL;
 
-	PLT_SET_USED(inl_dev_sso);
-
 	req = mbox_alloc_msg_cpt_lf_alloc(mbox);
 	req->nix_pf_func = 0;
-	req->sso_pf_func = idev_sso_pffunc_get();
+	if (inl_dev_sso && nix_inl_dev_pffunc_get())
+		req->sso_pf_func = nix_inl_dev_pffunc_get();
+	else
+		req->sso_pf_func = idev_sso_pffunc_get();
 	req->eng_grpmsk = eng_grpmsk;
 	req->blkaddr = blkaddr;
 
drivers/common/cnxk/roc_idev.c +2 -0
index 1494187..648f37b 100644
@@ -38,6 +38,8 @@ idev_set_defaults(struct idev_cfg *idev)
 	idev->num_lmtlines = 0;
 	idev->bphy = NULL;
 	idev->cpt = NULL;
+	idev->nix_inl_dev = NULL;
+	plt_spinlock_init(&idev->nix_inl_dev_lock);
 	__atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE);
 }
 
drivers/common/cnxk/roc_idev_priv.h +3 -0
index 84e6f1e..2c8309b 100644
@@ -9,6 +9,7 @@
 struct npa_lf;
 struct roc_bphy;
 struct roc_cpt;
+struct nix_inl_dev;
 struct idev_cfg {
 	uint16_t sso_pf_func;
 	uint16_t npa_pf_func;
@@ -20,6 +21,8 @@ struct idev_cfg {
 	uint64_t lmt_base_addr;
 	struct roc_bphy *bphy;
 	struct roc_cpt *cpt;
+	struct nix_inl_dev *nix_inl_dev;
+	plt_spinlock_t nix_inl_dev_lock;
 };
 
 /* Generic */
drivers/common/cnxk/roc_nix_debug.c +35 -0
index 9539bb9..582f5a3 100644
@@ -1213,3 +1213,38 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
 }
+
+void
+roc_nix_inl_dev_dump(struct roc_nix_inl_dev *roc_inl_dev)
+{
+	struct nix_inl_dev *inl_dev =
+		(struct nix_inl_dev *)&roc_inl_dev->reserved;
+	struct dev *dev = &inl_dev->dev;
+
+	nix_dump("nix_inl_dev@%p", inl_dev);
+	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
+	nix_dump("  vf = %d", dev_get_vf(dev->pf_func));
+	nix_dump("  bar2 = 0x%" PRIx64, dev->bar2);
+	nix_dump("  bar4 = 0x%" PRIx64, dev->bar4);
+
+	nix_dump("  \tpci_dev = %p", inl_dev->pci_dev);
+	nix_dump("  \tnix_base = 0x%" PRIxPTR "", inl_dev->nix_base);
+	nix_dump("  \tsso_base = 0x%" PRIxPTR "", inl_dev->sso_base);
+	nix_dump("  \tssow_base = 0x%" PRIxPTR "", inl_dev->ssow_base);
+	nix_dump("  \tnix_msixoff = %d", inl_dev->nix_msixoff);
+	nix_dump("  \tsso_msixoff = %d", inl_dev->sso_msixoff);
+	nix_dump("  \tssow_msixoff = %d", inl_dev->ssow_msixoff);
+	nix_dump("  \tnix_cints = %d", inl_dev->cints);
+	nix_dump("  \tnix_qints = %d", inl_dev->qints);
+	nix_dump("  \trq_refs = %d", inl_dev->rq_refs);
+	nix_dump("  \tinb_sa_base = 0x%p", inl_dev->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %d", inl_dev->inb_sa_sz);
+	nix_dump("  \txaq_buf_size = %u", inl_dev->xaq_buf_size);
+	nix_dump("  \txae_waes = %u", inl_dev->xae_waes);
+	nix_dump("  \tiue = %u", inl_dev->iue);
+	nix_dump("  \txaq_aura = 0x%" PRIx64, inl_dev->xaq_aura);
+	nix_dump("  \txaq_mem = 0x%p", inl_dev->xaq_mem);
+
+	nix_dump("  \tinl_dev_rq:");
+	roc_nix_rq_dump(&inl_dev->rq);
+}
drivers/common/cnxk/roc_nix_inl.h +55 -0

62 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_dev.c new file +544 -0

544 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h +2 -0
index f424009..ab38062 100644
@@ -54,4 +54,6 @@ void nix_inl_sso_unregister_irqs(struct nix_inl_dev *inl_dev);
 int nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev);
 void nix_inl_nix_unregister_irqs(struct nix_inl_dev *inl_dev);
 
+uint16_t nix_inl_dev_pffunc_get(void);
+
 #endif /* _ROC_NIX_INL_PRIV_H_ */
drivers/common/cnxk/roc_platform.h +2 -0
index 177db3d..241655b 100644
@@ -37,6 +37,7 @@
 #define PLT_MEMZONE_NAMESIZE	 RTE_MEMZONE_NAMESIZE
 #define PLT_STD_C11		 RTE_STD_C11
 #define PLT_PTR_ADD		 RTE_PTR_ADD
+#define PLT_PTR_DIFF		 RTE_PTR_DIFF
 #define PLT_MAX_RXTX_INTR_VEC_ID RTE_MAX_RXTX_INTR_VEC_ID
 #define PLT_INTR_VEC_RXTX_OFFSET RTE_INTR_VEC_RXTX_OFFSET
 #define PLT_MIN			 RTE_MIN
@@ -77,6 +78,7 @@
 #define plt_cpu_to_be_64 rte_cpu_to_be_64
 #define plt_be_to_cpu_64 rte_be_to_cpu_64
 
+#define plt_align32pow2	    rte_align32pow2
 #define plt_align32prevpow2 rte_align32prevpow2
 
 #define plt_bitmap			rte_bitmap
drivers/common/cnxk/version.map +3 -0
index 5dbb21c..3a35233 100644
@@ -100,6 +100,9 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_dev_dump;
+	roc_nix_inl_dev_fini;
+	roc_nix_inl_dev_init;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#7 lore raw

PATCH 7/27 common/cnxk: add nix inline inbound and outbound support API

In reply to Nithin Dabilpuram

Add API to support setting up nix inline inbound and nix inline outbound.

---
 drivers/common/cnxk/hw/cpt.h         |   8 +
 drivers/common/cnxk/meson.build      |   1 +
 drivers/common/cnxk/roc_api.h        |  48 +--
 drivers/common/cnxk/roc_constants.h  |  58 +++
 drivers/common/cnxk/roc_io.h         |   9 +
 drivers/common/cnxk/roc_io_generic.h |   3 +-
 drivers/common/cnxk/roc_nix.h        |   5 +
 drivers/common/cnxk/roc_nix_debug.c  |  15 +
 drivers/common/cnxk/roc_nix_inl.c    | 739 +++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h    | 100 +++++
 drivers/common/cnxk/roc_nix_priv.h   |  15 +
 drivers/common/cnxk/roc_npc.c        |  27 +-
 drivers/common/cnxk/version.map      |  25 ++
 13 files changed, 996 insertions(+), 57 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
drivers/common/cnxk/hw/cpt.h +8 -0
index 84ebf2d..975139f 100644
@@ -40,6 +40,7 @@
 #define CPT_LF_CTX_ENC_PKT_CNT	(0x540ull)
 #define CPT_LF_CTX_DEC_BYTE_CNT (0x550ull)
 #define CPT_LF_CTX_DEC_PKT_CNT	(0x560ull)
+#define CPT_LF_CTX_RELOAD	(0x570ull)
 
 #define CPT_AF_LFX_CTL(a)  (0x27000ull | (uint64_t)(a) << 3)
 #define CPT_AF_LFX_CTL2(a) (0x29000ull | (uint64_t)(a) << 3)
@@ -68,6 +69,13 @@ union cpt_lf_ctx_flush {
 	} s;
 };
 
+union cpt_lf_ctx_reload {
+	uint64_t u;
+	struct {
+		uint64_t cptr : 46;
+	} s;
+};
+
 union cpt_lf_inprog {
 	uint64_t u;
 	struct cpt_lf_inprog_s {
drivers/common/cnxk/meson.build +1 -0
index e8940d7..cd19ad2 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl.c',
         'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
drivers/common/cnxk/roc_api.h +3 -45

72 lines not on this page · raw message

drivers/common/cnxk/roc_constants.h new file +58 -0

58 lines not on this page · raw message

drivers/common/cnxk/roc_io.h +9 -0
index aee8c7f..fe5f7f4 100644
@@ -13,6 +13,15 @@
 		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
 	} while (0)
 
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id)                              \
+	do {                                                                   \
+		/* 16 Lines per core */                                        \
+		lmt_id = ROC_LMT_CPT_BASE_ID_OFF;                              \
+		lmt_id += (plt_lcore_id() << ROC_LMT_CPT_LINES_PER_CORE_LOG2); \
+		/* Each line is of 128B */                                     \
+		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
+	} while (0)
+
 #define roc_load_pair(val0, val1, addr)                                        \
 	({                                                                     \
 		asm volatile("ldp %x[x0], %x[x1], [%x[p1]]"                    \
drivers/common/cnxk/roc_io_generic.h +2 -1
index 28cb096..ceaa3a3 100644
@@ -5,7 +5,8 @@
 #ifndef _ROC_IO_GENERIC_H_
 #define _ROC_IO_GENERIC_H_
 
-#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
+#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id)	  (lmt_id = 0)
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
 
 #define roc_load_pair(val0, val1, addr)                                        \
 	do {                                                                   \
drivers/common/cnxk/roc_nix.h +5 -0
index 822c190..ed6e721 100644
@@ -171,6 +171,7 @@ struct roc_nix_rq {
 	uint8_t spb_red_pass;
 	/* End of Input parameters */
 	struct roc_nix *roc_nix;
+	bool inl_dev_ref;
 };
 
 struct roc_nix_cq {
@@ -254,6 +255,10 @@ struct roc_nix {
 	bool enable_loop;
 	bool hw_vlan_ins;
 	uint8_t lock_rx_ctx;
+	uint32_t outb_nb_desc;
+	uint16_t outb_nb_crypto_qs;
+	uint16_t ipsec_in_max_spi;
+	uint16_t ipsec_out_max_sa;
 	/* End of input parameters */
 	/* LMT line base for "Per Core Tx LMT line" mode*/
 	uintptr_t lmt_base;
drivers/common/cnxk/roc_nix_debug.c +15 -0
index 582f5a3..266935a 100644
@@ -818,6 +818,7 @@ roc_nix_rq_dump(struct roc_nix_rq *rq)
 	nix_dump("  vwqe_wait_tmo = %ld", rq->vwqe_wait_tmo);
 	nix_dump("  vwqe_aura_handle = %ld", rq->vwqe_aura_handle);
 	nix_dump("  roc_nix = %p", rq->roc_nix);
+	nix_dump("  inl_dev_ref = %d", rq->inl_dev_ref);
 }
 
 void
@@ -1160,6 +1161,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 {
 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
 	struct dev *dev = &nix->dev;
+	int i;
 
 	nix_dump("nix@%p", nix);
 	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
@@ -1169,6 +1171,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  port_id = %d", roc_nix->port_id);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->rss_tag_as_xor);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->max_sqb_count);
+	nix_dump("  outb_nb_desc = %u", roc_nix->outb_nb_desc);
 
 	nix_dump("  \tpci_dev = %p", nix->pci_dev);
 	nix_dump("  \tbase = 0x%" PRIxPTR "", nix->base);
@@ -1206,12 +1209,24 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \ttx_link = %d", nix->tx_link);
 	nix_dump("  \tsqb_size = %d", nix->sqb_size);
 	nix_dump("  \tmsixoff = %d", nix->msixoff);
+	for (i = 0; i < nix->nb_cpt_lf; i++)
+		nix_dump("  \tcpt_msixoff[%d] = %d", i, nix->cpt_msixoff[i]);
 	nix_dump("  \tcints = %d", nix->cints);
 	nix_dump("  \tqints = %d", nix->qints);
 	nix_dump("  \tsdp_link = %d", nix->sdp_link);
 	nix_dump("  \tptp_en = %d", nix->ptp_en);
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
+	nix_dump("  \tinl_inb_ena = %d", nix->inl_inb_ena);
+	nix_dump("  \tinl_outb_ena = %d", nix->inl_outb_ena);
+	nix_dump("  \tinb_sa_base = 0x%p", nix->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %" PRIu64, nix->inb_sa_sz);
+	nix_dump("  \toutb_sa_base = 0x%p", nix->outb_sa_base);
+	nix_dump("  \toutb_sa_sz = %" PRIu64, nix->outb_sa_sz);
+	nix_dump("  \toutb_err_sso_pffunc = 0x%x", nix->outb_err_sso_pffunc);
+	nix_dump("  \tcpt_lf_base = 0x%p", nix->cpt_lf_base);
+	nix_dump("  \tnb_cpt_lf = %d", nix->nb_cpt_lf);
+	nix_dump("  \tinb_inl_dev = %d", nix->inb_inl_dev);
 }
 
 void
drivers/common/cnxk/roc_nix_inl.c new file +739 -0

739 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl.h +100 -0

111 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +15 -0
index 79c15ea..2cd5a72 100644
@@ -162,6 +162,21 @@ struct nix {
 	uint16_t tm_link_cfg_lvl;
 	uint16_t contig_rsvd[NIX_TXSCH_LVL_CNT];
 	uint16_t discontig_rsvd[NIX_TXSCH_LVL_CNT];
+
+	/* Ipsec info */
+	uint16_t cpt_msixoff[MAX_RVU_BLKLF_CNT];
+	bool inl_inb_ena;
+	bool inl_outb_ena;
+	void *inb_sa_base;
+	size_t inb_sa_sz;
+	void *outb_sa_base;
+	size_t outb_sa_sz;
+	uint16_t outb_err_sso_pffunc;
+	struct roc_cpt_lf *cpt_lf_base;
+	uint16_t nb_cpt_lf;
+	/* Mode provided by driver */
+	bool inb_inl_dev;
+
 } __plt_cache_aligned;
 
 enum nix_err_status {
drivers/common/cnxk/roc_npc.c +16 -11
index aff4eef..f13331f 100644
@@ -340,10 +340,11 @@ roc_npc_fini(struct roc_npc *roc_npc)
 }
 
 static int
-npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_queue *act_q;
 	const struct roc_npc_action_vf *vf_act;
@@ -425,15 +426,16 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
 			 *    NPC_SECURITY_ACTION_TYPE_INLINE_PROTOCOL &&
 			 *  session_protocol ==
 			 *    NPC_SECURITY_PROTOCOL_IPSEC
-			 *
-			 * RSS is not supported with inline ipsec. Get the
-			 * rq from associated conf, or make
-			 * ROC_NPC_ACTION_TYPE_QUEUE compulsory with this
-			 * action.
-			 * Currently, rq = 0 is assumed.
 			 */
 			req_act |= ROC_NPC_ACTION_TYPE_SEC;
 			rq = 0;
+
+			/* Special processing when with inline device */
+			if (roc_nix_inb_is_with_inl_dev(roc_npc->roc_nix) &&
+			    roc_nix_inl_dev_is_probed()) {
+				rq = 0;
+				pf_func = nix_inl_dev_pffunc_get();
+			}
 			break;
 		case ROC_NPC_ACTION_TYPE_VLAN_STRIP:
 			req_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;
@@ -660,11 +662,12 @@ npc_parse_attr(struct npc *npc, const struct roc_npc_attr *attr,
 }
 
 static int
-npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_rule(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	       const struct roc_npc_item_info pattern[],
 	       const struct roc_npc_action actions[], struct roc_npc_flow *flow,
 	       struct npc_parse_state *pst)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	int err;
 
 	/* Check attr */
@@ -678,7 +681,7 @@ npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
 		return err;
 
 	/* Check action */
-	err = npc_parse_actions(npc, attr, actions, flow);
+	err = npc_parse_actions(roc_npc, attr, actions, flow);
 	if (err)
 		return err;
 	return 0;
@@ -694,7 +697,8 @@ roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	struct npc_parse_state parse_state = {0};
 	int rc;
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc)
 		return rc;
 
@@ -1018,7 +1022,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	}
 	memset(flow, 0, sizeof(*flow));
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc != 0) {
 		*errcode = rc;
 		goto err_exit;
drivers/common/cnxk/version.map +25 -0
index 3a35233..9fcc677 100644
@@ -100,9 +100,34 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_cb_register;
+	roc_nix_inl_cb_unregister;
 	roc_nix_inl_dev_dump;
 	roc_nix_inl_dev_fini;
 	roc_nix_inl_dev_init;
+	roc_nix_inl_dev_is_probed;
+	roc_nix_inl_dev_lock;
+	roc_nix_inl_dev_unlock;
+	roc_nix_inl_dev_rq;
+	roc_nix_inl_dev_rq_get;
+	roc_nix_inl_dev_rq_put;
+	roc_nix_inl_inb_is_enabled;
+	roc_nix_inl_inb_init;
+	roc_nix_inl_inb_sa_base_get;
+	roc_nix_inl_inb_sa_get;
+	roc_nix_inl_inb_sa_max_spi;
+	roc_nix_inl_inb_sa_sz;
+	roc_nix_inl_inb_tag_update;
+	roc_nix_inl_inb_fini;
+	roc_nix_inb_is_with_inl_dev;
+	roc_nix_inb_mode_set;
+	roc_nix_inl_outb_fini;
+	roc_nix_inl_outb_init;
+	roc_nix_inl_outb_lf_base_get;
+	roc_nix_inl_outb_sa_base_get;
+	roc_nix_inl_outb_sso_pffunc_get;
+	roc_nix_inl_outb_is_enabled;
+	roc_nix_inl_sa_sync;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#8 lore raw

PATCH 8/27 common/cnxk: dump cpt lf registers on error intr

In reply to Nithin Dabilpuram

Dump CPT LF registers on error interrupt.

---
 drivers/common/cnxk/roc_cpt.c       |  5 ++++-
 drivers/common/cnxk/roc_cpt_debug.c | 32 ++++++++++++++++++++++++++++++--
 drivers/common/cnxk/roc_cpt_priv.h  |  1 +
 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_cpt.c +4 -1
index 3222b3e..f08b5d0 100644
@@ -51,6 +51,9 @@ cpt_lf_misc_irq(void *param)
 
 	plt_err("Err_irq=0x%" PRIx64 " pf=%d, vf=%d", intr, dev->pf, dev->vf);
 
+	/* Dump lf registers */
+	cpt_lf_print(lf);
+
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
 }
@@ -203,7 +206,7 @@ cpt_lf_dump(struct roc_cpt_lf *lf)
 	plt_cpt_dbg("CPT LF REG:");
 	plt_cpt_dbg("LF_CTL[0x%016llx]: 0x%016" PRIx64, CPT_LF_CTL,
 		    plt_read64(lf->rbase + CPT_LF_CTL));
-	plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
+	plt_cpt_dbg("LF_INPROG[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
 		    plt_read64(lf->rbase + CPT_LF_INPROG));
 
 	plt_cpt_dbg("Q_BASE[0x%016llx]: 0x%016" PRIx64, CPT_LF_Q_BASE,
drivers/common/cnxk/roc_cpt_debug.c +30 -2
index a6c9004..847d969 100644
@@ -157,11 +157,40 @@ roc_cpt_afs_print(struct roc_cpt *roc_cpt)
 	return 0;
 }
 
-static void
+void
 cpt_lf_print(struct roc_cpt_lf *lf)
 {
 	uint64_t reg_val;
 
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_BASE);
+	plt_print("    CPT_LF_Q_BASE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_SIZE);
+	plt_print("    CPT_LF_Q_SIZE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_INST_PTR);
+	plt_print("    CPT_LF_Q_INST_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR);
+	plt_print("    CPT_LF_Q_GRP_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_CTL);
+	plt_print("    CPT_LF_CTL:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT_ENA_W1S);
+	plt_print("    CPT_LF_MISC_INT_ENA_W1S:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT);
+	plt_print("    CPT_LF_MISC_INT:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_INPROG);
+	plt_print("    CPT_LF_INPROG:\t%016lx", reg_val);
+
+	if (roc_model_is_cn9k())
+		return;
+
+	plt_print("Count registers for CPT LF%d:", lf->lf_id);
+
 	reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT);
 	plt_print("    Encrypted byte count:\t%" PRIu64, reg_val);
 
@@ -190,7 +219,6 @@ roc_cpt_lfs_print(struct roc_cpt *roc_cpt)
 		if (lf == NULL)
 			continue;
 
-		plt_print("Count registers for CPT LF%d:", lf_id);
 		cpt_lf_print(lf);
 	}
 
drivers/common/cnxk/roc_cpt_priv.h +1 -0
index 21911e5..61dec9a 100644
@@ -31,5 +31,6 @@ int cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func,
 		    uint8_t lf_id, bool ena);
 int cpt_get_msix_offset(struct dev *dev, struct msix_offset_rsp **msix_rsp);
 uint64_t cpt_get_blkaddr(struct dev *dev);
+void cpt_lf_print(struct roc_cpt_lf *lf);
 
 #endif /* _ROC_CPT_PRIV_H_ */
Signature · 1 line
2.8.4
#9 lore raw

PATCH 9/27 common/cnxk: align cpt lf enable/disable sequence

In reply to Nithin Dabilpuram

For CPT LF IQ enable, set CPT_LF_CTL[ENA] before setting CPT_LF_INPROG[EENA] to true.

For CPT LF IQ disable, align sequence to that of HRM.

Also this patch aligns space for instructions in CPT LF to ROC_ALIGN to make complete memory cache aligned and has other minor fixes/additions.

---
 drivers/common/cnxk/hw/cpt.h  | 11 +++++++++++
 drivers/common/cnxk/roc_cpt.c | 42 ++++++++++++++++++++++++++++++++++--------
 drivers/common/cnxk/roc_cpt.h |  8 ++++++++
 3 files changed, 53 insertions(+), 8 deletions(-)
drivers/common/cnxk/hw/cpt.h +11 -0
index 975139f..4d9df59 100644
@@ -124,6 +124,17 @@ union cpt_lf_misc_int {
 	} s;
 };
 
+union cpt_lf_q_grp_ptr {
+	uint64_t u;
+	struct {
+		uint64_t dq_ptr : 15;
+		uint64_t reserved_31_15 : 17;
+		uint64_t nq_ptr : 15;
+		uint64_t reserved_47_62 : 16;
+		uint64_t xq_xor : 1;
+	} s;
+};
+
 union cpt_inst_w4 {
 	uint64_t u64;
 	struct {
drivers/common/cnxk/roc_cpt.c +34 -8

86 lines not on this page · raw message

drivers/common/cnxk/roc_cpt.h +8 -0
index 9b55303..2ac3197 100644
@@ -75,6 +75,14 @@
 #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20
 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40
 
+#define ROC_CPT_CCM_AAD_DATA 1
+#define ROC_CPT_CCM_MSG_LEN  4
+#define ROC_CPT_CCM_ICV_LEN  16
+#define ROC_CPT_CCM_FLAGS                                                      \
+	((ROC_CPT_CCM_AAD_DATA << 6) |                                         \
+	 (((ROC_CPT_CCM_ICV_LEN - 2) / 2) << 3) | (ROC_CPT_CCM_MSG_LEN - 1))
+#define ROC_CPT_CCM_SALT_LEN 3
+
 struct roc_cpt_lmtline {
 	uint64_t io_addr;
 	uint64_t *fc_addr;
Signature · 1 line
2.8.4
#10 lore raw

PATCH 10/27 common/cnxk: restore nix sqb pool limit before destroy

In reply to Nithin Dabilpuram

Restore SQB aura/pool limit before destroying SQB to be able to drain all the buffers from the aura.

---
 drivers/common/cnxk/roc_nix_queue.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/common/cnxk/roc_nix_queue.c +5 -0
index de63361..03a3a06 100644
@@ -921,6 +921,11 @@ roc_nix_sq_fini(struct roc_nix_sq *sq)
 		rc |= NIX_ERR_NDC_SYNC;
 
 	rc |= nix_tm_sq_flush_post(sq);
+
+	/* Restore limit to max SQB count that the pool was created
+	 * for aura drain to succeed.
+	 */
+	roc_npa_aura_limit_modify(sq->aura_handle, NIX_MAX_SQB);
 	rc |= roc_npa_pool_destroy(sq->aura_handle);
 	plt_free(sq->fc);
 	plt_free(sq->sqe_mem);
Signature · 1 line
2.8.4
#11 lore raw

PATCH 11/27 common/cnxk: add cq enable support in nix Tx path

In reply to Nithin Dabilpuram

From: Kommula Shiva Shankar <[email protected]>

This patch provides applications to add
cq support in Tx path

---
 drivers/common/cnxk/roc_nix.h       | 2 ++
 drivers/common/cnxk/roc_nix_queue.c | 4 ++++
 2 files changed, 6 insertions(+)
drivers/common/cnxk/roc_nix.h +2 -0
index ed6e721..95ea4e0 100644
@@ -194,7 +194,9 @@ struct roc_nix_sq {
 	enum roc_nix_sq_max_sqe_sz max_sqe_sz;
 	uint32_t nb_desc;
 	uint16_t qid;
+	uint16_t cqid;
 	bool sso_ena;
+	bool cq_ena;
 	/* End of Input parameters */
 	uint16_t sqes_per_sqb_log2;
 	struct roc_nix *roc_nix;
drivers/common/cnxk/roc_nix_queue.c +4 -0
index 03a3a06..8fbb13e 100644
@@ -648,6 +648,8 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -746,6 +748,8 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
Signature · 1 line
2.8.4
#12 lore raw

PATCH 12/27 common/cnxk: setup aura bp conf based on nix

In reply to Nithin Dabilpuram

Currently only nix0 conf is setup in Aura for backpressure. This patch adds support for nix1 as well.

---
 drivers/common/cnxk/roc_nix_fc.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_fc.c +19 -4
index f17eba4..7eac7d0 100644
@@ -284,8 +284,18 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	limit = rsp->aura.limit;
 	/* BP is already enabled. */
 	if (rsp->aura.bp_ena) {
+		uint16_t bpid;
+		bool nix1;
+
+		nix1 = !!(rsp->aura.bp_ena & 0x2);
+		if (nix1)
+			bpid = rsp->aura.nix1_bpid;
+		else
+			bpid = rsp->aura.nix0_bpid;
+
 		/* If BP ids don't match disable BP. */
-		if ((rsp->aura.nix0_bpid != nix->bpid[0]) && !force) {
+		if (((nix1 != nix->is_nix1) || (bpid != nix->bpid[0])) &&
+		    !force) {
 			req = mbox_alloc_msg_npa_aq_enq(mbox);
 			if (req == NULL)
 				return;
@@ -315,14 +325,19 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	req->op = NPA_AQ_INSTOP_WRITE;
 
 	if (ena) {
-		req->aura.nix0_bpid = nix->bpid[0];
-		req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		if (nix->is_nix1) {
+			req->aura.nix1_bpid = nix->bpid[0];
+			req->aura_mask.nix1_bpid = ~(req->aura_mask.nix1_bpid);
+		} else {
+			req->aura.nix0_bpid = nix->bpid[0];
+			req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		}
 		req->aura.bp = NIX_RQ_AURA_THRESH(
 			limit > 128 ? 256 : limit); /* 95% of size*/
 		req->aura_mask.bp = ~(req->aura_mask.bp);
 	}
 
-	req->aura.bp_ena = !!ena;
+	req->aura.bp_ena = (!!ena << nix->is_nix1);
 	req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena);
 
 	mbox_process(mbox);
Signature · 1 line
2.8.4
#13 lore raw

PATCH 13/27 common/cnxk: add anti-replay check implementation for cn9k

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds anti replay helper for cn9k platform.

---
 drivers/common/cnxk/cnxk_security_ar.h | 184 +++++++++++++++++++++++++++++++++
 1 file changed, 184 insertions(+)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
drivers/common/cnxk/cnxk_security_ar.h new file +184 -0
new file mode 100644
index 0000000..6bc517c
@@ -0,0 +1,184 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef __CNXK_SECURITY_AR_H__
+#define __CNXK_SECURITY_AR_H__
+
+#include <rte_mbuf.h>
+
+#include "cnxk_security.h"
+
+#define CNXK_ON_AR_WIN_SIZE_MAX 1024
+
+/* u64 array size to fit anti replay window bits */
+#define AR_WIN_ARR_SZ                                                          \
+	(PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) /        \
+	 BITS_PER_LONG_LONG)
+
+#define WORD_SHIFT 6
+#define WORD_SIZE  (1 << WORD_SHIFT)
+#define WORD_MASK  (WORD_SIZE - 1)
+
+#define IPSEC_ANTI_REPLAY_FAILED (-1)
+
+struct cnxk_on_ipsec_ar {
+	rte_spinlock_t lock;
+	uint32_t winb;
+	uint32_t wint;
+	uint64_t base;			/**< base of the anti-replay window */
+	uint64_t window[AR_WIN_ARR_SZ]; /**< anti-replay window */
+};
+
+static inline int
+cnxk_on_anti_replay_check(uint64_t seq, struct cnxk_on_ipsec_ar *ar,
+			  uint32_t winsz)
+{
+	uint64_t ex_winsz = winsz + WORD_SIZE;
+	uint64_t *window = &ar->window[0];
+	uint64_t seqword, shiftwords;
+	uint64_t base = ar->base;
+	uint32_t winb = ar->winb;
+	uint32_t wint = ar->wint;
+	uint64_t winwords;
+	uint64_t bit_pos;
+	uint64_t shift;
+	uint64_t *wptr;
+	uint64_t tmp;
+
+	winwords = ex_winsz >> WORD_SHIFT;
+	if (winsz > 64)
+		goto slow_shift;
+	/* Check if the seq is the biggest one yet */
+	if (likely(seq > base)) {
+		shift = seq - base;
+		if (shift < winsz) { /* In window */
+			/*
+			 * If more than 64-bit anti-replay window,
+			 * use slow shift routine
+			 */
+			wptr = window + (shift >> WORD_SHIFT);
+			*wptr <<= shift;
+			*wptr |= 1ull;
+		} else {
+			/* No special handling of window size > 64 */
+			wptr = window + ((winsz - 1) >> WORD_SHIFT);
+			/*
+			 * Zero out the whole window (especially for
+			 * bigger than 64b window) till the last 64b word
+			 * as the incoming sequence number minus
+			 * base sequence is more than the window size.
+			 */
+			while (window != wptr)
+				*window++ = 0ull;
+			/*
+			 * Set the last bit (of the window) to 1
+			 * as that corresponds to the base sequence number.
+			 * Now any incoming sequence number which is
+			 * (base - window size - 1) will pass anti-replay check
+			 */
+			*wptr = 1ull;
+		}
+		/*
+		 * Set the base to incoming sequence number as
+		 * that is the biggest sequence number seen yet
+		 */
+		ar->base = seq;
+		return 0;
+	}
+
+	bit_pos = base - seq;
+
+	/* If seq falls behind the window, return failure */
+	if (bit_pos >= winsz)
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* seq is within anti-replay window */
+	wptr = window + ((winsz - bit_pos - 1) >> WORD_SHIFT);
+	bit_pos &= WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (*wptr & ((1ull) << bit_pos))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* mark as seen */
+	*wptr |= ((1ull) << bit_pos);
+	return 0;
+
+slow_shift:
+	if (likely(seq > base)) {
+		uint32_t i;
+
+		shift = seq - base;
+		if (unlikely(shift >= winsz)) {
+			/*
+			 * shift is bigger than the window,
+			 * so just zero out everything
+			 */
+			for (i = 0; i < winwords; i++)
+				window[i] = 0;
+winupdate:
+			/* Find out the word */
+			seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+			/* Find out the bit in the word */
+			bit_pos = (seq - 1) & WORD_MASK;
+
+			/*
+			 * Set the bit corresponding to sequence number
+			 * in window to mark it as received
+			 */
+			window[seqword] |= (1ull << (63 - bit_pos));
+
+			/* wint and winb range from 1 to ex_winsz */
+			ar->wint = ((wint + shift - 1) % ex_winsz) + 1;
+			ar->winb = ((winb + shift - 1) % ex_winsz) + 1;
+
+			ar->base = seq;
+			return 0;
+		}
+
+		/*
+		 * New sequence number is bigger than the base but
+		 * it's not bigger than base + window size
+		 */
+
+		shiftwords = ((wint + shift - 1) >> WORD_SHIFT) -
+			     ((wint - 1) >> WORD_SHIFT);
+		if (unlikely(shiftwords)) {
+			tmp = (wint + WORD_SIZE - 1) / WORD_SIZE;
+			for (i = 0; i < shiftwords; i++) {
+				tmp %= winwords;
+				window[tmp++] = 0;
+			}
+		}
+
+		goto winupdate;
+	}
+
+	/* Sequence number is before the window */
+	if (unlikely((seq + winsz) <= base))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* Sequence number is within the window */
+
+	/* Find out the word */
+	seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+	/* Find out the bit in the word */
+	bit_pos = (seq - 1) & WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (window[seqword] & (1ull << (63 - bit_pos)))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/*
+	 * Set the bit corresponding to sequence number
+	 * in window to mark it as received
+	 */
+	window[seqword] |= (1ull << (63 - bit_pos));
+
+	return 0;
+}
+
+#endif /* __CNXK_SECURITY_AR_H__ */
Signature · 1 line
2.8.4
#14 lore raw

PATCH 14/27 common/cnxk: add inline IPsec support in rte flow

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add support to configure flow rules with inline IPsec action.

---
 drivers/common/cnxk/roc_nix_inl.h      |  4 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c  |  3 +++
 drivers/common/cnxk/roc_nix_inl_priv.h |  3 +++
 drivers/common/cnxk/roc_npc_mcam.c     | 28 ++++++++++++++++++++++++++--
 4 files changed, 36 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +4 -0
index efc5a19..1f7ec4f 100644
@@ -107,6 +107,10 @@ struct roc_nix_inl_dev {
 	struct plt_pci_device *pci_dev;
 	uint16_t ipsec_in_max_spi;
 	bool selftest;
+	bool is_multi_channel;
+	uint16_t channel;
+	uint16_t chan_mask;
+
 	/* End of input parameters */
 
 #define ROC_NIX_INL_MEM_SZ (1024)
drivers/common/cnxk/roc_nix_inl_dev.c +3 -0
index 214f183..2dc2188 100644
@@ -461,6 +461,9 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev)
 	inl_dev->pci_dev = pci_dev;
 	inl_dev->ipsec_in_max_spi = roc_inl_dev->ipsec_in_max_spi;
 	inl_dev->selftest = roc_inl_dev->selftest;
+	inl_dev->is_multi_channel = roc_inl_dev->is_multi_channel;
+	inl_dev->channel = roc_inl_dev->channel;
+	inl_dev->chan_mask = roc_inl_dev->chan_mask;
 
 	/* Initialize base device */
 	rc = dev_init(&inl_dev->dev, pci_dev);
drivers/common/cnxk/roc_nix_inl_priv.h +3 -0
index ab38062..a302118 100644
@@ -45,6 +45,9 @@ struct nix_inl_dev {
 
 	/* Device arguments */
 	uint8_t selftest;
+	uint16_t channel;
+	uint16_t chan_mask;
+	bool is_multi_channel;
 	uint16_t ipsec_in_max_spi;
 };
 
drivers/common/cnxk/roc_npc_mcam.c +26 -2
index 8ccaaad..4985d22 100644
@@ -503,8 +503,11 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 {
 	int use_ctr = (flow->ctr_id == NPC_COUNTER_NONE ? 0 : 1);
 	struct npc_mcam_write_entry_req *req;
+	struct nix_inl_dev *inl_dev = NULL;
 	struct mbox *mbox = npc->mbox;
 	struct mbox_msghdr *rsp;
+	struct idev_cfg *idev;
+	uint16_t pf_func = 0;
 	uint16_t ctr = ~(0);
 	int rc, idx;
 	int entry;
@@ -553,9 +556,30 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 		req->entry_data.kw_mask[idx] = flow->mcam_mask[idx];
 	}
 
+	idev = idev_get_cfg();
+	if (idev)
+		inl_dev = idev->nix_inl_dev;
+
 	if (flow->nix_intf == NIX_INTF_RX) {
-		req->entry_data.kw[0] |= (uint64_t)npc->channel;
-		req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+		if (inl_dev && inl_dev->is_multi_channel &&
+		    (flow->npc_action & NIX_RX_ACTIONOP_UCAST_IPSEC)) {
+			req->entry_data.kw[0] |= (uint64_t)inl_dev->channel;
+			req->entry_data.kw_mask[0] |=
+				(uint64_t)inl_dev->chan_mask;
+			pf_func = nix_inl_dev_pffunc_get();
+			req->entry_data.action &= ~(GENMASK(19, 4));
+			req->entry_data.action |= (uint64_t)pf_func << 4;
+
+			flow->npc_action &= ~(GENMASK(19, 4));
+			flow->npc_action |= (uint64_t)pf_func << 4;
+			flow->mcam_data[0] |= (uint64_t)inl_dev->channel;
+			flow->mcam_mask[0] |= (uint64_t)inl_dev->chan_mask;
+		} else {
+			req->entry_data.kw[0] |= (uint64_t)npc->channel;
+			req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+			flow->mcam_data[0] |= (uint64_t)npc->channel;
+			flow->mcam_mask[0] |= (BIT_ULL(12) - 1);
+		}
 	} else {
 		uint16_t pf_func = (flow->npc_action >> 4) & 0xffff;
 
Signature · 1 line
2.8.4
#15 lore raw

PATCH 15/27 net/cnxk: add inline security support for cn9k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

---
 drivers/net/cnxk/cn9k_ethdev.c         |  23 +++
 drivers/net/cnxk/cn9k_ethdev.h         |  61 +++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c     | 313 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h             |   1 +
 drivers/net/cnxk/cn9k_tx.h             |   1 +
 drivers/net/cnxk/cnxk_ethdev.c         | 214 +++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h         | 121 ++++++++++++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c |  88 ++++++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c     | 278 +++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_lookup.c         |  50 +++++-
 drivers/net/cnxk/meson.build           |   2 +
 drivers/net/cnxk/version.map           |   5 +
 12 files changed, 1146 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
drivers/net/cnxk/cn9k_ethdev.c +23 -0
index 115e678..08c86f9 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -179,8 +185,10 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_cpt_lf *inl_lf;
 	struct cn9k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -200,6 +208,19 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(BIT_ULL(16) == ROC_NIX_INL_SA_BASE_ALIGN);
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -508,6 +529,8 @@ cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn9k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn9k_ethdev.h +61 -0

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev_sec.c new file +313 -0

313 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +1 -0
index a3bf4e0..59545af 100644
@@ -17,6 +17,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn9k_tx.h +1 -0
index ed65cd3..a27ff76 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cnxk_ethdev.c +212 -2

308 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +119 -2

185 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_devargs.c +87 -1

122 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_sec.c new file +278 -0

278 lines not on this page · raw message

drivers/net/cnxk/cnxk_lookup.c +44 -6

59 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -0
index d4cdd17..6cc30c3 100644
@@ -12,6 +12,7 @@ sources = files(
         'cnxk_ethdev.c',
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
+        'cnxk_ethdev_sec.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
@@ -22,6 +23,7 @@ sources = files(
 # CN9K
 sources += files(
         'cn9k_ethdev.c',
+        'cn9k_ethdev_sec.c',
         'cn9k_rte_flow.c',
         'cn9k_rx.c',
         'cn9k_rx_mseg.c',
drivers/net/cnxk/version.map +5 -0
index c2e0723..b9da6b1 100644
@@ -1,3 +1,8 @@
 DPDK_22 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+	cnxk_nix_inb_mode_set;
+};
Signature · 1 line
2.8.4
#16 lore raw

PATCH 16/27 net/cnxk: add inline security support for cn10k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

This patch also changes dpdk-devbind.py to list new inline device as misc device.

---
 doc/guides/nics/cnxk.rst                 | 102 ++++++++
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.c          |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.h          |  43 ++++
 drivers/net/cnxk/cn10k_ethdev_sec.c      | 426 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_rx.h              |   1 +
 drivers/net/cnxk/cn10k_tx.h              |   1 +
 drivers/net/cnxk/meson.build             |   1 +
 usertools/dpdk-devbind.py                |   8 +-
 9 files changed, 649 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
doc/guides/nics/cnxk.rst +102 -0
index 90d27db..b542437 100644
@@ -34,6 +34,7 @@ Features of the CNXK Ethdev PMD are:
 - Vector Poll mode driver
 - Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
+- Inline IPsec processing support
 
 Prerequisites
 -------------
@@ -185,6 +186,74 @@ Runtime Config Options
 
       -a 0002:02:00.0,tag_as_xor=1
 
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127).
+
+- ``Max SA's for outbound inline IPsec`` (default ``4096``)
+
+   Max number of SA's supported for outbound inline IPsec processing can be
+   specified by ``ipsec_out_max_sa`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_out_max_sa=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 outbound SAs.
+
+- ``Outbound CPT LF queue size`` (default ``8200``)
+
+   Size of Outbound CPT LF queue in number of descriptors can be specified by
+   ``outb_nb_desc`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_desc=16384
+
+    With the above configuration, Outbound CPT LF will be created to accommodate
+    at max 16384 descriptors at any given time.
+
+- ``Outbound CPT LF count`` (default ``1``)
+
+   Number of CPT LF's to attach for Outbound processing can be specified by
+   ``outb_nb_crypto_qs`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_crypto_qs=2
+
+   With the above confiuration, two CPT LF's are setup and distributed among
+   all the Tx queues for outbound processing.
+
+- ``Force using inline ipsec device for inbound`` (default ``0``)
+
+   In CN10K, in event mode, driver can work in two modes,
+
+   1. Inbound encrypted traffic received by probed ipsec inline device while
+      plain traffic post decryption is received by ethdev.
+
+   2. Both Inbound encrypted traffic and plain traffic post decryption are
+      received by ethdev.
+
+   By default event mode works without using inline device i.e mode ``2``.
+   This behaviour can be changed to pick mode ``1`` by using
+   ``force_inb_inl_dev`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,force_inb_inl_dev=1 -a 0002:03:00.0,force_inb_inl_dev=1
+
+   With the above configuration, inbound encrypted traffic from both the ports
+   is received by ipsec inline device.
 
 .. note::
 
@@ -250,6 +319,39 @@ Example usage in testpmd::
    testpmd> flow create 0 ingress pattern eth / raw relative is 0 pattern \
           spec ab pattern mask ab offset is 4 / end actions queue index 1 / end
 
+Inline device support for CN10K
+-------------------------------
+
+CN10K HW provides a misc device Inline device that supports ethernet devices in
+providing following features.
+
+  - Aggregate all the inline IPsec inbound traffic from all the CN10K ethernet
+    devices to be processed by the single inline IPSec device. This allows
+    single rte security session to accept traffic from multiple ports.
+
+  - Support for event generation on outbound inline IPsec processing errors.
+
+  - Support CN106xx poll mode of operation for inline IPSec inbound processing.
+
+Inline IPsec device is identified by PCI PF vendid:devid ``177D:A0F0`` or
+VF ``177D:A0F1``.
+
+Runtime Config Options for inline device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:1d:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127) for traffic aggregated on inline device.
+
+
 Debugging Options
 -----------------
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +35 -1
index baf2f2a..a34efbb 100644
@@ -123,7 +123,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		    uint16_t port_id, const struct rte_event *ev,
 		    uint8_t custom_flowid)
 {
+	struct roc_nix *nix = &cnxk_eth_dev->nix;
 	struct roc_nix_rq *rq;
+	int rc;
 
 	rq = &cnxk_eth_dev->rqs[rq_id];
 	rq->sso_ena = 1;
@@ -140,7 +142,24 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		rq->tag_mask |= ev->flow_id;
 	}
 
-	return roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	rc = roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	if (rc)
+		return rc;
+
+	if (rq_id == 0 && roc_nix_inl_inb_is_enabled(nix)) {
+		uint32_t sec_tag_const;
+
+		/* IPSec tag const is 8-bit left shifted value of tag_mask
+		 * as it applies to bit 32:8 of tag only.
+		 */
+		sec_tag_const = rq->tag_mask >> 8;
+		rc = roc_nix_inl_inb_tag_update(nix, sec_tag_const,
+						ev->sched_type);
+		if (rc)
+			plt_err("Failed to set tag conf for ipsec, rc=%d", rc);
+	}
+
+	return rc;
 }
 
 static int
@@ -186,6 +205,7 @@ cnxk_sso_rx_adapter_queue_add(
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, true,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso++;
 	}
 
 	if (rc < 0) {
@@ -196,6 +216,14 @@ cnxk_sso_rx_adapter_queue_add(
 
 	dev->rx_offloads |= cnxk_eth_dev->rx_offload_flags;
 
+	/* Switch to use PF/VF's NIX LF instead of inline device for inbound
+	 * when all the RQ's are switched to event dev mode. We do this only
+	 * when using inline device is not forced by dev args.
+	 */
+	if (!cnxk_eth_dev->inb.force_inl_dev &&
+	    cnxk_eth_dev->nb_rxq_sso == cnxk_eth_dev->nb_rxq)
+		cnxk_nix_inb_mode_set(cnxk_eth_dev, false);
+
 	return 0;
 }
 
@@ -220,12 +248,18 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, false,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso--;
 	}
 
 	if (rc < 0)
 		plt_err("Failed to clear Rx adapter config port=%d, q=%d",
 			eth_dev->data->port_id, rx_queue_id);
 
+	/* Removing RQ from Rx adapter implies need to use
+	 * inline device for CQ/Poll mode.
+	 */
+	cnxk_nix_inb_mode_set(cnxk_eth_dev, true);
+
 	return rc;
 }
 
drivers/net/cnxk/cn10k_ethdev.c +35 -1
index 7caec6c..fa2343c 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (conf & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -181,8 +187,11 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	struct roc_cpt_lf *inl_lf;
 	struct cn10k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -198,11 +207,24 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq = eth_dev->data->tx_queues[qid];
 	txq->fc_mem = sq->fc;
 	/* Store lmt base in tx queue for easy access */
-	txq->lmt_base = dev->nix.lmt_base;
+	txq->lmt_base = nix->lmt_base;
 	txq->io_addr = sq->io_addr;
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(ROC_NIX_INL_SA_BASE_ALIGN == BIT_ULL(16));
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -215,6 +237,7 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 struct rte_mempool *mp)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_eth_rxq_sp *rxq_sp;
 	struct cn10k_eth_rxq *rxq;
 	struct roc_nix_rq *rq;
 	struct roc_nix_cq *cq;
@@ -250,6 +273,15 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
 
+	/* Setup security related info */
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F) {
+		rxq->lmt_base = dev->nix.lmt_base;
+		rxq->sa_base = roc_nix_inl_inb_sa_base_get(&dev->nix,
+							   dev->inb.inl_dev);
+	}
+	rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+	rxq->aura_handle = rxq_sp->qconf.mp->pool_id;
+
 	/* Lookup mem */
 	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
@@ -500,6 +532,8 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn10k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn10k_ethdev.h +43 -0

67 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev_sec.c new file +426 -0

426 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +1 -0
index 68219b8..d27a231 100644
@@ -16,6 +16,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn10k_tx.h +1 -0
index f75cae0..8577a7b 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/meson.build +1 -0
index 6cc30c3..d1d4b4e 100644
@@ -37,6 +37,7 @@ sources += files(
 # CN10K
 sources += files(
         'cn10k_ethdev.c',
+        'cn10k_ethdev_sec.c',
         'cn10k_rte_flow.c',
         'cn10k_rx.c',
         'cn10k_rx_mseg.c',
usertools/dpdk-devbind.py +5 -3
index 74d16e4..5f0e817 100755
@@ -49,6 +49,8 @@
              'SVendor': None, 'SDevice': None}
 cnxk_bphy_cgx = {'Class': '08', 'Vendor': '177d', 'Device': 'a059,a060',
                  'SVendor': None, 'SDevice': None}
+cnxk_inl_dev = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f0,a0f1',
+                'SVendor': None, 'SDevice': None}
 
 intel_dlb = {'Class': '0b', 'Vendor': '8086', 'Device': '270b,2710,2714',
              'SVendor': None, 'SDevice': None}
@@ -73,9 +75,9 @@
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
 regex_devices = [octeontx2_ree]
-misc_devices = [cnxk_bphy, cnxk_bphy_cgx, intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_idxd_spr,
-                intel_ntb_skx, intel_ntb_icx,
-                octeontx2_dma]
+misc_devices = [cnxk_bphy, cnxk_bphy_cgx, cnxk_inl_dev, intel_ioat_bdw,
+	        intel_ioat_skx, intel_ioat_icx, intel_idxd_spr, intel_ntb_skx,
+		intel_ntb_icx, octeontx2_dma]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
Signature · 1 line
2.8.4
#17 lore raw

PATCH 17/27 net/cnxk: add cn9k Rx support for security offload

In reply to Nithin Dabilpuram

Add support to receive CPT processed packets on Rx.

---
 drivers/event/cnxk/cn9k_eventdev.c              | 153 ++++----
 drivers/event/cnxk/cn9k_worker.h                |   7 +-
 drivers/event/cnxk/cn9k_worker_deq.c            |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c      |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c         |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c        |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c       |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c    |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c   |   2 +-
 drivers/net/cnxk/cn9k_rx.c                      |  31 +-
 drivers/net/cnxk/cn9k_rx.h                      | 440 +++++++++++++++++++-----
 drivers/net/cnxk/cn9k_rx_mseg.c                 |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                  |   2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c             |   2 +-
 drivers/net/cnxk/cnxk_ethdev.h                  |   3 +
 16 files changed, 461 insertions(+), 195 deletions(-)
drivers/event/cnxk/cn9k_eventdev.c +80 -73
index 6601c44..e91234e 100644
@@ -10,7 +10,8 @@
 #define CN9K_DUAL_WS_PAIR_ID(x, id) (((x)*CN9K_DUAL_WS_NB_WS) + id)
 
 #define CN9K_SET_EVDEV_DEQ_OP(dev, deq_op, deq_ops)                            \
-	deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]   \
+	deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_SECURITY_F)]     \
+			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]   \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_MARK_UPDATE_F)]  \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_CHECKSUM_F)]     \
@@ -329,178 +330,184 @@ cn9k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 {
 	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
 	/* Single WS modes */
-	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_##name,
+	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_burst_##name,
+	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_##name,
+	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_##name,
+	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_##name,
+	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_burst_##name,
+		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_burst_##name,
+		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	/* Dual WS modes */
-	const event_dequeue_t sso_hws_dual_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_##name,
+	const event_dequeue_t sso_hws_dual_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_dual_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_dual_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_##name,
+	const event_dequeue_t sso_hws_dual_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_burst_##name,
+		sso_hws_dual_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_##name,
+	const event_dequeue_t sso_hws_dual_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_burst_##name,
+		sso_hws_dual_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_burst_##name,
+		sso_hws_dual_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_dual_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_burst_##name,
+		sso_hws_dual_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] =                                         \
+			cn9k_sso_hws_dual_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_dual_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_burst_##name,
+		sso_hws_dual_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] =                                         \
+			cn9k_sso_hws_dual_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
drivers/event/cnxk/cn9k_worker.h +5 -2
index 3e8f214..f1d2e47 100644
@@ -5,6 +5,9 @@
 #ifndef __CN9K_WORKER_H__
 #define __CN9K_WORKER_H__
 
+#include <rte_eventdev.h>
+#include <rte_vect.h>
+
 #include "cnxk_ethdev.h"
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
@@ -380,7 +383,7 @@ uint16_t __rte_hot cn9k_sso_hws_ca_enq(void *port, struct rte_event ev[],
 uint16_t __rte_hot cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[],
 					    uint16_t nb_events);
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_##name(                            \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
 	uint16_t __rte_hot cn9k_sso_hws_deq_burst_##name(                      \
@@ -415,7 +418,7 @@ uint16_t __rte_hot cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[],
 NIX_RX_FASTPATH_MODES
 #undef R
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_burst_##name(                 \
drivers/event/cnxk/cn9k_worker_deq.c +1 -1
index 51ccaf4..d65c72a 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_##name(                            \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_deq_burst.c +1 -1
index 4e28014..42dc59b 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_burst_##name(                      \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn9k_worker_deq_ca.c +1 -1
index dde8288..6c5325f 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_ca_##name(                         \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_deq_tmo.c +1 -1
index 9713d1e..b41a590 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_tmo_##name(                        \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq.c +1 -1
index 709fa2d..440b66e 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq_burst.c +1 -1
index d50e1cf..4d913f9 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_burst_##name(                 \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn9k_worker_dual_deq_ca.c +1 -1
index 26cc60f..74116a9 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_##name(                    \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c +1 -1
index a0508fd..78a4b3d 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_tmo_##name(                   \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx.c +16 -15
index 7d9f1bd..5c4387e 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [TSP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
@@ -38,33 +39,33 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,7 +74,7 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0][0];
 
 	if (dev->scalar_ena) {
 		if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
drivers/net/cnxk/cn9k_rx.h +346 -94

485 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index d7e19b1..06509e8 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +1 -1
index ef5f771..c96f61c 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec_mseg.c +1 -1
index e46d8a4..938b1c0 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_mseg_##name(  \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 5ae791f..cfdc493 100644
@@ -130,6 +130,9 @@
 /* Subtype from inline outbound error event */
 #define CNXK_ETHDEV_SEC_OUTB_EV_SUB 0xFFUL
 
+/* SPI will be in 20 bits of tag */
+#define CNXK_ETHDEV_SPI_TAG_MASK 0xFFFFFUL
+
 struct cnxk_fc_cfg {
 	enum rte_eth_fc_mode mode;
 	uint8_t rx_pause;
Signature · 1 line
2.8.4
#18 lore raw

PATCH 18/27 net/cnxk: add cn9k Tx support for security offload

In reply to Nithin Dabilpuram

Add support to create and submit CPT instructions on Tx.

---
 drivers/event/cnxk/cn9k_eventdev.c               |  27 +-
 drivers/event/cnxk/cn9k_worker.h                 | 164 +++++++++-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |   2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |   2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |   2 +-
 drivers/net/cnxk/cn9k_tx.c                       |  29 +-
 drivers/net/cnxk/cn9k_tx.h                       | 392 +++++++++++++++--------
 drivers/net/cnxk/cn9k_tx_mseg.c                  |   2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |   2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |   2 +-
 11 files changed, 459 insertions(+), 167 deletions(-)
drivers/event/cnxk/cn9k_eventdev.c +14 -13
index e91234e..0c7206c 100644
@@ -19,7 +19,8 @@
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_RSS_F)]
 
 #define CN9K_SET_EVDEV_ENQ_OP(dev, enq_op, enq_ops)                            \
-	enq_op = enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
+	enq_op = enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_SECURITY_F)]     \
+			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSO_F)]          \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_MBUF_NOFF_F)]    \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_VLAN_QINQ_F)]    \
@@ -514,33 +515,33 @@ cn9k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	/* Tx modes */
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_##name,
+		sso_hws_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_seg_##name,
+		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_dual_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_##name,
+		sso_hws_dual_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_dual_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_seg_##name,
+		sso_hws_dual_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
drivers/event/cnxk/cn9k_worker.h +162 -2

192 lines not on this page · raw message

drivers/event/cnxk/cn9k_worker_dual_tx_enq.c +1 -1
index 92e2981..db045d0 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_dual_tx_adptr_enq_##name(              \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c +1 -1
index dfb574c..95d711f 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_dual_tx_adptr_enq_seg_##name(          \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_tx_enq.c +1 -1
index 3df649c..026cef8 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_tx_adptr_enq_##name(                   \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_tx_enq_seg.c +1 -1
index 0efe291..97cd7c7 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_tx_adptr_enq_seg_##name(               \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/net/cnxk/cn9k_tx.c +15 -14
index 763f9a1..e5691a2 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -23,12 +23,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [TS] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_SECURITY_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
@@ -42,33 +43,33 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
drivers/net/cnxk/cn9k_tx.h +261 -131

400 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_mseg.c +1 -1
index f3c427c..37cba78 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn9k_tx_vec.c +1 -1
index 56a3e25..b424f95 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
 					      struct rte_mbuf **tx_pkts,       \
drivers/net/cnxk/cn9k_tx_vec_mseg.c +1 -1
index 0256efd..5fdf0a9 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_vec_mseg_##name(  \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
Signature · 1 line
2.8.4
#19 lore raw

PATCH 19/27 net/cnxk: add cn10k Rx support for security offload

In reply to Nithin Dabilpuram

Add support to receive CPT processed packets on Rx via second pass.

---
 drivers/event/cnxk/cn10k_eventdev.c         |  80 ++--
 drivers/event/cnxk/cn10k_worker.h           |  73 +++-
 drivers/event/cnxk/cn10k_worker_deq.c       |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c    |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c   |   2 +-
 drivers/net/cnxk/cn10k_ethdev.h             |   4 +
 drivers/net/cnxk/cn10k_rx.c                 |  31 +-
 drivers/net/cnxk/cn10k_rx.h                 | 648 +++++++++++++++++++++++-----
 drivers/net/cnxk/cn10k_rx_mseg.c            |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c             |   4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c        |   4 +-
 drivers/net/cnxk/cn10k_tx.h                 |   3 -
 13 files changed, 688 insertions(+), 169 deletions(-)
drivers/event/cnxk/cn10k_eventdev.c +42 -38
index bfb6f1a..2f2e7f8 100644
@@ -7,7 +7,8 @@
 #include "cnxk_worker.h"
 
 #define CN10K_SET_EVDEV_DEQ_OP(dev, deq_op, deq_ops)                           \
-	deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]   \
+	deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_SECURITY_F)]     \
+			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]   \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_MARK_UPDATE_F)]  \
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_CHECKSUM_F)]     \
@@ -287,88 +288,91 @@ static void
 cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 {
 	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
-	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_##name,
+	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                            \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_burst_##name,
+	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_##name,
+	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_##name,
+	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_##name,
+	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_burst_##name,
+		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_burst_##name,
+		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
@@ -384,7 +388,7 @@ cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	const event_tx_adapter_enqueue
 		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                            \
 	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
drivers/event/cnxk/cn10k_worker.h +68 -5

123 lines not on this page · raw message

drivers/event/cnxk/cn10k_worker_deq.c +1 -1
index 36ec454..6083f69 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn10k_sso_hws_deq_##name(                           \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_deq_burst.c +1 -1
index 29ecc55..8539d5d 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_hot cn10k_sso_hws_deq_burst_##name(                     \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn10k_worker_deq_ca.c +1 -1
index 508d30f..0d10fc8 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn10k_sso_hws_deq_ca_##name(                        \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_deq_tmo.c +1 -1
index c8524a2..537ae37 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_hot cn10k_sso_hws_deq_tmo_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_ethdev.h +4 -0
index a888364..200cd93 100644
@@ -81,4 +81,8 @@ void cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 /* Security context setup */
 void cn10k_eth_sec_ops_override(void);
 
+#define LMT_OFF(lmt_addr, lmt_num, offset)                                     \
+	(void *)((uintptr_t)(lmt_addr) +                                       \
+		 ((uint64_t)(lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset))
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn10k_rx.c +16 -15
index 69e767a..d6af54b 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
@@ -38,33 +39,33 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                            \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,7 +74,7 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0][0];
 
 	if (dev->scalar_ena) {
 		if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
drivers/net/cnxk/cn10k_rx.h +549 -99

756 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index 3340771..e7c2321 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +2 -2
index 166735a..0ccc4df 100644
@@ -5,14 +5,14 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
 					       uint16_t pkts)                  \
 	{                                                                      \
 		return cn10k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,     \
-						  (flags), NULL, NULL);        \
+						  (flags), NULL, NULL, 0);     \
 	}
 
 NIX_RX_FASTPATH_MODES
drivers/net/cnxk/cn10k_rx_vec_mseg.c +2 -2
index 1f44ddd..38e0ec3 100644
@@ -5,13 +5,13 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_vec_mseg_##name( \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
 		return cn10k_nix_recv_pkts_vector(                             \
 			rx_queue, rx_pkts, pkts, (flags) | NIX_RX_MULTI_SEG_F, \
-			NULL, NULL);                                           \
+			NULL, NULL, 0);                                        \
 	}
 
 NIX_RX_FASTPATH_MODES
drivers/net/cnxk/cn10k_tx.h +0 -3
index 8577a7b..c81a612 100644
@@ -51,9 +51,6 @@
 
 #define NIX_NB_SEGS_TO_SEGDW(x) ((NIX_SEGDW_MAGIC >> ((x) << 2)) & 0xF)
 
-#define LMT_OFF(lmt_addr, lmt_num, offset)                                     \
-	(void *)((lmt_addr) + ((lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset))
-
 /* Function to determine no of tx subdesc required in case ext
  * sub desc is enabled.
  */
Signature · 1 line
2.8.4
#20 lore raw

PATCH 20/27 net/cnxk: add cn10k Tx support for security offload

In reply to Nithin Dabilpuram

Add support to create and submit CPT instructions on Tx.

---
 doc/guides/rel_notes/release_21_11.rst       |   5 +
 drivers/event/cnxk/cn10k_eventdev.c          |  15 +-
 drivers/event/cnxk/cn10k_worker.h            |  74 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c     |   2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c |   2 +-
 drivers/net/cnxk/cn10k_tx.c                  |  31 +-
 drivers/net/cnxk/cn10k_tx.h                  | 981 +++++++++++++++++++++++----
 drivers/net/cnxk/cn10k_tx_mseg.c             |   2 +-
 drivers/net/cnxk/cn10k_tx_vec.c              |   2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c         |   2 +-
 10 files changed, 934 insertions(+), 182 deletions(-)
doc/guides/rel_notes/release_21_11.rst +5 -0
index fb599e5..a87f6cb 100644
@@ -65,6 +65,11 @@ New Features
 
   * Added event crypto adapter OP_FORWARD mode support.
 
+* **Added support for Inline IPsec on Marvell CN10K and CN9K.**
+
+  * Added support for Inline IPsec in net/cnxk PMD for CN9K event mode
+    and CN10K poll mode and event mode.
+
 Removed Items
 -------------
 
drivers/event/cnxk/cn10k_eventdev.c +8 -7
index 2f2e7f8..bd1cf55 100644
@@ -16,7 +16,8 @@
 			[!!(dev->rx_offloads & NIX_RX_OFFLOAD_RSS_F)]
 
 #define CN10K_SET_EVDEV_ENQ_OP(dev, enq_op, enq_ops)                           \
-	enq_op = enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
+	enq_op = enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_SECURITY_F)]     \
+			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSO_F)]          \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_MBUF_NOFF_F)]    \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_VLAN_QINQ_F)]    \
@@ -379,17 +380,17 @@ cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	/* Tx modes */
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_##name,
+		sso_hws_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                            \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
+		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
drivers/event/cnxk/cn10k_worker.h +56 -18

118 lines not on this page · raw message

drivers/event/cnxk/cn10k_worker_tx_enq.c +1 -1
index f9968ac..f14c7fc 100644
@@ -4,7 +4,7 @@
 
 #include "cn10k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn10k_sso_hws_tx_adptr_enq_##name(                  \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_tx_enq_seg.c +1 -1
index a24fc42..2ea61e5 100644
@@ -4,7 +4,7 @@
 
 #include "cn10k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn10k_sso_hws_tx_adptr_enq_seg_##name(              \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/net/cnxk/cn10k_tx.c +16 -15
index 0e1276c..eb962ef 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -24,12 +24,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [SEC] [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_SECURITY_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
@@ -43,33 +44,33 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
drivers/net/cnxk/cn10k_tx.h +844 -137

1,332 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_mseg.c +1 -1
index 4ea4c8a..2b83409 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
 						struct rte_mbuf **tx_pkts,     \
drivers/net/cnxk/cn10k_tx_vec.c +1 -1
index a035049..2789b13 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn10k_tx_vec_mseg.c +1 -1
index 7f98f79..98000df 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_vec_mseg_##name( \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
Signature · 1 line
2.8.4
#21 lore raw

PATCH 21/27 net/cnxk: add cn9k anti replay support for security offload

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds anti replay support for cn9k platform.

---
 drivers/net/cnxk/cn9k_ethdev.h     |  3 +++
 drivers/net/cnxk/cn9k_ethdev_sec.c | 29 ++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h         | 54 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 85 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn9k_ethdev.h +3 -0
index f8818b8..2b452fe 100644
@@ -6,6 +6,7 @@
 
 #include <cnxk_ethdev.h>
 #include <cnxk_security.h>
+#include <cnxk_security_ar.h>
 
 struct cn9k_eth_txq {
 	uint64_t cmd[8];
@@ -40,6 +41,8 @@ struct cn9k_eth_rxq {
 /* Private data in sw rsvd area of struct roc_onf_ipsec_inb_sa */
 struct cn9k_inb_priv_data {
 	void *userdata;
+	uint32_t replay_win_sz;
+	struct cnxk_on_ipsec_ar ar;
 	struct cnxk_eth_sec_sess *eth_sec;
 };
 
drivers/net/cnxk/cn9k_ethdev_sec.c +29 -0
index 3ec7497..deb1daf 100644
@@ -73,6 +73,27 @@ static const struct rte_security_capability cn9k_eth_sec_capabilities[] = {
 	}
 };
 
+static inline int
+ar_window_init(struct cn9k_inb_priv_data *inb_priv)
+{
+	if (inb_priv->replay_win_sz > CNXK_ON_AR_WIN_SIZE_MAX) {
+		plt_err("Replay window size:%u is not supported",
+			inb_priv->replay_win_sz);
+		return -ENOTSUP;
+	}
+
+	rte_spinlock_init(&inb_priv->ar.lock);
+	/*
+	 * Set window bottom to 1, base and top to size of
+	 * window
+	 */
+	inb_priv->ar.winb = 1;
+	inb_priv->ar.wint = inb_priv->replay_win_sz;
+	inb_priv->ar.base = inb_priv->replay_win_sz;
+
+	return 0;
+}
+
 static int
 cn9k_eth_sec_session_create(void *device,
 			    struct rte_security_session_conf *conf,
@@ -158,6 +179,14 @@ cn9k_eth_sec_session_create(void *device,
 		/* Save userdata in inb private area */
 		inb_priv->userdata = conf->userdata;
 
+		inb_priv->replay_win_sz = ipsec->replay_win_sz;
+		if (inb_priv->replay_win_sz) {
+			rc = ar_window_init(inb_priv);
+			if (rc)
+				goto mempool_put;
+		}
+
+		/* Prepare session priv */
 		sess_priv.inb_sa = 1;
 		sess_priv.sa_idx = ipsec->spi;
 
drivers/net/cnxk/cn9k_rx.h +53 -1

79 lines not on this page · raw message

Signature · 1 line
2.8.4
#22 lore raw

PATCH 22/27 net/cnxk: add cn10k IPsec transport mode support

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds IPsec transport mode capability to rte security capabilities.

---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/net/cnxk/cn10k_ethdev_sec.c +24 -0
index 3ffd824..dae5ea7 100644
@@ -69,6 +69,30 @@ static const struct rte_security_capability cn10k_eth_sec_capabilities[] = {
 		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
 		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
 	},
+	{	/* IPsec Inline Protocol ESP Transport Egress */
+		.action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
+		.protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+		.ipsec = {
+			.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+			.mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
+			.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
+			.options = { 0 }
+		},
+		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
+		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+	},
+	{	/* IPsec Inline Protocol ESP Transport Ingress */
+		.action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
+		.protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+		.ipsec = {
+			.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+			.mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
+			.direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
+			.options = { 0 }
+		},
+		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
+		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+	},
 	{
 		.action = RTE_SECURITY_ACTION_TYPE_NONE
 	}
Signature · 1 line
2.8.4
#23 lore raw

PATCH 23/27 net/cnxk: update ethertype for mixed IPsec tunnel versions

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds support to update ethertype for mixed IPsec tunnel versions. And also sets et_overwr for inbound IPsec.

---
 drivers/common/cnxk/cnxk_security.c |  1 +
 drivers/net/cnxk/cn10k_ethdev.h     |  3 ++-
 drivers/net/cnxk/cn10k_ethdev_sec.c |  2 ++
 drivers/net/cnxk/cn10k_tx.h         | 19 +++++++++++++++++++
 4 files changed, 24 insertions(+), 1 deletion(-)
drivers/common/cnxk/cnxk_security.c +1 -0
index c25b3fd..90b5205 100644
@@ -239,6 +239,7 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
 	/* There are two words of CPT_CTX_HW_S for ucode to skip */
 	sa->w0.s.ctx_hdr_size = 1;
 	sa->w0.s.aop_valid = 1;
+	sa->w0.s.et_ovrwr = 1;
 
 	rte_wmb();
 
drivers/net/cnxk/cn10k_ethdev.h +2 -1
index 200cd93..c2a46ad 100644
@@ -64,7 +64,8 @@ struct cn10k_sec_sess_priv {
 		struct {
 			uint32_t sa_idx;
 			uint8_t inb_sa : 1;
-			uint8_t rsvd1 : 2;
+			uint8_t outer_ip_ver : 1;
+			uint8_t mode : 1;
 			uint8_t roundup_byte : 5;
 			uint8_t roundup_len;
 			uint16_t partial_len;
drivers/net/cnxk/cn10k_ethdev_sec.c +2 -0
index dae5ea7..c66730a 100644
@@ -341,6 +341,8 @@ cn10k_eth_sec_session_create(void *device,
 		sess_priv.roundup_byte = rlens->roundup_byte;
 		sess_priv.roundup_len = rlens->roundup_len;
 		sess_priv.partial_len = rlens->partial_len;
+		sess_priv.mode = outb_sa->w2.s.ipsec_mode;
+		sess_priv.outer_ip_ver = outb_sa->w2.s.outer_ip_ver;
 
 		/* Pointer from eth_sec -> outb_sa */
 		eth_sec->sa = outb_sa;
drivers/net/cnxk/cn10k_tx.h +19 -0
index 70ba929..f56aa8e 100644
@@ -302,6 +302,16 @@ cn10k_nix_prep_sec_vec(struct rte_mbuf *m, uint64x2_t *cmd0, uint64x2_t *cmd1,
 	cmd23 = vsetq_lane_u64((uintptr_t)m | 1, cmd23, 1);
 
 	dptr += l2_len;
+
+	if (sess_priv.mode == ROC_IE_SA_MODE_TUNNEL) {
+		if (sess_priv.outer_ip_ver == ROC_IE_SA_IP_VERSION_4)
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+		else
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	}
+
 	ucode_cmd[1] = dptr;
 	ucode_cmd[2] = dptr;
 
@@ -396,6 +406,15 @@ cn10k_nix_prep_sec(struct rte_mbuf *m, uint64_t *cmd, uintptr_t *nixtx_addr,
 	cmd23 = vsetq_lane_u64((uintptr_t)m | 1, cmd23, 1);
 
 	dptr += l2_len;
+
+	if (sess_priv.mode == ROC_IE_SA_MODE_TUNNEL) {
+		if (sess_priv.outer_ip_ver == ROC_IE_SA_IP_VERSION_4)
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+		else
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	}
 	ucode_cmd[1] = dptr;
 	ucode_cmd[2] = dptr;
 
Signature · 1 line
2.8.4
#24 lore raw

PATCH 24/27 net/cnxk: allow zero udp6 checksum for non inline device

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Sets IP6_UDP_OPT in NIX RX config to allow optional UDP checksum for IPv6 in case of security offload.

---
 drivers/net/cnxk/cnxk_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index 60a4df5..8a102aa 100644
@@ -1005,6 +1005,9 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		   ROC_NIX_LF_RX_CFG_LEN_IL4 | ROC_NIX_LF_RX_CFG_LEN_IL3 |
 		   ROC_NIX_LF_RX_CFG_LEN_OL4 | ROC_NIX_LF_RX_CFG_LEN_OL3);
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		rx_cfg |= ROC_NIX_LF_RX_CFG_IP6_UDP_OPT;
+
 	nb_rxq = RTE_MAX(data->nb_rx_queues, 1);
 	nb_txq = RTE_MAX(data->nb_tx_queues, 1);
 
Signature · 1 line
2.8.4
#25 lore raw

PATCH 25/27 net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds capabitlities for AES_CBC and HMAC_SHA1 for 9k security offload.

---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c  | 40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
drivers/net/cnxk/cn10k_ethdev_sec.c +40 -0
index c66730a..82dc636 100644
@@ -41,6 +41,46 @@ static struct rte_cryptodev_capabilities cn10k_eth_sec_crypto_caps[] = {
 			}, }
 		}, }
 	},
+	{	/* AES CBC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_AES_CBC,
+				.block_size = 16,
+				.key_size = {
+					.min = 16,
+					.max = 32,
+					.increment = 8
+				},
+				.iv_size = {
+					.min = 16,
+					.max = 16,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
+	{	/* SHA1 HMAC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+				.block_size = 64,
+				.key_size = {
+					.min = 20,
+					.max = 64,
+					.increment = 1
+				},
+				.digest_size = {
+					.min = 12,
+					.max = 12,
+					.increment = 0
+				},
+			}, }
+		}, }
+	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
drivers/net/cnxk/cn9k_ethdev_sec.c +40 -0
index deb1daf..b070ad5 100644
@@ -40,6 +40,46 @@ static struct rte_cryptodev_capabilities cn9k_eth_sec_crypto_caps[] = {
 			}, }
 		}, }
 	},
+	{	/* AES CBC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_AES_CBC,
+				.block_size = 16,
+				.key_size = {
+					.min = 16,
+					.max = 32,
+					.increment = 8
+				},
+				.iv_size = {
+					.min = 16,
+					.max = 16,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
+	{	/* SHA1 HMAC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+				.block_size = 64,
+				.key_size = {
+					.min = 20,
+					.max = 64,
+					.increment = 1
+				},
+				.digest_size = {
+					.min = 12,
+					.max = 12,
+					.increment = 0
+				},
+			}, }
+		}, }
+	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
Signature · 1 line
2.8.4
#26 lore raw

PATCH 26/27 net/cnxk: add devargs for configuring channel mask

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds support to configure channel mask which will be used by rte flow when adding flow rules with inline IPsec action.

---
 doc/guides/nics/cnxk.rst           | 20 +++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev_sec.c | 39 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)
doc/guides/nics/cnxk.rst +20 -0
index b542437..dd955d3 100644
@@ -255,6 +255,26 @@ Runtime Config Options
    With the above configuration, inbound encrypted traffic from both the ports
    is received by ipsec inline device.
 
+- ``Inline IPsec device channel and mask`` (default ``none``)
+
+   Set channel and channel mask configuration for the inline IPSec device. This
+   will be used when creating flow rules with RTE_FLOW_ACTION_TYPE_SECURITY
+   action.
+
+   By default, RTE Flow API sets the channel number of the port on which the
+   rule is created in the MCAM entry and matches it exactly. This behaviour can
+   be modified using the ``inl_cpt_channel`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:1d:00.0,inl_cpt_channel=0x100/0xf00
+
+   With the above configuration, RTE Flow rules API will set the channel
+   and channel mask as 0x100 and 0xF00 in the MCAM entries of the  flow rules
+   created with RTE_FLOW_ACTION_TYPE_SECURITY action. Since channel number is
+   set with this custom mask, inbound encrypted traffic from all ports with
+   matching channel number pattern will be directed to the inline IPSec device.
+
 .. note::
 
    Above devarg parameters are configurable per device, user needs to pass the
drivers/net/cnxk/cnxk_ethdev_sec.c +38 -1
index c002c30..523837a 100644
@@ -6,6 +6,13 @@
 
 #define CNXK_NIX_INL_SELFTEST	      "selftest"
 #define CNXK_NIX_INL_IPSEC_IN_MAX_SPI "ipsec_in_max_spi"
+#define CNXK_INL_CPT_CHANNEL	      "inl_cpt_channel"
+
+struct inl_cpt_channel {
+	bool is_multi_channel;
+	uint16_t channel;
+	uint16_t mask;
+};
 
 #define CNXK_NIX_INL_DEV_NAME RTE_STR(cnxk_nix_inl_dev_)
 #define CNXK_NIX_INL_DEV_NAME_LEN                                              \
@@ -137,13 +144,37 @@ parse_selftest(const char *key, const char *value, void *extra_args)
 }
 
 static int
+parse_inl_cpt_channel(const char *key, const char *value, void *extra_args)
+{
+	RTE_SET_USED(key);
+	uint16_t chan = 0, mask = 0;
+	char *next = 0;
+
+	/* next will point to the separator '/' */
+	chan = strtol(value, &next, 16);
+	mask = strtol(++next, 0, 16);
+
+	if (chan > GENMASK(12, 0) || mask > GENMASK(12, 0))
+		return -EINVAL;
+
+	((struct inl_cpt_channel *)extra_args)->channel = chan;
+	((struct inl_cpt_channel *)extra_args)->mask = mask;
+	((struct inl_cpt_channel *)extra_args)->is_multi_channel = true;
+
+	return 0;
+}
+
+static int
 nix_inl_parse_devargs(struct rte_devargs *devargs,
 		      struct roc_nix_inl_dev *inl_dev)
 {
 	uint32_t ipsec_in_max_spi = BIT(8) - 1;
+	struct inl_cpt_channel cpt_channel;
 	struct rte_kvargs *kvlist;
 	uint8_t selftest = 0;
 
+	memset(&cpt_channel, 0, sizeof(cpt_channel));
+
 	if (devargs == NULL)
 		goto null_devargs;
 
@@ -155,11 +186,16 @@ nix_inl_parse_devargs(struct rte_devargs *devargs,
 			   &selftest);
 	rte_kvargs_process(kvlist, CNXK_NIX_INL_IPSEC_IN_MAX_SPI,
 			   &parse_ipsec_in_max_spi, &ipsec_in_max_spi);
+	rte_kvargs_process(kvlist, CNXK_INL_CPT_CHANNEL, &parse_inl_cpt_channel,
+			   &cpt_channel);
 	rte_kvargs_free(kvlist);
 
 null_devargs:
 	inl_dev->ipsec_in_max_spi = ipsec_in_max_spi;
 	inl_dev->selftest = selftest;
+	inl_dev->channel = cpt_channel.channel;
+	inl_dev->chan_mask = cpt_channel.mask;
+	inl_dev->is_multi_channel = cpt_channel.is_multi_channel;
 	return 0;
 exit:
 	return -EINVAL;
@@ -275,4 +311,5 @@ RTE_PMD_REGISTER_KMOD_DEP(cnxk_nix_inl, "vfio-pci");
 
 RTE_PMD_REGISTER_PARAM_STRING(cnxk_nix_inl,
 			      CNXK_NIX_INL_SELFTEST "=1"
-			      CNXK_NIX_INL_IPSEC_IN_MAX_SPI "=<1-65535>");
+			      CNXK_NIX_INL_IPSEC_IN_MAX_SPI "=<1-65535>"
+			      CNXK_INL_CPT_CHANNEL "=<1-4095>/<1-4095>");
Signature · 1 line
2.8.4
#27 lore raw

PATCH 27/27 net/cnxk: reflect globally enabled offloads in queue conf

In reply to Nithin Dabilpuram

Reflect globally enabled Rx and Tx offloads in queue conf. Also fix issue with lmt data prepare for multi seg.

Fixes a24af6361e37 ("net/cnxk: add Tx queue setup and release")
Fixes a86144cd9ded ("net/cnxk: add Rx queue setup and release")
Fixes 305ca2c4c382 ("net/cnxk: support multi-segment vector Tx")
---
 drivers/net/cnxk/cn10k_tx.h    | 2 +-
 drivers/net/cnxk/cnxk_ethdev.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn10k_tx.h +1 -1
index f56aa8e..2821f71 100644
@@ -1280,7 +1280,7 @@ cn10k_nix_prep_lmt_mseg_vector(struct rte_mbuf **mbufs, uint64x2_t *cmd0,
 			vst1q_u64(lmt_addr + 14, cmd1[3]);
 
 			*data128 |= ((__uint128_t)7) << *shift;
-			shift += 3;
+			*shift += 3;
 
 			return 1;
 		}
drivers/net/cnxk/cnxk_ethdev.c +4 -0
index 8a102aa..978ee5b 100644
@@ -377,6 +377,8 @@ cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq_sp->dev = dev;
 	txq_sp->qid = qid;
 	txq_sp->qconf.conf.tx = *tx_conf;
+	/* Queue config should reflect global offloads */
+	txq_sp->qconf.conf.tx.offloads = dev->tx_offloads;
 	txq_sp->qconf.nb_desc = nb_desc;
 
 	plt_nix_dbg("sq=%d fc=%p offload=0x%" PRIx64 " lmt_addr=%p"
@@ -511,6 +513,8 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq_sp->dev = dev;
 	rxq_sp->qid = qid;
 	rxq_sp->qconf.conf.rx = *rx_conf;
+	/* Queue config should reflect global offloads */
+	rxq_sp->qconf.conf.rx.offloads = dev->rx_offloads;
 	rxq_sp->qconf.nb_desc = nb_desc;
 	rxq_sp->qconf.mp = mp;
 
Signature · 1 line
2.8.4
#28 lore raw
In reply to Nithin Dabilpuram
Quoted 7 lines · Nithin Dabilpuram

Support for inline ipsec in CN9K event mode and in Cn10K event mode and poll mode.

Depends-on: series-18524 ("Crypto adapter support for Marvell CNXK driver)
Depends-on: series-18262 ("security: Improve inline fast path routines")
Depends-on: series-18562 ("add lookaside IPsec additional features)

Now that these patches merged to main. Please rebase based on main. Also, update the release notes for cnxk ethdev for this feature.

#29 lore raw

v2 cover net/cnxk: support for inline ipsec

In reply to Nithin Dabilpuram

Support for inline ipsec in CN9K event mode and in Cn10K event mode and poll mode.

Kommula Shiva Shankar (1):
common/cnxk: add CQ enable support in NIX Tx path

Nithin Dabilpuram (18):
common/cnxk: support CPT parse header dump common/cnxk: allow reuse of SSO API for inline dev common/cnxk: change NIX debug API and queue API interface common/cnxk: support NIX inline device IRQ common/cnxk: support NIX inline device init and fini common/cnxk: support NIX inline inbound and outbound setup common/cnxk: disable CQ drop when inline inbound is enabled common/cnxk: dump CPT LF registers on error intr common/cnxk: align CPT LF enable/disable sequence common/cnxk: restore NIX sqb pool limit before destroy common/cnxk: setup aura BP conf based on nix net/cnxk: support inline security setup for cn9k net/cnxk: support inline security setup for cn10k net/cnxk: support Rx security offload on cn9k net/cnxk: support Tx security offload on cn9k net/cnxk: support Rx security offload on cn10k net/cnxk: support Tx security offload on cn10k net/cnxk: reflect globally enabled offloads in queue conf

Satheesh Paul (2):
common/cnxk: support inline IPsec rte flow action net/cnxk: support configuring channel mask via devargs

Srujana Challa (7):
common/cnxk: support cn9k fast path security session common/cnxk: support anti-replay check in SW for cn9k net/cnxk: support IPsec anti replay in cn9k net/cnxk: support IPsec transport mode in cn10k net/cnxk: update ethertype for mixed IPsec tunnel versions net/cnxk: allow zero udp6 checksum for non inline device net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

v2:
- Included bug fixes for second pass packets
- Updated .ini files.
- Reworded commit messages with additional description and abbreviation fixes

 doc/guides/nics/cnxk.rst                         |  122 +++
 doc/guides/nics/features/cnxk.ini                |    1 +
 doc/guides/nics/features/cnxk_vec.ini            |    1 +
 doc/guides/nics/features/cnxk_vf.ini             |    1 +
 doc/guides/rel_notes/release_21_11.rst           |    2 +
 drivers/common/cnxk/cnxk_security.c              |  212 +++++
 drivers/common/cnxk/cnxk_security.h              |   12 +
 drivers/common/cnxk/cnxk_security_ar.h           |  184 ++++
 drivers/common/cnxk/hw/cpt.h                     |   19 +
 drivers/common/cnxk/meson.build                  |    3 +
 drivers/common/cnxk/roc_api.h                    |   49 +-
 drivers/common/cnxk/roc_constants.h              |   58 ++
 drivers/common/cnxk/roc_cpt.c                    |   54 +-
 drivers/common/cnxk/roc_cpt.h                    |   10 +
 drivers/common/cnxk/roc_cpt_debug.c              |   63 +-
 drivers/common/cnxk/roc_cpt_priv.h               |    1 +
 drivers/common/cnxk/roc_idev.c                   |    2 +
 drivers/common/cnxk/roc_idev_priv.h              |    3 +
 drivers/common/cnxk/roc_io.h                     |    9 +
 drivers/common/cnxk/roc_io_generic.h             |    3 +-
 drivers/common/cnxk/roc_irq.c                    |    7 +-
 drivers/common/cnxk/roc_nix.c                    |    2 +-
 drivers/common/cnxk/roc_nix.h                    |    7 +
 drivers/common/cnxk/roc_nix_debug.c              |  168 +++-
 drivers/common/cnxk/roc_nix_fc.c                 |   23 +-
 drivers/common/cnxk/roc_nix_inl.c                |  778 +++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h                |  170 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c            |  639 ++++++++++++++
 drivers/common/cnxk/roc_nix_inl_dev_irq.c        |  359 ++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h           |   68 ++
 drivers/common/cnxk/roc_nix_priv.h               |   31 +
 drivers/common/cnxk/roc_nix_queue.c              |  137 +--
 drivers/common/cnxk/roc_npc.c                    |   27 +-
 drivers/common/cnxk/roc_npc_mcam.c               |   28 +-
 drivers/common/cnxk/roc_platform.h               |   11 +-
 drivers/common/cnxk/roc_priv.h                   |    3 +
 drivers/common/cnxk/roc_sso.c                    |   52 +-
 drivers/common/cnxk/roc_sso_priv.h               |    9 +
 drivers/common/cnxk/version.map                  |   34 +
 drivers/event/cnxk/cn10k_eventdev.c              |   93 +-
 drivers/event/cnxk/cn10k_worker.h                |  147 +++-
 drivers/event/cnxk/cn10k_worker_deq.c            |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c      |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c        |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c     |    2 +-
 drivers/event/cnxk/cn9k_eventdev.c               |  182 ++--
 drivers/event/cnxk/cn9k_worker.h                 |  170 +++-
 drivers/event/cnxk/cn9k_worker_deq.c             |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c       |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c         |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c        |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c  |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c    |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |    2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c         |   36 +-
 drivers/net/cnxk/cn10k_ethdev.c                  |   41 +-
 drivers/net/cnxk/cn10k_ethdev.h                  |   48 ++
 drivers/net/cnxk/cn10k_ethdev_sec.c              |  492 +++++++++++
 drivers/net/cnxk/cn10k_rx.c                      |   31 +-
 drivers/net/cnxk/cn10k_rx.h                      |  649 +++++++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_rx_vec.c                  |    4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c             |    4 +-
 drivers/net/cnxk/cn10k_tx.c                      |   31 +-
 drivers/net/cnxk/cn10k_tx.h                      | 1006 +++++++++++++++++++---
 drivers/net/cnxk/cn10k_tx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_tx_vec.c                  |    2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c             |    2 +-
 drivers/net/cnxk/cn9k_ethdev.c                   |   23 +
 drivers/net/cnxk/cn9k_ethdev.h                   |   64 ++
 drivers/net/cnxk/cn9k_ethdev_sec.c               |  382 ++++++++
 drivers/net/cnxk/cn9k_rx.c                       |   31 +-
 drivers/net/cnxk/cn9k_rx.h                       |  493 +++++++++--
 drivers/net/cnxk/cn9k_rx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cn9k_tx.c                       |   29 +-
 drivers/net/cnxk/cn9k_tx.h                       |  393 ++++++---
 drivers/net/cnxk/cn9k_tx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cnxk_ethdev.c                   |  243 +++++-
 drivers/net/cnxk/cnxk_ethdev.h                   |  125 ++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c           |   88 +-
 drivers/net/cnxk/cnxk_ethdev_sec.c               |  315 +++++++
 drivers/net/cnxk/cnxk_lookup.c                   |   50 +-
 drivers/net/cnxk/meson.build                     |    3 +
 drivers/net/cnxk/version.map                     |    5 +
 usertools/dpdk-devbind.py                        |    8 +-
 96 files changed, 7686 insertions(+), 918 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
Signature · 1 line
2.8.4
#30 lore raw

PATCH v2 1/28 common/cnxk: support cn9k fast path security session

From: Srujana Challa <[email protected]>

Add security support to init cn9k fast path SA data for AES GCM and AES CBC + HMAC SHA1.

---
 drivers/common/cnxk/cnxk_security.c | 211 ++++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/cnxk_security.h |  12 ++
 drivers/common/cnxk/version.map     |   4 +
 3 files changed, 227 insertions(+)
drivers/common/cnxk/cnxk_security.c +211 -0
index cc5daf3..c117fa7 100644
@@ -513,6 +513,217 @@ cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa)
 	return !!sa->w2.s.valid;
 }
 
+static inline int
+ipsec_xfrm_verify(struct rte_security_ipsec_xform *ipsec_xfrm,
+		  struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	if (crypto_xfrm->next == NULL)
+		return -EINVAL;
+
+	if (ipsec_xfrm->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_AUTH ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_CIPHER)
+			return -EINVAL;
+	} else {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_CIPHER ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_AUTH)
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int
+onf_ipsec_sa_common_param_fill(struct roc_ie_onf_sa_ctl *ctl, uint8_t *salt,
+			       uint8_t *cipher_key, uint8_t *hmac_opad_ipad,
+			       struct rte_security_ipsec_xform *ipsec_xfrm,
+			       struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_crypto_sym_xform *auth_xfrm, *cipher_xfrm;
+	int rc, length, auth_key_len;
+	const uint8_t *key = NULL;
+
+	/* Set direction */
+	switch (ipsec_xfrm->direction) {
+	case RTE_SECURITY_IPSEC_SA_DIR_INGRESS:
+		ctl->direction = ROC_IE_SA_DIR_INBOUND;
+		auth_xfrm = crypto_xfrm;
+		cipher_xfrm = crypto_xfrm->next;
+		break;
+	case RTE_SECURITY_IPSEC_SA_DIR_EGRESS:
+		ctl->direction = ROC_IE_SA_DIR_OUTBOUND;
+		cipher_xfrm = crypto_xfrm;
+		auth_xfrm = crypto_xfrm->next;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set protocol - ESP vs AH */
+	switch (ipsec_xfrm->proto) {
+	case RTE_SECURITY_IPSEC_SA_PROTO_ESP:
+		ctl->ipsec_proto = ROC_IE_SA_PROTOCOL_ESP;
+		break;
+	case RTE_SECURITY_IPSEC_SA_PROTO_AH:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set mode - transport vs tunnel */
+	switch (ipsec_xfrm->mode) {
+	case RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TRANSPORT;
+		break;
+	case RTE_SECURITY_IPSEC_SA_MODE_TUNNEL:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TUNNEL;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set encryption algorithm */
+	if (crypto_xfrm->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
+		length = crypto_xfrm->aead.key.length;
+
+		switch (crypto_xfrm->aead.algo) {
+		case RTE_CRYPTO_AEAD_AES_GCM:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_GCM;
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_NULL;
+			memcpy(salt, &ipsec_xfrm->salt, 4);
+			key = crypto_xfrm->aead.key.data;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+	} else {
+		rc = ipsec_xfrm_verify(ipsec_xfrm, crypto_xfrm);
+		if (rc)
+			return rc;
+
+		switch (cipher_xfrm->cipher.algo) {
+		case RTE_CRYPTO_CIPHER_AES_CBC:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_CBC;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+		switch (auth_xfrm->auth.algo) {
+		case RTE_CRYPTO_AUTH_SHA1_HMAC:
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_SHA1;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+		auth_key_len = auth_xfrm->auth.key.length;
+		if (auth_key_len < 20 || auth_key_len > 64)
+			return -ENOTSUP;
+
+		key = cipher_xfrm->cipher.key.data;
+		length = cipher_xfrm->cipher.key.length;
+
+		ipsec_hmac_opad_ipad_gen(auth_xfrm, hmac_opad_ipad);
+	}
+
+	switch (length) {
+	case ROC_CPT_AES128_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
+		break;
+	case ROC_CPT_AES192_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_192;
+		break;
+	case ROC_CPT_AES256_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_256;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	memcpy(cipher_key, key, length);
+
+	if (ipsec_xfrm->options.esn)
+		ctl->esn_en = 1;
+
+	ctl->spi = rte_cpu_to_be_32(ipsec_xfrm->spi);
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_security_ipsec_tunnel_param *tunnel = &ipsec_xfrm->tunnel;
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	/* Fill common params */
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	if (ipsec_xfrm->mode != RTE_SECURITY_IPSEC_SA_MODE_TUNNEL)
+		goto skip_tunnel_info;
+
+	/* Tunnel header info */
+	switch (tunnel->type) {
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV4:
+		memcpy(&sa->ip_src, &tunnel->ipv4.src_ip,
+		       sizeof(struct in_addr));
+		memcpy(&sa->ip_dst, &tunnel->ipv4.dst_ip,
+		       sizeof(struct in_addr));
+		break;
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV6:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+skip_tunnel_info:
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+bool
+cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
+bool
+cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
 uint8_t
 cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo,
 		     enum rte_crypto_auth_algorithm a_algo,
drivers/common/cnxk/cnxk_security.h +12 -0
index 602f583..db97887 100644
@@ -46,4 +46,16 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
 bool __roc_api cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa);
 bool __roc_api cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa);
 
+/* [CN9K, CN10K) */
+int __roc_api
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm);
+int __roc_api
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm);
+bool __roc_api cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa);
+bool __roc_api cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa);
+
 #endif /* _CNXK_SECURITY_H__ */
drivers/common/cnxk/version.map +4 -0
index 5df2e56..c132871 100644
@@ -14,6 +14,10 @@ INTERNAL {
 	cnxk_logtype_sso;
 	cnxk_logtype_tim;
 	cnxk_logtype_tm;
+	cnxk_onf_ipsec_inb_sa_fill;
+	cnxk_onf_ipsec_outb_sa_fill;
+	cnxk_onf_ipsec_inb_sa_valid;
+	cnxk_onf_ipsec_outb_sa_valid;
 	cnxk_ot_ipsec_inb_sa_fill;
 	cnxk_ot_ipsec_outb_sa_fill;
 	cnxk_ot_ipsec_inb_sa_valid;
Signature · 1 line
2.8.4
#31 lore raw

PATCH v2 2/28 common/cnxk: support CPT parse header dump

In reply to Nithin Dabilpuram

Add helper API to dump CPT parse header.

---
 drivers/common/cnxk/roc_cpt.h       |  2 ++
 drivers/common/cnxk/roc_cpt_debug.c | 31 +++++++++++++++++++++++++++++++
 drivers/common/cnxk/version.map     |  1 +
 3 files changed, 34 insertions(+)
drivers/common/cnxk/roc_cpt.h +2 -0
index 9e63073..c80a8e0 100644
@@ -155,4 +155,6 @@ void __roc_api roc_cpt_iq_enable(struct roc_cpt_lf *lf);
 int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
 				   struct roc_cpt_lmtline *lmtline, int lf_id);
 
+void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
+
 #endif /* _ROC_CPT_H_ */
drivers/common/cnxk/roc_cpt_debug.c +31 -0
index 9a9dcba..a6c9004 100644
@@ -5,6 +5,37 @@
 #include "roc_api.h"
 #include "roc_priv.h"
 
+void
+roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
+{
+	plt_print("CPT_PARSE \t0x%p:", cpth);
+
+	/* W0 */
+	plt_print("W0: cookie \t0x%x\t\tmatch_id \t0x%04x\t\terr_sum \t%u \t",
+		  cpth->w0.cookie, cpth->w0.match_id, cpth->w0.err_sum);
+	plt_print("W0: reas_sts \t0x%x\t\tet_owr \t%u\t\tpkt_fmt \t%u \t",
+		  cpth->w0.reas_sts, cpth->w0.et_owr, cpth->w0.pkt_fmt);
+	plt_print("W0: pad_len \t%u\t\tnum_frags \t%u\t\tpkt_out \t%u \t",
+		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
+
+	/* W1 */
+	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+
+	/* W2 */
+	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
+		  cpth->w2.frag_age, cpth->w2.orig_pf_func);
+	plt_print("W2: il3_off \t0x%x\t\tfi_pad \t0x%x\t\tfi_offset \t0x%x \t",
+		  cpth->w2.il3_off, cpth->w2.fi_pad, cpth->w2.fi_offset);
+
+	/* W3 */
+	plt_print("W3: hw_ccode \t0x%x\t\tuc_ccode \t0x%x\t\tspi \t0x%08x",
+		  cpth->w3.hw_ccode, cpth->w3.uc_ccode, cpth->w3.spi);
+
+	/* W4 */
+	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
+		  cpth->esn, cpth->frag1_wqe_ptr);
+}
+
 static int
 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
 {
drivers/common/cnxk/version.map +1 -0
index c132871..1f9fe36 100644
@@ -66,6 +66,7 @@ INTERNAL {
 	roc_cpt_lf_fini;
 	roc_cpt_lfs_print;
 	roc_cpt_lmtline_init;
+	roc_cpt_parse_hdr_dump;
 	roc_cpt_rxc_time_cfg;
 	roc_error_msg_get;
 	roc_hash_sha1_gen;
Signature · 1 line
2.8.4
#32 lore raw

PATCH v2 3/28 common/cnxk: allow reuse of SSO API for inline dev

In reply to Nithin Dabilpuram

Rework interface of SSO internal functions to use for NIX inline dev's SSO LF's.

---
 drivers/common/cnxk/roc_sso.c      | 52 ++++++++++++++++++++++++--------------
 drivers/common/cnxk/roc_sso_priv.h |  9 +++++++
 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/common/cnxk/roc_sso.c +33 -19
index 1ccf262..bdf973f 100644
@@ -6,11 +6,10 @@
 #include "roc_priv.h"
 
 /* Private functions. */
-static int
-sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
+int
+sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
 	     void **rsp)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -41,10 +40,9 @@ sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
 	return 0;
 }
 
-static int
-sso_lf_free(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf)
+int
+sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -152,7 +150,7 @@ sso_rsrc_get(struct roc_sso *roc_sso)
 	return 0;
 }
 
-static void
+void
 sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		    uint16_t hwgrp[], uint16_t n, uint16_t enable)
 {
@@ -172,8 +170,10 @@ sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		k = k ? k : 4;
 		for (j = 0; j < k; j++) {
 			mask[j] = hwgrp[i + j] | enable << 14;
-			enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
-				 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			if (bmp) {
+				enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
+					 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			}
 			plt_sso_dbg("HWS %d Linked to HWGRP %d", hws,
 				    hwgrp[i + j]);
 		}
@@ -388,10 +388,8 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,
 }
 
 int
-roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
-			uint16_t hwgrps)
+sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	struct sso_hw_setconfig *req;
 	int rc = -ENOSPC;
 
@@ -406,9 +404,17 @@ roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
 }
 
 int
-roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
+			uint16_t hwgrps)
 {
 	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_alloc_xaq(dev, npa_aura_id, hwgrps);
+}
+
+int
+sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)
+{
 	struct sso_hw_xaq_release *req;
 
 	req = mbox_alloc_msg_sso_hw_release_xaq_aura(dev->mbox);
@@ -420,6 +426,14 @@ roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
 }
 
 int
+roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+{
+	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_release_xaq(dev, hwgrps);
+}
+
+int
 roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp,
 			   uint8_t weight, uint8_t affinity, uint8_t priority)
 {
@@ -468,13 +482,13 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 		goto hwgrp_atch_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWS, nb_hws, NULL);
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWS, nb_hws, NULL);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWS LFs");
 		goto hws_alloc_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp,
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp,
 			  (void **)&rsp_hwgrp);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWGRP Lfs");
@@ -503,9 +517,9 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 
 	return 0;
 sso_msix_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp);
 hwgrp_alloc_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, nb_hws);
 hws_alloc_fail:
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
 hwgrp_atch_fail:
@@ -523,8 +537,8 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)
 
 	sso_unregister_irqs_priv(roc_sso, &sso->pci_dev->intr_handle,
 				 roc_sso->nb_hws, roc_sso->nb_hwgrp);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
 
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWS);
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
drivers/common/cnxk/roc_sso_priv.h +9 -0
index 5361d4f..8dffa3f 100644
@@ -39,6 +39,15 @@ roc_sso_to_sso_priv(struct roc_sso *roc_sso)
 	return (struct sso *)&roc_sso->reserved[0];
 }
 
+/* SSO LF ops */
+int sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
+		 void **rsp);
+int sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf);
+void sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
+			 uint16_t hwgrp[], uint16_t n, uint16_t enable);
+int sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps);
+int sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps);
+
 /* SSO IRQ */
 int sso_register_irqs_priv(struct roc_sso *roc_sso,
 			   struct plt_intr_handle *handle, uint16_t nb_hws,
Signature · 1 line
2.8.4
#33 lore raw

PATCH v2 4/28 common/cnxk: change NIX debug API and queue API interface

In reply to Nithin Dabilpuram

Change NIX debug API and queue API interface for use by internal NIX inline device initialization.

---
 drivers/common/cnxk/roc_nix.c       |   2 +-
 drivers/common/cnxk/roc_nix_debug.c | 118 +++++++++++++++++++++++++++---------
 drivers/common/cnxk/roc_nix_priv.h  |  16 +++++
 drivers/common/cnxk/roc_nix_queue.c |  89 +++++++++++++++------------
 4 files changed, 159 insertions(+), 66 deletions(-)
drivers/common/cnxk/roc_nix.c +1 -1
index 23d508b..3ab954e 100644
@@ -300,7 +300,7 @@ sdp_lbk_id_update(struct plt_pci_device *pci_dev, struct nix *nix)
 	}
 }
 
-static inline uint64_t
+uint64_t
 nix_get_blkaddr(struct dev *dev)
 {
 	uint64_t reg;
drivers/common/cnxk/roc_nix_debug.c +91 -27

283 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +16 -0
index 1bd1b6a..0cabcd2 100644
@@ -349,6 +349,12 @@ int nix_tm_sq_sched_conf(struct nix *nix, struct nix_tm_node *node,
 			 bool rr_quantum_only);
 int nix_tm_prepare_rate_limited_tree(struct roc_nix *roc_nix);
 
+int nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
+		    bool cfg, bool ena);
+int nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
+	       bool ena);
+int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable);
+
 /*
  * TM priv utils.
  */
@@ -394,4 +400,14 @@ void nix_tm_node_free(struct nix_tm_node *node);
 struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc(void);
 void nix_tm_shaper_profile_free(struct nix_tm_shaper_profile *profile);
 
+uint64_t nix_get_blkaddr(struct dev *dev);
+void nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx);
+int nix_lf_gen_reg_dump(uintptr_t nix_lf_base, uint64_t *data);
+int nix_lf_stat_reg_dump(uintptr_t nix_lf_base, uint64_t *data,
+			 uint8_t lf_tx_stats, uint8_t lf_rx_stats);
+int nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
+			uint16_t cints);
+int nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid,
+		  __io void **ctx_p);
+
 #endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_queue.c +51 -38

160 lines not on this page · raw message

Signature · 1 line
2.8.4
#34 lore raw

PATCH v2 5/28 common/cnxk: support NIX inline device IRQ

In reply to Nithin Dabilpuram

Add API to setup NIX inline device IRQ's. This registers IRQ's for errors in case of NIX, CPT LF, SSOW and get wor interrupt in case of SSO.

---
 drivers/common/cnxk/meson.build           |   1 +
 drivers/common/cnxk/roc_api.h             |   3 +
 drivers/common/cnxk/roc_irq.c             |   7 +-
 drivers/common/cnxk/roc_nix_inl.h         |  10 +
 drivers/common/cnxk/roc_nix_inl_dev_irq.c | 359 ++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h    |  57 +++++
 drivers/common/cnxk/roc_platform.h        |   9 +-
 drivers/common/cnxk/roc_priv.h            |   3 +
 8 files changed, 442 insertions(+), 7 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
drivers/common/cnxk/meson.build +1 -0
index 8a551d1..207ca00 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
         'roc_nix_npc.c',
drivers/common/cnxk/roc_api.h +3 -0
index 7dec845..c1af95e 100644
@@ -129,4 +129,7 @@
 /* HASH computation */
 #include "roc_hash.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl.h"
+
 #endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_irq.c +4 -3
index 4c2b4c3..28fe691 100644
@@ -138,9 +138,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
 		irq_init(intr_handle);
 	}
 
-	if (vec > intr_handle->max_intr) {
-		plt_err("Vector=%d greater than max_intr=%d", vec,
-			intr_handle->max_intr);
+	if (vec > intr_handle->max_intr || vec >= PLT_DIM(intr_handle->efds)) {
+		plt_err("Vector=%d greater than max_intr=%d or "
+			"max_efd=%" PRIu64,
+			vec, intr_handle->max_intr, PLT_DIM(intr_handle->efds));
 		return -EINVAL;
 	}
 
drivers/common/cnxk/roc_nix_inl.h new file +10 -0
new file mode 100644
index 0000000..1ec3dda
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _ROC_NIX_INL_H_
+#define _ROC_NIX_INL_H_
+
+/* Inline device SSO Work callback */
+typedef void (*roc_nix_inl_sso_work_cb_t)(uint64_t *gw, void *args);
+
+#endif /* _ROC_NIX_INL_H_ */
drivers/common/cnxk/roc_nix_inl_dev_irq.c new file +359 -0

359 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h new file +57 -0

57 lines not on this page · raw message

drivers/common/cnxk/roc_platform.h +5 -4
index 285b24b..177db3d 100644
@@ -113,10 +113,11 @@
 #define plt_write64(val, addr)                                                 \
 	rte_write64_relaxed((val), (volatile void *)(addr))
 
-#define plt_wmb() rte_wmb()
-#define plt_rmb() rte_rmb()
-#define plt_io_wmb() rte_io_wmb()
-#define plt_io_rmb() rte_io_rmb()
+#define plt_wmb()		rte_wmb()
+#define plt_rmb()		rte_rmb()
+#define plt_io_wmb()		rte_io_wmb()
+#define plt_io_rmb()		rte_io_rmb()
+#define plt_atomic_thread_fence rte_atomic_thread_fence
 
 #define plt_mmap       mmap
 #define PLT_PROT_READ  PROT_READ
drivers/common/cnxk/roc_priv.h +3 -0
index 7494b8d..f72bbd5 100644
@@ -38,4 +38,7 @@
 /* CPT */
 #include "roc_cpt_priv.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl_priv.h"
+
 #endif /* _ROC_PRIV_H_ */
Signature · 1 line
2.8.4
#35 lore raw

PATCH v2 6/28 common/cnxk: support NIX inline device init and fini

In reply to Nithin Dabilpuram

Add support to init and fini inline device with NIX LF, SSO LF and SSOW LF for inline inbound IPSec in CN10K.

---
 drivers/common/cnxk/meson.build        |   1 +
 drivers/common/cnxk/roc_api.h          |   2 +
 drivers/common/cnxk/roc_cpt.c          |   7 +-
 drivers/common/cnxk/roc_idev.c         |   2 +
 drivers/common/cnxk/roc_idev_priv.h    |   3 +
 drivers/common/cnxk/roc_nix_debug.c    |  35 ++
 drivers/common/cnxk/roc_nix_inl.h      |  56 +++
 drivers/common/cnxk/roc_nix_inl_dev.c  | 636 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h |   8 +
 drivers/common/cnxk/roc_platform.h     |   2 +
 drivers/common/cnxk/version.map        |   3 +
 11 files changed, 752 insertions(+), 3 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
drivers/common/cnxk/meson.build +1 -0
index 207ca00..e8940d7 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
drivers/common/cnxk/roc_api.h +2 -0
index c1af95e..53f4e4b 100644
@@ -53,6 +53,8 @@
 #define PCI_DEVID_CNXK_RVU_SDP_PF     0xA0f6
 #define PCI_DEVID_CNXK_RVU_SDP_VF     0xA0f7
 #define PCI_DEVID_CNXK_BPHY	      0xA089
+#define PCI_DEVID_CNXK_RVU_NIX_INL_PF 0xA0F0
+#define PCI_DEVID_CNXK_RVU_NIX_INL_VF 0xA0F1
 
 #define PCI_DEVID_CN9K_CGX  0xA059
 #define PCI_DEVID_CN10K_RPM 0xA060
drivers/common/cnxk/roc_cpt.c +4 -3
index 33524ef..48a378b 100644
@@ -381,11 +381,12 @@ cpt_lfs_alloc(struct dev *dev, uint8_t eng_grpmsk, uint8_t blkaddr,
 	if (blkaddr != RVU_BLOCK_ADDR_CPT0 && blkaddr != RVU_BLOCK_ADDR_CPT1)
 		return -EINVAL;
 
-	PLT_SET_USED(inl_dev_sso);
-
 	req = mbox_alloc_msg_cpt_lf_alloc(mbox);
 	req->nix_pf_func = 0;
-	req->sso_pf_func = idev_sso_pffunc_get();
+	if (inl_dev_sso && nix_inl_dev_pffunc_get())
+		req->sso_pf_func = nix_inl_dev_pffunc_get();
+	else
+		req->sso_pf_func = idev_sso_pffunc_get();
 	req->eng_grpmsk = eng_grpmsk;
 	req->blkaddr = blkaddr;
 
drivers/common/cnxk/roc_idev.c +2 -0
index 1494187..648f37b 100644
@@ -38,6 +38,8 @@ idev_set_defaults(struct idev_cfg *idev)
 	idev->num_lmtlines = 0;
 	idev->bphy = NULL;
 	idev->cpt = NULL;
+	idev->nix_inl_dev = NULL;
+	plt_spinlock_init(&idev->nix_inl_dev_lock);
 	__atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE);
 }
 
drivers/common/cnxk/roc_idev_priv.h +3 -0
index 84e6f1e..2c8309b 100644
@@ -9,6 +9,7 @@
 struct npa_lf;
 struct roc_bphy;
 struct roc_cpt;
+struct nix_inl_dev;
 struct idev_cfg {
 	uint16_t sso_pf_func;
 	uint16_t npa_pf_func;
@@ -20,6 +21,8 @@ struct idev_cfg {
 	uint64_t lmt_base_addr;
 	struct roc_bphy *bphy;
 	struct roc_cpt *cpt;
+	struct nix_inl_dev *nix_inl_dev;
+	plt_spinlock_t nix_inl_dev_lock;
 };
 
 /* Generic */
drivers/common/cnxk/roc_nix_debug.c +35 -0
index 9539bb9..582f5a3 100644
@@ -1213,3 +1213,38 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
 }
+
+void
+roc_nix_inl_dev_dump(struct roc_nix_inl_dev *roc_inl_dev)
+{
+	struct nix_inl_dev *inl_dev =
+		(struct nix_inl_dev *)&roc_inl_dev->reserved;
+	struct dev *dev = &inl_dev->dev;
+
+	nix_dump("nix_inl_dev@%p", inl_dev);
+	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
+	nix_dump("  vf = %d", dev_get_vf(dev->pf_func));
+	nix_dump("  bar2 = 0x%" PRIx64, dev->bar2);
+	nix_dump("  bar4 = 0x%" PRIx64, dev->bar4);
+
+	nix_dump("  \tpci_dev = %p", inl_dev->pci_dev);
+	nix_dump("  \tnix_base = 0x%" PRIxPTR "", inl_dev->nix_base);
+	nix_dump("  \tsso_base = 0x%" PRIxPTR "", inl_dev->sso_base);
+	nix_dump("  \tssow_base = 0x%" PRIxPTR "", inl_dev->ssow_base);
+	nix_dump("  \tnix_msixoff = %d", inl_dev->nix_msixoff);
+	nix_dump("  \tsso_msixoff = %d", inl_dev->sso_msixoff);
+	nix_dump("  \tssow_msixoff = %d", inl_dev->ssow_msixoff);
+	nix_dump("  \tnix_cints = %d", inl_dev->cints);
+	nix_dump("  \tnix_qints = %d", inl_dev->qints);
+	nix_dump("  \trq_refs = %d", inl_dev->rq_refs);
+	nix_dump("  \tinb_sa_base = 0x%p", inl_dev->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %d", inl_dev->inb_sa_sz);
+	nix_dump("  \txaq_buf_size = %u", inl_dev->xaq_buf_size);
+	nix_dump("  \txae_waes = %u", inl_dev->xae_waes);
+	nix_dump("  \tiue = %u", inl_dev->iue);
+	nix_dump("  \txaq_aura = 0x%" PRIx64, inl_dev->xaq_aura);
+	nix_dump("  \txaq_mem = 0x%p", inl_dev->xaq_mem);
+
+	nix_dump("  \tinl_dev_rq:");
+	roc_nix_rq_dump(&inl_dev->rq);
+}
drivers/common/cnxk/roc_nix_inl.h +56 -0

63 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_dev.c new file +636 -0

636 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h +8 -0
index f424009..4729a38 100644
@@ -15,11 +15,13 @@ struct nix_inl_dev {
 	uintptr_t nix_base;
 	uintptr_t ssow_base;
 	uintptr_t sso_base;
+	uintptr_t cpt_base;
 
 	/* MSIX vector offsets */
 	uint16_t nix_msixoff;
 	uint16_t ssow_msixoff;
 	uint16_t sso_msixoff;
+	uint16_t cpt_msixoff;
 
 	/* SSO data */
 	uint32_t xaq_buf_size;
@@ -43,9 +45,13 @@ struct nix_inl_dev {
 	void *inb_sa_base;
 	uint16_t inb_sa_sz;
 
+	/* CPT data */
+	struct roc_cpt_lf cpt_lf;
+
 	/* Device arguments */
 	uint8_t selftest;
 	uint16_t ipsec_in_max_spi;
+	bool attach_cptlf;
 };
 
 int nix_inl_sso_register_irqs(struct nix_inl_dev *inl_dev);
@@ -54,4 +60,6 @@ void nix_inl_sso_unregister_irqs(struct nix_inl_dev *inl_dev);
 int nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev);
 void nix_inl_nix_unregister_irqs(struct nix_inl_dev *inl_dev);
 
+uint16_t nix_inl_dev_pffunc_get(void);
+
 #endif /* _ROC_NIX_INL_PRIV_H_ */
drivers/common/cnxk/roc_platform.h +2 -0
index 177db3d..241655b 100644
@@ -37,6 +37,7 @@
 #define PLT_MEMZONE_NAMESIZE	 RTE_MEMZONE_NAMESIZE
 #define PLT_STD_C11		 RTE_STD_C11
 #define PLT_PTR_ADD		 RTE_PTR_ADD
+#define PLT_PTR_DIFF		 RTE_PTR_DIFF
 #define PLT_MAX_RXTX_INTR_VEC_ID RTE_MAX_RXTX_INTR_VEC_ID
 #define PLT_INTR_VEC_RXTX_OFFSET RTE_INTR_VEC_RXTX_OFFSET
 #define PLT_MIN			 RTE_MIN
@@ -77,6 +78,7 @@
 #define plt_cpu_to_be_64 rte_cpu_to_be_64
 #define plt_be_to_cpu_64 rte_be_to_cpu_64
 
+#define plt_align32pow2	    rte_align32pow2
 #define plt_align32prevpow2 rte_align32prevpow2
 
 #define plt_bitmap			rte_bitmap
drivers/common/cnxk/version.map +3 -0
index 1f9fe36..3256aeb 100644
@@ -100,6 +100,9 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_dev_dump;
+	roc_nix_inl_dev_fini;
+	roc_nix_inl_dev_init;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#36 lore raw

PATCH v2 7/28 common/cnxk: support NIX inline inbound and outbound setup

In reply to Nithin Dabilpuram

Add API to support setting up NIX inline inbound and NIX inline outbound. In case of inbound, SA base is setup on NIX PFFUNC and in case of outbound, required number of CPT LF's are attached to NIX PFFUNC.

---
 drivers/common/cnxk/hw/cpt.h         |   8 +
 drivers/common/cnxk/meson.build      |   1 +
 drivers/common/cnxk/roc_api.h        |  48 +--
 drivers/common/cnxk/roc_constants.h  |  58 +++
 drivers/common/cnxk/roc_io.h         |   9 +
 drivers/common/cnxk/roc_io_generic.h |   3 +-
 drivers/common/cnxk/roc_nix.h        |   5 +
 drivers/common/cnxk/roc_nix_debug.c  |  15 +
 drivers/common/cnxk/roc_nix_inl.c    | 778 +++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h    | 101 +++++
 drivers/common/cnxk/roc_nix_priv.h   |  15 +
 drivers/common/cnxk/roc_nix_queue.c  |  28 +-
 drivers/common/cnxk/roc_npc.c        |  27 +-
 drivers/common/cnxk/version.map      |  26 ++
 14 files changed, 1047 insertions(+), 75 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
drivers/common/cnxk/hw/cpt.h +8 -0
index 84ebf2d..975139f 100644
@@ -40,6 +40,7 @@
 #define CPT_LF_CTX_ENC_PKT_CNT	(0x540ull)
 #define CPT_LF_CTX_DEC_BYTE_CNT (0x550ull)
 #define CPT_LF_CTX_DEC_PKT_CNT	(0x560ull)
+#define CPT_LF_CTX_RELOAD	(0x570ull)
 
 #define CPT_AF_LFX_CTL(a)  (0x27000ull | (uint64_t)(a) << 3)
 #define CPT_AF_LFX_CTL2(a) (0x29000ull | (uint64_t)(a) << 3)
@@ -68,6 +69,13 @@ union cpt_lf_ctx_flush {
 	} s;
 };
 
+union cpt_lf_ctx_reload {
+	uint64_t u;
+	struct {
+		uint64_t cptr : 46;
+	} s;
+};
+
 union cpt_lf_inprog {
 	uint64_t u;
 	struct cpt_lf_inprog_s {
drivers/common/cnxk/meson.build +1 -0
index e8940d7..cd19ad2 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl.c',
         'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
drivers/common/cnxk/roc_api.h +3 -45

72 lines not on this page · raw message

drivers/common/cnxk/roc_constants.h new file +58 -0

58 lines not on this page · raw message

drivers/common/cnxk/roc_io.h +9 -0
index aee8c7f..fe5f7f4 100644
@@ -13,6 +13,15 @@
 		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
 	} while (0)
 
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id)                              \
+	do {                                                                   \
+		/* 16 Lines per core */                                        \
+		lmt_id = ROC_LMT_CPT_BASE_ID_OFF;                              \
+		lmt_id += (plt_lcore_id() << ROC_LMT_CPT_LINES_PER_CORE_LOG2); \
+		/* Each line is of 128B */                                     \
+		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
+	} while (0)
+
 #define roc_load_pair(val0, val1, addr)                                        \
 	({                                                                     \
 		asm volatile("ldp %x[x0], %x[x1], [%x[p1]]"                    \
drivers/common/cnxk/roc_io_generic.h +2 -1
index 28cb096..ceaa3a3 100644
@@ -5,7 +5,8 @@
 #ifndef _ROC_IO_GENERIC_H_
 #define _ROC_IO_GENERIC_H_
 
-#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
+#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id)	  (lmt_id = 0)
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
 
 #define roc_load_pair(val0, val1, addr)                                        \
 	do {                                                                   \
drivers/common/cnxk/roc_nix.h +5 -0
index b0e6fab..ff8c93a 100644
@@ -171,6 +171,7 @@ struct roc_nix_rq {
 	uint8_t spb_red_pass;
 	/* End of Input parameters */
 	struct roc_nix *roc_nix;
+	bool inl_dev_ref;
 };
 
 struct roc_nix_cq {
@@ -258,6 +259,10 @@ struct roc_nix {
 	bool enable_loop;
 	bool hw_vlan_ins;
 	uint8_t lock_rx_ctx;
+	uint32_t outb_nb_desc;
+	uint16_t outb_nb_crypto_qs;
+	uint16_t ipsec_in_max_spi;
+	uint16_t ipsec_out_max_sa;
 	/* End of input parameters */
 	/* LMT line base for "Per Core Tx LMT line" mode*/
 	uintptr_t lmt_base;
drivers/common/cnxk/roc_nix_debug.c +15 -0
index 582f5a3..266935a 100644
@@ -818,6 +818,7 @@ roc_nix_rq_dump(struct roc_nix_rq *rq)
 	nix_dump("  vwqe_wait_tmo = %ld", rq->vwqe_wait_tmo);
 	nix_dump("  vwqe_aura_handle = %ld", rq->vwqe_aura_handle);
 	nix_dump("  roc_nix = %p", rq->roc_nix);
+	nix_dump("  inl_dev_ref = %d", rq->inl_dev_ref);
 }
 
 void
@@ -1160,6 +1161,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 {
 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
 	struct dev *dev = &nix->dev;
+	int i;
 
 	nix_dump("nix@%p", nix);
 	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
@@ -1169,6 +1171,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  port_id = %d", roc_nix->port_id);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->rss_tag_as_xor);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->max_sqb_count);
+	nix_dump("  outb_nb_desc = %u", roc_nix->outb_nb_desc);
 
 	nix_dump("  \tpci_dev = %p", nix->pci_dev);
 	nix_dump("  \tbase = 0x%" PRIxPTR "", nix->base);
@@ -1206,12 +1209,24 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \ttx_link = %d", nix->tx_link);
 	nix_dump("  \tsqb_size = %d", nix->sqb_size);
 	nix_dump("  \tmsixoff = %d", nix->msixoff);
+	for (i = 0; i < nix->nb_cpt_lf; i++)
+		nix_dump("  \tcpt_msixoff[%d] = %d", i, nix->cpt_msixoff[i]);
 	nix_dump("  \tcints = %d", nix->cints);
 	nix_dump("  \tqints = %d", nix->qints);
 	nix_dump("  \tsdp_link = %d", nix->sdp_link);
 	nix_dump("  \tptp_en = %d", nix->ptp_en);
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
+	nix_dump("  \tinl_inb_ena = %d", nix->inl_inb_ena);
+	nix_dump("  \tinl_outb_ena = %d", nix->inl_outb_ena);
+	nix_dump("  \tinb_sa_base = 0x%p", nix->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %" PRIu64, nix->inb_sa_sz);
+	nix_dump("  \toutb_sa_base = 0x%p", nix->outb_sa_base);
+	nix_dump("  \toutb_sa_sz = %" PRIu64, nix->outb_sa_sz);
+	nix_dump("  \toutb_err_sso_pffunc = 0x%x", nix->outb_err_sso_pffunc);
+	nix_dump("  \tcpt_lf_base = 0x%p", nix->cpt_lf_base);
+	nix_dump("  \tnb_cpt_lf = %d", nix->nb_cpt_lf);
+	nix_dump("  \tinb_inl_dev = %d", nix->inb_inl_dev);
 }
 
 void
drivers/common/cnxk/roc_nix_inl.c new file +778 -0

778 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl.h +101 -0

112 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +15 -0
index 0cabcd2..13867b9 100644
@@ -163,6 +163,21 @@ struct nix {
 	uint16_t tm_link_cfg_lvl;
 	uint16_t contig_rsvd[NIX_TXSCH_LVL_CNT];
 	uint16_t discontig_rsvd[NIX_TXSCH_LVL_CNT];
+
+	/* Ipsec info */
+	uint16_t cpt_msixoff[MAX_RVU_BLKLF_CNT];
+	bool inl_inb_ena;
+	bool inl_outb_ena;
+	void *inb_sa_base;
+	size_t inb_sa_sz;
+	void *outb_sa_base;
+	size_t outb_sa_sz;
+	uint16_t outb_err_sso_pffunc;
+	struct roc_cpt_lf *cpt_lf_base;
+	uint16_t nb_cpt_lf;
+	/* Mode provided by driver */
+	bool inb_inl_dev;
+
 } __plt_cache_aligned;
 
 enum nix_err_status {
drivers/common/cnxk/roc_nix_queue.c +10 -18
index cff0ec3..41e8f2c 100644
@@ -131,11 +131,11 @@ nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
 
 	/* If RED enabled, then fill enable for all cases */
 	if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-		aq->rq.spb_aura_pass = rq->spb_red_pass;
-		aq->rq.lpb_aura_pass = rq->red_pass;
+		aq->rq.spb_pool_pass = rq->spb_red_pass;
+		aq->rq.lpb_pool_pass = rq->red_pass;
 
-		aq->rq.spb_aura_drop = rq->spb_red_drop;
-		aq->rq.lpb_aura_drop = rq->red_drop;
+		aq->rq.spb_pool_drop = rq->spb_red_drop;
+		aq->rq.lpb_pool_drop = rq->red_drop;
 	}
 
 	if (cfg) {
@@ -176,11 +176,11 @@ nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
 		aq->rq_mask.xqe_drop_ena = ~aq->rq_mask.xqe_drop_ena;
 
 		if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-			aq->rq_mask.spb_aura_pass = ~aq->rq_mask.spb_aura_pass;
-			aq->rq_mask.lpb_aura_pass = ~aq->rq_mask.lpb_aura_pass;
+			aq->rq_mask.spb_pool_pass = ~aq->rq_mask.spb_pool_pass;
+			aq->rq_mask.lpb_pool_pass = ~aq->rq_mask.lpb_pool_pass;
 
-			aq->rq_mask.spb_aura_drop = ~aq->rq_mask.spb_aura_drop;
-			aq->rq_mask.lpb_aura_drop = ~aq->rq_mask.lpb_aura_drop;
+			aq->rq_mask.spb_pool_drop = ~aq->rq_mask.spb_pool_drop;
+			aq->rq_mask.lpb_pool_drop = ~aq->rq_mask.lpb_pool_drop;
 		}
 	}
 
@@ -276,17 +276,13 @@ nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 
 	/* If RED enabled, then fill enable for all cases */
 	if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-		aq->rq.spb_pool_pass = rq->red_pass;
-		aq->rq.spb_aura_pass = rq->red_pass;
+		aq->rq.spb_pool_pass = rq->spb_red_pass;
 		aq->rq.lpb_pool_pass = rq->red_pass;
-		aq->rq.lpb_aura_pass = rq->red_pass;
 		aq->rq.wqe_pool_pass = rq->red_pass;
 		aq->rq.xqe_pass = rq->red_pass;
 
-		aq->rq.spb_pool_drop = rq->red_drop;
-		aq->rq.spb_aura_drop = rq->red_drop;
+		aq->rq.spb_pool_drop = rq->spb_red_drop;
 		aq->rq.lpb_pool_drop = rq->red_drop;
-		aq->rq.lpb_aura_drop = rq->red_drop;
 		aq->rq.wqe_pool_drop = rq->red_drop;
 		aq->rq.xqe_drop = rq->red_drop;
 	}
@@ -346,16 +342,12 @@ nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 
 		if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
 			aq->rq_mask.spb_pool_pass = ~aq->rq_mask.spb_pool_pass;
-			aq->rq_mask.spb_aura_pass = ~aq->rq_mask.spb_aura_pass;
 			aq->rq_mask.lpb_pool_pass = ~aq->rq_mask.lpb_pool_pass;
-			aq->rq_mask.lpb_aura_pass = ~aq->rq_mask.lpb_aura_pass;
 			aq->rq_mask.wqe_pool_pass = ~aq->rq_mask.wqe_pool_pass;
 			aq->rq_mask.xqe_pass = ~aq->rq_mask.xqe_pass;
 
 			aq->rq_mask.spb_pool_drop = ~aq->rq_mask.spb_pool_drop;
-			aq->rq_mask.spb_aura_drop = ~aq->rq_mask.spb_aura_drop;
 			aq->rq_mask.lpb_pool_drop = ~aq->rq_mask.lpb_pool_drop;
-			aq->rq_mask.lpb_aura_drop = ~aq->rq_mask.lpb_aura_drop;
 			aq->rq_mask.wqe_pool_drop = ~aq->rq_mask.wqe_pool_drop;
 			aq->rq_mask.xqe_drop = ~aq->rq_mask.xqe_drop;
 		}
drivers/common/cnxk/roc_npc.c +16 -11
index 52a54b3..047b969 100644
@@ -340,10 +340,11 @@ roc_npc_fini(struct roc_npc *roc_npc)
 }
 
 static int
-npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_queue *act_q;
 	const struct roc_npc_action_vf *vf_act;
@@ -425,15 +426,16 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
 			 *    NPC_SECURITY_ACTION_TYPE_INLINE_PROTOCOL &&
 			 *  session_protocol ==
 			 *    NPC_SECURITY_PROTOCOL_IPSEC
-			 *
-			 * RSS is not supported with inline ipsec. Get the
-			 * rq from associated conf, or make
-			 * ROC_NPC_ACTION_TYPE_QUEUE compulsory with this
-			 * action.
-			 * Currently, rq = 0 is assumed.
 			 */
 			req_act |= ROC_NPC_ACTION_TYPE_SEC;
 			rq = 0;
+
+			/* Special processing when with inline device */
+			if (roc_nix_inb_is_with_inl_dev(roc_npc->roc_nix) &&
+			    roc_nix_inl_dev_is_probed()) {
+				rq = 0;
+				pf_func = nix_inl_dev_pffunc_get();
+			}
 			break;
 		case ROC_NPC_ACTION_TYPE_VLAN_STRIP:
 			req_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;
@@ -677,11 +679,12 @@ npc_parse_attr(struct npc *npc, const struct roc_npc_attr *attr,
 }
 
 static int
-npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_rule(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	       const struct roc_npc_item_info pattern[],
 	       const struct roc_npc_action actions[], struct roc_npc_flow *flow,
 	       struct npc_parse_state *pst)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	int err;
 
 	/* Check attr */
@@ -695,7 +698,7 @@ npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
 		return err;
 
 	/* Check action */
-	err = npc_parse_actions(npc, attr, actions, flow);
+	err = npc_parse_actions(roc_npc, attr, actions, flow);
 	if (err)
 		return err;
 	return 0;
@@ -711,7 +714,8 @@ roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	struct npc_parse_state parse_state = {0};
 	int rc;
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc)
 		return rc;
 
@@ -1191,7 +1195,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	}
 	memset(flow, 0, sizeof(*flow));
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc != 0) {
 		*errcode = rc;
 		goto err_exit;
drivers/common/cnxk/version.map +26 -0
index 3256aeb..0ea3cbd 100644
@@ -100,9 +100,35 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_cb_register;
+	roc_nix_inl_cb_unregister;
 	roc_nix_inl_dev_dump;
 	roc_nix_inl_dev_fini;
 	roc_nix_inl_dev_init;
+	roc_nix_inl_dev_is_probed;
+	roc_nix_inl_dev_lock;
+	roc_nix_inl_dev_unlock;
+	roc_nix_inl_dev_rq;
+	roc_nix_inl_dev_rq_get;
+	roc_nix_inl_dev_rq_put;
+	roc_nix_inl_dev_rq_limit_get;
+	roc_nix_inl_inb_is_enabled;
+	roc_nix_inl_inb_init;
+	roc_nix_inl_inb_sa_base_get;
+	roc_nix_inl_inb_sa_get;
+	roc_nix_inl_inb_sa_max_spi;
+	roc_nix_inl_inb_sa_sz;
+	roc_nix_inl_inb_tag_update;
+	roc_nix_inl_inb_fini;
+	roc_nix_inb_is_with_inl_dev;
+	roc_nix_inb_mode_set;
+	roc_nix_inl_outb_fini;
+	roc_nix_inl_outb_init;
+	roc_nix_inl_outb_lf_base_get;
+	roc_nix_inl_outb_sa_base_get;
+	roc_nix_inl_outb_sso_pffunc_get;
+	roc_nix_inl_outb_is_enabled;
+	roc_nix_inl_sa_sync;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#37 lore raw

PATCH v2 8/28 common/cnxk: disable CQ drop when inline inbound is enabled

In reply to Nithin Dabilpuram

Disable CQ drop when inline inbound is enabled. CQ drop is not supported for second pass IPsec decrypted packets.

---
 drivers/common/cnxk/roc_nix_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_nix_queue.c +8 -3
index 41e8f2c..41a1422 100644
@@ -492,15 +492,20 @@ roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq)
 		cq->drop_thresh = min_rx_drop;
 	} else {
 		cq->drop_thresh = NIX_CQ_THRESH_LEVEL;
-		cq_ctx->drop = cq->drop_thresh;
-		cq_ctx->drop_ena = 1;
+		/* Drop processing or red drop cannot be enabled due to
+		 * due to packets coming for second pass from CPT.
+		 */
+		if (!roc_nix_inl_inb_is_enabled(roc_nix)) {
+			cq_ctx->drop = cq->drop_thresh;
+			cq_ctx->drop_ena = 1;
+		}
 	}
 
 	/* TX pause frames enable flow ctrl on RX side */
 	if (nix->tx_pause) {
 		/* Single BPID is allocated for all rx channels for now */
 		cq_ctx->bpid = nix->bpid[0];
-		cq_ctx->bp = cq_ctx->drop;
+		cq_ctx->bp = cq->drop_thresh;
 		cq_ctx->bp_ena = 1;
 	}
 
Signature · 1 line
2.8.4
#38 lore raw

PATCH v2 9/28 common/cnxk: dump CPT LF registers on error intr

In reply to Nithin Dabilpuram

Dump CPT LF registers on error interrupt for debugging purpose.

---
 drivers/common/cnxk/roc_cpt.c       |  5 ++++-
 drivers/common/cnxk/roc_cpt_debug.c | 32 ++++++++++++++++++++++++++++++--
 drivers/common/cnxk/roc_cpt_priv.h  |  1 +
 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_cpt.c +4 -1
index 48a378b..6ddbaa2 100644
@@ -51,6 +51,9 @@ cpt_lf_misc_irq(void *param)
 
 	plt_err("Err_irq=0x%" PRIx64 " pf=%d, vf=%d", intr, dev->pf, dev->vf);
 
+	/* Dump lf registers */
+	cpt_lf_print(lf);
+
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
 }
@@ -203,7 +206,7 @@ cpt_lf_dump(struct roc_cpt_lf *lf)
 	plt_cpt_dbg("CPT LF REG:");
 	plt_cpt_dbg("LF_CTL[0x%016llx]: 0x%016" PRIx64, CPT_LF_CTL,
 		    plt_read64(lf->rbase + CPT_LF_CTL));
-	plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
+	plt_cpt_dbg("LF_INPROG[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
 		    plt_read64(lf->rbase + CPT_LF_INPROG));
 
 	plt_cpt_dbg("Q_BASE[0x%016llx]: 0x%016" PRIx64, CPT_LF_Q_BASE,
drivers/common/cnxk/roc_cpt_debug.c +30 -2
index a6c9004..847d969 100644
@@ -157,11 +157,40 @@ roc_cpt_afs_print(struct roc_cpt *roc_cpt)
 	return 0;
 }
 
-static void
+void
 cpt_lf_print(struct roc_cpt_lf *lf)
 {
 	uint64_t reg_val;
 
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_BASE);
+	plt_print("    CPT_LF_Q_BASE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_SIZE);
+	plt_print("    CPT_LF_Q_SIZE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_INST_PTR);
+	plt_print("    CPT_LF_Q_INST_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR);
+	plt_print("    CPT_LF_Q_GRP_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_CTL);
+	plt_print("    CPT_LF_CTL:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT_ENA_W1S);
+	plt_print("    CPT_LF_MISC_INT_ENA_W1S:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT);
+	plt_print("    CPT_LF_MISC_INT:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_INPROG);
+	plt_print("    CPT_LF_INPROG:\t%016lx", reg_val);
+
+	if (roc_model_is_cn9k())
+		return;
+
+	plt_print("Count registers for CPT LF%d:", lf->lf_id);
+
 	reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT);
 	plt_print("    Encrypted byte count:\t%" PRIu64, reg_val);
 
@@ -190,7 +219,6 @@ roc_cpt_lfs_print(struct roc_cpt *roc_cpt)
 		if (lf == NULL)
 			continue;
 
-		plt_print("Count registers for CPT LF%d:", lf_id);
 		cpt_lf_print(lf);
 	}
 
drivers/common/cnxk/roc_cpt_priv.h +1 -0
index 21911e5..61dec9a 100644
@@ -31,5 +31,6 @@ int cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func,
 		    uint8_t lf_id, bool ena);
 int cpt_get_msix_offset(struct dev *dev, struct msix_offset_rsp **msix_rsp);
 uint64_t cpt_get_blkaddr(struct dev *dev);
+void cpt_lf_print(struct roc_cpt_lf *lf);
 
 #endif /* _ROC_CPT_PRIV_H_ */
Signature · 1 line
2.8.4
#39 lore raw

PATCH v2 10/28 common/cnxk: align CPT LF enable/disable sequence

In reply to Nithin Dabilpuram

For CPT LF IQ enable, set CPT_LF_CTL[ENA] before setting CPT_LF_INPROG[EENA] to true.

For CPT LF IQ disable, align sequence to that of HRM.

Also this patch aligns space for instructions in CPT LF to ROC_ALIGN to make complete memory cache aligned and has other minor fixes/additions.

---
 drivers/common/cnxk/hw/cpt.h  | 11 +++++++++++
 drivers/common/cnxk/roc_cpt.c | 42 ++++++++++++++++++++++++++++++++++--------
 drivers/common/cnxk/roc_cpt.h |  8 ++++++++
 3 files changed, 53 insertions(+), 8 deletions(-)
drivers/common/cnxk/hw/cpt.h +11 -0
index 975139f..4d9df59 100644
@@ -124,6 +124,17 @@ union cpt_lf_misc_int {
 	} s;
 };
 
+union cpt_lf_q_grp_ptr {
+	uint64_t u;
+	struct {
+		uint64_t dq_ptr : 15;
+		uint64_t reserved_31_15 : 17;
+		uint64_t nq_ptr : 15;
+		uint64_t reserved_47_62 : 16;
+		uint64_t xq_xor : 1;
+	} s;
+};
+
 union cpt_inst_w4 {
 	uint64_t u64;
 	struct {
drivers/common/cnxk/roc_cpt.c +34 -8

86 lines not on this page · raw message

drivers/common/cnxk/roc_cpt.h +8 -0
index c80a8e0..06277d1 100644
@@ -76,6 +76,14 @@
 #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20
 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40
 
+#define ROC_CPT_CCM_AAD_DATA 1
+#define ROC_CPT_CCM_MSG_LEN  4
+#define ROC_CPT_CCM_ICV_LEN  16
+#define ROC_CPT_CCM_FLAGS                                                      \
+	((ROC_CPT_CCM_AAD_DATA << 6) |                                         \
+	 (((ROC_CPT_CCM_ICV_LEN - 2) / 2) << 3) | (ROC_CPT_CCM_MSG_LEN - 1))
+#define ROC_CPT_CCM_SALT_LEN 3
+
 struct roc_cpt_lmtline {
 	uint64_t io_addr;
 	uint64_t *fc_addr;
Signature · 1 line
2.8.4
#40 lore raw

PATCH v2 11/28 common/cnxk: restore NIX sqb pool limit before destroy

In reply to Nithin Dabilpuram

Restore SQB AURA/POOL limit before destroying SQB to be able to drain all the buffers from the aura.

---
 drivers/common/cnxk/roc_nix_queue.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/common/cnxk/roc_nix_queue.c +5 -0
index 41a1422..a8a713a 100644
@@ -934,6 +934,11 @@ roc_nix_sq_fini(struct roc_nix_sq *sq)
 		rc |= NIX_ERR_NDC_SYNC;
 
 	rc |= nix_tm_sq_flush_post(sq);
+
+	/* Restore limit to max SQB count that the pool was created
+	 * for aura drain to succeed.
+	 */
+	roc_npa_aura_limit_modify(sq->aura_handle, NIX_MAX_SQB);
 	rc |= roc_npa_pool_destroy(sq->aura_handle);
 	plt_free(sq->fc);
 	plt_free(sq->sqe_mem);
Signature · 1 line
2.8.4
#41 lore raw

PATCH v2 12/28 common/cnxk: add CQ enable support in NIX Tx path

In reply to Nithin Dabilpuram

From: Kommula Shiva Shankar <[email protected]>

This patch provides applications to add CQ support in Tx path. This enables packet completion events on CQ for requested packets.

---
 drivers/common/cnxk/roc_nix.h       | 2 ++
 drivers/common/cnxk/roc_nix_queue.c | 4 ++++
 2 files changed, 6 insertions(+)
drivers/common/cnxk/roc_nix.h +2 -0
index ff8c93a..9d3f338 100644
@@ -194,7 +194,9 @@ struct roc_nix_sq {
 	enum roc_nix_sq_max_sqe_sz max_sqe_sz;
 	uint32_t nb_desc;
 	uint16_t qid;
+	uint16_t cqid;
 	bool sso_ena;
+	bool cq_ena;
 	/* End of Input parameters */
 	uint16_t sqes_per_sqb_log2;
 	struct roc_nix *roc_nix;
drivers/common/cnxk/roc_nix_queue.c +4 -0
index a8a713a..cba1294 100644
@@ -661,6 +661,8 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -759,6 +761,8 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
Signature · 1 line
2.8.4
#42 lore raw

PATCH v2 13/28 common/cnxk: setup aura BP conf based on nix

In reply to Nithin Dabilpuram

Currently only NIX0 conf is setup in AURA for backpressure. This patch adds support for NIX1 as well.

---
 drivers/common/cnxk/roc_nix_fc.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_fc.c +19 -4
index f17eba4..7eac7d0 100644
@@ -284,8 +284,18 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	limit = rsp->aura.limit;
 	/* BP is already enabled. */
 	if (rsp->aura.bp_ena) {
+		uint16_t bpid;
+		bool nix1;
+
+		nix1 = !!(rsp->aura.bp_ena & 0x2);
+		if (nix1)
+			bpid = rsp->aura.nix1_bpid;
+		else
+			bpid = rsp->aura.nix0_bpid;
+
 		/* If BP ids don't match disable BP. */
-		if ((rsp->aura.nix0_bpid != nix->bpid[0]) && !force) {
+		if (((nix1 != nix->is_nix1) || (bpid != nix->bpid[0])) &&
+		    !force) {
 			req = mbox_alloc_msg_npa_aq_enq(mbox);
 			if (req == NULL)
 				return;
@@ -315,14 +325,19 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	req->op = NPA_AQ_INSTOP_WRITE;
 
 	if (ena) {
-		req->aura.nix0_bpid = nix->bpid[0];
-		req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		if (nix->is_nix1) {
+			req->aura.nix1_bpid = nix->bpid[0];
+			req->aura_mask.nix1_bpid = ~(req->aura_mask.nix1_bpid);
+		} else {
+			req->aura.nix0_bpid = nix->bpid[0];
+			req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		}
 		req->aura.bp = NIX_RQ_AURA_THRESH(
 			limit > 128 ? 256 : limit); /* 95% of size*/
 		req->aura_mask.bp = ~(req->aura_mask.bp);
 	}
 
-	req->aura.bp_ena = !!ena;
+	req->aura.bp_ena = (!!ena << nix->is_nix1);
 	req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena);
 
 	mbox_process(mbox);
Signature · 1 line
2.8.4
#43 lore raw

PATCH v2 14/28 common/cnxk: support anti-replay check in SW for cn9k

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds anti replay SW implementation for cn9k platform.

---
 drivers/common/cnxk/cnxk_security_ar.h | 184 +++++++++++++++++++++++++++++++++
 1 file changed, 184 insertions(+)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
drivers/common/cnxk/cnxk_security_ar.h new file +184 -0
new file mode 100644
index 0000000..6bc517c
@@ -0,0 +1,184 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef __CNXK_SECURITY_AR_H__
+#define __CNXK_SECURITY_AR_H__
+
+#include <rte_mbuf.h>
+
+#include "cnxk_security.h"
+
+#define CNXK_ON_AR_WIN_SIZE_MAX 1024
+
+/* u64 array size to fit anti replay window bits */
+#define AR_WIN_ARR_SZ                                                          \
+	(PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) /        \
+	 BITS_PER_LONG_LONG)
+
+#define WORD_SHIFT 6
+#define WORD_SIZE  (1 << WORD_SHIFT)
+#define WORD_MASK  (WORD_SIZE - 1)
+
+#define IPSEC_ANTI_REPLAY_FAILED (-1)
+
+struct cnxk_on_ipsec_ar {
+	rte_spinlock_t lock;
+	uint32_t winb;
+	uint32_t wint;
+	uint64_t base;			/**< base of the anti-replay window */
+	uint64_t window[AR_WIN_ARR_SZ]; /**< anti-replay window */
+};
+
+static inline int
+cnxk_on_anti_replay_check(uint64_t seq, struct cnxk_on_ipsec_ar *ar,
+			  uint32_t winsz)
+{
+	uint64_t ex_winsz = winsz + WORD_SIZE;
+	uint64_t *window = &ar->window[0];
+	uint64_t seqword, shiftwords;
+	uint64_t base = ar->base;
+	uint32_t winb = ar->winb;
+	uint32_t wint = ar->wint;
+	uint64_t winwords;
+	uint64_t bit_pos;
+	uint64_t shift;
+	uint64_t *wptr;
+	uint64_t tmp;
+
+	winwords = ex_winsz >> WORD_SHIFT;
+	if (winsz > 64)
+		goto slow_shift;
+	/* Check if the seq is the biggest one yet */
+	if (likely(seq > base)) {
+		shift = seq - base;
+		if (shift < winsz) { /* In window */
+			/*
+			 * If more than 64-bit anti-replay window,
+			 * use slow shift routine
+			 */
+			wptr = window + (shift >> WORD_SHIFT);
+			*wptr <<= shift;
+			*wptr |= 1ull;
+		} else {
+			/* No special handling of window size > 64 */
+			wptr = window + ((winsz - 1) >> WORD_SHIFT);
+			/*
+			 * Zero out the whole window (especially for
+			 * bigger than 64b window) till the last 64b word
+			 * as the incoming sequence number minus
+			 * base sequence is more than the window size.
+			 */
+			while (window != wptr)
+				*window++ = 0ull;
+			/*
+			 * Set the last bit (of the window) to 1
+			 * as that corresponds to the base sequence number.
+			 * Now any incoming sequence number which is
+			 * (base - window size - 1) will pass anti-replay check
+			 */
+			*wptr = 1ull;
+		}
+		/*
+		 * Set the base to incoming sequence number as
+		 * that is the biggest sequence number seen yet
+		 */
+		ar->base = seq;
+		return 0;
+	}
+
+	bit_pos = base - seq;
+
+	/* If seq falls behind the window, return failure */
+	if (bit_pos >= winsz)
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* seq is within anti-replay window */
+	wptr = window + ((winsz - bit_pos - 1) >> WORD_SHIFT);
+	bit_pos &= WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (*wptr & ((1ull) << bit_pos))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* mark as seen */
+	*wptr |= ((1ull) << bit_pos);
+	return 0;
+
+slow_shift:
+	if (likely(seq > base)) {
+		uint32_t i;
+
+		shift = seq - base;
+		if (unlikely(shift >= winsz)) {
+			/*
+			 * shift is bigger than the window,
+			 * so just zero out everything
+			 */
+			for (i = 0; i < winwords; i++)
+				window[i] = 0;
+winupdate:
+			/* Find out the word */
+			seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+			/* Find out the bit in the word */
+			bit_pos = (seq - 1) & WORD_MASK;
+
+			/*
+			 * Set the bit corresponding to sequence number
+			 * in window to mark it as received
+			 */
+			window[seqword] |= (1ull << (63 - bit_pos));
+
+			/* wint and winb range from 1 to ex_winsz */
+			ar->wint = ((wint + shift - 1) % ex_winsz) + 1;
+			ar->winb = ((winb + shift - 1) % ex_winsz) + 1;
+
+			ar->base = seq;
+			return 0;
+		}
+
+		/*
+		 * New sequence number is bigger than the base but
+		 * it's not bigger than base + window size
+		 */
+
+		shiftwords = ((wint + shift - 1) >> WORD_SHIFT) -
+			     ((wint - 1) >> WORD_SHIFT);
+		if (unlikely(shiftwords)) {
+			tmp = (wint + WORD_SIZE - 1) / WORD_SIZE;
+			for (i = 0; i < shiftwords; i++) {
+				tmp %= winwords;
+				window[tmp++] = 0;
+			}
+		}
+
+		goto winupdate;
+	}
+
+	/* Sequence number is before the window */
+	if (unlikely((seq + winsz) <= base))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* Sequence number is within the window */
+
+	/* Find out the word */
+	seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+	/* Find out the bit in the word */
+	bit_pos = (seq - 1) & WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (window[seqword] & (1ull << (63 - bit_pos)))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/*
+	 * Set the bit corresponding to sequence number
+	 * in window to mark it as received
+	 */
+	window[seqword] |= (1ull << (63 - bit_pos));
+
+	return 0;
+}
+
+#endif /* __CNXK_SECURITY_AR_H__ */
Signature · 1 line
2.8.4
#44 lore raw

PATCH v2 15/28 common/cnxk: support inline IPsec rte flow action

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add support to configure flow rules with inline IPsec action.

---
 drivers/common/cnxk/roc_nix_inl.h      |  3 +++
 drivers/common/cnxk/roc_nix_inl_dev.c  |  3 +++
 drivers/common/cnxk/roc_nix_inl_priv.h |  3 +++
 drivers/common/cnxk/roc_npc_mcam.c     | 28 ++++++++++++++++++++++++++--
 4 files changed, 35 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +3 -0
index 6b8c268..ae5e022 100644
@@ -107,6 +107,9 @@ struct roc_nix_inl_dev {
 	struct plt_pci_device *pci_dev;
 	uint16_t ipsec_in_max_spi;
 	bool selftest;
+	bool is_multi_channel;
+	uint16_t channel;
+	uint16_t chan_mask;
 	bool attach_cptlf;
 	/* End of input parameters */
 
drivers/common/cnxk/roc_nix_inl_dev.c +3 -0
index 0789f99..495dd19 100644
@@ -543,6 +543,9 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev)
 	inl_dev->pci_dev = pci_dev;
 	inl_dev->ipsec_in_max_spi = roc_inl_dev->ipsec_in_max_spi;
 	inl_dev->selftest = roc_inl_dev->selftest;
+	inl_dev->is_multi_channel = roc_inl_dev->is_multi_channel;
+	inl_dev->channel = roc_inl_dev->channel;
+	inl_dev->chan_mask = roc_inl_dev->chan_mask;
 	inl_dev->attach_cptlf = roc_inl_dev->attach_cptlf;
 
 	/* Initialize base device */
drivers/common/cnxk/roc_nix_inl_priv.h +3 -0
index 4729a38..3dc526f 100644
@@ -50,6 +50,9 @@ struct nix_inl_dev {
 
 	/* Device arguments */
 	uint8_t selftest;
+	uint16_t channel;
+	uint16_t chan_mask;
+	bool is_multi_channel;
 	uint16_t ipsec_in_max_spi;
 	bool attach_cptlf;
 };
drivers/common/cnxk/roc_npc_mcam.c +26 -2
index 8ccaaad..4985d22 100644
@@ -503,8 +503,11 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 {
 	int use_ctr = (flow->ctr_id == NPC_COUNTER_NONE ? 0 : 1);
 	struct npc_mcam_write_entry_req *req;
+	struct nix_inl_dev *inl_dev = NULL;
 	struct mbox *mbox = npc->mbox;
 	struct mbox_msghdr *rsp;
+	struct idev_cfg *idev;
+	uint16_t pf_func = 0;
 	uint16_t ctr = ~(0);
 	int rc, idx;
 	int entry;
@@ -553,9 +556,30 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 		req->entry_data.kw_mask[idx] = flow->mcam_mask[idx];
 	}
 
+	idev = idev_get_cfg();
+	if (idev)
+		inl_dev = idev->nix_inl_dev;
+
 	if (flow->nix_intf == NIX_INTF_RX) {
-		req->entry_data.kw[0] |= (uint64_t)npc->channel;
-		req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+		if (inl_dev && inl_dev->is_multi_channel &&
+		    (flow->npc_action & NIX_RX_ACTIONOP_UCAST_IPSEC)) {
+			req->entry_data.kw[0] |= (uint64_t)inl_dev->channel;
+			req->entry_data.kw_mask[0] |=
+				(uint64_t)inl_dev->chan_mask;
+			pf_func = nix_inl_dev_pffunc_get();
+			req->entry_data.action &= ~(GENMASK(19, 4));
+			req->entry_data.action |= (uint64_t)pf_func << 4;
+
+			flow->npc_action &= ~(GENMASK(19, 4));
+			flow->npc_action |= (uint64_t)pf_func << 4;
+			flow->mcam_data[0] |= (uint64_t)inl_dev->channel;
+			flow->mcam_mask[0] |= (uint64_t)inl_dev->chan_mask;
+		} else {
+			req->entry_data.kw[0] |= (uint64_t)npc->channel;
+			req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+			flow->mcam_data[0] |= (uint64_t)npc->channel;
+			flow->mcam_mask[0] |= (BIT_ULL(12) - 1);
+		}
 	} else {
 		uint16_t pf_func = (flow->npc_action >> 4) & 0xffff;
 
Signature · 1 line
2.8.4
#45 lore raw

PATCH v2 16/28 net/cnxk: support inline security setup for cn9k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

---
 drivers/net/cnxk/cn9k_ethdev.c         |  23 +++
 drivers/net/cnxk/cn9k_ethdev.h         |  61 +++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c     | 313 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h             |   1 +
 drivers/net/cnxk/cn9k_tx.h             |   1 +
 drivers/net/cnxk/cnxk_ethdev.c         | 230 +++++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h         | 121 ++++++++++++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c |  88 ++++++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c     | 278 +++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_lookup.c         |  50 +++++-
 drivers/net/cnxk/meson.build           |   2 +
 drivers/net/cnxk/version.map           |   5 +
 12 files changed, 1162 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
drivers/net/cnxk/cn9k_ethdev.c +23 -0
index 115e678..08c86f9 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -179,8 +185,10 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_cpt_lf *inl_lf;
 	struct cn9k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -200,6 +208,19 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(BIT_ULL(16) == ROC_NIX_INL_SA_BASE_ALIGN);
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -508,6 +529,8 @@ cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn9k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn9k_ethdev.h +61 -0

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev_sec.c new file +313 -0

313 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +1 -0
index a3bf4e0..59545af 100644
@@ -17,6 +17,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn9k_tx.h +1 -0
index ed65cd3..a27ff76 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cnxk_ethdev.c +228 -2

330 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +119 -2

185 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_devargs.c +87 -1

122 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_sec.c new file +278 -0

278 lines not on this page · raw message

drivers/net/cnxk/cnxk_lookup.c +44 -6

59 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -0
index d4cdd17..6cc30c3 100644
@@ -12,6 +12,7 @@ sources = files(
         'cnxk_ethdev.c',
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
+        'cnxk_ethdev_sec.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
@@ -22,6 +23,7 @@ sources = files(
 # CN9K
 sources += files(
         'cn9k_ethdev.c',
+        'cn9k_ethdev_sec.c',
         'cn9k_rte_flow.c',
         'cn9k_rx.c',
         'cn9k_rx_mseg.c',
drivers/net/cnxk/version.map +5 -0
index c2e0723..b9da6b1 100644
@@ -1,3 +1,8 @@
 DPDK_22 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+	cnxk_nix_inb_mode_set;
+};
Signature · 1 line
2.8.4
#46 lore raw

PATCH v2 17/28 net/cnxk: support inline security setup for cn10k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

This patch also changes dpdk-devbind.py to list new inline device as misc device.

---
 doc/guides/nics/cnxk.rst                 | 102 ++++++++
 doc/guides/nics/features/cnxk.ini        |   1 +
 doc/guides/nics/features/cnxk_vec.ini    |   1 +
 doc/guides/nics/features/cnxk_vf.ini     |   1 +
 doc/guides/rel_notes/release_21_11.rst   |   2 +
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.c          |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.h          |  43 ++++
 drivers/net/cnxk/cn10k_ethdev_sec.c      | 426 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_rx.h              |   1 +
 drivers/net/cnxk/cn10k_tx.h              |   1 +
 drivers/net/cnxk/meson.build             |   1 +
 usertools/dpdk-devbind.py                |   8 +-
 13 files changed, 654 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
doc/guides/nics/cnxk.rst +102 -0
index 90d27db..b542437 100644
@@ -34,6 +34,7 @@ Features of the CNXK Ethdev PMD are:
 - Vector Poll mode driver
 - Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
+- Inline IPsec processing support
 
 Prerequisites
 -------------
@@ -185,6 +186,74 @@ Runtime Config Options
 
       -a 0002:02:00.0,tag_as_xor=1
 
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127).
+
+- ``Max SA's for outbound inline IPsec`` (default ``4096``)
+
+   Max number of SA's supported for outbound inline IPsec processing can be
+   specified by ``ipsec_out_max_sa`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_out_max_sa=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 outbound SAs.
+
+- ``Outbound CPT LF queue size`` (default ``8200``)
+
+   Size of Outbound CPT LF queue in number of descriptors can be specified by
+   ``outb_nb_desc`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_desc=16384
+
+    With the above configuration, Outbound CPT LF will be created to accommodate
+    at max 16384 descriptors at any given time.
+
+- ``Outbound CPT LF count`` (default ``1``)
+
+   Number of CPT LF's to attach for Outbound processing can be specified by
+   ``outb_nb_crypto_qs`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_crypto_qs=2
+
+   With the above confiuration, two CPT LF's are setup and distributed among
+   all the Tx queues for outbound processing.
+
+- ``Force using inline ipsec device for inbound`` (default ``0``)
+
+   In CN10K, in event mode, driver can work in two modes,
+
+   1. Inbound encrypted traffic received by probed ipsec inline device while
+      plain traffic post decryption is received by ethdev.
+
+   2. Both Inbound encrypted traffic and plain traffic post decryption are
+      received by ethdev.
+
+   By default event mode works without using inline device i.e mode ``2``.
+   This behaviour can be changed to pick mode ``1`` by using
+   ``force_inb_inl_dev`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,force_inb_inl_dev=1 -a 0002:03:00.0,force_inb_inl_dev=1
+
+   With the above configuration, inbound encrypted traffic from both the ports
+   is received by ipsec inline device.
 
 .. note::
 
@@ -250,6 +319,39 @@ Example usage in testpmd::
    testpmd> flow create 0 ingress pattern eth / raw relative is 0 pattern \
           spec ab pattern mask ab offset is 4 / end actions queue index 1 / end
 
+Inline device support for CN10K
+-------------------------------
+
+CN10K HW provides a misc device Inline device that supports ethernet devices in
+providing following features.
+
+  - Aggregate all the inline IPsec inbound traffic from all the CN10K ethernet
+    devices to be processed by the single inline IPSec device. This allows
+    single rte security session to accept traffic from multiple ports.
+
+  - Support for event generation on outbound inline IPsec processing errors.
+
+  - Support CN106xx poll mode of operation for inline IPSec inbound processing.
+
+Inline IPsec device is identified by PCI PF vendid:devid ``177D:A0F0`` or
+VF ``177D:A0F1``.
+
+Runtime Config Options for inline device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:1d:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127) for traffic aggregated on inline device.
+
+
 Debugging Options
 -----------------
 
doc/guides/nics/features/cnxk.ini +1 -0
index 5d45625..1ced3ee 100644
@@ -27,6 +27,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Flow control         = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index abf2b8d..12ca0a5 100644
@@ -26,6 +26,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Flow control         = Y
 Jumbo frame          = Y
 L3 checksum offload  = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 7b4299f..139d9b9 100644
@@ -22,6 +22,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 L3 checksum offload  = Y
doc/guides/rel_notes/release_21_11.rst +2 -0
index f85dc99..8116f1e 100644
@@ -65,6 +65,8 @@ New Features
 * **Updated Marvell cnxk ethdev driver.**
 
   * Added rte_flow support for dual VLAN insert and strip actions.
+  * Added support for Inline IPsec for CN9K event mode and CN10K
+    poll mode and event mode.
 
 * **Updated Marvell cnxk crypto PMD.**
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +35 -1
index baf2f2a..a34efbb 100644
@@ -123,7 +123,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		    uint16_t port_id, const struct rte_event *ev,
 		    uint8_t custom_flowid)
 {
+	struct roc_nix *nix = &cnxk_eth_dev->nix;
 	struct roc_nix_rq *rq;
+	int rc;
 
 	rq = &cnxk_eth_dev->rqs[rq_id];
 	rq->sso_ena = 1;
@@ -140,7 +142,24 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		rq->tag_mask |= ev->flow_id;
 	}
 
-	return roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	rc = roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	if (rc)
+		return rc;
+
+	if (rq_id == 0 && roc_nix_inl_inb_is_enabled(nix)) {
+		uint32_t sec_tag_const;
+
+		/* IPSec tag const is 8-bit left shifted value of tag_mask
+		 * as it applies to bit 32:8 of tag only.
+		 */
+		sec_tag_const = rq->tag_mask >> 8;
+		rc = roc_nix_inl_inb_tag_update(nix, sec_tag_const,
+						ev->sched_type);
+		if (rc)
+			plt_err("Failed to set tag conf for ipsec, rc=%d", rc);
+	}
+
+	return rc;
 }
 
 static int
@@ -186,6 +205,7 @@ cnxk_sso_rx_adapter_queue_add(
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, true,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso++;
 	}
 
 	if (rc < 0) {
@@ -196,6 +216,14 @@ cnxk_sso_rx_adapter_queue_add(
 
 	dev->rx_offloads |= cnxk_eth_dev->rx_offload_flags;
 
+	/* Switch to use PF/VF's NIX LF instead of inline device for inbound
+	 * when all the RQ's are switched to event dev mode. We do this only
+	 * when using inline device is not forced by dev args.
+	 */
+	if (!cnxk_eth_dev->inb.force_inl_dev &&
+	    cnxk_eth_dev->nb_rxq_sso == cnxk_eth_dev->nb_rxq)
+		cnxk_nix_inb_mode_set(cnxk_eth_dev, false);
+
 	return 0;
 }
 
@@ -220,12 +248,18 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, false,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso--;
 	}
 
 	if (rc < 0)
 		plt_err("Failed to clear Rx adapter config port=%d, q=%d",
 			eth_dev->data->port_id, rx_queue_id);
 
+	/* Removing RQ from Rx adapter implies need to use
+	 * inline device for CQ/Poll mode.
+	 */
+	cnxk_nix_inb_mode_set(cnxk_eth_dev, true);
+
 	return rc;
 }
 
drivers/net/cnxk/cn10k_ethdev.c +35 -1
index 7caec6c..fa2343c 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (conf & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -181,8 +187,11 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	struct roc_cpt_lf *inl_lf;
 	struct cn10k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -198,11 +207,24 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq = eth_dev->data->tx_queues[qid];
 	txq->fc_mem = sq->fc;
 	/* Store lmt base in tx queue for easy access */
-	txq->lmt_base = dev->nix.lmt_base;
+	txq->lmt_base = nix->lmt_base;
 	txq->io_addr = sq->io_addr;
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(ROC_NIX_INL_SA_BASE_ALIGN == BIT_ULL(16));
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -215,6 +237,7 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 struct rte_mempool *mp)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_eth_rxq_sp *rxq_sp;
 	struct cn10k_eth_rxq *rxq;
 	struct roc_nix_rq *rq;
 	struct roc_nix_cq *cq;
@@ -250,6 +273,15 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
 
+	/* Setup security related info */
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F) {
+		rxq->lmt_base = dev->nix.lmt_base;
+		rxq->sa_base = roc_nix_inl_inb_sa_base_get(&dev->nix,
+							   dev->inb.inl_dev);
+	}
+	rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+	rxq->aura_handle = rxq_sp->qconf.mp->pool_id;
+
 	/* Lookup mem */
 	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
@@ -500,6 +532,8 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn10k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn10k_ethdev.h +43 -0

67 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev_sec.c new file +426 -0

426 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +1 -0
index 68219b8..d27a231 100644
@@ -16,6 +16,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn10k_tx.h +1 -0
index f75cae0..8577a7b 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/meson.build +1 -0
index 6cc30c3..d1d4b4e 100644
@@ -37,6 +37,7 @@ sources += files(
 # CN10K
 sources += files(
         'cn10k_ethdev.c',
+        'cn10k_ethdev_sec.c',
         'cn10k_rte_flow.c',
         'cn10k_rx.c',
         'cn10k_rx_mseg.c',
usertools/dpdk-devbind.py +5 -3
index 74d16e4..5f0e817 100755
@@ -49,6 +49,8 @@
              'SVendor': None, 'SDevice': None}
 cnxk_bphy_cgx = {'Class': '08', 'Vendor': '177d', 'Device': 'a059,a060',
                  'SVendor': None, 'SDevice': None}
+cnxk_inl_dev = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f0,a0f1',
+                'SVendor': None, 'SDevice': None}
 
 intel_dlb = {'Class': '0b', 'Vendor': '8086', 'Device': '270b,2710,2714',
              'SVendor': None, 'SDevice': None}
@@ -73,9 +75,9 @@
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
 regex_devices = [octeontx2_ree]
-misc_devices = [cnxk_bphy, cnxk_bphy_cgx, intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_idxd_spr,
-                intel_ntb_skx, intel_ntb_icx,
-                octeontx2_dma]
+misc_devices = [cnxk_bphy, cnxk_bphy_cgx, cnxk_inl_dev, intel_ioat_bdw,
+	        intel_ioat_skx, intel_ioat_icx, intel_idxd_spr, intel_ntb_skx,
+		intel_ntb_icx, octeontx2_dma]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
Signature · 1 line
2.8.4
#47 lore raw

PATCH v2 18/28 net/cnxk: support Rx security offload on cn9k

In reply to Nithin Dabilpuram

Add support to receive CPT processed packets on Rx for CN9K.

---
 drivers/event/cnxk/cn9k_eventdev.c              | 153 ++++----
 drivers/event/cnxk/cn9k_worker.h                |   7 +-
 drivers/event/cnxk/cn9k_worker_deq.c            |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c      |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c         |   2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c        |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c       |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c    |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c   |   2 +-
 drivers/net/cnxk/cn9k_rx.c                      |  31 +-
 drivers/net/cnxk/cn9k_rx.h                      | 440 +++++++++++++++++++-----
 drivers/net/cnxk/cn9k_rx_mseg.c                 |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                  |   2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c             |   2 +-
 drivers/net/cnxk/cnxk_ethdev.h                  |   3 +
 16 files changed, 461 insertions(+), 195 deletions(-)
drivers/event/cnxk/cn9k_eventdev.c +80 -73
index 59a3dc2..64d9ded 100644
@@ -10,7 +10,8 @@
 #define CN9K_DUAL_WS_PAIR_ID(x, id) (((x)*CN9K_DUAL_WS_NB_WS) + id)
 
 #define CN9K_SET_EVDEV_DEQ_OP(dev, deq_op, deq_ops)                            \
-	(deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]  \
+	(deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_SECURITY_F)]    \
+			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]  \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_TSTAMP_F)]      \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_MARK_UPDATE_F)] \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_CHECKSUM_F)]    \
@@ -330,178 +331,184 @@ cn9k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 {
 	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
 	/* Single WS modes */
-	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_##name,
+	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_burst_##name,
+	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_##name,
+	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_##name,
+	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_##name,
+	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_seg_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_burst_##name,
+		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_burst_##name,
+		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	/* Dual WS modes */
-	const event_dequeue_t sso_hws_dual_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_##name,
+	const event_dequeue_t sso_hws_dual_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_dual_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_dual_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_##name,
+	const event_dequeue_t sso_hws_dual_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_burst_##name,
+		sso_hws_dual_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_##name,
+	const event_dequeue_t sso_hws_dual_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_burst_##name,
+		sso_hws_dual_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_dual_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_burst_##name,
+		sso_hws_dual_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_dual_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_tmo_seg_burst_##name,
+		sso_hws_dual_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] =                                         \
+			cn9k_sso_hws_dual_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_dual_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_dual_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_dual_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_deq_ca_seg_burst_##name,
+		sso_hws_dual_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] =                                         \
+			cn9k_sso_hws_dual_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
drivers/event/cnxk/cn9k_worker.h +5 -2
index 3e8f214..f1d2e47 100644
@@ -5,6 +5,9 @@
 #ifndef __CN9K_WORKER_H__
 #define __CN9K_WORKER_H__
 
+#include <rte_eventdev.h>
+#include <rte_vect.h>
+
 #include "cnxk_ethdev.h"
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
@@ -380,7 +383,7 @@ uint16_t __rte_hot cn9k_sso_hws_ca_enq(void *port, struct rte_event ev[],
 uint16_t __rte_hot cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[],
 					    uint16_t nb_events);
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_##name(                            \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
 	uint16_t __rte_hot cn9k_sso_hws_deq_burst_##name(                      \
@@ -415,7 +418,7 @@ uint16_t __rte_hot cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[],
 NIX_RX_FASTPATH_MODES
 #undef R
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_burst_##name(                 \
drivers/event/cnxk/cn9k_worker_deq.c +1 -1
index 51ccaf4..d65c72a 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_##name(                            \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_deq_burst.c +1 -1
index 4e28014..42dc59b 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_burst_##name(                      \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn9k_worker_deq_ca.c +1 -1
index dbdbba1..b5d0263 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_ca_##name(                         \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_deq_tmo.c +1 -1
index 9713d1e..b41a590 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_deq_tmo_##name(                        \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq.c +1 -1
index 709fa2d..440b66e 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq_burst.c +1 -1
index d50e1cf..4d913f9 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_burst_##name(                 \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn9k_worker_dual_deq_ca.c +1 -1
index dc9191f..b66e2cf 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_##name(                    \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c +1 -1
index a0508fd..78a4b3d 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn9k_sso_hws_dual_deq_tmo_##name(                   \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx.c +16 -15
index 7d9f1bd..5c4387e 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [TSP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
@@ -38,33 +39,33 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,7 +74,7 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0][0];
 
 	if (dev->scalar_ena) {
 		if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
drivers/net/cnxk/cn9k_rx.h +346 -94

485 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index d7e19b1..06509e8 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +1 -1
index ef5f771..c96f61c 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec_mseg.c +1 -1
index e46d8a4..938b1c0 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_mseg_##name(  \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cnxk_ethdev.h +3 -0
index b233010..a2bcea2 100644
@@ -130,6 +130,9 @@
 /* Subtype from inline outbound error event */
 #define CNXK_ETHDEV_SEC_OUTB_EV_SUB 0xFFUL
 
+/* SPI will be in 20 bits of tag */
+#define CNXK_ETHDEV_SPI_TAG_MASK 0xFFFFFUL
+
 struct cnxk_fc_cfg {
 	enum rte_eth_fc_mode mode;
 	uint8_t rx_pause;
Signature · 1 line
2.8.4
#48 lore raw

PATCH v2 19/28 net/cnxk: support Tx security offload on cn9k

In reply to Nithin Dabilpuram

Add support to create and submit CPT instructions on Tx on CN9K SoC.

---
 drivers/event/cnxk/cn9k_eventdev.c               |  29 +-
 drivers/event/cnxk/cn9k_worker.h                 | 163 +++++++++-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |   2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |   2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |   2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |   2 +-
 drivers/net/cnxk/cn9k_tx.c                       |  29 +-
 drivers/net/cnxk/cn9k_tx.h                       | 392 +++++++++++++++--------
 drivers/net/cnxk/cn9k_tx_mseg.c                  |   2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |   2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |   2 +-
 11 files changed, 459 insertions(+), 168 deletions(-)
drivers/event/cnxk/cn9k_eventdev.c +15 -14
index 64d9ded..806dcb0 100644
@@ -19,8 +19,8 @@
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_RSS_F)])
 
 #define CN9K_SET_EVDEV_ENQ_OP(dev, enq_op, enq_ops)                            \
-	(enq_op =                                                              \
-		 enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
+	(enq_op = enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_SECURITY_F)]    \
+			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSO_F)]          \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_MBUF_NOFF_F)]    \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_VLAN_QINQ_F)]    \
@@ -515,33 +515,34 @@ cn9k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	/* Tx modes */
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_##name,
+		sso_hws_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_seg_##name,
+		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_dual_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_##name,
+		sso_hws_dual_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_dual_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn9k_sso_hws_dual_tx_adptr_enq_seg_##name,
+		sso_hws_dual_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] =                                         \
+			cn9k_sso_hws_dual_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
drivers/event/cnxk/cn9k_worker.h +161 -2

191 lines not on this page · raw message

drivers/event/cnxk/cn9k_worker_dual_tx_enq.c +1 -1
index 92e2981..db045d0 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_dual_tx_adptr_enq_##name(              \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c +1 -1
index dfb574c..95d711f 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_dual_tx_adptr_enq_seg_##name(          \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_tx_enq.c +1 -1
index 3df649c..026cef8 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_tx_adptr_enq_##name(                   \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn9k_worker_tx_enq_seg.c +1 -1
index 0efe291..97cd7c7 100644
@@ -4,7 +4,7 @@
 
 #include "cn9k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn9k_sso_hws_tx_adptr_enq_seg_##name(               \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/net/cnxk/cn9k_tx.c +15 -14
index 763f9a1..e5691a2 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -23,12 +23,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [TS] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_SECURITY_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
@@ -42,33 +43,33 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
drivers/net/cnxk/cn9k_tx.h +261 -131

400 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_mseg.c +1 -1
index f3c427c..37cba78 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn9k_tx_vec.c +1 -1
index 56a3e25..b424f95 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
 					      struct rte_mbuf **tx_pkts,       \
drivers/net/cnxk/cn9k_tx_vec_mseg.c +1 -1
index 0256efd..5fdf0a9 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_vec_mseg_##name(  \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
Signature · 1 line
2.8.4
#49 lore raw

PATCH v2 20/28 net/cnxk: support Rx security offload on cn10k

In reply to Nithin Dabilpuram

Add support to receive CPT processed packets on Rx via second pass on CN10K.

---
 drivers/event/cnxk/cn10k_eventdev.c         |  80 ++--
 drivers/event/cnxk/cn10k_worker.h           |  73 +++-
 drivers/event/cnxk/cn10k_worker_deq.c       |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c    |   2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c   |   2 +-
 drivers/net/cnxk/cn10k_ethdev.h             |   4 +
 drivers/net/cnxk/cn10k_rx.c                 |  31 +-
 drivers/net/cnxk/cn10k_rx.h                 | 648 +++++++++++++++++++++++-----
 drivers/net/cnxk/cn10k_rx_mseg.c            |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c             |   4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c        |   4 +-
 drivers/net/cnxk/cn10k_tx.h                 |   3 -
 13 files changed, 688 insertions(+), 169 deletions(-)
drivers/event/cnxk/cn10k_eventdev.c +42 -38
index 8af273a..9c0d84b 100644
@@ -7,7 +7,8 @@
 #include "cnxk_worker.h"
 
 #define CN10K_SET_EVDEV_DEQ_OP(dev, deq_op, deq_ops)                           \
-	(deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]  \
+	(deq_op = deq_ops[!!(dev->rx_offloads & NIX_RX_OFFLOAD_SECURITY_F)]    \
+			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_VLAN_STRIP_F)]  \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_TSTAMP_F)]      \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_MARK_UPDATE_F)] \
 			 [!!(dev->rx_offloads & NIX_RX_OFFLOAD_CHECKSUM_F)]    \
@@ -288,88 +289,91 @@ static void
 cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 {
 	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
-	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_##name,
+	const event_dequeue_t sso_hws_deq[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                            \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_burst_##name,
+	const event_dequeue_burst_t sso_hws_deq_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_##name,
+	const event_dequeue_t sso_hws_deq_tmo[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_tmo_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_tmo_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_##name,
+	const event_dequeue_t sso_hws_deq_ca[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_ca_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_ca_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_##name,
+	const event_dequeue_t sso_hws_deq_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_burst_t sso_hws_deq_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_burst_##name,
+	const event_dequeue_burst_t
+		sso_hws_deq_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_seg_burst_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_##name,
+	const event_dequeue_t sso_hws_deq_tmo_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_burst_##name,
+		sso_hws_deq_tmo_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_tmo_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 		};
 
-	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_##name,
+	const event_dequeue_t sso_hws_deq_ca_seg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_##name,
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
 	const event_dequeue_burst_t
-		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_burst_##name,
+		sso_hws_deq_ca_seg_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_deq_ca_seg_burst_##name,
 			NIX_RX_FASTPATH_MODES
 #undef R
 	};
@@ -385,7 +389,7 @@ cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	const event_tx_adapter_enqueue
 		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                            \
 	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
drivers/event/cnxk/cn10k_worker.h +68 -5

123 lines not on this page · raw message

drivers/event/cnxk/cn10k_worker_deq.c +1 -1
index 36ec454..6083f69 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn10k_sso_hws_deq_##name(                           \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_deq_burst.c +1 -1
index 29ecc55..8539d5d 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_hot cn10k_sso_hws_deq_burst_##name(                     \
 		void *port, struct rte_event ev[], uint16_t nb_events,         \
 		uint64_t timeout_ticks)                                        \
drivers/event/cnxk/cn10k_worker_deq_ca.c +1 -1
index c90f6a9..15c698e 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_hot cn10k_sso_hws_deq_ca_##name(                        \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_deq_tmo.c +1 -1
index c8524a2..537ae37 100644
@@ -6,7 +6,7 @@
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_hot cn10k_sso_hws_deq_tmo_##name(                       \
 		void *port, struct rte_event *ev, uint64_t timeout_ticks)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_ethdev.h +4 -0
index a888364..200cd93 100644
@@ -81,4 +81,8 @@ void cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 /* Security context setup */
 void cn10k_eth_sec_ops_override(void);
 
+#define LMT_OFF(lmt_addr, lmt_num, offset)                                     \
+	(void *)((uintptr_t)(lmt_addr) +                                       \
+		 ((uint64_t)(lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset))
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn10k_rx.c +16 -15
index 69e767a..d6af54b 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
 	/* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
@@ -38,33 +39,33 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			      \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                            \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,7 +74,7 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0][0];
 
 	if (dev->scalar_ena) {
 		if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
drivers/net/cnxk/cn10k_rx.h +549 -99

756 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index 3340771..e7c2321 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +2 -2
index 166735a..0ccc4df 100644
@@ -5,14 +5,14 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
 					       uint16_t pkts)                  \
 	{                                                                      \
 		return cn10k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,     \
-						  (flags), NULL, NULL);        \
+						  (flags), NULL, NULL, 0);     \
 	}
 
 NIX_RX_FASTPATH_MODES
drivers/net/cnxk/cn10k_rx_vec_mseg.c +2 -2
index 1f44ddd..38e0ec3 100644
@@ -5,13 +5,13 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+#define R(name, f6, f5, f4, f3, f2, f1, f0, flags)                             \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_vec_mseg_##name( \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
 		return cn10k_nix_recv_pkts_vector(                             \
 			rx_queue, rx_pkts, pkts, (flags) | NIX_RX_MULTI_SEG_F, \
-			NULL, NULL);                                           \
+			NULL, NULL, 0);                                        \
 	}
 
 NIX_RX_FASTPATH_MODES
drivers/net/cnxk/cn10k_tx.h +0 -3
index 8577a7b..c81a612 100644
@@ -51,9 +51,6 @@
 
 #define NIX_NB_SEGS_TO_SEGDW(x) ((NIX_SEGDW_MAGIC >> ((x) << 2)) & 0xF)
 
-#define LMT_OFF(lmt_addr, lmt_num, offset)                                     \
-	(void *)((lmt_addr) + ((lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset))
-
 /* Function to determine no of tx subdesc required in case ext
  * sub desc is enabled.
  */
Signature · 1 line
2.8.4
#50 lore raw

PATCH v2 21/28 net/cnxk: support Tx security offload on cn10k

In reply to Nithin Dabilpuram

Add support to create and submit CPT instructions on Tx on CN10K.

---
 drivers/event/cnxk/cn10k_eventdev.c          |  15 +-
 drivers/event/cnxk/cn10k_worker.h            |  74 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c     |   2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c |   2 +-
 drivers/net/cnxk/cn10k_tx.c                  |  31 +-
 drivers/net/cnxk/cn10k_tx.h                  | 981 +++++++++++++++++++++++----
 drivers/net/cnxk/cn10k_tx_mseg.c             |   2 +-
 drivers/net/cnxk/cn10k_tx_vec.c              |   2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c         |   2 +-
 9 files changed, 929 insertions(+), 182 deletions(-)
drivers/event/cnxk/cn10k_eventdev.c +8 -7
index 9c0d84b..dec1653 100644
@@ -17,7 +17,8 @@
 
 #define CN10K_SET_EVDEV_ENQ_OP(dev, enq_op, enq_ops)                           \
 	(enq_op =                                                              \
-		 enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
+		 enq_ops[!!(dev->tx_offloads & NIX_TX_OFFLOAD_SECURITY_F)]     \
+			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSTAMP_F)]       \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_TSO_F)]          \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_MBUF_NOFF_F)]    \
 			[!!(dev->tx_offloads & NIX_TX_OFFLOAD_VLAN_QINQ_F)]    \
@@ -380,17 +381,17 @@ cn10k_sso_fp_fns_set(struct rte_eventdev *event_dev)
 
 	/* Tx modes */
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_##name,
+		sso_hws_tx_adptr_enq[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
 
 	const event_tx_adapter_enqueue
-		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                            \
-	[f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
+		sso_hws_tx_adptr_enq_seg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_sso_hws_tx_adptr_enq_seg_##name,
 			NIX_TX_FASTPATH_MODES
 #undef T
 		};
drivers/event/cnxk/cn10k_worker.h +56 -18

118 lines not on this page · raw message

drivers/event/cnxk/cn10k_worker_tx_enq.c +1 -1
index f9968ac..f14c7fc 100644
@@ -4,7 +4,7 @@
 
 #include "cn10k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn10k_sso_hws_tx_adptr_enq_##name(                  \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/event/cnxk/cn10k_worker_tx_enq_seg.c +1 -1
index a24fc42..2ea61e5 100644
@@ -4,7 +4,7 @@
 
 #include "cn10k_worker.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_hot cn10k_sso_hws_tx_adptr_enq_seg_##name(              \
 		void *port, struct rte_event ev[], uint16_t nb_events)         \
 	{                                                                      \
drivers/net/cnxk/cn10k_tx.c +16 -15
index 0e1276c..eb962ef 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -24,12 +24,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [SEC] [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_SECURITY_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
@@ -43,33 +44,33 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2] = {
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
-	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst_mseg[2][2][2][2][2][2][2] = {
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f6][f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
drivers/net/cnxk/cn10k_tx.h +844 -137

1,332 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_mseg.c +1 -1
index 4ea4c8a..2b83409 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
 						struct rte_mbuf **tx_pkts,     \
drivers/net/cnxk/cn10k_tx_vec.c +1 -1
index a035049..2789b13 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn10k_tx_vec_mseg.c +1 -1
index 7f98f79..98000df 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+#define T(name, f6, f5, f4, f3, f2, f1, f0, sz, flags)                         \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_vec_mseg_##name( \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
Signature · 1 line
2.8.4
#51 lore raw

PATCH v2 22/28 net/cnxk: support IPsec anti replay in cn9k

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds anti replay support for cn9k platform using
SW anti replay check.

---
 drivers/net/cnxk/cn9k_ethdev.h     |  3 +++
 drivers/net/cnxk/cn9k_ethdev_sec.c | 29 ++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h         | 54 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 85 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn9k_ethdev.h +3 -0
index f8818b8..2b452fe 100644
@@ -6,6 +6,7 @@
 
 #include <cnxk_ethdev.h>
 #include <cnxk_security.h>
+#include <cnxk_security_ar.h>
 
 struct cn9k_eth_txq {
 	uint64_t cmd[8];
@@ -40,6 +41,8 @@ struct cn9k_eth_rxq {
 /* Private data in sw rsvd area of struct roc_onf_ipsec_inb_sa */
 struct cn9k_inb_priv_data {
 	void *userdata;
+	uint32_t replay_win_sz;
+	struct cnxk_on_ipsec_ar ar;
 	struct cnxk_eth_sec_sess *eth_sec;
 };
 
drivers/net/cnxk/cn9k_ethdev_sec.c +29 -0
index 3ec7497..deb1daf 100644
@@ -73,6 +73,27 @@ static const struct rte_security_capability cn9k_eth_sec_capabilities[] = {
 	}
 };
 
+static inline int
+ar_window_init(struct cn9k_inb_priv_data *inb_priv)
+{
+	if (inb_priv->replay_win_sz > CNXK_ON_AR_WIN_SIZE_MAX) {
+		plt_err("Replay window size:%u is not supported",
+			inb_priv->replay_win_sz);
+		return -ENOTSUP;
+	}
+
+	rte_spinlock_init(&inb_priv->ar.lock);
+	/*
+	 * Set window bottom to 1, base and top to size of
+	 * window
+	 */
+	inb_priv->ar.winb = 1;
+	inb_priv->ar.wint = inb_priv->replay_win_sz;
+	inb_priv->ar.base = inb_priv->replay_win_sz;
+
+	return 0;
+}
+
 static int
 cn9k_eth_sec_session_create(void *device,
 			    struct rte_security_session_conf *conf,
@@ -158,6 +179,14 @@ cn9k_eth_sec_session_create(void *device,
 		/* Save userdata in inb private area */
 		inb_priv->userdata = conf->userdata;
 
+		inb_priv->replay_win_sz = ipsec->replay_win_sz;
+		if (inb_priv->replay_win_sz) {
+			rc = ar_window_init(inb_priv);
+			if (rc)
+				goto mempool_put;
+		}
+
+		/* Prepare session priv */
 		sess_priv.inb_sa = 1;
 		sess_priv.sa_idx = ipsec->spi;
 
drivers/net/cnxk/cn9k_rx.h +53 -1

79 lines not on this page · raw message

Signature · 1 line
2.8.4
#52 lore raw

PATCH v2 23/28 net/cnxk: support IPsec transport mode in cn10k

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds IPsec transport mode capability to rte security capabilities.

---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/net/cnxk/cn10k_ethdev_sec.c +24 -0
index 3ffd824..dae5ea7 100644
@@ -69,6 +69,30 @@ static const struct rte_security_capability cn10k_eth_sec_capabilities[] = {
 		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
 		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
 	},
+	{	/* IPsec Inline Protocol ESP Transport Egress */
+		.action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
+		.protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+		.ipsec = {
+			.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+			.mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
+			.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
+			.options = { 0 }
+		},
+		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
+		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+	},
+	{	/* IPsec Inline Protocol ESP Transport Ingress */
+		.action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
+		.protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+		.ipsec = {
+			.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+			.mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
+			.direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
+			.options = { 0 }
+		},
+		.crypto_capabilities = cn10k_eth_sec_crypto_caps,
+		.ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+	},
 	{
 		.action = RTE_SECURITY_ACTION_TYPE_NONE
 	}
Signature · 1 line
2.8.4
#53 lore raw

PATCH v2 24/28 net/cnxk: update ethertype for mixed IPsec tunnel versions

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds support to update ethertype for mixed IPsec tunnel versions. And also sets et_overwr for inbound IPsec.

---
 drivers/common/cnxk/cnxk_security.c |  1 +
 drivers/net/cnxk/cn10k_ethdev.h     |  3 ++-
 drivers/net/cnxk/cn10k_ethdev_sec.c |  2 ++
 drivers/net/cnxk/cn10k_tx.h         | 19 +++++++++++++++++++
 4 files changed, 24 insertions(+), 1 deletion(-)
drivers/common/cnxk/cnxk_security.c +1 -0
index c117fa7..0039a9d 100644
@@ -344,6 +344,7 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
 	/* There are two words of CPT_CTX_HW_S for ucode to skip */
 	sa->w0.s.ctx_hdr_size = 1;
 	sa->w0.s.aop_valid = 1;
+	sa->w0.s.et_ovrwr = 1;
 
 	rte_wmb();
 
drivers/net/cnxk/cn10k_ethdev.h +2 -1
index 200cd93..c2a46ad 100644
@@ -64,7 +64,8 @@ struct cn10k_sec_sess_priv {
 		struct {
 			uint32_t sa_idx;
 			uint8_t inb_sa : 1;
-			uint8_t rsvd1 : 2;
+			uint8_t outer_ip_ver : 1;
+			uint8_t mode : 1;
 			uint8_t roundup_byte : 5;
 			uint8_t roundup_len;
 			uint16_t partial_len;
drivers/net/cnxk/cn10k_ethdev_sec.c +2 -0
index dae5ea7..c66730a 100644
@@ -341,6 +341,8 @@ cn10k_eth_sec_session_create(void *device,
 		sess_priv.roundup_byte = rlens->roundup_byte;
 		sess_priv.roundup_len = rlens->roundup_len;
 		sess_priv.partial_len = rlens->partial_len;
+		sess_priv.mode = outb_sa->w2.s.ipsec_mode;
+		sess_priv.outer_ip_ver = outb_sa->w2.s.outer_ip_ver;
 
 		/* Pointer from eth_sec -> outb_sa */
 		eth_sec->sa = outb_sa;
drivers/net/cnxk/cn10k_tx.h +19 -0
index 52bb71d..ad84464 100644
@@ -302,6 +302,16 @@ cn10k_nix_prep_sec_vec(struct rte_mbuf *m, uint64x2_t *cmd0, uint64x2_t *cmd1,
 	cmd23 = vsetq_lane_u64((uintptr_t)m | 1, cmd23, 1);
 
 	dptr += l2_len;
+
+	if (sess_priv.mode == ROC_IE_SA_MODE_TUNNEL) {
+		if (sess_priv.outer_ip_ver == ROC_IE_SA_IP_VERSION_4)
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+		else
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	}
+
 	ucode_cmd[1] = dptr;
 	ucode_cmd[2] = dptr;
 
@@ -396,6 +406,15 @@ cn10k_nix_prep_sec(struct rte_mbuf *m, uint64_t *cmd, uintptr_t *nixtx_addr,
 	cmd23 = vsetq_lane_u64((uintptr_t)m | 1, cmd23, 1);
 
 	dptr += l2_len;
+
+	if (sess_priv.mode == ROC_IE_SA_MODE_TUNNEL) {
+		if (sess_priv.outer_ip_ver == ROC_IE_SA_IP_VERSION_4)
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+		else
+			*((uint16_t *)(dptr - 2)) =
+				rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	}
 	ucode_cmd[1] = dptr;
 	ucode_cmd[2] = dptr;
 
Signature · 1 line
2.8.4
#54 lore raw

PATCH v2 25/28 net/cnxk: allow zero udp6 checksum for non inline device

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Sets IP6_UDP_OPT in NIX RX config to allow optional UDP checksum for IPv6 in case of security offload. Also disable drop_re when inline inbound is enabled.

---
 drivers/net/cnxk/cn10k_ethdev.c | 5 +++++
 drivers/net/cnxk/cnxk_ethdev.c  | 9 +++++++++
 drivers/net/cnxk/cnxk_ethdev.h  | 1 +
 3 files changed, 15 insertions(+)
drivers/net/cnxk/cn10k_ethdev.c +5 -0
index fa2343c..9dfea99 100644
@@ -553,6 +553,11 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 
 	dev = cnxk_eth_pmd_priv(eth_dev);
 
+	/* DROP_RE is not supported with inline IPSec for CN10K A0 */
+	if (roc_model_is_cn10ka_a0() || roc_model_is_cnf10ka_a0() ||
+	    roc_model_is_cnf10kb_a0())
+		dev->ipsecd_drop_re_dis = 1;
+
 	/* Register up msg callbacks for PTP information */
 	roc_nix_ptp_info_cb_register(&dev->nix, cn10k_nix_ptp_info_update_cb);
 
drivers/net/cnxk/cnxk_ethdev.c +9 -0
index 5a64691..2367d5c 100644
@@ -1021,6 +1021,15 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		   ROC_NIX_LF_RX_CFG_LEN_IL4 | ROC_NIX_LF_RX_CFG_LEN_IL3 |
 		   ROC_NIX_LF_RX_CFG_LEN_OL4 | ROC_NIX_LF_RX_CFG_LEN_OL3);
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY) {
+		rx_cfg |= ROC_NIX_LF_RX_CFG_IP6_UDP_OPT;
+		/* Disable drop re if rx offload security is enabled and
+		 * platform does not support it.
+		 */
+		if (dev->ipsecd_drop_re_dis)
+			rx_cfg &= ~(ROC_NIX_LF_RX_CFG_DROP_RE);
+	}
+
 	nb_rxq = RTE_MAX(data->nb_rx_queues, 1);
 	nb_txq = RTE_MAX(data->nb_tx_queues, 1);
 
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index a2bcea2..6fd50da 100644
@@ -269,6 +269,7 @@ struct cnxk_eth_dev {
 	union {
 		struct {
 			uint64_t cq_min_4k : 1;
+			uint64_t ipsecd_drop_re_dis : 1;
 		};
 		uint64_t hwcap;
 	};
Signature · 1 line
2.8.4
#55 lore raw

PATCH v2 26/28 net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds capabitlities for AES_CBC and HMAC_SHA1 for 9k security offload.

---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c  | 40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
drivers/net/cnxk/cn10k_ethdev_sec.c +40 -0
index c66730a..82dc636 100644
@@ -41,6 +41,46 @@ static struct rte_cryptodev_capabilities cn10k_eth_sec_crypto_caps[] = {
 			}, }
 		}, }
 	},
+	{	/* AES CBC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_AES_CBC,
+				.block_size = 16,
+				.key_size = {
+					.min = 16,
+					.max = 32,
+					.increment = 8
+				},
+				.iv_size = {
+					.min = 16,
+					.max = 16,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
+	{	/* SHA1 HMAC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+				.block_size = 64,
+				.key_size = {
+					.min = 20,
+					.max = 64,
+					.increment = 1
+				},
+				.digest_size = {
+					.min = 12,
+					.max = 12,
+					.increment = 0
+				},
+			}, }
+		}, }
+	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
drivers/net/cnxk/cn9k_ethdev_sec.c +40 -0
index deb1daf..b070ad5 100644
@@ -40,6 +40,46 @@ static struct rte_cryptodev_capabilities cn9k_eth_sec_crypto_caps[] = {
 			}, }
 		}, }
 	},
+	{	/* AES CBC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_AES_CBC,
+				.block_size = 16,
+				.key_size = {
+					.min = 16,
+					.max = 32,
+					.increment = 8
+				},
+				.iv_size = {
+					.min = 16,
+					.max = 16,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
+	{	/* SHA1 HMAC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+				.block_size = 64,
+				.key_size = {
+					.min = 20,
+					.max = 64,
+					.increment = 1
+				},
+				.digest_size = {
+					.min = 12,
+					.max = 12,
+					.increment = 0
+				},
+			}, }
+		}, }
+	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
Signature · 1 line
2.8.4
#56 lore raw

PATCH v2 27/28 net/cnxk: support configuring channel mask via devargs

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds support to configure channel mask which will be used by rte flow when adding flow rules with inline IPsec action.

---
 doc/guides/nics/cnxk.rst           | 20 +++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev_sec.c | 39 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)
doc/guides/nics/cnxk.rst +20 -0
index b542437..dd955d3 100644
@@ -255,6 +255,26 @@ Runtime Config Options
    With the above configuration, inbound encrypted traffic from both the ports
    is received by ipsec inline device.
 
+- ``Inline IPsec device channel and mask`` (default ``none``)
+
+   Set channel and channel mask configuration for the inline IPSec device. This
+   will be used when creating flow rules with RTE_FLOW_ACTION_TYPE_SECURITY
+   action.
+
+   By default, RTE Flow API sets the channel number of the port on which the
+   rule is created in the MCAM entry and matches it exactly. This behaviour can
+   be modified using the ``inl_cpt_channel`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:1d:00.0,inl_cpt_channel=0x100/0xf00
+
+   With the above configuration, RTE Flow rules API will set the channel
+   and channel mask as 0x100 and 0xF00 in the MCAM entries of the  flow rules
+   created with RTE_FLOW_ACTION_TYPE_SECURITY action. Since channel number is
+   set with this custom mask, inbound encrypted traffic from all ports with
+   matching channel number pattern will be directed to the inline IPSec device.
+
 .. note::
 
    Above devarg parameters are configurable per device, user needs to pass the
drivers/net/cnxk/cnxk_ethdev_sec.c +38 -1
index c76e230..ae3e49c 100644
@@ -6,6 +6,13 @@
 
 #define CNXK_NIX_INL_SELFTEST	      "selftest"
 #define CNXK_NIX_INL_IPSEC_IN_MAX_SPI "ipsec_in_max_spi"
+#define CNXK_INL_CPT_CHANNEL	      "inl_cpt_channel"
+
+struct inl_cpt_channel {
+	bool is_multi_channel;
+	uint16_t channel;
+	uint16_t mask;
+};
 
 #define CNXK_NIX_INL_DEV_NAME RTE_STR(cnxk_nix_inl_dev_)
 #define CNXK_NIX_INL_DEV_NAME_LEN                                              \
@@ -137,13 +144,37 @@ parse_selftest(const char *key, const char *value, void *extra_args)
 }
 
 static int
+parse_inl_cpt_channel(const char *key, const char *value, void *extra_args)
+{
+	RTE_SET_USED(key);
+	uint16_t chan = 0, mask = 0;
+	char *next = 0;
+
+	/* next will point to the separator '/' */
+	chan = strtol(value, &next, 16);
+	mask = strtol(++next, 0, 16);
+
+	if (chan > GENMASK(12, 0) || mask > GENMASK(12, 0))
+		return -EINVAL;
+
+	((struct inl_cpt_channel *)extra_args)->channel = chan;
+	((struct inl_cpt_channel *)extra_args)->mask = mask;
+	((struct inl_cpt_channel *)extra_args)->is_multi_channel = true;
+
+	return 0;
+}
+
+static int
 nix_inl_parse_devargs(struct rte_devargs *devargs,
 		      struct roc_nix_inl_dev *inl_dev)
 {
 	uint32_t ipsec_in_max_spi = BIT(8) - 1;
+	struct inl_cpt_channel cpt_channel;
 	struct rte_kvargs *kvlist;
 	uint8_t selftest = 0;
 
+	memset(&cpt_channel, 0, sizeof(cpt_channel));
+
 	if (devargs == NULL)
 		goto null_devargs;
 
@@ -155,11 +186,16 @@ nix_inl_parse_devargs(struct rte_devargs *devargs,
 			   &selftest);
 	rte_kvargs_process(kvlist, CNXK_NIX_INL_IPSEC_IN_MAX_SPI,
 			   &parse_ipsec_in_max_spi, &ipsec_in_max_spi);
+	rte_kvargs_process(kvlist, CNXK_INL_CPT_CHANNEL, &parse_inl_cpt_channel,
+			   &cpt_channel);
 	rte_kvargs_free(kvlist);
 
 null_devargs:
 	inl_dev->ipsec_in_max_spi = ipsec_in_max_spi;
 	inl_dev->selftest = selftest;
+	inl_dev->channel = cpt_channel.channel;
+	inl_dev->chan_mask = cpt_channel.mask;
+	inl_dev->is_multi_channel = cpt_channel.is_multi_channel;
 	return 0;
 exit:
 	return -EINVAL;
@@ -275,4 +311,5 @@ RTE_PMD_REGISTER_KMOD_DEP(cnxk_nix_inl, "vfio-pci");
 
 RTE_PMD_REGISTER_PARAM_STRING(cnxk_nix_inl,
 			      CNXK_NIX_INL_SELFTEST "=1"
-			      CNXK_NIX_INL_IPSEC_IN_MAX_SPI "=<1-65535>");
+			      CNXK_NIX_INL_IPSEC_IN_MAX_SPI "=<1-65535>"
+			      CNXK_INL_CPT_CHANNEL "=<1-4095>/<1-4095>");
Signature · 1 line
2.8.4
#57 lore raw

PATCH v2 28/28 net/cnxk: reflect globally enabled offloads in queue conf

In reply to Nithin Dabilpuram

Reflect globally enabled Rx and Tx offloads in queue conf. Also fix issue with lmt data prepare for multi seg.

Fixes a24af6361e37 ("net/cnxk: add Tx queue setup and release")
Fixes a86144cd9ded ("net/cnxk: add Rx queue setup and release")
Fixes 305ca2c4c382 ("net/cnxk: support multi-segment vector Tx")
---
 drivers/net/cnxk/cn10k_tx.h    | 2 +-
 drivers/net/cnxk/cnxk_ethdev.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn10k_tx.h +1 -1
index ad84464..c6f349b 100644
@@ -1280,7 +1280,7 @@ cn10k_nix_prep_lmt_mseg_vector(struct rte_mbuf **mbufs, uint64x2_t *cmd0,
 			vst1q_u64(lmt_addr + 14, cmd1[3]);
 
 			*data128 |= ((__uint128_t)7) << *shift;
-			shift += 3;
+			*shift += 3;
 
 			return 1;
 		}
drivers/net/cnxk/cnxk_ethdev.c +4 -0
index 2367d5c..bdceac8 100644
@@ -380,6 +380,8 @@ cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq_sp->dev = dev;
 	txq_sp->qid = qid;
 	txq_sp->qconf.conf.tx = *tx_conf;
+	/* Queue config should reflect global offloads */
+	txq_sp->qconf.conf.tx.offloads = dev->tx_offloads;
 	txq_sp->qconf.nb_desc = nb_desc;
 
 	plt_nix_dbg("sq=%d fc=%p offload=0x%" PRIx64 " lmt_addr=%p"
@@ -527,6 +529,8 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq_sp->dev = dev;
 	rxq_sp->qid = qid;
 	rxq_sp->qconf.conf.rx = *rx_conf;
+	/* Queue config should reflect global offloads */
+	rxq_sp->qconf.conf.rx.offloads = dev->rx_offloads;
 	rxq_sp->qconf.nb_desc = nb_desc;
 	rxq_sp->qconf.mp = mp;
 
Signature · 1 line
2.8.4
#58 lore raw
In reply to Nithin Dabilpuram
Quoted 31 lines · Nithin Dabilpuram

Support for inline ipsec in CN9K event mode and in Cn10K event mode and poll mode.

Kommula Shiva Shankar (1):
common/cnxk: add CQ enable support in NIX Tx path

Nithin Dabilpuram (18):
common/cnxk: support CPT parse header dump common/cnxk: allow reuse of SSO API for inline dev common/cnxk: change NIX debug API and queue API interface common/cnxk: support NIX inline device IRQ common/cnxk: support NIX inline device init and fini common/cnxk: support NIX inline inbound and outbound setup common/cnxk: disable CQ drop when inline inbound is enabled common/cnxk: dump CPT LF registers on error intr common/cnxk: align CPT LF enable/disable sequence common/cnxk: restore NIX sqb pool limit before destroy common/cnxk: setup aura BP conf based on nix net/cnxk: support inline security setup for cn9k net/cnxk: support inline security setup for cn10k net/cnxk: support Rx security offload on cn9k net/cnxk: support Tx security offload on cn9k net/cnxk: support Rx security offload on cn10k net/cnxk: support Tx security offload on cn10k net/cnxk: reflect globally enabled offloads in queue conf

Satheesh Paul (2):
common/cnxk: support inline IPsec rte flow action net/cnxk: support configuring channel mask via devargs

Quoted 8 lines

Srujana Challa (7):
common/cnxk: support cn9k fast path security session common/cnxk: support anti-replay check in SW for cn9k net/cnxk: support IPsec anti replay in cn9k net/cnxk: support IPsec transport mode in cn10k net/cnxk: update ethertype for mixed IPsec tunnel versions net/cnxk: allow zero udp6 checksum for non inline device net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

Could you please rebase with next-net-mrvl

[for-next-net]dell[dpdk-next-net-mrvl] $ git pw series apply 19307
Applying: common/cnxk: support cn9k fast path security session
Applying: common/cnxk: support CPT parse header dump
Applying: common/cnxk: allow reuse of SSO API for inline dev
Applying: common/cnxk: change NIX debug API and queue API interface
error: sha1 information is lacking or useless (drivers/common/cnxk/roc_nix_priv.h).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0004 common/cnxk: change NIX debug API and queue API interface When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Quoted 117 lines

v2:
- Included bug fixes for second pass packets
- Updated .ini files.
- Reworded commit messages with additional description and abbreviation fixes

 doc/guides/nics/cnxk.rst                         |  122 +++
 doc/guides/nics/features/cnxk.ini                |    1 +
 doc/guides/nics/features/cnxk_vec.ini            |    1 +
 doc/guides/nics/features/cnxk_vf.ini             |    1 +
 doc/guides/rel_notes/release_21_11.rst           |    2 +
 drivers/common/cnxk/cnxk_security.c              |  212 +++++
 drivers/common/cnxk/cnxk_security.h              |   12 +
 drivers/common/cnxk/cnxk_security_ar.h           |  184 ++++
 drivers/common/cnxk/hw/cpt.h                     |   19 +
 drivers/common/cnxk/meson.build                  |    3 +
 drivers/common/cnxk/roc_api.h                    |   49 +-
 drivers/common/cnxk/roc_constants.h              |   58 ++
 drivers/common/cnxk/roc_cpt.c                    |   54 +-
 drivers/common/cnxk/roc_cpt.h                    |   10 +
 drivers/common/cnxk/roc_cpt_debug.c              |   63 +-
 drivers/common/cnxk/roc_cpt_priv.h               |    1 +
 drivers/common/cnxk/roc_idev.c                   |    2 +
 drivers/common/cnxk/roc_idev_priv.h              |    3 +
 drivers/common/cnxk/roc_io.h                     |    9 +
 drivers/common/cnxk/roc_io_generic.h             |    3 +-
 drivers/common/cnxk/roc_irq.c                    |    7 +-
 drivers/common/cnxk/roc_nix.c                    |    2 +-
 drivers/common/cnxk/roc_nix.h                    |    7 +
 drivers/common/cnxk/roc_nix_debug.c              |  168 +++-
 drivers/common/cnxk/roc_nix_fc.c                 |   23 +-
 drivers/common/cnxk/roc_nix_inl.c                |  778 +++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h                |  170 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c            |  639 ++++++++++++++
 drivers/common/cnxk/roc_nix_inl_dev_irq.c        |  359 ++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h           |   68 ++
 drivers/common/cnxk/roc_nix_priv.h               |   31 +
 drivers/common/cnxk/roc_nix_queue.c              |  137 +--
 drivers/common/cnxk/roc_npc.c                    |   27 +-
 drivers/common/cnxk/roc_npc_mcam.c               |   28 +-
 drivers/common/cnxk/roc_platform.h               |   11 +-
 drivers/common/cnxk/roc_priv.h                   |    3 +
 drivers/common/cnxk/roc_sso.c                    |   52 +-
 drivers/common/cnxk/roc_sso_priv.h               |    9 +
 drivers/common/cnxk/version.map                  |   34 +
 drivers/event/cnxk/cn10k_eventdev.c              |   93 +-
 drivers/event/cnxk/cn10k_worker.h                |  147 +++-
 drivers/event/cnxk/cn10k_worker_deq.c            |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c      |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c        |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c     |    2 +-
 drivers/event/cnxk/cn9k_eventdev.c               |  182 ++--
 drivers/event/cnxk/cn9k_worker.h                 |  170 +++-
 drivers/event/cnxk/cn9k_worker_deq.c             |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c       |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c         |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c        |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c  |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c    |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |    2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c         |   36 +-
 drivers/net/cnxk/cn10k_ethdev.c                  |   41 +-
 drivers/net/cnxk/cn10k_ethdev.h                  |   48 ++
 drivers/net/cnxk/cn10k_ethdev_sec.c              |  492 +++++++++++
 drivers/net/cnxk/cn10k_rx.c                      |   31 +-
 drivers/net/cnxk/cn10k_rx.h                      |  649 +++++++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_rx_vec.c                  |    4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c             |    4 +-
 drivers/net/cnxk/cn10k_tx.c                      |   31 +-
 drivers/net/cnxk/cn10k_tx.h                      | 1006 +++++++++++++++++++---
 drivers/net/cnxk/cn10k_tx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_tx_vec.c                  |    2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c             |    2 +-
 drivers/net/cnxk/cn9k_ethdev.c                   |   23 +
 drivers/net/cnxk/cn9k_ethdev.h                   |   64 ++
 drivers/net/cnxk/cn9k_ethdev_sec.c               |  382 ++++++++
 drivers/net/cnxk/cn9k_rx.c                       |   31 +-
 drivers/net/cnxk/cn9k_rx.h                       |  493 +++++++++--
 drivers/net/cnxk/cn9k_rx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cn9k_tx.c                       |   29 +-
 drivers/net/cnxk/cn9k_tx.h                       |  393 ++++++---
 drivers/net/cnxk/cn9k_tx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cnxk_ethdev.c                   |  243 +++++-
 drivers/net/cnxk/cnxk_ethdev.h                   |  125 ++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c           |   88 +-
 drivers/net/cnxk/cnxk_ethdev_sec.c               |  315 +++++++
 drivers/net/cnxk/cnxk_lookup.c                   |   50 +-
 drivers/net/cnxk/meson.build                     |    3 +
 drivers/net/cnxk/version.map                     |    5 +
 usertools/dpdk-devbind.py                        |    8 +-
 96 files changed, 7686 insertions(+), 918 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c

--
2.8.4

#59 lore raw

v3 cover net/cnxk: support for inline ipsec

In reply to Nithin Dabilpuram

Support for inline ipsec in CN9K event mode and in Cn10K event mode and poll mode.

Kommula Shiva Shankar (1):
common/cnxk: add CQ enable support in NIX Tx path

Nithin Dabilpuram (18):
common/cnxk: support CPT parse header dump common/cnxk: allow reuse of SSO API for inline dev common/cnxk: change NIX debug API and queue API interface common/cnxk: support NIX inline device IRQ common/cnxk: support NIX inline device init and fini common/cnxk: support NIX inline inbound and outbound setup common/cnxk: disable CQ drop when inline inbound is enabled common/cnxk: dump CPT LF registers on error intr common/cnxk: align CPT LF enable/disable sequence common/cnxk: restore NIX sqb pool limit before destroy common/cnxk: setup aura BP conf based on nix net/cnxk: support inline security setup for cn9k net/cnxk: support inline security setup for cn10k net/cnxk: support Rx security offload on cn9k net/cnxk: support Tx security offload on cn9k net/cnxk: support Rx security offload on cn10k net/cnxk: support Tx security offload on cn10k net/cnxk: reflect globally enabled offloads in queue conf

Satheesh Paul (2):
common/cnxk: support inline IPsec rte flow action net/cnxk: support configuring channel mask via devargs

Srujana Challa (7):
common/cnxk: support cn9k fast path security session common/cnxk: support anti-replay check in SW for cn9k net/cnxk: support IPsec anti replay in cn9k net/cnxk: support IPsec transport mode in cn10k net/cnxk: update ethertype for mixed IPsec tunnel versions net/cnxk: allow zero udp6 checksum for non inline device net/cnxk: add crypto capabilities for AES CBC and HMAC SHA1

v3:
- Rebased and fixed conflicts

v2:
- Included bug fixes for second pass packets
- Updated .ini files.
- Reworded commit messages with additional description and abbreviation fixes

 doc/guides/nics/cnxk.rst                         |  122 +++
 doc/guides/nics/features/cnxk.ini                |    1 +
 doc/guides/nics/features/cnxk_vec.ini            |    1 +
 doc/guides/nics/features/cnxk_vf.ini             |    1 +
 doc/guides/rel_notes/release_21_11.rst           |    2 +
 drivers/common/cnxk/cnxk_security.c              |  212 +++++
 drivers/common/cnxk/cnxk_security.h              |   12 +
 drivers/common/cnxk/cnxk_security_ar.h           |  184 ++++
 drivers/common/cnxk/hw/cpt.h                     |   19 +
 drivers/common/cnxk/meson.build                  |    3 +
 drivers/common/cnxk/roc_api.h                    |   49 +-
 drivers/common/cnxk/roc_constants.h              |   58 ++
 drivers/common/cnxk/roc_cpt.c                    |   54 +-
 drivers/common/cnxk/roc_cpt.h                    |   10 +
 drivers/common/cnxk/roc_cpt_debug.c              |   63 +-
 drivers/common/cnxk/roc_cpt_priv.h               |    1 +
 drivers/common/cnxk/roc_idev.c                   |    2 +
 drivers/common/cnxk/roc_idev_priv.h              |    3 +
 drivers/common/cnxk/roc_io.h                     |    9 +
 drivers/common/cnxk/roc_io_generic.h             |    3 +-
 drivers/common/cnxk/roc_irq.c                    |    7 +-
 drivers/common/cnxk/roc_nix.c                    |    2 +-
 drivers/common/cnxk/roc_nix.h                    |    7 +
 drivers/common/cnxk/roc_nix_debug.c              |  168 +++-
 drivers/common/cnxk/roc_nix_fc.c                 |   23 +-
 drivers/common/cnxk/roc_nix_inl.c                |  778 +++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h                |  170 ++++
 drivers/common/cnxk/roc_nix_inl_dev.c            |  639 ++++++++++++++
 drivers/common/cnxk/roc_nix_inl_dev_irq.c        |  359 ++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h           |   68 ++
 drivers/common/cnxk/roc_nix_priv.h               |   31 +
 drivers/common/cnxk/roc_nix_queue.c              |  137 +--
 drivers/common/cnxk/roc_npc.c                    |   27 +-
 drivers/common/cnxk/roc_npc_mcam.c               |   28 +-
 drivers/common/cnxk/roc_platform.h               |   11 +-
 drivers/common/cnxk/roc_priv.h                   |    3 +
 drivers/common/cnxk/roc_sso.c                    |   52 +-
 drivers/common/cnxk/roc_sso_priv.h               |    9 +
 drivers/common/cnxk/version.map                  |   34 +
 drivers/event/cnxk/cn10k_eventdev.c              |   93 +-
 drivers/event/cnxk/cn10k_worker.h                |  147 +++-
 drivers/event/cnxk/cn10k_worker_deq.c            |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_burst.c      |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_ca.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_deq_tmo.c        |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq.c         |    2 +-
 drivers/event/cnxk/cn10k_worker_tx_enq_seg.c     |    2 +-
 drivers/event/cnxk/cn9k_eventdev.c               |  182 ++--
 drivers/event/cnxk/cn9k_worker.h                 |  170 +++-
 drivers/event/cnxk/cn9k_worker_deq.c             |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_burst.c       |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_ca.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_deq_tmo.c         |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq.c        |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_burst.c  |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_ca.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_deq_tmo.c    |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq.c     |    2 +-
 drivers/event/cnxk/cn9k_worker_dual_tx_enq_seg.c |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq.c          |    2 +-
 drivers/event/cnxk/cn9k_worker_tx_enq_seg.c      |    2 +-
 drivers/event/cnxk/cnxk_eventdev_adptr.c         |   36 +-
 drivers/net/cnxk/cn10k_ethdev.c                  |   41 +-
 drivers/net/cnxk/cn10k_ethdev.h                  |   48 ++
 drivers/net/cnxk/cn10k_ethdev_sec.c              |  492 +++++++++++
 drivers/net/cnxk/cn10k_rx.c                      |   31 +-
 drivers/net/cnxk/cn10k_rx.h                      |  649 +++++++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_rx_vec.c                  |    4 +-
 drivers/net/cnxk/cn10k_rx_vec_mseg.c             |    4 +-
 drivers/net/cnxk/cn10k_tx.c                      |   31 +-
 drivers/net/cnxk/cn10k_tx.h                      | 1006 +++++++++++++++++++---
 drivers/net/cnxk/cn10k_tx_mseg.c                 |    2 +-
 drivers/net/cnxk/cn10k_tx_vec.c                  |    2 +-
 drivers/net/cnxk/cn10k_tx_vec_mseg.c             |    2 +-
 drivers/net/cnxk/cn9k_ethdev.c                   |   23 +
 drivers/net/cnxk/cn9k_ethdev.h                   |   64 ++
 drivers/net/cnxk/cn9k_ethdev_sec.c               |  382 ++++++++
 drivers/net/cnxk/cn9k_rx.c                       |   31 +-
 drivers/net/cnxk/cn9k_rx.h                       |  493 +++++++++--
 drivers/net/cnxk/cn9k_rx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_rx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_rx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cn9k_tx.c                       |   29 +-
 drivers/net/cnxk/cn9k_tx.h                       |  393 ++++++---
 drivers/net/cnxk/cn9k_tx_mseg.c                  |    2 +-
 drivers/net/cnxk/cn9k_tx_vec.c                   |    2 +-
 drivers/net/cnxk/cn9k_tx_vec_mseg.c              |    2 +-
 drivers/net/cnxk/cnxk_ethdev.c                   |  243 +++++-
 drivers/net/cnxk/cnxk_ethdev.h                   |  125 ++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c           |   88 +-
 drivers/net/cnxk/cnxk_ethdev_sec.c               |  315 +++++++
 drivers/net/cnxk/cnxk_lookup.c                   |   50 +-
 drivers/net/cnxk/meson.build                     |    3 +
 drivers/net/cnxk/version.map                     |    5 +
 usertools/dpdk-devbind.py                        |    8 +-
 96 files changed, 7686 insertions(+), 918 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
Signature · 1 line
2.8.4
#60 lore raw

PATCH v3 1/28 common/cnxk: support cn9k fast path security session

From: Srujana Challa <[email protected]>

Add security support to init cn9k fast path SA data for AES GCM and AES CBC + HMAC SHA1.

---
 drivers/common/cnxk/cnxk_security.c | 211 ++++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/cnxk_security.h |  12 ++
 drivers/common/cnxk/version.map     |   4 +
 3 files changed, 227 insertions(+)
drivers/common/cnxk/cnxk_security.c +211 -0
index cc5daf3..c117fa7 100644
@@ -513,6 +513,217 @@ cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa)
 	return !!sa->w2.s.valid;
 }
 
+static inline int
+ipsec_xfrm_verify(struct rte_security_ipsec_xform *ipsec_xfrm,
+		  struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	if (crypto_xfrm->next == NULL)
+		return -EINVAL;
+
+	if (ipsec_xfrm->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_AUTH ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_CIPHER)
+			return -EINVAL;
+	} else {
+		if (crypto_xfrm->type != RTE_CRYPTO_SYM_XFORM_CIPHER ||
+		    crypto_xfrm->next->type != RTE_CRYPTO_SYM_XFORM_AUTH)
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int
+onf_ipsec_sa_common_param_fill(struct roc_ie_onf_sa_ctl *ctl, uint8_t *salt,
+			       uint8_t *cipher_key, uint8_t *hmac_opad_ipad,
+			       struct rte_security_ipsec_xform *ipsec_xfrm,
+			       struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_crypto_sym_xform *auth_xfrm, *cipher_xfrm;
+	int rc, length, auth_key_len;
+	const uint8_t *key = NULL;
+
+	/* Set direction */
+	switch (ipsec_xfrm->direction) {
+	case RTE_SECURITY_IPSEC_SA_DIR_INGRESS:
+		ctl->direction = ROC_IE_SA_DIR_INBOUND;
+		auth_xfrm = crypto_xfrm;
+		cipher_xfrm = crypto_xfrm->next;
+		break;
+	case RTE_SECURITY_IPSEC_SA_DIR_EGRESS:
+		ctl->direction = ROC_IE_SA_DIR_OUTBOUND;
+		cipher_xfrm = crypto_xfrm;
+		auth_xfrm = crypto_xfrm->next;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set protocol - ESP vs AH */
+	switch (ipsec_xfrm->proto) {
+	case RTE_SECURITY_IPSEC_SA_PROTO_ESP:
+		ctl->ipsec_proto = ROC_IE_SA_PROTOCOL_ESP;
+		break;
+	case RTE_SECURITY_IPSEC_SA_PROTO_AH:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set mode - transport vs tunnel */
+	switch (ipsec_xfrm->mode) {
+	case RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TRANSPORT;
+		break;
+	case RTE_SECURITY_IPSEC_SA_MODE_TUNNEL:
+		ctl->ipsec_mode = ROC_IE_SA_MODE_TUNNEL;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Set encryption algorithm */
+	if (crypto_xfrm->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
+		length = crypto_xfrm->aead.key.length;
+
+		switch (crypto_xfrm->aead.algo) {
+		case RTE_CRYPTO_AEAD_AES_GCM:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_GCM;
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_NULL;
+			memcpy(salt, &ipsec_xfrm->salt, 4);
+			key = crypto_xfrm->aead.key.data;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+	} else {
+		rc = ipsec_xfrm_verify(ipsec_xfrm, crypto_xfrm);
+		if (rc)
+			return rc;
+
+		switch (cipher_xfrm->cipher.algo) {
+		case RTE_CRYPTO_CIPHER_AES_CBC:
+			ctl->enc_type = ROC_IE_ON_SA_ENC_AES_CBC;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+
+		switch (auth_xfrm->auth.algo) {
+		case RTE_CRYPTO_AUTH_SHA1_HMAC:
+			ctl->auth_type = ROC_IE_ON_SA_AUTH_SHA1;
+			break;
+		default:
+			return -ENOTSUP;
+		}
+		auth_key_len = auth_xfrm->auth.key.length;
+		if (auth_key_len < 20 || auth_key_len > 64)
+			return -ENOTSUP;
+
+		key = cipher_xfrm->cipher.key.data;
+		length = cipher_xfrm->cipher.key.length;
+
+		ipsec_hmac_opad_ipad_gen(auth_xfrm, hmac_opad_ipad);
+	}
+
+	switch (length) {
+	case ROC_CPT_AES128_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
+		break;
+	case ROC_CPT_AES192_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_192;
+		break;
+	case ROC_CPT_AES256_KEY_LEN:
+		ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_256;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	memcpy(cipher_key, key, length);
+
+	if (ipsec_xfrm->options.esn)
+		ctl->esn_en = 1;
+
+	ctl->spi = rte_cpu_to_be_32(ipsec_xfrm->spi);
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+int
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm)
+{
+	struct rte_security_ipsec_tunnel_param *tunnel = &ipsec_xfrm->tunnel;
+	struct roc_ie_onf_sa_ctl *ctl = &sa->ctl;
+	int rc;
+
+	/* Fill common params */
+	rc = onf_ipsec_sa_common_param_fill(ctl, sa->nonce, sa->cipher_key,
+					    sa->hmac_key, ipsec_xfrm,
+					    crypto_xfrm);
+	if (rc)
+		return rc;
+
+	if (ipsec_xfrm->mode != RTE_SECURITY_IPSEC_SA_MODE_TUNNEL)
+		goto skip_tunnel_info;
+
+	/* Tunnel header info */
+	switch (tunnel->type) {
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV4:
+		memcpy(&sa->ip_src, &tunnel->ipv4.src_ip,
+		       sizeof(struct in_addr));
+		memcpy(&sa->ip_dst, &tunnel->ipv4.dst_ip,
+		       sizeof(struct in_addr));
+		break;
+	case RTE_SECURITY_IPSEC_TUNNEL_IPV6:
+		return -ENOTSUP;
+	default:
+		return -EINVAL;
+	}
+
+skip_tunnel_info:
+	rte_wmb();
+
+	/* Enable SA */
+	ctl->valid = 1;
+	return 0;
+}
+
+bool
+cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
+bool
+cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa)
+{
+	return !!sa->ctl.valid;
+}
+
 uint8_t
 cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo,
 		     enum rte_crypto_auth_algorithm a_algo,
drivers/common/cnxk/cnxk_security.h +12 -0
index 602f583..db97887 100644
@@ -46,4 +46,16 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
 bool __roc_api cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa);
 bool __roc_api cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa);
 
+/* [CN9K, CN10K) */
+int __roc_api
+cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
+			   struct rte_security_ipsec_xform *ipsec_xfrm,
+			   struct rte_crypto_sym_xform *crypto_xfrm);
+int __roc_api
+cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
+			    struct rte_security_ipsec_xform *ipsec_xfrm,
+			    struct rte_crypto_sym_xform *crypto_xfrm);
+bool __roc_api cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa);
+bool __roc_api cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa);
+
 #endif /* _CNXK_SECURITY_H__ */
drivers/common/cnxk/version.map +4 -0
index fff7902..f7b6ef6 100644
@@ -14,6 +14,10 @@ INTERNAL {
 	cnxk_logtype_sso;
 	cnxk_logtype_tim;
 	cnxk_logtype_tm;
+	cnxk_onf_ipsec_inb_sa_fill;
+	cnxk_onf_ipsec_outb_sa_fill;
+	cnxk_onf_ipsec_inb_sa_valid;
+	cnxk_onf_ipsec_outb_sa_valid;
 	cnxk_ot_ipsec_inb_sa_fill;
 	cnxk_ot_ipsec_outb_sa_fill;
 	cnxk_ot_ipsec_inb_sa_valid;
Signature · 1 line
2.8.4
#61 lore raw

PATCH v3 2/28 common/cnxk: support CPT parse header dump

In reply to Nithin Dabilpuram

Add helper API to dump CPT parse header.

---
 drivers/common/cnxk/roc_cpt.h       |  2 ++
 drivers/common/cnxk/roc_cpt_debug.c | 31 +++++++++++++++++++++++++++++++
 drivers/common/cnxk/version.map     |  1 +
 3 files changed, 34 insertions(+)
drivers/common/cnxk/roc_cpt.h +2 -0
index 9e63073..c80a8e0 100644
@@ -155,4 +155,6 @@ void __roc_api roc_cpt_iq_enable(struct roc_cpt_lf *lf);
 int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
 				   struct roc_cpt_lmtline *lmtline, int lf_id);
 
+void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
+
 #endif /* _ROC_CPT_H_ */
drivers/common/cnxk/roc_cpt_debug.c +31 -0
index 9a9dcba..a6c9004 100644
@@ -5,6 +5,37 @@
 #include "roc_api.h"
 #include "roc_priv.h"
 
+void
+roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
+{
+	plt_print("CPT_PARSE \t0x%p:", cpth);
+
+	/* W0 */
+	plt_print("W0: cookie \t0x%x\t\tmatch_id \t0x%04x\t\terr_sum \t%u \t",
+		  cpth->w0.cookie, cpth->w0.match_id, cpth->w0.err_sum);
+	plt_print("W0: reas_sts \t0x%x\t\tet_owr \t%u\t\tpkt_fmt \t%u \t",
+		  cpth->w0.reas_sts, cpth->w0.et_owr, cpth->w0.pkt_fmt);
+	plt_print("W0: pad_len \t%u\t\tnum_frags \t%u\t\tpkt_out \t%u \t",
+		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
+
+	/* W1 */
+	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+
+	/* W2 */
+	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
+		  cpth->w2.frag_age, cpth->w2.orig_pf_func);
+	plt_print("W2: il3_off \t0x%x\t\tfi_pad \t0x%x\t\tfi_offset \t0x%x \t",
+		  cpth->w2.il3_off, cpth->w2.fi_pad, cpth->w2.fi_offset);
+
+	/* W3 */
+	plt_print("W3: hw_ccode \t0x%x\t\tuc_ccode \t0x%x\t\tspi \t0x%08x",
+		  cpth->w3.hw_ccode, cpth->w3.uc_ccode, cpth->w3.spi);
+
+	/* W4 */
+	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
+		  cpth->esn, cpth->frag1_wqe_ptr);
+}
+
 static int
 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
 {
drivers/common/cnxk/version.map +1 -0
index f7b6ef6..008098e 100644
@@ -65,6 +65,7 @@ INTERNAL {
 	roc_cpt_lf_fini;
 	roc_cpt_lfs_print;
 	roc_cpt_lmtline_init;
+	roc_cpt_parse_hdr_dump;
 	roc_cpt_rxc_time_cfg;
 	roc_error_msg_get;
 	roc_hash_sha1_gen;
Signature · 1 line
2.8.4
#62 lore raw

PATCH v3 3/28 common/cnxk: allow reuse of SSO API for inline dev

In reply to Nithin Dabilpuram

Rework interface of SSO internal functions to use for NIX inline dev's SSO LF's.

---
 drivers/common/cnxk/roc_sso.c      | 52 ++++++++++++++++++++++++--------------
 drivers/common/cnxk/roc_sso_priv.h |  9 +++++++
 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/common/cnxk/roc_sso.c +33 -19
index 1ccf262..bdf973f 100644
@@ -6,11 +6,10 @@
 #include "roc_priv.h"
 
 /* Private functions. */
-static int
-sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
+int
+sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
 	     void **rsp)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -41,10 +40,9 @@ sso_lf_alloc(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf,
 	return 0;
 }
 
-static int
-sso_lf_free(struct roc_sso *roc_sso, enum sso_lf_type lf_type, uint16_t nb_lf)
+int
+sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	int rc = -ENOSPC;
 
 	switch (lf_type) {
@@ -152,7 +150,7 @@ sso_rsrc_get(struct roc_sso *roc_sso)
 	return 0;
 }
 
-static void
+void
 sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		    uint16_t hwgrp[], uint16_t n, uint16_t enable)
 {
@@ -172,8 +170,10 @@ sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
 		k = k ? k : 4;
 		for (j = 0; j < k; j++) {
 			mask[j] = hwgrp[i + j] | enable << 14;
-			enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
-				 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			if (bmp) {
+				enable ? plt_bitmap_set(bmp, hwgrp[i + j]) :
+					 plt_bitmap_clear(bmp, hwgrp[i + j]);
+			}
 			plt_sso_dbg("HWS %d Linked to HWGRP %d", hws,
 				    hwgrp[i + j]);
 		}
@@ -388,10 +388,8 @@ roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos,
 }
 
 int
-roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
-			uint16_t hwgrps)
+sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps)
 {
-	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
 	struct sso_hw_setconfig *req;
 	int rc = -ENOSPC;
 
@@ -406,9 +404,17 @@ roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
 }
 
 int
-roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id,
+			uint16_t hwgrps)
 {
 	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_alloc_xaq(dev, npa_aura_id, hwgrps);
+}
+
+int
+sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps)
+{
 	struct sso_hw_xaq_release *req;
 
 	req = mbox_alloc_msg_sso_hw_release_xaq_aura(dev->mbox);
@@ -420,6 +426,14 @@ roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
 }
 
 int
+roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps)
+{
+	struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+
+	return sso_hwgrp_release_xaq(dev, hwgrps);
+}
+
+int
 roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp,
 			   uint8_t weight, uint8_t affinity, uint8_t priority)
 {
@@ -468,13 +482,13 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 		goto hwgrp_atch_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWS, nb_hws, NULL);
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWS, nb_hws, NULL);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWS LFs");
 		goto hws_alloc_fail;
 	}
 
-	rc = sso_lf_alloc(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp,
+	rc = sso_lf_alloc(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp,
 			  (void **)&rsp_hwgrp);
 	if (rc < 0) {
 		plt_err("Unable to alloc SSO HWGRP Lfs");
@@ -503,9 +517,9 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp)
 
 	return 0;
 sso_msix_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, nb_hwgrp);
 hwgrp_alloc_fail:
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, nb_hws);
 hws_alloc_fail:
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
 hwgrp_atch_fail:
@@ -523,8 +537,8 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)
 
 	sso_unregister_irqs_priv(roc_sso, &sso->pci_dev->intr_handle,
 				 roc_sso->nb_hws, roc_sso->nb_hwgrp);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
-	sso_lf_free(roc_sso, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWS, roc_sso->nb_hws);
+	sso_lf_free(&sso->dev, SSO_LF_TYPE_HWGRP, roc_sso->nb_hwgrp);
 
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWS);
 	sso_rsrc_detach(roc_sso, SSO_LF_TYPE_HWGRP);
drivers/common/cnxk/roc_sso_priv.h +9 -0
index 5361d4f..8dffa3f 100644
@@ -39,6 +39,15 @@ roc_sso_to_sso_priv(struct roc_sso *roc_sso)
 	return (struct sso *)&roc_sso->reserved[0];
 }
 
+/* SSO LF ops */
+int sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
+		 void **rsp);
+int sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf);
+void sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp,
+			 uint16_t hwgrp[], uint16_t n, uint16_t enable);
+int sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps);
+int sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps);
+
 /* SSO IRQ */
 int sso_register_irqs_priv(struct roc_sso *roc_sso,
 			   struct plt_intr_handle *handle, uint16_t nb_hws,
Signature · 1 line
2.8.4
#63 lore raw

PATCH v3 4/28 common/cnxk: change NIX debug API and queue API interface

In reply to Nithin Dabilpuram

Change NIX debug API and queue API interface for use by internal NIX inline device initialization.

---
 drivers/common/cnxk/roc_nix.c       |   2 +-
 drivers/common/cnxk/roc_nix_debug.c | 118 +++++++++++++++++++++++++++---------
 drivers/common/cnxk/roc_nix_priv.h  |  16 +++++
 drivers/common/cnxk/roc_nix_queue.c |  89 +++++++++++++++------------
 4 files changed, 159 insertions(+), 66 deletions(-)
drivers/common/cnxk/roc_nix.c +1 -1
index ee9e81d..b7ef843 100644
@@ -306,7 +306,7 @@ sdp_lbk_id_update(struct plt_pci_device *pci_dev, struct nix *nix)
 	}
 }
 
-static inline uint64_t
+uint64_t
 nix_get_blkaddr(struct dev *dev)
 {
 	uint64_t reg;
drivers/common/cnxk/roc_nix_debug.c +91 -27

283 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +16 -0
index b573879..b140dad 100644
@@ -352,6 +352,12 @@ int nix_tm_update_parent_info(struct nix *nix, enum roc_nix_tm_tree tree);
 int nix_tm_sq_sched_conf(struct nix *nix, struct nix_tm_node *node,
 			 bool rr_quantum_only);
 
+int nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
+		    bool cfg, bool ena);
+int nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
+	       bool ena);
+int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable);
+
 /*
  * TM priv utils.
  */
@@ -397,4 +403,14 @@ void nix_tm_node_free(struct nix_tm_node *node);
 struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc(void);
 void nix_tm_shaper_profile_free(struct nix_tm_shaper_profile *profile);
 
+uint64_t nix_get_blkaddr(struct dev *dev);
+void nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx);
+int nix_lf_gen_reg_dump(uintptr_t nix_lf_base, uint64_t *data);
+int nix_lf_stat_reg_dump(uintptr_t nix_lf_base, uint64_t *data,
+			 uint8_t lf_tx_stats, uint8_t lf_rx_stats);
+int nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
+			uint16_t cints);
+int nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid,
+		  __io void **ctx_p);
+
 #endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_queue.c +51 -38

160 lines not on this page · raw message

Signature · 1 line
2.8.4
#64 lore raw

PATCH v3 5/28 common/cnxk: support NIX inline device IRQ

In reply to Nithin Dabilpuram

Add API to setup NIX inline device IRQ's. This registers IRQ's for errors in case of NIX, CPT LF, SSOW and get wor interrupt in case of SSO.

---
 drivers/common/cnxk/meson.build           |   1 +
 drivers/common/cnxk/roc_api.h             |   3 +
 drivers/common/cnxk/roc_irq.c             |   7 +-
 drivers/common/cnxk/roc_nix_inl.h         |  10 +
 drivers/common/cnxk/roc_nix_inl_dev_irq.c | 359 ++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h    |  57 +++++
 drivers/common/cnxk/roc_platform.h        |   9 +-
 drivers/common/cnxk/roc_priv.h            |   3 +
 8 files changed, 442 insertions(+), 7 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev_irq.c
 create mode 100644 drivers/common/cnxk/roc_nix_inl_priv.h
drivers/common/cnxk/meson.build +1 -0
index 258429d..3e836ce 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
         'roc_nix_npc.c',
drivers/common/cnxk/roc_api.h +3 -0
index 7dec845..c1af95e 100644
@@ -129,4 +129,7 @@
 /* HASH computation */
 #include "roc_hash.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl.h"
+
 #endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_irq.c +4 -3
index 4c2b4c3..28fe691 100644
@@ -138,9 +138,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
 		irq_init(intr_handle);
 	}
 
-	if (vec > intr_handle->max_intr) {
-		plt_err("Vector=%d greater than max_intr=%d", vec,
-			intr_handle->max_intr);
+	if (vec > intr_handle->max_intr || vec >= PLT_DIM(intr_handle->efds)) {
+		plt_err("Vector=%d greater than max_intr=%d or "
+			"max_efd=%" PRIu64,
+			vec, intr_handle->max_intr, PLT_DIM(intr_handle->efds));
 		return -EINVAL;
 	}
 
drivers/common/cnxk/roc_nix_inl.h new file +10 -0
new file mode 100644
index 0000000..1ec3dda
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _ROC_NIX_INL_H_
+#define _ROC_NIX_INL_H_
+
+/* Inline device SSO Work callback */
+typedef void (*roc_nix_inl_sso_work_cb_t)(uint64_t *gw, void *args);
+
+#endif /* _ROC_NIX_INL_H_ */
drivers/common/cnxk/roc_nix_inl_dev_irq.c new file +359 -0

359 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h new file +57 -0

57 lines not on this page · raw message

drivers/common/cnxk/roc_platform.h +5 -4
index 285b24b..177db3d 100644
@@ -113,10 +113,11 @@
 #define plt_write64(val, addr)                                                 \
 	rte_write64_relaxed((val), (volatile void *)(addr))
 
-#define plt_wmb() rte_wmb()
-#define plt_rmb() rte_rmb()
-#define plt_io_wmb() rte_io_wmb()
-#define plt_io_rmb() rte_io_rmb()
+#define plt_wmb()		rte_wmb()
+#define plt_rmb()		rte_rmb()
+#define plt_io_wmb()		rte_io_wmb()
+#define plt_io_rmb()		rte_io_rmb()
+#define plt_atomic_thread_fence rte_atomic_thread_fence
 
 #define plt_mmap       mmap
 #define PLT_PROT_READ  PROT_READ
drivers/common/cnxk/roc_priv.h +3 -0
index 7494b8d..f72bbd5 100644
@@ -38,4 +38,7 @@
 /* CPT */
 #include "roc_cpt_priv.h"
 
+/* NIX Inline dev */
+#include "roc_nix_inl_priv.h"
+
 #endif /* _ROC_PRIV_H_ */
Signature · 1 line
2.8.4
#65 lore raw

PATCH v3 6/28 common/cnxk: support NIX inline device init and fini

In reply to Nithin Dabilpuram

Add support to init and fini inline device with NIX LF, SSO LF and SSOW LF for inline inbound IPSec in CN10K.

---
 drivers/common/cnxk/meson.build        |   1 +
 drivers/common/cnxk/roc_api.h          |   2 +
 drivers/common/cnxk/roc_cpt.c          |   7 +-
 drivers/common/cnxk/roc_idev.c         |   2 +
 drivers/common/cnxk/roc_idev_priv.h    |   3 +
 drivers/common/cnxk/roc_nix_debug.c    |  35 ++
 drivers/common/cnxk/roc_nix_inl.h      |  56 +++
 drivers/common/cnxk/roc_nix_inl_dev.c  | 636 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl_priv.h |   8 +
 drivers/common/cnxk/roc_platform.h     |   2 +
 drivers/common/cnxk/version.map        |   3 +
 11 files changed, 752 insertions(+), 3 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_nix_inl_dev.c
drivers/common/cnxk/meson.build +1 -0
index 3e836ce..43af6a0 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
         'roc_nix_mcast.c',
drivers/common/cnxk/roc_api.h +2 -0
index c1af95e..53f4e4b 100644
@@ -53,6 +53,8 @@
 #define PCI_DEVID_CNXK_RVU_SDP_PF     0xA0f6
 #define PCI_DEVID_CNXK_RVU_SDP_VF     0xA0f7
 #define PCI_DEVID_CNXK_BPHY	      0xA089
+#define PCI_DEVID_CNXK_RVU_NIX_INL_PF 0xA0F0
+#define PCI_DEVID_CNXK_RVU_NIX_INL_VF 0xA0F1
 
 #define PCI_DEVID_CN9K_CGX  0xA059
 #define PCI_DEVID_CN10K_RPM 0xA060
drivers/common/cnxk/roc_cpt.c +4 -3
index 33524ef..48a378b 100644
@@ -381,11 +381,12 @@ cpt_lfs_alloc(struct dev *dev, uint8_t eng_grpmsk, uint8_t blkaddr,
 	if (blkaddr != RVU_BLOCK_ADDR_CPT0 && blkaddr != RVU_BLOCK_ADDR_CPT1)
 		return -EINVAL;
 
-	PLT_SET_USED(inl_dev_sso);
-
 	req = mbox_alloc_msg_cpt_lf_alloc(mbox);
 	req->nix_pf_func = 0;
-	req->sso_pf_func = idev_sso_pffunc_get();
+	if (inl_dev_sso && nix_inl_dev_pffunc_get())
+		req->sso_pf_func = nix_inl_dev_pffunc_get();
+	else
+		req->sso_pf_func = idev_sso_pffunc_get();
 	req->eng_grpmsk = eng_grpmsk;
 	req->blkaddr = blkaddr;
 
drivers/common/cnxk/roc_idev.c +2 -0
index 1494187..648f37b 100644
@@ -38,6 +38,8 @@ idev_set_defaults(struct idev_cfg *idev)
 	idev->num_lmtlines = 0;
 	idev->bphy = NULL;
 	idev->cpt = NULL;
+	idev->nix_inl_dev = NULL;
+	plt_spinlock_init(&idev->nix_inl_dev_lock);
 	__atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE);
 }
 
drivers/common/cnxk/roc_idev_priv.h +3 -0
index 84e6f1e..2c8309b 100644
@@ -9,6 +9,7 @@
 struct npa_lf;
 struct roc_bphy;
 struct roc_cpt;
+struct nix_inl_dev;
 struct idev_cfg {
 	uint16_t sso_pf_func;
 	uint16_t npa_pf_func;
@@ -20,6 +21,8 @@ struct idev_cfg {
 	uint64_t lmt_base_addr;
 	struct roc_bphy *bphy;
 	struct roc_cpt *cpt;
+	struct nix_inl_dev *nix_inl_dev;
+	plt_spinlock_t nix_inl_dev_lock;
 };
 
 /* Generic */
drivers/common/cnxk/roc_nix_debug.c +35 -0
index 9539bb9..582f5a3 100644
@@ -1213,3 +1213,38 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
 }
+
+void
+roc_nix_inl_dev_dump(struct roc_nix_inl_dev *roc_inl_dev)
+{
+	struct nix_inl_dev *inl_dev =
+		(struct nix_inl_dev *)&roc_inl_dev->reserved;
+	struct dev *dev = &inl_dev->dev;
+
+	nix_dump("nix_inl_dev@%p", inl_dev);
+	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
+	nix_dump("  vf = %d", dev_get_vf(dev->pf_func));
+	nix_dump("  bar2 = 0x%" PRIx64, dev->bar2);
+	nix_dump("  bar4 = 0x%" PRIx64, dev->bar4);
+
+	nix_dump("  \tpci_dev = %p", inl_dev->pci_dev);
+	nix_dump("  \tnix_base = 0x%" PRIxPTR "", inl_dev->nix_base);
+	nix_dump("  \tsso_base = 0x%" PRIxPTR "", inl_dev->sso_base);
+	nix_dump("  \tssow_base = 0x%" PRIxPTR "", inl_dev->ssow_base);
+	nix_dump("  \tnix_msixoff = %d", inl_dev->nix_msixoff);
+	nix_dump("  \tsso_msixoff = %d", inl_dev->sso_msixoff);
+	nix_dump("  \tssow_msixoff = %d", inl_dev->ssow_msixoff);
+	nix_dump("  \tnix_cints = %d", inl_dev->cints);
+	nix_dump("  \tnix_qints = %d", inl_dev->qints);
+	nix_dump("  \trq_refs = %d", inl_dev->rq_refs);
+	nix_dump("  \tinb_sa_base = 0x%p", inl_dev->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %d", inl_dev->inb_sa_sz);
+	nix_dump("  \txaq_buf_size = %u", inl_dev->xaq_buf_size);
+	nix_dump("  \txae_waes = %u", inl_dev->xae_waes);
+	nix_dump("  \tiue = %u", inl_dev->iue);
+	nix_dump("  \txaq_aura = 0x%" PRIx64, inl_dev->xaq_aura);
+	nix_dump("  \txaq_mem = 0x%p", inl_dev->xaq_mem);
+
+	nix_dump("  \tinl_dev_rq:");
+	roc_nix_rq_dump(&inl_dev->rq);
+}
drivers/common/cnxk/roc_nix_inl.h +56 -0

63 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_dev.c new file +636 -0

636 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl_priv.h +8 -0
index f424009..4729a38 100644
@@ -15,11 +15,13 @@ struct nix_inl_dev {
 	uintptr_t nix_base;
 	uintptr_t ssow_base;
 	uintptr_t sso_base;
+	uintptr_t cpt_base;
 
 	/* MSIX vector offsets */
 	uint16_t nix_msixoff;
 	uint16_t ssow_msixoff;
 	uint16_t sso_msixoff;
+	uint16_t cpt_msixoff;
 
 	/* SSO data */
 	uint32_t xaq_buf_size;
@@ -43,9 +45,13 @@ struct nix_inl_dev {
 	void *inb_sa_base;
 	uint16_t inb_sa_sz;
 
+	/* CPT data */
+	struct roc_cpt_lf cpt_lf;
+
 	/* Device arguments */
 	uint8_t selftest;
 	uint16_t ipsec_in_max_spi;
+	bool attach_cptlf;
 };
 
 int nix_inl_sso_register_irqs(struct nix_inl_dev *inl_dev);
@@ -54,4 +60,6 @@ void nix_inl_sso_unregister_irqs(struct nix_inl_dev *inl_dev);
 int nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev);
 void nix_inl_nix_unregister_irqs(struct nix_inl_dev *inl_dev);
 
+uint16_t nix_inl_dev_pffunc_get(void);
+
 #endif /* _ROC_NIX_INL_PRIV_H_ */
drivers/common/cnxk/roc_platform.h +2 -0
index 177db3d..241655b 100644
@@ -37,6 +37,7 @@
 #define PLT_MEMZONE_NAMESIZE	 RTE_MEMZONE_NAMESIZE
 #define PLT_STD_C11		 RTE_STD_C11
 #define PLT_PTR_ADD		 RTE_PTR_ADD
+#define PLT_PTR_DIFF		 RTE_PTR_DIFF
 #define PLT_MAX_RXTX_INTR_VEC_ID RTE_MAX_RXTX_INTR_VEC_ID
 #define PLT_INTR_VEC_RXTX_OFFSET RTE_INTR_VEC_RXTX_OFFSET
 #define PLT_MIN			 RTE_MIN
@@ -77,6 +78,7 @@
 #define plt_cpu_to_be_64 rte_cpu_to_be_64
 #define plt_be_to_cpu_64 rte_be_to_cpu_64
 
+#define plt_align32pow2	    rte_align32pow2
 #define plt_align32prevpow2 rte_align32prevpow2
 
 #define plt_bitmap			rte_bitmap
drivers/common/cnxk/version.map +3 -0
index 008098e..1f76664 100644
@@ -99,6 +99,9 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_dev_dump;
+	roc_nix_inl_dev_fini;
+	roc_nix_inl_dev_init;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#66 lore raw

PATCH v3 7/28 common/cnxk: support NIX inline inbound and outbound setup

In reply to Nithin Dabilpuram

Add API to support setting up NIX inline inbound and NIX inline outbound. In case of inbound, SA base is setup on NIX PFFUNC and in case of outbound, required number of CPT LF's are attached to NIX PFFUNC.

---
 drivers/common/cnxk/hw/cpt.h         |   8 +
 drivers/common/cnxk/meson.build      |   1 +
 drivers/common/cnxk/roc_api.h        |  48 +--
 drivers/common/cnxk/roc_constants.h  |  58 +++
 drivers/common/cnxk/roc_io.h         |   9 +
 drivers/common/cnxk/roc_io_generic.h |   3 +-
 drivers/common/cnxk/roc_nix.h        |   5 +
 drivers/common/cnxk/roc_nix_debug.c  |  15 +
 drivers/common/cnxk/roc_nix_inl.c    | 778 +++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix_inl.h    | 101 +++++
 drivers/common/cnxk/roc_nix_priv.h   |  15 +
 drivers/common/cnxk/roc_nix_queue.c  |  28 +-
 drivers/common/cnxk/roc_npc.c        |  27 +-
 drivers/common/cnxk/version.map      |  26 ++
 14 files changed, 1047 insertions(+), 75 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_constants.h
 create mode 100644 drivers/common/cnxk/roc_nix_inl.c
drivers/common/cnxk/hw/cpt.h +8 -0
index 84ebf2d..975139f 100644
@@ -40,6 +40,7 @@
 #define CPT_LF_CTX_ENC_PKT_CNT	(0x540ull)
 #define CPT_LF_CTX_DEC_BYTE_CNT (0x550ull)
 #define CPT_LF_CTX_DEC_PKT_CNT	(0x560ull)
+#define CPT_LF_CTX_RELOAD	(0x570ull)
 
 #define CPT_AF_LFX_CTL(a)  (0x27000ull | (uint64_t)(a) << 3)
 #define CPT_AF_LFX_CTL2(a) (0x29000ull | (uint64_t)(a) << 3)
@@ -68,6 +69,13 @@ union cpt_lf_ctx_flush {
 	} s;
 };
 
+union cpt_lf_ctx_reload {
+	uint64_t u;
+	struct {
+		uint64_t cptr : 46;
+	} s;
+};
+
 union cpt_lf_inprog {
 	uint64_t u;
 	struct cpt_lf_inprog_s {
drivers/common/cnxk/meson.build +1 -0
index 43af6a0..97db5f0 100644
@@ -28,6 +28,7 @@ sources = files(
         'roc_nix_debug.c',
         'roc_nix_fc.c',
         'roc_nix_irq.c',
+        'roc_nix_inl.c',
         'roc_nix_inl_dev.c',
         'roc_nix_inl_dev_irq.c',
         'roc_nix_mac.c',
drivers/common/cnxk/roc_api.h +3 -45

72 lines not on this page · raw message

drivers/common/cnxk/roc_constants.h new file +58 -0

58 lines not on this page · raw message

drivers/common/cnxk/roc_io.h +9 -0
index aee8c7f..fe5f7f4 100644
@@ -13,6 +13,15 @@
 		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
 	} while (0)
 
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id)                              \
+	do {                                                                   \
+		/* 16 Lines per core */                                        \
+		lmt_id = ROC_LMT_CPT_BASE_ID_OFF;                              \
+		lmt_id += (plt_lcore_id() << ROC_LMT_CPT_LINES_PER_CORE_LOG2); \
+		/* Each line is of 128B */                                     \
+		(lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
+	} while (0)
+
 #define roc_load_pair(val0, val1, addr)                                        \
 	({                                                                     \
 		asm volatile("ldp %x[x0], %x[x1], [%x[p1]]"                    \
drivers/common/cnxk/roc_io_generic.h +2 -1
index 28cb096..ceaa3a3 100644
@@ -5,7 +5,8 @@
 #ifndef _ROC_IO_GENERIC_H_
 #define _ROC_IO_GENERIC_H_
 
-#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
+#define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id)	  (lmt_id = 0)
+#define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
 
 #define roc_load_pair(val0, val1, addr)                                        \
 	do {                                                                   \
drivers/common/cnxk/roc_nix.h +5 -0
index d9a4613..4fcce49 100644
@@ -171,6 +171,7 @@ struct roc_nix_rq {
 	uint8_t spb_red_pass;
 	/* End of Input parameters */
 	struct roc_nix *roc_nix;
+	bool inl_dev_ref;
 };
 
 struct roc_nix_cq {
@@ -258,6 +259,10 @@ struct roc_nix {
 	bool enable_loop;
 	bool hw_vlan_ins;
 	uint8_t lock_rx_ctx;
+	uint32_t outb_nb_desc;
+	uint16_t outb_nb_crypto_qs;
+	uint16_t ipsec_in_max_spi;
+	uint16_t ipsec_out_max_sa;
 	/* End of input parameters */
 	/* LMT line base for "Per Core Tx LMT line" mode*/
 	uintptr_t lmt_base;
drivers/common/cnxk/roc_nix_debug.c +15 -0
index 582f5a3..266935a 100644
@@ -818,6 +818,7 @@ roc_nix_rq_dump(struct roc_nix_rq *rq)
 	nix_dump("  vwqe_wait_tmo = %ld", rq->vwqe_wait_tmo);
 	nix_dump("  vwqe_aura_handle = %ld", rq->vwqe_aura_handle);
 	nix_dump("  roc_nix = %p", rq->roc_nix);
+	nix_dump("  inl_dev_ref = %d", rq->inl_dev_ref);
 }
 
 void
@@ -1160,6 +1161,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 {
 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
 	struct dev *dev = &nix->dev;
+	int i;
 
 	nix_dump("nix@%p", nix);
 	nix_dump("  pf = %d", dev_get_pf(dev->pf_func));
@@ -1169,6 +1171,7 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  port_id = %d", roc_nix->port_id);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->rss_tag_as_xor);
 	nix_dump("  rss_tag_as_xor = %d", roc_nix->max_sqb_count);
+	nix_dump("  outb_nb_desc = %u", roc_nix->outb_nb_desc);
 
 	nix_dump("  \tpci_dev = %p", nix->pci_dev);
 	nix_dump("  \tbase = 0x%" PRIxPTR "", nix->base);
@@ -1206,12 +1209,24 @@ roc_nix_dump(struct roc_nix *roc_nix)
 	nix_dump("  \ttx_link = %d", nix->tx_link);
 	nix_dump("  \tsqb_size = %d", nix->sqb_size);
 	nix_dump("  \tmsixoff = %d", nix->msixoff);
+	for (i = 0; i < nix->nb_cpt_lf; i++)
+		nix_dump("  \tcpt_msixoff[%d] = %d", i, nix->cpt_msixoff[i]);
 	nix_dump("  \tcints = %d", nix->cints);
 	nix_dump("  \tqints = %d", nix->qints);
 	nix_dump("  \tsdp_link = %d", nix->sdp_link);
 	nix_dump("  \tptp_en = %d", nix->ptp_en);
 	nix_dump("  \trss_alg_idx = %d", nix->rss_alg_idx);
 	nix_dump("  \ttx_pause = %d", nix->tx_pause);
+	nix_dump("  \tinl_inb_ena = %d", nix->inl_inb_ena);
+	nix_dump("  \tinl_outb_ena = %d", nix->inl_outb_ena);
+	nix_dump("  \tinb_sa_base = 0x%p", nix->inb_sa_base);
+	nix_dump("  \tinb_sa_sz = %" PRIu64, nix->inb_sa_sz);
+	nix_dump("  \toutb_sa_base = 0x%p", nix->outb_sa_base);
+	nix_dump("  \toutb_sa_sz = %" PRIu64, nix->outb_sa_sz);
+	nix_dump("  \toutb_err_sso_pffunc = 0x%x", nix->outb_err_sso_pffunc);
+	nix_dump("  \tcpt_lf_base = 0x%p", nix->cpt_lf_base);
+	nix_dump("  \tnb_cpt_lf = %d", nix->nb_cpt_lf);
+	nix_dump("  \tinb_inl_dev = %d", nix->inb_inl_dev);
 }
 
 void
drivers/common/cnxk/roc_nix_inl.c new file +778 -0

778 lines not on this page · raw message

drivers/common/cnxk/roc_nix_inl.h +101 -0

112 lines not on this page · raw message

drivers/common/cnxk/roc_nix_priv.h +15 -0
index b140dad..7653c5a 100644
@@ -164,6 +164,21 @@ struct nix {
 	uint16_t tm_link_cfg_lvl;
 	uint16_t contig_rsvd[NIX_TXSCH_LVL_CNT];
 	uint16_t discontig_rsvd[NIX_TXSCH_LVL_CNT];
+
+	/* Ipsec info */
+	uint16_t cpt_msixoff[MAX_RVU_BLKLF_CNT];
+	bool inl_inb_ena;
+	bool inl_outb_ena;
+	void *inb_sa_base;
+	size_t inb_sa_sz;
+	void *outb_sa_base;
+	size_t outb_sa_sz;
+	uint16_t outb_err_sso_pffunc;
+	struct roc_cpt_lf *cpt_lf_base;
+	uint16_t nb_cpt_lf;
+	/* Mode provided by driver */
+	bool inb_inl_dev;
+
 } __plt_cache_aligned;
 
 enum nix_err_status {
drivers/common/cnxk/roc_nix_queue.c +10 -18
index cff0ec3..41e8f2c 100644
@@ -131,11 +131,11 @@ nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
 
 	/* If RED enabled, then fill enable for all cases */
 	if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-		aq->rq.spb_aura_pass = rq->spb_red_pass;
-		aq->rq.lpb_aura_pass = rq->red_pass;
+		aq->rq.spb_pool_pass = rq->spb_red_pass;
+		aq->rq.lpb_pool_pass = rq->red_pass;
 
-		aq->rq.spb_aura_drop = rq->spb_red_drop;
-		aq->rq.lpb_aura_drop = rq->red_drop;
+		aq->rq.spb_pool_drop = rq->spb_red_drop;
+		aq->rq.lpb_pool_drop = rq->red_drop;
 	}
 
 	if (cfg) {
@@ -176,11 +176,11 @@ nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
 		aq->rq_mask.xqe_drop_ena = ~aq->rq_mask.xqe_drop_ena;
 
 		if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-			aq->rq_mask.spb_aura_pass = ~aq->rq_mask.spb_aura_pass;
-			aq->rq_mask.lpb_aura_pass = ~aq->rq_mask.lpb_aura_pass;
+			aq->rq_mask.spb_pool_pass = ~aq->rq_mask.spb_pool_pass;
+			aq->rq_mask.lpb_pool_pass = ~aq->rq_mask.lpb_pool_pass;
 
-			aq->rq_mask.spb_aura_drop = ~aq->rq_mask.spb_aura_drop;
-			aq->rq_mask.lpb_aura_drop = ~aq->rq_mask.lpb_aura_drop;
+			aq->rq_mask.spb_pool_drop = ~aq->rq_mask.spb_pool_drop;
+			aq->rq_mask.lpb_pool_drop = ~aq->rq_mask.lpb_pool_drop;
 		}
 	}
 
@@ -276,17 +276,13 @@ nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 
 	/* If RED enabled, then fill enable for all cases */
 	if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
-		aq->rq.spb_pool_pass = rq->red_pass;
-		aq->rq.spb_aura_pass = rq->red_pass;
+		aq->rq.spb_pool_pass = rq->spb_red_pass;
 		aq->rq.lpb_pool_pass = rq->red_pass;
-		aq->rq.lpb_aura_pass = rq->red_pass;
 		aq->rq.wqe_pool_pass = rq->red_pass;
 		aq->rq.xqe_pass = rq->red_pass;
 
-		aq->rq.spb_pool_drop = rq->red_drop;
-		aq->rq.spb_aura_drop = rq->red_drop;
+		aq->rq.spb_pool_drop = rq->spb_red_drop;
 		aq->rq.lpb_pool_drop = rq->red_drop;
-		aq->rq.lpb_aura_drop = rq->red_drop;
 		aq->rq.wqe_pool_drop = rq->red_drop;
 		aq->rq.xqe_drop = rq->red_drop;
 	}
@@ -346,16 +342,12 @@ nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
 
 		if (rq->red_pass && (rq->red_pass >= rq->red_drop)) {
 			aq->rq_mask.spb_pool_pass = ~aq->rq_mask.spb_pool_pass;
-			aq->rq_mask.spb_aura_pass = ~aq->rq_mask.spb_aura_pass;
 			aq->rq_mask.lpb_pool_pass = ~aq->rq_mask.lpb_pool_pass;
-			aq->rq_mask.lpb_aura_pass = ~aq->rq_mask.lpb_aura_pass;
 			aq->rq_mask.wqe_pool_pass = ~aq->rq_mask.wqe_pool_pass;
 			aq->rq_mask.xqe_pass = ~aq->rq_mask.xqe_pass;
 
 			aq->rq_mask.spb_pool_drop = ~aq->rq_mask.spb_pool_drop;
-			aq->rq_mask.spb_aura_drop = ~aq->rq_mask.spb_aura_drop;
 			aq->rq_mask.lpb_pool_drop = ~aq->rq_mask.lpb_pool_drop;
-			aq->rq_mask.lpb_aura_drop = ~aq->rq_mask.lpb_aura_drop;
 			aq->rq_mask.wqe_pool_drop = ~aq->rq_mask.wqe_pool_drop;
 			aq->rq_mask.xqe_drop = ~aq->rq_mask.xqe_drop;
 		}
drivers/common/cnxk/roc_npc.c +16 -11
index 1c1e043..b724ff9 100644
@@ -342,10 +342,11 @@ roc_npc_fini(struct roc_npc *roc_npc)
 }
 
 static int
-npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_queue *act_q;
 	const struct roc_npc_action_vf *vf_act;
@@ -427,15 +428,16 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
 			 *    NPC_SECURITY_ACTION_TYPE_INLINE_PROTOCOL &&
 			 *  session_protocol ==
 			 *    NPC_SECURITY_PROTOCOL_IPSEC
-			 *
-			 * RSS is not supported with inline ipsec. Get the
-			 * rq from associated conf, or make
-			 * ROC_NPC_ACTION_TYPE_QUEUE compulsory with this
-			 * action.
-			 * Currently, rq = 0 is assumed.
 			 */
 			req_act |= ROC_NPC_ACTION_TYPE_SEC;
 			rq = 0;
+
+			/* Special processing when with inline device */
+			if (roc_nix_inb_is_with_inl_dev(roc_npc->roc_nix) &&
+			    roc_nix_inl_dev_is_probed()) {
+				rq = 0;
+				pf_func = nix_inl_dev_pffunc_get();
+			}
 			break;
 		case ROC_NPC_ACTION_TYPE_VLAN_STRIP:
 			req_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;
@@ -679,11 +681,12 @@ npc_parse_attr(struct npc *npc, const struct roc_npc_attr *attr,
 }
 
 static int
-npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_rule(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	       const struct roc_npc_item_info pattern[],
 	       const struct roc_npc_action actions[], struct roc_npc_flow *flow,
 	       struct npc_parse_state *pst)
 {
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	int err;
 
 	/* Check attr */
@@ -697,7 +700,7 @@ npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
 		return err;
 
 	/* Check action */
-	err = npc_parse_actions(npc, attr, actions, flow);
+	err = npc_parse_actions(roc_npc, attr, actions, flow);
 	if (err)
 		return err;
 	return 0;
@@ -713,7 +716,8 @@ roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	struct npc_parse_state parse_state = {0};
 	int rc;
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc)
 		return rc;
 
@@ -1193,7 +1197,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	}
 	memset(flow, 0, sizeof(*flow));
 
-	rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+	rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+			    &parse_state);
 	if (rc != 0) {
 		*errcode = rc;
 		goto err_exit;
drivers/common/cnxk/version.map +26 -0
index 1f76664..926d5c2 100644
@@ -99,9 +99,35 @@ INTERNAL {
 	roc_nix_get_pf_func;
 	roc_nix_get_vf;
 	roc_nix_get_vwqe_interval;
+	roc_nix_inl_cb_register;
+	roc_nix_inl_cb_unregister;
 	roc_nix_inl_dev_dump;
 	roc_nix_inl_dev_fini;
 	roc_nix_inl_dev_init;
+	roc_nix_inl_dev_is_probed;
+	roc_nix_inl_dev_lock;
+	roc_nix_inl_dev_unlock;
+	roc_nix_inl_dev_rq;
+	roc_nix_inl_dev_rq_get;
+	roc_nix_inl_dev_rq_put;
+	roc_nix_inl_dev_rq_limit_get;
+	roc_nix_inl_inb_is_enabled;
+	roc_nix_inl_inb_init;
+	roc_nix_inl_inb_sa_base_get;
+	roc_nix_inl_inb_sa_get;
+	roc_nix_inl_inb_sa_max_spi;
+	roc_nix_inl_inb_sa_sz;
+	roc_nix_inl_inb_tag_update;
+	roc_nix_inl_inb_fini;
+	roc_nix_inb_is_with_inl_dev;
+	roc_nix_inb_mode_set;
+	roc_nix_inl_outb_fini;
+	roc_nix_inl_outb_init;
+	roc_nix_inl_outb_lf_base_get;
+	roc_nix_inl_outb_sa_base_get;
+	roc_nix_inl_outb_sso_pffunc_get;
+	roc_nix_inl_outb_is_enabled;
+	roc_nix_inl_sa_sync;
 	roc_nix_is_lbk;
 	roc_nix_is_pf;
 	roc_nix_is_sdp;
Signature · 1 line
2.8.4
#67 lore raw

PATCH v3 8/28 common/cnxk: disable CQ drop when inline inbound is enabled

In reply to Nithin Dabilpuram

Disable CQ drop when inline inbound is enabled. CQ drop is not supported for second pass IPsec decrypted packets.

---
 drivers/common/cnxk/roc_nix_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_nix_queue.c +8 -3
index 41e8f2c..41a1422 100644
@@ -492,15 +492,20 @@ roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq)
 		cq->drop_thresh = min_rx_drop;
 	} else {
 		cq->drop_thresh = NIX_CQ_THRESH_LEVEL;
-		cq_ctx->drop = cq->drop_thresh;
-		cq_ctx->drop_ena = 1;
+		/* Drop processing or red drop cannot be enabled due to
+		 * due to packets coming for second pass from CPT.
+		 */
+		if (!roc_nix_inl_inb_is_enabled(roc_nix)) {
+			cq_ctx->drop = cq->drop_thresh;
+			cq_ctx->drop_ena = 1;
+		}
 	}
 
 	/* TX pause frames enable flow ctrl on RX side */
 	if (nix->tx_pause) {
 		/* Single BPID is allocated for all rx channels for now */
 		cq_ctx->bpid = nix->bpid[0];
-		cq_ctx->bp = cq_ctx->drop;
+		cq_ctx->bp = cq->drop_thresh;
 		cq_ctx->bp_ena = 1;
 	}
 
Signature · 1 line
2.8.4
#68 lore raw

PATCH v3 9/28 common/cnxk: dump CPT LF registers on error intr

In reply to Nithin Dabilpuram

Dump CPT LF registers on error interrupt for debugging purpose.

---
 drivers/common/cnxk/roc_cpt.c       |  5 ++++-
 drivers/common/cnxk/roc_cpt_debug.c | 32 ++++++++++++++++++++++++++++++--
 drivers/common/cnxk/roc_cpt_priv.h  |  1 +
 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_cpt.c +4 -1
index 48a378b..6ddbaa2 100644
@@ -51,6 +51,9 @@ cpt_lf_misc_irq(void *param)
 
 	plt_err("Err_irq=0x%" PRIx64 " pf=%d, vf=%d", intr, dev->pf, dev->vf);
 
+	/* Dump lf registers */
+	cpt_lf_print(lf);
+
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
 }
@@ -203,7 +206,7 @@ cpt_lf_dump(struct roc_cpt_lf *lf)
 	plt_cpt_dbg("CPT LF REG:");
 	plt_cpt_dbg("LF_CTL[0x%016llx]: 0x%016" PRIx64, CPT_LF_CTL,
 		    plt_read64(lf->rbase + CPT_LF_CTL));
-	plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
+	plt_cpt_dbg("LF_INPROG[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG,
 		    plt_read64(lf->rbase + CPT_LF_INPROG));
 
 	plt_cpt_dbg("Q_BASE[0x%016llx]: 0x%016" PRIx64, CPT_LF_Q_BASE,
drivers/common/cnxk/roc_cpt_debug.c +30 -2
index a6c9004..847d969 100644
@@ -157,11 +157,40 @@ roc_cpt_afs_print(struct roc_cpt *roc_cpt)
 	return 0;
 }
 
-static void
+void
 cpt_lf_print(struct roc_cpt_lf *lf)
 {
 	uint64_t reg_val;
 
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_BASE);
+	plt_print("    CPT_LF_Q_BASE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_SIZE);
+	plt_print("    CPT_LF_Q_SIZE:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_INST_PTR);
+	plt_print("    CPT_LF_Q_INST_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR);
+	plt_print("    CPT_LF_Q_GRP_PTR:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_CTL);
+	plt_print("    CPT_LF_CTL:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT_ENA_W1S);
+	plt_print("    CPT_LF_MISC_INT_ENA_W1S:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT);
+	plt_print("    CPT_LF_MISC_INT:\t%016lx", reg_val);
+
+	reg_val = plt_read64(lf->rbase + CPT_LF_INPROG);
+	plt_print("    CPT_LF_INPROG:\t%016lx", reg_val);
+
+	if (roc_model_is_cn9k())
+		return;
+
+	plt_print("Count registers for CPT LF%d:", lf->lf_id);
+
 	reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT);
 	plt_print("    Encrypted byte count:\t%" PRIu64, reg_val);
 
@@ -190,7 +219,6 @@ roc_cpt_lfs_print(struct roc_cpt *roc_cpt)
 		if (lf == NULL)
 			continue;
 
-		plt_print("Count registers for CPT LF%d:", lf_id);
 		cpt_lf_print(lf);
 	}
 
drivers/common/cnxk/roc_cpt_priv.h +1 -0
index 21911e5..61dec9a 100644
@@ -31,5 +31,6 @@ int cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func,
 		    uint8_t lf_id, bool ena);
 int cpt_get_msix_offset(struct dev *dev, struct msix_offset_rsp **msix_rsp);
 uint64_t cpt_get_blkaddr(struct dev *dev);
+void cpt_lf_print(struct roc_cpt_lf *lf);
 
 #endif /* _ROC_CPT_PRIV_H_ */
Signature · 1 line
2.8.4
#69 lore raw

PATCH v3 10/28 common/cnxk: align CPT LF enable/disable sequence

In reply to Nithin Dabilpuram

For CPT LF IQ enable, set CPT_LF_CTL[ENA] before setting CPT_LF_INPROG[EENA] to true.

For CPT LF IQ disable, align sequence to that of HRM.

Also this patch aligns space for instructions in CPT LF to ROC_ALIGN to make complete memory cache aligned and has other minor fixes/additions.

---
 drivers/common/cnxk/hw/cpt.h  | 11 +++++++++++
 drivers/common/cnxk/roc_cpt.c | 42 ++++++++++++++++++++++++++++++++++--------
 drivers/common/cnxk/roc_cpt.h |  8 ++++++++
 3 files changed, 53 insertions(+), 8 deletions(-)
drivers/common/cnxk/hw/cpt.h +11 -0
index 975139f..4d9df59 100644
@@ -124,6 +124,17 @@ union cpt_lf_misc_int {
 	} s;
 };
 
+union cpt_lf_q_grp_ptr {
+	uint64_t u;
+	struct {
+		uint64_t dq_ptr : 15;
+		uint64_t reserved_31_15 : 17;
+		uint64_t nq_ptr : 15;
+		uint64_t reserved_47_62 : 16;
+		uint64_t xq_xor : 1;
+	} s;
+};
+
 union cpt_inst_w4 {
 	uint64_t u64;
 	struct {
drivers/common/cnxk/roc_cpt.c +34 -8

86 lines not on this page · raw message

drivers/common/cnxk/roc_cpt.h +8 -0
index c80a8e0..06277d1 100644
@@ -76,6 +76,14 @@
 #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20
 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40
 
+#define ROC_CPT_CCM_AAD_DATA 1
+#define ROC_CPT_CCM_MSG_LEN  4
+#define ROC_CPT_CCM_ICV_LEN  16
+#define ROC_CPT_CCM_FLAGS                                                      \
+	((ROC_CPT_CCM_AAD_DATA << 6) |                                         \
+	 (((ROC_CPT_CCM_ICV_LEN - 2) / 2) << 3) | (ROC_CPT_CCM_MSG_LEN - 1))
+#define ROC_CPT_CCM_SALT_LEN 3
+
 struct roc_cpt_lmtline {
 	uint64_t io_addr;
 	uint64_t *fc_addr;
Signature · 1 line
2.8.4
#70 lore raw

PATCH v3 11/28 common/cnxk: restore NIX sqb pool limit before destroy

In reply to Nithin Dabilpuram

Restore SQB AURA/POOL limit before destroying SQB to be able to drain all the buffers from the aura.

---
 drivers/common/cnxk/roc_nix_queue.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/common/cnxk/roc_nix_queue.c +5 -0
index 41a1422..a8a713a 100644
@@ -934,6 +934,11 @@ roc_nix_sq_fini(struct roc_nix_sq *sq)
 		rc |= NIX_ERR_NDC_SYNC;
 
 	rc |= nix_tm_sq_flush_post(sq);
+
+	/* Restore limit to max SQB count that the pool was created
+	 * for aura drain to succeed.
+	 */
+	roc_npa_aura_limit_modify(sq->aura_handle, NIX_MAX_SQB);
 	rc |= roc_npa_pool_destroy(sq->aura_handle);
 	plt_free(sq->fc);
 	plt_free(sq->sqe_mem);
Signature · 1 line
2.8.4
#71 lore raw

PATCH v3 12/28 common/cnxk: add CQ enable support in NIX Tx path

In reply to Nithin Dabilpuram

From: Kommula Shiva Shankar <[email protected]>

This patch provides applications to add CQ support in Tx path. This enables packet completion events on CQ for requested packets.

---
 drivers/common/cnxk/roc_nix.h       | 2 ++
 drivers/common/cnxk/roc_nix_queue.c | 4 ++++
 2 files changed, 6 insertions(+)
drivers/common/cnxk/roc_nix.h +2 -0
index 4fcce49..b06895a 100644
@@ -194,7 +194,9 @@ struct roc_nix_sq {
 	enum roc_nix_sq_max_sqe_sz max_sqe_sz;
 	uint32_t nb_desc;
 	uint16_t qid;
+	uint16_t cqid;
 	bool sso_ena;
+	bool cq_ena;
 	/* End of Input parameters */
 	uint16_t sqes_per_sqb_log2;
 	struct roc_nix *roc_nix;
drivers/common/cnxk/roc_nix_queue.c +4 -0
index a8a713a..cba1294 100644
@@ -661,6 +661,8 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -759,6 +761,8 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
 	aq->sq.sso_ena = !!sq->sso_ena;
+	aq->sq.cq_ena = !!sq->cq_ena;
+	aq->sq.cq = sq->cqid;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
Signature · 1 line
2.8.4
#72 lore raw

PATCH v3 13/28 common/cnxk: setup aura BP conf based on nix

In reply to Nithin Dabilpuram

Currently only NIX0 conf is setup in AURA for backpressure. This patch adds support for NIX1 as well.

---
 drivers/common/cnxk/roc_nix_fc.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_nix_fc.c +19 -4
index f17eba4..7eac7d0 100644
@@ -284,8 +284,18 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	limit = rsp->aura.limit;
 	/* BP is already enabled. */
 	if (rsp->aura.bp_ena) {
+		uint16_t bpid;
+		bool nix1;
+
+		nix1 = !!(rsp->aura.bp_ena & 0x2);
+		if (nix1)
+			bpid = rsp->aura.nix1_bpid;
+		else
+			bpid = rsp->aura.nix0_bpid;
+
 		/* If BP ids don't match disable BP. */
-		if ((rsp->aura.nix0_bpid != nix->bpid[0]) && !force) {
+		if (((nix1 != nix->is_nix1) || (bpid != nix->bpid[0])) &&
+		    !force) {
 			req = mbox_alloc_msg_npa_aq_enq(mbox);
 			if (req == NULL)
 				return;
@@ -315,14 +325,19 @@ rox_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
 	req->op = NPA_AQ_INSTOP_WRITE;
 
 	if (ena) {
-		req->aura.nix0_bpid = nix->bpid[0];
-		req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		if (nix->is_nix1) {
+			req->aura.nix1_bpid = nix->bpid[0];
+			req->aura_mask.nix1_bpid = ~(req->aura_mask.nix1_bpid);
+		} else {
+			req->aura.nix0_bpid = nix->bpid[0];
+			req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid);
+		}
 		req->aura.bp = NIX_RQ_AURA_THRESH(
 			limit > 128 ? 256 : limit); /* 95% of size*/
 		req->aura_mask.bp = ~(req->aura_mask.bp);
 	}
 
-	req->aura.bp_ena = !!ena;
+	req->aura.bp_ena = (!!ena << nix->is_nix1);
 	req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena);
 
 	mbox_process(mbox);
Signature · 1 line
2.8.4
#73 lore raw

PATCH v3 14/28 common/cnxk: support anti-replay check in SW for cn9k

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Adds anti replay SW implementation for cn9k platform.

---
 drivers/common/cnxk/cnxk_security_ar.h | 184 +++++++++++++++++++++++++++++++++
 1 file changed, 184 insertions(+)
 create mode 100644 drivers/common/cnxk/cnxk_security_ar.h
drivers/common/cnxk/cnxk_security_ar.h new file +184 -0
new file mode 100644
index 0000000..6bc517c
@@ -0,0 +1,184 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef __CNXK_SECURITY_AR_H__
+#define __CNXK_SECURITY_AR_H__
+
+#include <rte_mbuf.h>
+
+#include "cnxk_security.h"
+
+#define CNXK_ON_AR_WIN_SIZE_MAX 1024
+
+/* u64 array size to fit anti replay window bits */
+#define AR_WIN_ARR_SZ                                                          \
+	(PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) /        \
+	 BITS_PER_LONG_LONG)
+
+#define WORD_SHIFT 6
+#define WORD_SIZE  (1 << WORD_SHIFT)
+#define WORD_MASK  (WORD_SIZE - 1)
+
+#define IPSEC_ANTI_REPLAY_FAILED (-1)
+
+struct cnxk_on_ipsec_ar {
+	rte_spinlock_t lock;
+	uint32_t winb;
+	uint32_t wint;
+	uint64_t base;			/**< base of the anti-replay window */
+	uint64_t window[AR_WIN_ARR_SZ]; /**< anti-replay window */
+};
+
+static inline int
+cnxk_on_anti_replay_check(uint64_t seq, struct cnxk_on_ipsec_ar *ar,
+			  uint32_t winsz)
+{
+	uint64_t ex_winsz = winsz + WORD_SIZE;
+	uint64_t *window = &ar->window[0];
+	uint64_t seqword, shiftwords;
+	uint64_t base = ar->base;
+	uint32_t winb = ar->winb;
+	uint32_t wint = ar->wint;
+	uint64_t winwords;
+	uint64_t bit_pos;
+	uint64_t shift;
+	uint64_t *wptr;
+	uint64_t tmp;
+
+	winwords = ex_winsz >> WORD_SHIFT;
+	if (winsz > 64)
+		goto slow_shift;
+	/* Check if the seq is the biggest one yet */
+	if (likely(seq > base)) {
+		shift = seq - base;
+		if (shift < winsz) { /* In window */
+			/*
+			 * If more than 64-bit anti-replay window,
+			 * use slow shift routine
+			 */
+			wptr = window + (shift >> WORD_SHIFT);
+			*wptr <<= shift;
+			*wptr |= 1ull;
+		} else {
+			/* No special handling of window size > 64 */
+			wptr = window + ((winsz - 1) >> WORD_SHIFT);
+			/*
+			 * Zero out the whole window (especially for
+			 * bigger than 64b window) till the last 64b word
+			 * as the incoming sequence number minus
+			 * base sequence is more than the window size.
+			 */
+			while (window != wptr)
+				*window++ = 0ull;
+			/*
+			 * Set the last bit (of the window) to 1
+			 * as that corresponds to the base sequence number.
+			 * Now any incoming sequence number which is
+			 * (base - window size - 1) will pass anti-replay check
+			 */
+			*wptr = 1ull;
+		}
+		/*
+		 * Set the base to incoming sequence number as
+		 * that is the biggest sequence number seen yet
+		 */
+		ar->base = seq;
+		return 0;
+	}
+
+	bit_pos = base - seq;
+
+	/* If seq falls behind the window, return failure */
+	if (bit_pos >= winsz)
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* seq is within anti-replay window */
+	wptr = window + ((winsz - bit_pos - 1) >> WORD_SHIFT);
+	bit_pos &= WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (*wptr & ((1ull) << bit_pos))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* mark as seen */
+	*wptr |= ((1ull) << bit_pos);
+	return 0;
+
+slow_shift:
+	if (likely(seq > base)) {
+		uint32_t i;
+
+		shift = seq - base;
+		if (unlikely(shift >= winsz)) {
+			/*
+			 * shift is bigger than the window,
+			 * so just zero out everything
+			 */
+			for (i = 0; i < winwords; i++)
+				window[i] = 0;
+winupdate:
+			/* Find out the word */
+			seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+			/* Find out the bit in the word */
+			bit_pos = (seq - 1) & WORD_MASK;
+
+			/*
+			 * Set the bit corresponding to sequence number
+			 * in window to mark it as received
+			 */
+			window[seqword] |= (1ull << (63 - bit_pos));
+
+			/* wint and winb range from 1 to ex_winsz */
+			ar->wint = ((wint + shift - 1) % ex_winsz) + 1;
+			ar->winb = ((winb + shift - 1) % ex_winsz) + 1;
+
+			ar->base = seq;
+			return 0;
+		}
+
+		/*
+		 * New sequence number is bigger than the base but
+		 * it's not bigger than base + window size
+		 */
+
+		shiftwords = ((wint + shift - 1) >> WORD_SHIFT) -
+			     ((wint - 1) >> WORD_SHIFT);
+		if (unlikely(shiftwords)) {
+			tmp = (wint + WORD_SIZE - 1) / WORD_SIZE;
+			for (i = 0; i < shiftwords; i++) {
+				tmp %= winwords;
+				window[tmp++] = 0;
+			}
+		}
+
+		goto winupdate;
+	}
+
+	/* Sequence number is before the window */
+	if (unlikely((seq + winsz) <= base))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/* Sequence number is within the window */
+
+	/* Find out the word */
+	seqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;
+
+	/* Find out the bit in the word */
+	bit_pos = (seq - 1) & WORD_MASK;
+
+	/* Check if this is a replayed packet */
+	if (window[seqword] & (1ull << (63 - bit_pos)))
+		return IPSEC_ANTI_REPLAY_FAILED;
+
+	/*
+	 * Set the bit corresponding to sequence number
+	 * in window to mark it as received
+	 */
+	window[seqword] |= (1ull << (63 - bit_pos));
+
+	return 0;
+}
+
+#endif /* __CNXK_SECURITY_AR_H__ */
Signature · 1 line
2.8.4
#74 lore raw

PATCH v3 15/28 common/cnxk: support inline IPsec rte flow action

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add support to configure flow rules with inline IPsec action.

---
 drivers/common/cnxk/roc_nix_inl.h      |  3 +++
 drivers/common/cnxk/roc_nix_inl_dev.c  |  3 +++
 drivers/common/cnxk/roc_nix_inl_priv.h |  3 +++
 drivers/common/cnxk/roc_npc_mcam.c     | 28 ++++++++++++++++++++++++++--
 4 files changed, 35 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_nix_inl.h +3 -0
index 6b8c268..ae5e022 100644
@@ -107,6 +107,9 @@ struct roc_nix_inl_dev {
 	struct plt_pci_device *pci_dev;
 	uint16_t ipsec_in_max_spi;
 	bool selftest;
+	bool is_multi_channel;
+	uint16_t channel;
+	uint16_t chan_mask;
 	bool attach_cptlf;
 	/* End of input parameters */
 
drivers/common/cnxk/roc_nix_inl_dev.c +3 -0
index 0789f99..495dd19 100644
@@ -543,6 +543,9 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev)
 	inl_dev->pci_dev = pci_dev;
 	inl_dev->ipsec_in_max_spi = roc_inl_dev->ipsec_in_max_spi;
 	inl_dev->selftest = roc_inl_dev->selftest;
+	inl_dev->is_multi_channel = roc_inl_dev->is_multi_channel;
+	inl_dev->channel = roc_inl_dev->channel;
+	inl_dev->chan_mask = roc_inl_dev->chan_mask;
 	inl_dev->attach_cptlf = roc_inl_dev->attach_cptlf;
 
 	/* Initialize base device */
drivers/common/cnxk/roc_nix_inl_priv.h +3 -0
index 4729a38..3dc526f 100644
@@ -50,6 +50,9 @@ struct nix_inl_dev {
 
 	/* Device arguments */
 	uint8_t selftest;
+	uint16_t channel;
+	uint16_t chan_mask;
+	bool is_multi_channel;
 	uint16_t ipsec_in_max_spi;
 	bool attach_cptlf;
 };
drivers/common/cnxk/roc_npc_mcam.c +26 -2
index 8ccaaad..4985d22 100644
@@ -503,8 +503,11 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 {
 	int use_ctr = (flow->ctr_id == NPC_COUNTER_NONE ? 0 : 1);
 	struct npc_mcam_write_entry_req *req;
+	struct nix_inl_dev *inl_dev = NULL;
 	struct mbox *mbox = npc->mbox;
 	struct mbox_msghdr *rsp;
+	struct idev_cfg *idev;
+	uint16_t pf_func = 0;
 	uint16_t ctr = ~(0);
 	int rc, idx;
 	int entry;
@@ -553,9 +556,30 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 		req->entry_data.kw_mask[idx] = flow->mcam_mask[idx];
 	}
 
+	idev = idev_get_cfg();
+	if (idev)
+		inl_dev = idev->nix_inl_dev;
+
 	if (flow->nix_intf == NIX_INTF_RX) {
-		req->entry_data.kw[0] |= (uint64_t)npc->channel;
-		req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+		if (inl_dev && inl_dev->is_multi_channel &&
+		    (flow->npc_action & NIX_RX_ACTIONOP_UCAST_IPSEC)) {
+			req->entry_data.kw[0] |= (uint64_t)inl_dev->channel;
+			req->entry_data.kw_mask[0] |=
+				(uint64_t)inl_dev->chan_mask;
+			pf_func = nix_inl_dev_pffunc_get();
+			req->entry_data.action &= ~(GENMASK(19, 4));
+			req->entry_data.action |= (uint64_t)pf_func << 4;
+
+			flow->npc_action &= ~(GENMASK(19, 4));
+			flow->npc_action |= (uint64_t)pf_func << 4;
+			flow->mcam_data[0] |= (uint64_t)inl_dev->channel;
+			flow->mcam_mask[0] |= (uint64_t)inl_dev->chan_mask;
+		} else {
+			req->entry_data.kw[0] |= (uint64_t)npc->channel;
+			req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
+			flow->mcam_data[0] |= (uint64_t)npc->channel;
+			flow->mcam_mask[0] |= (BIT_ULL(12) - 1);
+		}
 	} else {
 		uint16_t pf_func = (flow->npc_action >> 4) & 0xffff;
 
Signature · 1 line
2.8.4
#75 lore raw

PATCH v3 16/28 net/cnxk: support inline security setup for cn9k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

---
 drivers/net/cnxk/cn9k_ethdev.c         |  23 +++
 drivers/net/cnxk/cn9k_ethdev.h         |  61 +++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c     | 313 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h             |   1 +
 drivers/net/cnxk/cn9k_tx.h             |   1 +
 drivers/net/cnxk/cnxk_ethdev.c         | 230 +++++++++++++++++++++++-
 drivers/net/cnxk/cnxk_ethdev.h         | 121 ++++++++++++-
 drivers/net/cnxk/cnxk_ethdev_devargs.c |  88 ++++++++-
 drivers/net/cnxk/cnxk_ethdev_sec.c     | 278 +++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_lookup.c         |  50 +++++-
 drivers/net/cnxk/meson.build           |   2 +
 drivers/net/cnxk/version.map           |   5 +
 12 files changed, 1162 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_ethdev_sec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec.c
drivers/net/cnxk/cn9k_ethdev.c +23 -0
index 115e678..08c86f9 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -179,8 +185,10 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_cpt_lf *inl_lf;
 	struct cn9k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -200,6 +208,19 @@ cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(BIT_ULL(16) == ROC_NIX_INL_SA_BASE_ALIGN);
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -508,6 +529,8 @@ cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn9k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn9k_ethdev.h +61 -0

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev_sec.c new file +313 -0

313 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +1 -0
index a3bf4e0..59545af 100644
@@ -17,6 +17,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn9k_tx.h +1 -0
index ed65cd3..a27ff76 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cnxk_ethdev.c +228 -2

330 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +119 -2

185 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_devargs.c +87 -1

122 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev_sec.c new file +278 -0

278 lines not on this page · raw message

drivers/net/cnxk/cnxk_lookup.c +44 -6

59 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -0
index 1e86144..c00da62 100644
@@ -12,6 +12,7 @@ sources = files(
         'cnxk_ethdev.c',
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
+        'cnxk_ethdev_sec.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
@@ -23,6 +24,7 @@ sources = files(
 # CN9K
 sources += files(
         'cn9k_ethdev.c',
+        'cn9k_ethdev_sec.c',
         'cn9k_rte_flow.c',
         'cn9k_rx.c',
         'cn9k_rx_mseg.c',
drivers/net/cnxk/version.map +5 -0
index c2e0723..b9da6b1 100644
@@ -1,3 +1,8 @@
 DPDK_22 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+	cnxk_nix_inb_mode_set;
+};
Signature · 1 line
2.8.4
#76 lore raw

Re: [dpdk-dev] [PATCH v3 16/28] net/cnxk: support inline security setup for cn9k

Quoted 23 lines · Nithin Dabilpuram
drivers/net/cnxk/cnxk_ethdev.c +23 -0
+static int
+nix_security_release(struct cnxk_eth_dev *dev)
+{
+	struct rte_eth_dev *eth_dev = dev->eth_dev;
+	struct cnxk_eth_sec_sess *eth_sec, *tvar;
+	struct roc_nix *nix = &dev->nix;
+	int rc, ret = 0;
+
+	/* Cleanup Inline inbound */
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY) {
+		/* Destroy inbound sessions */
+		tvar = NULL;
+		TAILQ_FOREACH_SAFE(eth_sec, &dev->inb.list, entry, tvar)
+			cnxk_eth_sec_ops.session_destroy(eth_dev,
+							 eth_sec->sess);
+
+		/* Clear lookup mem */
+		cnxk_nix_lookup_mem_sa_base_clear(dev);
+
+		rc = roc_nix_inl_inb_fini(nix);
+		if (rc)
+			plt_err("Failed to cleanup nix inline inb, rc=%d", rc);
+		ret |= rc;

drivers/net/cnxk/cnxk_ethdev.c nix_get_speed_capa(struct cnxk_eth_dev *dev) · line 176

Quoted 10 lines
drivers/net/cnxk/cnxk_ethdev.c +10 -0
+	}
+
+	/* Cleanup Inline outbound */
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_SECURITY ||
+	    dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY) {
+		/* Destroy outbound sessions */
+		tvar = NULL;
+		TAILQ_FOREACH_SAFE(eth_sec, &dev->outb.list, entry, tvar)
+			cnxk_eth_sec_ops.session_destroy(eth_dev,
+							 eth_sec->sess);

Replacing 'TAILQ_FOREACH_SAFE' with 'RTE_TAILQ_FOREACH_SAFE' on next-net, because of following commit in the main repo:

Commit f1f6ebc0eaf6 ("eal: remove sys/queue.h from public headers")

#77 lore raw

Re: [dpdk-dev] [PATCH v3 16/28] net/cnxk: support inline security setup for cn9k

Quoted 39 lines · Ferruh Yigit
Quoted 23 lines · Nithin Dabilpuram
drivers/net/cnxk/cnxk_ethdev.c +23 -0
+static int
+nix_security_release(struct cnxk_eth_dev *dev)
+{
+    struct rte_eth_dev *eth_dev = dev->eth_dev;
+    struct cnxk_eth_sec_sess *eth_sec, *tvar;
+    struct roc_nix *nix = &dev->nix;
+    int rc, ret = 0;
+
+    /* Cleanup Inline inbound */
+    if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY) {
+        /* Destroy inbound sessions */
+        tvar = NULL;
+        TAILQ_FOREACH_SAFE(eth_sec, &dev->inb.list, entry, tvar)
+            cnxk_eth_sec_ops.session_destroy(eth_dev,
+                             eth_sec->sess);
+
+        /* Clear lookup mem */
+        cnxk_nix_lookup_mem_sa_base_clear(dev);
+
+        rc = roc_nix_inl_inb_fini(nix);
+        if (rc)
+            plt_err("Failed to cleanup nix inline inb, rc=%d", rc);
+        ret |= rc;

drivers/net/cnxk/cnxk_ethdev.c nix_get_speed_capa(struct cnxk_eth_dev *dev) · line 176

Quoted 10 lines
drivers/net/cnxk/cnxk_ethdev.c +10 -0
+    }
+
+    /* Cleanup Inline outbound */
+    if (dev->tx_offloads & DEV_TX_OFFLOAD_SECURITY ||
+        dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY) {
+        /* Destroy outbound sessions */
+        tvar = NULL;
+        TAILQ_FOREACH_SAFE(eth_sec, &dev->outb.list, entry, tvar)
+            cnxk_eth_sec_ops.session_destroy(eth_dev,
+                             eth_sec->sess);

Replacing 'TAILQ_FOREACH_SAFE' with 'RTE_TAILQ_FOREACH_SAFE' on next-net, because of following commit in the main repo:

Quoted 1 line

Commit f1f6ebc0eaf6 ("eal: remove sys/queue.h from public headers")

Ack, Thanks.

#78 lore raw

PATCH v3 17/28 net/cnxk: support inline security setup for cn10k

In reply to Nithin Dabilpuram

Add support for inline inbound and outbound IPSec for SA create, destroy and other NIX / CPT LF configurations.

This patch also changes dpdk-devbind.py to list new inline device as misc device.

---
 doc/guides/nics/cnxk.rst                 | 102 ++++++++
 doc/guides/nics/features/cnxk.ini        |   1 +
 doc/guides/nics/features/cnxk_vec.ini    |   1 +
 doc/guides/nics/features/cnxk_vf.ini     |   1 +
 doc/guides/rel_notes/release_21_11.rst   |   2 +
 drivers/event/cnxk/cnxk_eventdev_adptr.c |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.c          |  36 ++-
 drivers/net/cnxk/cn10k_ethdev.h          |  43 ++++
 drivers/net/cnxk/cn10k_ethdev_sec.c      | 426 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_rx.h              |   1 +
 drivers/net/cnxk/cn10k_tx.h              |   1 +
 drivers/net/cnxk/meson.build             |   1 +
 usertools/dpdk-devbind.py                |   8 +-
 13 files changed, 654 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_sec.c
doc/guides/nics/cnxk.rst +102 -0
index 90d27db..b542437 100644
@@ -34,6 +34,7 @@ Features of the CNXK Ethdev PMD are:
 - Vector Poll mode driver
 - Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
+- Inline IPsec processing support
 
 Prerequisites
 -------------
@@ -185,6 +186,74 @@ Runtime Config Options
 
       -a 0002:02:00.0,tag_as_xor=1
 
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127).
+
+- ``Max SA's for outbound inline IPsec`` (default ``4096``)
+
+   Max number of SA's supported for outbound inline IPsec processing can be
+   specified by ``ipsec_out_max_sa`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,ipsec_out_max_sa=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 outbound SAs.
+
+- ``Outbound CPT LF queue size`` (default ``8200``)
+
+   Size of Outbound CPT LF queue in number of descriptors can be specified by
+   ``outb_nb_desc`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_desc=16384
+
+    With the above configuration, Outbound CPT LF will be created to accommodate
+    at max 16384 descriptors at any given time.
+
+- ``Outbound CPT LF count`` (default ``1``)
+
+   Number of CPT LF's to attach for Outbound processing can be specified by
+   ``outb_nb_crypto_qs`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,outb_nb_crypto_qs=2
+
+   With the above confiuration, two CPT LF's are setup and distributed among
+   all the Tx queues for outbound processing.
+
+- ``Force using inline ipsec device for inbound`` (default ``0``)
+
+   In CN10K, in event mode, driver can work in two modes,
+
+   1. Inbound encrypted traffic received by probed ipsec inline device while
+      plain traffic post decryption is received by ethdev.
+
+   2. Both Inbound encrypted traffic and plain traffic post decryption are
+      received by ethdev.
+
+   By default event mode works without using inline device i.e mode ``2``.
+   This behaviour can be changed to pick mode ``1`` by using
+   ``force_inb_inl_dev`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,force_inb_inl_dev=1 -a 0002:03:00.0,force_inb_inl_dev=1
+
+   With the above configuration, inbound encrypted traffic from both the ports
+   is received by ipsec inline device.
 
 .. note::
 
@@ -250,6 +319,39 @@ Example usage in testpmd::
    testpmd> flow create 0 ingress pattern eth / raw relative is 0 pattern \
           spec ab pattern mask ab offset is 4 / end actions queue index 1 / end
 
+Inline device support for CN10K
+-------------------------------
+
+CN10K HW provides a misc device Inline device that supports ethernet devices in
+providing following features.
+
+  - Aggregate all the inline IPsec inbound traffic from all the CN10K ethernet
+    devices to be processed by the single inline IPSec device. This allows
+    single rte security session to accept traffic from multiple ports.
+
+  - Support for event generation on outbound inline IPsec processing errors.
+
+  - Support CN106xx poll mode of operation for inline IPSec inbound processing.
+
+Inline IPsec device is identified by PCI PF vendid:devid ``177D:A0F0`` or
+VF ``177D:A0F1``.
+
+Runtime Config Options for inline device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``Max SPI for inbound inline IPsec`` (default ``255``)
+
+   Max SPI supported for inbound inline IPsec processing can be specified by
+   ``ipsec_in_max_spi`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:1d:00.0,ipsec_in_max_spi=128
+
+   With the above configuration, application can enable inline IPsec processing
+   for 128 inbound SAs (SPI 0-127) for traffic aggregated on inline device.
+
+
 Debugging Options
 -----------------
 
doc/guides/nics/features/cnxk.ini +1 -0
index 5d45625..1ced3ee 100644
@@ -27,6 +27,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Flow control         = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index abf2b8d..12ca0a5 100644
@@ -26,6 +26,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Flow control         = Y
 Jumbo frame          = Y
 L3 checksum offload  = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 7b4299f..139d9b9 100644
@@ -22,6 +22,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 Inner RSS            = Y
+Inline protocol      = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 L3 checksum offload  = Y
doc/guides/rel_notes/release_21_11.rst +2 -0
index f099b1c..354d063 100644
@@ -88,6 +88,8 @@ New Features
 
   * Added rte_flow support for dual VLAN insert and strip actions.
   * Added rte_tm support.
+  * Added support for Inline IPsec for CN9K event mode and CN10K
+    poll mode and event mode.
 
 * **Updated Marvell cnxk crypto PMD.**
 
drivers/event/cnxk/cnxk_eventdev_adptr.c +35 -1
index baf2f2a..a34efbb 100644
@@ -123,7 +123,9 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		    uint16_t port_id, const struct rte_event *ev,
 		    uint8_t custom_flowid)
 {
+	struct roc_nix *nix = &cnxk_eth_dev->nix;
 	struct roc_nix_rq *rq;
+	int rc;
 
 	rq = &cnxk_eth_dev->rqs[rq_id];
 	rq->sso_ena = 1;
@@ -140,7 +142,24 @@ cnxk_sso_rxq_enable(struct cnxk_eth_dev *cnxk_eth_dev, uint16_t rq_id,
 		rq->tag_mask |= ev->flow_id;
 	}
 
-	return roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	rc = roc_nix_rq_modify(&cnxk_eth_dev->nix, rq, 0);
+	if (rc)
+		return rc;
+
+	if (rq_id == 0 && roc_nix_inl_inb_is_enabled(nix)) {
+		uint32_t sec_tag_const;
+
+		/* IPSec tag const is 8-bit left shifted value of tag_mask
+		 * as it applies to bit 32:8 of tag only.
+		 */
+		sec_tag_const = rq->tag_mask >> 8;
+		rc = roc_nix_inl_inb_tag_update(nix, sec_tag_const,
+						ev->sched_type);
+		if (rc)
+			plt_err("Failed to set tag conf for ipsec, rc=%d", rc);
+	}
+
+	return rc;
 }
 
 static int
@@ -186,6 +205,7 @@ cnxk_sso_rx_adapter_queue_add(
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, true,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso++;
 	}
 
 	if (rc < 0) {
@@ -196,6 +216,14 @@ cnxk_sso_rx_adapter_queue_add(
 
 	dev->rx_offloads |= cnxk_eth_dev->rx_offload_flags;
 
+	/* Switch to use PF/VF's NIX LF instead of inline device for inbound
+	 * when all the RQ's are switched to event dev mode. We do this only
+	 * when using inline device is not forced by dev args.
+	 */
+	if (!cnxk_eth_dev->inb.force_inl_dev &&
+	    cnxk_eth_dev->nb_rxq_sso == cnxk_eth_dev->nb_rxq)
+		cnxk_nix_inb_mode_set(cnxk_eth_dev, false);
+
 	return 0;
 }
 
@@ -220,12 +248,18 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev,
 		rox_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix,
 				      rxq_sp->qconf.mp->pool_id, false,
 				      dev->force_ena_bp);
+		cnxk_eth_dev->nb_rxq_sso--;
 	}
 
 	if (rc < 0)
 		plt_err("Failed to clear Rx adapter config port=%d, q=%d",
 			eth_dev->data->port_id, rx_queue_id);
 
+	/* Removing RQ from Rx adapter implies need to use
+	 * inline device for CQ/Poll mode.
+	 */
+	cnxk_nix_inb_mode_set(cnxk_eth_dev, true);
+
 	return rc;
 }
 
drivers/net/cnxk/cn10k_ethdev.c +35 -1
index 7caec6c..fa2343c 100644
@@ -36,6 +36,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)
+		flags |= NIX_RX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -101,6 +104,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
 		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
 
+	if (conf & DEV_TX_OFFLOAD_SECURITY)
+		flags |= NIX_TX_OFFLOAD_SECURITY_F;
+
 	return flags;
 }
 
@@ -181,8 +187,11 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 const struct rte_eth_txconf *tx_conf)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	struct roc_cpt_lf *inl_lf;
 	struct cn10k_eth_txq *txq;
 	struct roc_nix_sq *sq;
+	uint16_t crypto_qid;
 	int rc;
 
 	RTE_SET_USED(socket);
@@ -198,11 +207,24 @@ cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	txq = eth_dev->data->tx_queues[qid];
 	txq->fc_mem = sq->fc;
 	/* Store lmt base in tx queue for easy access */
-	txq->lmt_base = dev->nix.lmt_base;
+	txq->lmt_base = nix->lmt_base;
 	txq->io_addr = sq->io_addr;
 	txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
 	txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
 
+	/* Fetch CPT LF info for outbound if present */
+	if (dev->outb.lf_base) {
+		crypto_qid = qid % dev->outb.nb_crypto_qs;
+		inl_lf = dev->outb.lf_base + crypto_qid;
+
+		txq->cpt_io_addr = inl_lf->io_addr;
+		txq->cpt_fc = inl_lf->fc_addr;
+		txq->cpt_desc = inl_lf->nb_desc * 0.7;
+		txq->sa_base = (uint64_t)dev->outb.sa_base;
+		txq->sa_base |= eth_dev->data->port_id;
+		PLT_STATIC_ASSERT(ROC_NIX_INL_SA_BASE_ALIGN == BIT_ULL(16));
+	}
+
 	nix_form_default_desc(dev, txq, qid);
 	txq->lso_tun_fmt = dev->lso_tun_fmt;
 	return 0;
@@ -215,6 +237,7 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			 struct rte_mempool *mp)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_eth_rxq_sp *rxq_sp;
 	struct cn10k_eth_rxq *rxq;
 	struct roc_nix_rq *rq;
 	struct roc_nix_cq *cq;
@@ -250,6 +273,15 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
 
+	/* Setup security related info */
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F) {
+		rxq->lmt_base = dev->nix.lmt_base;
+		rxq->sa_base = roc_nix_inl_inb_sa_base_get(&dev->nix,
+							   dev->inb.inl_dev);
+	}
+	rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+	rxq->aura_handle = rxq_sp->qconf.mp->pool_id;
+
 	/* Lookup mem */
 	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
@@ -500,6 +532,8 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	nix_eth_dev_ops_override();
 	npc_flow_ops_override();
 
+	cn10k_eth_sec_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn10k_ethdev.h +43 -0

67 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev_sec.c new file +426 -0

426 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +1 -0
index 68219b8..d27a231 100644
@@ -16,6 +16,7 @@
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
 #define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 #define NIX_RX_OFFLOAD_VLAN_STRIP_F  BIT(5)
+#define NIX_RX_OFFLOAD_SECURITY_F    BIT(6)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn10k_tx.h +1 -0
index f75cae0..8577a7b 100644
@@ -13,6 +13,7 @@
 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
 #define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
 #define NIX_TX_OFFLOAD_TSTAMP_F	      BIT(5)
+#define NIX_TX_OFFLOAD_SECURITY_F     BIT(6)
 
 /* Flags to control xmit_prepare function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/meson.build +1 -0
index c00da62..d86188f 100644
@@ -38,6 +38,7 @@ sources += files(
 # CN10K
 sources += files(
         'cn10k_ethdev.c',
+        'cn10k_ethdev_sec.c',
         'cn10k_rte_flow.c',
         'cn10k_rx.c',
         'cn10k_rx_mseg.c',
usertools/dpdk-devbind.py +5 -3
index 74d16e4..5f0e817 100755
@@ -49,6 +49,8 @@
              'SVendor': None, 'SDevice': None}
 cnxk_bphy_cgx = {'Class': '08', 'Vendor': '177d', 'Device': 'a059,a060',
                  'SVendor': None, 'SDevice': None}
+cnxk_inl_dev = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f0,a0f1',
+                'SVendor': None, 'SDevice': None}
 
 intel_dlb = {'Class': '0b', 'Vendor': '8086', 'Device': '270b,2710,2714',
              'SVendor': None, 'SDevice': None}
@@ -73,9 +75,9 @@
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
 regex_devices = [octeontx2_ree]
-misc_devices = [cnxk_bphy, cnxk_bphy_cgx, intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_idxd_spr,
-                intel_ntb_skx, intel_ntb_icx,
-                octeontx2_dma]
+misc_devices = [cnxk_bphy, cnxk_bphy_cgx, cnxk_inl_dev, intel_ioat_bdw,
+	        intel_ioat_skx, intel_ioat_icx, intel_idxd_spr, intel_ntb_skx,
+		intel_ntb_icx, octeontx2_dma]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
Signature · 1 line
2.8.4