DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Bhansali <rbhansali@marvell.com>
To: <dev@dpdk.org>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <jerinj@marvell.com>, Rakesh Kudurumalla <rkudurumalla@marvell.com>
Subject: [PATCH 13/14] common/cnxk: support for cn20k legacy msns mode
Date: Thu, 17 Sep 2026 12:40:15 +0530	[thread overview]
Message-ID: <20260917071016.2366467-13-rbhansali@marvell.com> (raw)
In-Reply-To: <20260917071016.2366467-1-rbhansali@marvell.com>

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Update nix_rx_action2_s for legacy msns mode support for cn20k

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/roc_cpt.h                 |  2 +
 drivers/common/cnxk/roc_cpt_debug.c           | 22 ++++++++
 drivers/common/cnxk/roc_nix_debug.c           |  2 +-
 drivers/common/cnxk/roc_nix_inl.c             |  4 +-
 drivers/common/cnxk/roc_npc.c                 | 54 ++++++++++---------
 .../common/cnxk/roc_platform_base_symbols.c   |  1 +
 6 files changed, 56 insertions(+), 29 deletions(-)

diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index 533d194bd4..1673cdb5db 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -260,4 +260,6 @@ int __roc_api roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *arg
 
 bool roc_cpt_has_ie_engines(void);
 
+void __roc_api roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq);
+
 #endif /* _ROC_CPT_H_ */
diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c
index 3c1c052e50..91e8cbc30d 100644
--- a/drivers/common/cnxk/roc_cpt_debug.c
+++ b/drivers/common/cnxk/roc_cpt_debug.c
@@ -191,6 +191,28 @@ roc_cpt_parse_hdr_dump(FILE *file, const union cpt_parse_hdr_u *cpth)
 		cpt_cnxk_parse_hdr_dump(file, &cpth->s);
 }
 
+void
+roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq)
+{
+	cpt_dump(file, "CPT_CQ \t%p:", cq);
+
+	/* W0 */
+	cpt_dump(file, "W0: compcode \t0x%x\t\tdoneint \t%u\t", cq->w0.s.compcode,
+		 cq->w0.s.doneint);
+	cpt_dump(file, "W0: uc_compcode \t0x%x\t\tuc_info \t0%" PRIu64, cq->w0.s.uc_compcode,
+		 (uint64_t)cq->w0.s.uc_info);
+
+	/* W1 */
+	cpt_dump(file, "W1: esn \t%" PRIx64 "\t\n", cq->w1.esn);
+
+	/* W2 */
+	cpt_dump(file, "W2: fmt \t0x%x\t\tuc_info2 \t%" PRIu64, cq->w2.s.fmt,
+		 (uint64_t)cq->w2.s.uc_info2);
+
+	/* W3 */
+	cpt_dump(file, "W3: comp_ptr \t0x%" PRIx64 "\t\n", cq->w3.comp_ptr);
+}
+
 static int
 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
 {
diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c
index 9c3bc8abe3..4f4e9b0c6c 100644
--- a/drivers/common/cnxk/roc_nix_debug.c
+++ b/drivers/common/cnxk/roc_nix_debug.c
@@ -1087,7 +1087,7 @@ roc_nix_cqe_dump(FILE *file, const struct nix_cqe_hdr_s *cq)
 	nix_dump(file, "W5: vtag0_ptr \t%d\t\tvtag1_ptr \t%d\t\tflow_key_alg \t%d",
 		 rx->vtag0_ptr, rx->vtag1_ptr, rx->flow_key_alg);
 
-	for (i = 0; i < (rx->desc_sizem1 + 1) << 1; i++)
+	for (i = 0; i < ((rx->desc_sizem1 + 1) << 1) + 2; i++)
 		nix_dump(file, "sg[%u] = %p", i, (void *)sgs[i]);
 }
 
diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
index 935dd37778..4c0ddb66ed 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -2620,11 +2620,9 @@ roc_nix_inl_ctx_write(struct roc_nix *roc_nix, void *sa_dptr, void *sa_cptr,
 		return -EINVAL;
 
 	if (roc_nix) {
-		if (inb && roc_nix->custom_inb_sa && sa_len > ROC_NIX_INL_INB_CUSTOM_SA_SZ) {
+		if (inb && roc_nix->custom_inb_sa && sa_len > ROC_NIX_INL_INB_CUSTOM_SA_SZ)
 			plt_nix_dbg("SA length: %u is more than allocated length: %u", sa_len,
 				    ROC_NIX_INL_INB_CUSTOM_SA_SZ);
-			return -EINVAL;
-		}
 		nix = roc_nix_to_nix_priv(roc_nix);
 		outb_lf = nix->cpt_lf_base;
 
diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index a8a31c7f6c..f709c71e36 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -544,49 +544,37 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action
 	struct nix_spi_to_sa_add_rsp *rsp;
 	struct nix_inl_dev *inl_dev;
 	struct idev_cfg *idev;
+	uint64_t npc_action2 = 0;
 	union {
 		uint64_t reg;
 		union nix_rx_vtag_action_u act;
-	} vtag_act;
+	} vtag_act = {0};
 	struct mbox *mbox;
+	uint8_t alg = 0;
 	int rc;
 
 	if (roc_npc->roc_nix->custom_sa_action == 0 || roc_model_is_cn9k() == 1 ||
 	    act->conf == NULL || flow->is_validate)
 		return 0;
 
-	*has_spi_to_sa_action = true;
-	sec_action = act->conf;
-
-	vtag_act.reg = 0;
-	vtag_act.act.sa_xor = sec_action->sa_xor;
-	vtag_act.act.sa_hi = sec_action->sa_hi;
-	vtag_act.act.sa_lo = sec_action->sa_lo;
-
 	idev = idev_get_cfg();
 	if (!idev)
 		return -1;
 
 	inl_dev = idev->nix_inl_dev;
 
+	*has_spi_to_sa_action = true;
+	sec_action = act->conf;
+
 	switch (sec_action->alg) {
 	case ROC_NPC_SEC_ACTION_ALG0:
-		break;
 	case ROC_NPC_SEC_ACTION_ALG1:
-		vtag_act.act.vtag1_valid = false;
-		vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG1;
-		break;
 	case ROC_NPC_SEC_ACTION_ALG2:
-		vtag_act.act.vtag1_valid = false;
-		vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG2;
-		break;
 	case ROC_NPC_SEC_ACTION_ALG3:
-		vtag_act.act.vtag1_valid = false;
-		vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG3;
+		alg = sec_action->alg;
 		break;
 	case ROC_NPC_SEC_ACTION_ALG4:
-		vtag_act.act.vtag1_valid = false;
-		vtag_act.act.vtag1_lid = 0;
+		alg = 0;
 		mbox = inl_dev->dev.mbox;
 		req = mbox_alloc_msg_nix_spi_to_sa_add(mbox);
 		if (req == NULL)
@@ -595,7 +583,7 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action
 		req->spi_index = plt_be_to_cpu_32(flow->spi_to_sa_info.spi);
 		req->match_id = flow->match_id;
 		req->valid = true;
-		if (roc_model_is_cn20k()) {
+		if (roc_feature_nix_has_inl_profile()) {
 			if (sec_action->use_custom_profile)
 				req->inline_profile_id = sec_action->profile_id;
 			else
@@ -614,7 +602,21 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action
 		return -1;
 	}
 
+	if (!roc_feature_nix_has_inl_profile()) {
+		vtag_act.act.sa_xor = sec_action->sa_xor;
+		vtag_act.act.sa_hi = sec_action->sa_hi;
+		vtag_act.act.sa_lo = sec_action->sa_lo;
+		vtag_act.act.vtag1_valid = false;
+		vtag_act.act.vtag1_lid = alg;
+
+	} else {
+		npc_action2 = ((uint64_t)sec_action->sa_xor << 7);
+		npc_action2 |= ((uint64_t)sec_action->sa_hi << 48);
+		npc_action2 |= ((uint64_t)sec_action->sa_lo << 32);
+		npc_action2 |= ((uint64_t)alg << 17);
+	}
 	flow->vtag_action = vtag_act.reg;
+	flow->npc_action2 |= npc_action2;
 
 	return 0;
 }
@@ -679,6 +681,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	/* Initialize actions */
 	flow->ctr_id = NPC_COUNTER_NONE;
 	flow->mtr_id = ROC_NIX_MTR_ID_INVALID;
+	flow->npc_action2 = 0;
 	pf_func = npc->pf_func;
 	if (flow->has_rep)
 		pf_func = flow->rep_pf_func;
@@ -988,19 +991,20 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	} else if (req_act & ROC_NPC_ACTION_TYPE_RSS) {
 		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
 	} else if (req_act & ROC_NPC_ACTION_TYPE_SEC) {
-		if (roc_model_is_cn20k()) {
+		if (roc_feature_nix_has_inl_profile()) {
 			const struct roc_npc_sec_action *sa_action = NULL;
 			uint16_t profile_id;
 
-			flow->npc_action = NIX_RX_ACTIONOP_UCAST_CPT;
-			flow->npc_action |= (uint64_t)rq << 20;
 			profile_id = roc_nix_inl_inb_ipsec_profile_id_get(roc_nix, true);
 			if (sec_action && sec_action->conf) {
 				sa_action = (const struct roc_npc_sec_action *)sec_action->conf;
 				if (sa_action->use_custom_profile)
 					profile_id = sa_action->profile_id;
 			}
-			flow->npc_action2 = (is_non_inp ? (1ULL << 15) : 0) | (profile_id << 8);
+			flow->npc_action2 |= (is_non_inp ? (1ULL << 15) : 0) | (profile_id << 8);
+
+			flow->npc_action = NIX_RX_ACTIONOP_UCAST_CPT;
+			flow->npc_action |= (uint64_t)rq << 20;
 		} else {
 			flow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC;
 			flow->npc_action |= (uint64_t)rq << 20;
diff --git a/drivers/common/cnxk/roc_platform_base_symbols.c b/drivers/common/cnxk/roc_platform_base_symbols.c
index de8de910f6..440ff13118 100644
--- a/drivers/common/cnxk/roc_platform_base_symbols.c
+++ b/drivers/common/cnxk/roc_platform_base_symbols.c
@@ -63,6 +63,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_int_misc_cb_unregister)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_parse_hdr_dump)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_afs_print)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_lfs_print)
+RTE_EXPORT_INTERNAL_SYMBOL(roc_cpt_cq_dump)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_wait_queue_idle)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(roc_dpi_disable)
-- 
2.34.1


  parent reply	other threads:[~2026-09-17  7:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  7:10 [PATCH 01/14] net/cnxk: fix packet length handling Rahul Bhansali
2026-09-17  7:10 ` [PATCH 02/14] common/cnxk: disable CPT drop error in CQ Rahul Bhansali
2026-09-17 16:14   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 03/14] common/cnxk: fix NIX QINT count reset Rahul Bhansali
2026-09-17 16:14   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 04/14] common/cnxk: update channel mask for cn20k Rahul Bhansali
2026-09-17  7:10 ` [PATCH 05/14] common/cnxk: update macro " Rahul Bhansali
2026-09-17  7:10 ` [PATCH 06/14] common/cnxk: fix null deref and irq ack in CPT CQ handler Rahul Bhansali
2026-09-17 16:15   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 07/14] common/cnxk: derive mbuf from CPT CQ in inline IRQ path Rahul Bhansali
2026-09-17 16:15   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 08/14] net/cnxk: resolve mbuf from CPT CQ format in SSO work cb Rahul Bhansali
2026-09-17 16:16   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 09/14] common/cnxk: update bpid config for cn20k Rahul Bhansali
2026-09-17 16:16   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 10/14] net/cnxk: add MSNS inb SA and CN20K CPT result struct Rahul Bhansali
2026-09-17 16:16   ` Stephen Hemminger
2026-09-17  7:10 ` [PATCH 11/14] common/cnxk: fix CPT CQ base address calculation Rahul Bhansali
2026-09-17  7:10 ` [PATCH 12/14] common/cnxk: update mode param for link speed Rahul Bhansali
2026-09-17 16:17   ` Stephen Hemminger
2026-09-17  7:10 ` Rahul Bhansali [this message]
2026-09-17 16:18   ` [PATCH 13/14] common/cnxk: support for cn20k legacy msns mode Stephen Hemminger
2026-09-17  7:10 ` [PATCH 14/14] net/cnxk: fix custom inbound SA condition check Rahul Bhansali
2026-09-17 16:12 ` [PATCH 01/14] net/cnxk: fix packet length handling Stephen Hemminger
2026-09-17 16:29 ` Stephen Hemminger

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20260917071016.2366467-13-rbhansali@marvell.com \
    --to=rbhansali@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=rkudurumalla@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /path/to/YOUR_REPLY

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

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