Skip to contentSkip to conversation

common/cnxk: support SPI to SA translation action

PATCH Applied [email protected] 2 participants 4 messages Mar 13, 2023 – Apr 4, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 common/cnxk: support SPI to SA translation action

From: Kiran Kumar K <[email protected]>

Support SPI to SA index translation action with
SPI bits MS_28_25.

---
 drivers/common/cnxk/roc_npc.c | 4 ++++
 drivers/common/cnxk/roc_npc.h | 1 +
 2 files changed, 5 insertions(+)
drivers/common/cnxk/roc_npc.c +4 -0
index 47536c8ce8..7228cffb57 100644
@@ -438,6 +438,10 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action
 		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;
+		break;
+	case ROC_NPC_SEC_ACTION_ALG4:
 		vtag_act.act.vtag1_valid = false;
 		vtag_act.act.vtag1_lid = 0;
 		mbox = inl_dev->dev.mbox;
drivers/common/cnxk/roc_npc.h +1 -0
index 61d0628f5f..26a43c12cb 100644
@@ -235,6 +235,7 @@ enum roc_npc_sec_action_alg {
 	ROC_NPC_SEC_ACTION_ALG1,
 	ROC_NPC_SEC_ACTION_ALG2,
 	ROC_NPC_SEC_ACTION_ALG3,
+	ROC_NPC_SEC_ACTION_ALG4,
 };
 
 struct roc_npc_sec_action {
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 common/cnxk: fix SPI to SA index destroy

From: Satheesh Paul <[email protected]>

While destroying SPI to SA index rule, inline device mbox should be used. Adding changes to fix this.

Fixes 04087b781484 ("common/cnxk: support SPI to SA index")
---
 drivers/common/cnxk/roc_npc.c      | 14 ++++++++++----
 drivers/common/cnxk/roc_npc_mcam.c |  8 ++++----
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/common/cnxk/roc_npc.c +10 -4
index 7228cffb57..ba75207955 100644
@@ -1503,16 +1503,22 @@ npc_rss_group_free(struct npc *npc, struct roc_npc_flow *flow)
 static int
 roc_npc_delete_spi_to_sa_action(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 {
-	struct roc_nix *roc_nix = roc_npc->roc_nix;
 	struct nix_spi_to_sa_delete_req *req;
+	struct nix_inl_dev *inl_dev;
+	struct idev_cfg *idev;
 	struct mbox *mbox;
-	struct nix *nix;
+
+	PLT_SET_USED(roc_npc);
 
 	if (!flow->spi_to_sa_info.has_action || flow->spi_to_sa_info.duplicate)
 		return 0;
 
-	nix = roc_nix_to_nix_priv(roc_nix);
-	mbox = (&nix->dev)->mbox;
+	idev = idev_get_cfg();
+	if (!idev)
+		return -1;
+
+	inl_dev = idev->nix_inl_dev;
+	mbox = inl_dev->dev.mbox;
 	req = mbox_alloc_msg_nix_spi_to_sa_delete(mbox);
 	if (req == NULL)
 		return -ENOSPC;
drivers/common/cnxk/roc_npc_mcam.c +4 -4
index 948c446312..72892be300 100644
@@ -96,10 +96,10 @@ int
 npc_mcam_free_all_entries(struct npc *npc)
 {
 	struct npc_mcam_free_entry_req *req;
-	struct mbox *mbox = npc->mbox;
+	struct mbox *mbox = mbox_get(npc->mbox);
 	int rc = -ENOSPC;
 
-	req = mbox_alloc_msg_npc_mcam_free_entry(mbox_get(mbox));
+	req = mbox_alloc_msg_npc_mcam_free_entry(mbox);
 	if (req == NULL)
 		goto exit;
 	req->all = 1;
@@ -354,10 +354,10 @@ npc_mcam_alloc_entry(struct npc *npc, struct roc_npc_flow *mcam,
 {
 	struct npc_mcam_alloc_entry_req *req;
 	struct npc_mcam_alloc_entry_rsp *rsp;
-	struct mbox *mbox = npc->mbox;
+	struct mbox *mbox = mbox_get(npc->mbox);
 	int rc = -ENOSPC;
 
-	req = mbox_alloc_msg_npc_mcam_alloc_entry(mbox_get(mbox));
+	req = mbox_alloc_msg_npc_mcam_alloc_entry(mbox);
 	if (req == NULL)
 		goto exit;
 	req->contig = 1;
Signature · 1 line
2.39.2
#2 lore raw

Re: [dpdk-dev] [PATCH 2/2] common/cnxk: fix SPI to SA index destroy

Quoted 7 lines · On Mon, Mar 13, 2023 at 10:54 AM <[email protected]> wrote:

From: Satheesh Paul <[email protected]>

While destroying SPI to SA index rule, inline device mbox should be used. Adding changes to fix this.

Fixes 04087b781484 ("common/cnxk: support SPI to SA index")

Merged only 2/2 for rc3 as it is a fix. Applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 72 lines
---
 drivers/common/cnxk/roc_npc.c      | 14 ++++++++++----
 drivers/common/cnxk/roc_npc_mcam.c |  8 ++++----
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/common/cnxk/roc_npc.c +10 -4
index 7228cffb57..ba75207955 100644
@@ -1503,16 +1503,22 @@ npc_rss_group_free(struct npc *npc, struct roc_npc_flow *flow)
 static int
 roc_npc_delete_spi_to_sa_action(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 {
-       struct roc_nix *roc_nix = roc_npc->roc_nix;
        struct nix_spi_to_sa_delete_req *req;
+       struct nix_inl_dev *inl_dev;
+       struct idev_cfg *idev;
        struct mbox *mbox;
-       struct nix *nix;
+
+       PLT_SET_USED(roc_npc);
 
        if (!flow->spi_to_sa_info.has_action || flow->spi_to_sa_info.duplicate)
                return 0;
 
-       nix = roc_nix_to_nix_priv(roc_nix);
-       mbox = (&nix->dev)->mbox;
+       idev = idev_get_cfg();
+       if (!idev)
+               return -1;
+
+       inl_dev = idev->nix_inl_dev;
+       mbox = inl_dev->dev.mbox;
        req = mbox_alloc_msg_nix_spi_to_sa_delete(mbox);
        if (req == NULL)
                return -ENOSPC;
drivers/common/cnxk/roc_npc_mcam.c +4 -5
index 948c446312..72892be300 100644
@@ -96,10 +96,10 @@ int
 npc_mcam_free_all_entries(struct npc *npc)
 {
        struct npc_mcam_free_entry_req *req;
-       struct mbox *mbox = npc->mbox;
+       struct mbox *mbox = mbox_get(npc->mbox);
        int rc = -ENOSPC;
 
-       req = mbox_alloc_msg_npc_mcam_free_entry(mbox_get(mbox));
+       req = mbox_alloc_msg_npc_mcam_free_entry(mbox);
        if (req == NULL)
                goto exit;
        req->all = 1;
@@ -354,10 +354,10 @@ npc_mcam_alloc_entry(struct npc *npc, struct roc_npc_flow *mcam,
 {
        struct npc_mcam_alloc_entry_req *req;
        struct npc_mcam_alloc_entry_rsp *rsp;
-       struct mbox *mbox = npc->mbox;
+       struct mbox *mbox = mbox_get(npc->mbox);
        int rc = -ENOSPC;
 
-       req = mbox_alloc_msg_npc_mcam_alloc_entry(mbox_get(mbox));
+       req = mbox_alloc_msg_npc_mcam_alloc_entry(mbox);
        if (req == NULL)
                goto exit;
        req->contig = 1;
--

2.39.2

Applied
#3 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, Mar 13, 2023 at 10:54 AM <[email protected]> wrote:

From: Kiran Kumar K <[email protected]>

Support SPI to SA index translation action with
SPI bits MS_28_25.

Applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 35 lines
---
 drivers/common/cnxk/roc_npc.c | 4 ++++
 drivers/common/cnxk/roc_npc.h | 1 +
 2 files changed, 5 insertions(+)
drivers/common/cnxk/roc_npc.c +4 -0
index 47536c8ce8..7228cffb57 100644
@@ -438,6 +438,10 @@ npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action
                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;
+               break;
+       case ROC_NPC_SEC_ACTION_ALG4:
                vtag_act.act.vtag1_valid = false;
                vtag_act.act.vtag1_lid = 0;
                mbox = inl_dev->dev.mbox;
drivers/common/cnxk/roc_npc.h +1 -1
index 61d0628f5f..26a43c12cb 100644
@@ -235,6 +235,7 @@ enum roc_npc_sec_action_alg {
        ROC_NPC_SEC_ACTION_ALG1,
        ROC_NPC_SEC_ACTION_ALG2,
        ROC_NPC_SEC_ACTION_ALG3,
+       ROC_NPC_SEC_ACTION_ALG4,
 };
 
 struct roc_npc_sec_action {
--

2.39.2