[2/2] common/cnxk: fix SPI to SA index destroy

Message ID 20230313052403.230953-2-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/2] common/cnxk: support SPI to SA translation action |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance fail Performance Testing issues
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Satheesh Paul Antonysamy March 13, 2023, 5:24 a.m. UTC
  From: Satheesh Paul <psatheesh@marvell.com>

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")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc.c      | 14 ++++++++++----
 drivers/common/cnxk/roc_npc_mcam.c |  8 ++++----
 2 files changed, 14 insertions(+), 8 deletions(-)
  

Comments

Jerin Jacob March 15, 2023, 5:52 a.m. UTC | #1
On Mon, Mar 13, 2023 at 10:54 AM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> 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

>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> ---
>  drivers/common/cnxk/roc_npc.c      | 14 ++++++++++----
>  drivers/common/cnxk/roc_npc_mcam.c |  8 ++++----
>  2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
> index 7228cffb57..ba75207955 100644
> --- a/drivers/common/cnxk/roc_npc.c
> +++ b/drivers/common/cnxk/roc_npc.c
> @@ -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;
> diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c
> index 948c446312..72892be300 100644
> --- a/drivers/common/cnxk/roc_npc_mcam.c
> +++ b/drivers/common/cnxk/roc_npc_mcam.c
> @@ -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
>
  

Patch

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 7228cffb57..ba75207955 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -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;
diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c
index 948c446312..72892be300 100644
--- a/drivers/common/cnxk/roc_npc_mcam.c
+++ b/drivers/common/cnxk/roc_npc_mcam.c
@@ -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;