[21/34] common/cnxk: add NPC action2 support

Message ID 20250131080530.3224977-21-ndabilpuram@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers
Series [01/34] net/cnxk: allow duplicate SPI in outbound IPsec |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram Jan. 31, 2025, 8:05 a.m. UTC
From: Rahul Bhansali <rbhansali@marvell.com>

Add action2 config for IPsec rule.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
---
 drivers/common/cnxk/hw/nix.h       | 13 +++++++++++--
 drivers/common/cnxk/roc_mbox.h     |  1 +
 drivers/common/cnxk/roc_npc.h      |  1 +
 drivers/common/cnxk/roc_npc_mcam.c |  1 +
 4 files changed, 14 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h
index dd629a2080..e4d8d285d5 100644
--- a/drivers/common/cnxk/hw/nix.h
+++ b/drivers/common/cnxk/hw/nix.h
@@ -1678,6 +1678,15 @@  struct nix_rx_action_s {
 	uint64_t rsvd_63_61 : 3;
 };
 
+/* NIX receive action structure */
+struct nix_rx_action2_s {
+	uint64_t ipsec_qsel                  :  3;
+	uint64_t ipsec_qidx                  :  4;
+	uint64_t reserved_7_7                :  1;
+	uint64_t inline_profile_id           :  4;
+	uint64_t reserved_12_63              : 52;
+
+};
 /* NIX receive immediate sub descriptor structure */
 struct nix_rx_imm_s {
 	uint64_t size : 16;
@@ -2666,9 +2675,9 @@  struct nix_lso_format {
 #define NIX_SENDSTAT_IOFFSET_MASK 0xFFF
 #define NIX_SENDSTAT_OOFFSET_MASK 0xFFF
 
-/* The mask is to extract lower 10-bits of channel number
+/* The mask is to extract lower 11-bits of channel number
  * which CPT will pass to X2P.
  */
-#define NIX_CHAN_CPT_X2P_MASK (0x3ffull)
+#define NIX_CHAN_CPT_X2P_MASK (0x7ffull)
 
 #endif /* __NIX_HW_H__ */
diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index e50550bb53..a4212a59ed 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -2694,6 +2694,7 @@  struct cn20k_mcam_entry {
 	uint64_t __io kw_mask[NPC_CN20K_MAX_KWS_IN_KEY];
 	uint64_t __io action;
 	uint64_t __io vtag_action;
+	uint64_t __io action2;
 };
 
 struct npc_cn20k_mcam_write_entry_req {
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index 4da21a8eb3..2a409cce99 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -328,6 +328,7 @@  struct roc_npc_flow {
 	uint64_t mcam_data[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];
 	uint64_t mcam_mask[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];
 	uint64_t npc_action;
+	uint64_t npc_action2;
 	uint64_t vtag_action;
 	bool vtag_insert_enabled;
 	int8_t vtag_insert_count;
diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c
index 412b2611b7..5db72c22ae 100644
--- a/drivers/common/cnxk/roc_npc_mcam.c
+++ b/drivers/common/cnxk/roc_npc_mcam.c
@@ -511,6 +511,7 @@  npc_mcam_write_entry(struct mbox *mbox, struct roc_npc_flow *mcam)
 		cn20k_req->intf = mcam->nix_intf;
 		cn20k_req->enable_entry = mcam->enable;
 		cn20k_req->entry_data.action = mcam->npc_action;
+		cn20k_req->entry_data.action2 = mcam->npc_action2;
 		cn20k_req->entry_data.vtag_action = mcam->vtag_action;
 		cn20k_req->hw_prio = mcam->priority;
 		if (mcam->use_ctr)