DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH ] common/cnxk: fix setting default flow action
@ 2023-07-31  2:56 psatheesh
  2023-07-31 12:47 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: psatheesh @ 2023-07-31  2:56 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Satheesh Paul, stable

From: Satheesh Paul <psatheesh@marvell.com>

For MCAM rules with PF/VF action, the PF's default rule action is
is copied and overwritten over the user provided action. Fixing this
by setting default action only if no other action (like queue) is
specified by user.

Fixes: a07f7ced436def ("common/cnxk: add NPC init and fini")
Cc: stable@dpdk.org

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
---
 drivers/common/cnxk/hw/nix.h            |  1 +
 drivers/common/cnxk/roc_npc.c           | 17 ++++++++++-------
 drivers/common/cnxk/roc_npc_mcam_dump.c |  4 ++++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h
index 26dcda680e..d2c80f3c74 100644
--- a/drivers/common/cnxk/hw/nix.h
+++ b/drivers/common/cnxk/hw/nix.h
@@ -619,6 +619,7 @@
 #define NIX_RX_ACTIONOP_RSS	     (0x4ull)
 #define NIX_RX_ACTIONOP_PF_FUNC_DROP (0x5ull)
 #define NIX_RX_ACTIONOP_MIRROR	     (0x6ull)
+#define NIX_RX_ACTIONOP_DEFAULT	     (0xfull)
 
 #define NIX_RX_VTAGACTION_VTAG0_RELPTR (0x0ull)
 #define NIX_RX_VTAGACTION_VTAG1_RELPTR (0x4ull)
diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 848086c8de..586bc55791 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -726,11 +726,15 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	if (req_act == ROC_NPC_ACTION_TYPE_VLAN_STRIP) {
 		/* Only VLAN action is provided */
 		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
-	} else if (req_act &
-		   (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
-		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
-		if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
-			flow->npc_action |= (uint64_t)rq << 20;
+	} else if (req_act & (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
+		/* Check if any other action is set */
+		if ((req_act == ROC_NPC_ACTION_TYPE_PF) || (req_act == ROC_NPC_ACTION_TYPE_VF)) {
+			flow->npc_action = NIX_RX_ACTIONOP_DEFAULT;
+		} else {
+			flow->npc_action = NIX_RX_ACTIONOP_UCAST;
+			if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
+				flow->npc_action |= (uint64_t)rq << 20;
+		}
 	} else if (req_act & ROC_NPC_ACTION_TYPE_DROP) {
 		flow->npc_action = NIX_RX_ACTIONOP_DROP;
 	} else if (req_act & ROC_NPC_ACTION_TYPE_QUEUE) {
@@ -741,8 +745,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	} else if (req_act & ROC_NPC_ACTION_TYPE_SEC) {
 		flow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC;
 		flow->npc_action |= (uint64_t)rq << 20;
-	} else if (req_act &
-		   (ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
+	} else if (req_act & (ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
 		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
 	} else if (req_act & ROC_NPC_ACTION_TYPE_COUNT) {
 		/* Keep ROC_NPC_ACTION_TYPE_COUNT_ACT always at the end
diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c b/drivers/common/cnxk/roc_npc_mcam_dump.c
index 01c4212567..ebd2dd69c2 100644
--- a/drivers/common/cnxk/roc_npc_mcam_dump.c
+++ b/drivers/common/cnxk/roc_npc_mcam_dump.c
@@ -496,6 +496,10 @@ npc_flow_dump_rx_action(FILE *file, uint64_t npc_action)
 		plt_strlcpy(index_name, "Multicast/mirror table index",
 			    NPC_MAX_FIELD_NAME_SIZE);
 		break;
+	case NIX_RX_ACTIONOP_DEFAULT:
+		fprintf(file, "NIX_RX_ACTIONOP_DEFAULT (%" PRIu64 ")\n",
+			(uint64_t)NIX_RX_ACTIONOP_DEFAULT);
+		break;
 	default:
 		plt_err("Unknown NIX_RX_ACTIONOP found");
 		return;
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH ] common/cnxk: fix setting default flow action
  2023-07-31  2:56 [dpdk-dev] [PATCH ] common/cnxk: fix setting default flow action psatheesh
@ 2023-07-31 12:47 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-07-31 12:47 UTC (permalink / raw)
  To: psatheesh
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	dev, stable

On Mon, Jul 31, 2023 at 8:26 AM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> For MCAM rules with PF/VF action, the PF's default rule action is
> is copied and overwritten over the user provided action. Fixing this
> by setting default action only if no other action (like queue) is
> specified by user.
>
> Fixes: a07f7ced436def ("common/cnxk: add NPC init and fini")
> Cc: stable@dpdk.org
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>

Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks


    common/cnxk: fix default flow action setting

    For MCAM rules with PF/VF action, the PF's default rule action is
    is copied and overwritten over the user provided action. Fixing this
    by setting default action only if no other action (like queue) is
    specified by user.

    Fixes: a07f7ced436d ("common/cnxk: add NPC init and fini")
    Cc: stable@dpdk.org

    Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
    Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>


> ---
>  drivers/common/cnxk/hw/nix.h            |  1 +
>  drivers/common/cnxk/roc_npc.c           | 17 ++++++++++-------
>  drivers/common/cnxk/roc_npc_mcam_dump.c |  4 ++++
>  3 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h
> index 26dcda680e..d2c80f3c74 100644
> --- a/drivers/common/cnxk/hw/nix.h
> +++ b/drivers/common/cnxk/hw/nix.h
> @@ -619,6 +619,7 @@
>  #define NIX_RX_ACTIONOP_RSS         (0x4ull)
>  #define NIX_RX_ACTIONOP_PF_FUNC_DROP (0x5ull)
>  #define NIX_RX_ACTIONOP_MIRROR      (0x6ull)
> +#define NIX_RX_ACTIONOP_DEFAULT             (0xfull)
>
>  #define NIX_RX_VTAGACTION_VTAG0_RELPTR (0x0ull)
>  #define NIX_RX_VTAGACTION_VTAG1_RELPTR (0x4ull)
> diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
> index 848086c8de..586bc55791 100644
> --- a/drivers/common/cnxk/roc_npc.c
> +++ b/drivers/common/cnxk/roc_npc.c
> @@ -726,11 +726,15 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
>         if (req_act == ROC_NPC_ACTION_TYPE_VLAN_STRIP) {
>                 /* Only VLAN action is provided */
>                 flow->npc_action = NIX_RX_ACTIONOP_UCAST;
> -       } else if (req_act &
> -                  (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
> -               flow->npc_action = NIX_RX_ACTIONOP_UCAST;
> -               if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
> -                       flow->npc_action |= (uint64_t)rq << 20;
> +       } else if (req_act & (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {
> +               /* Check if any other action is set */
> +               if ((req_act == ROC_NPC_ACTION_TYPE_PF) || (req_act == ROC_NPC_ACTION_TYPE_VF)) {
> +                       flow->npc_action = NIX_RX_ACTIONOP_DEFAULT;
> +               } else {
> +                       flow->npc_action = NIX_RX_ACTIONOP_UCAST;
> +                       if (req_act & ROC_NPC_ACTION_TYPE_QUEUE)
> +                               flow->npc_action |= (uint64_t)rq << 20;
> +               }
>         } else if (req_act & ROC_NPC_ACTION_TYPE_DROP) {
>                 flow->npc_action = NIX_RX_ACTIONOP_DROP;
>         } else if (req_act & ROC_NPC_ACTION_TYPE_QUEUE) {
> @@ -741,8 +745,7 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
>         } else if (req_act & ROC_NPC_ACTION_TYPE_SEC) {
>                 flow->npc_action = NIX_RX_ACTIONOP_UCAST_IPSEC;
>                 flow->npc_action |= (uint64_t)rq << 20;
> -       } else if (req_act &
> -                  (ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
> +       } else if (req_act & (ROC_NPC_ACTION_TYPE_FLAG | ROC_NPC_ACTION_TYPE_MARK)) {
>                 flow->npc_action = NIX_RX_ACTIONOP_UCAST;
>         } else if (req_act & ROC_NPC_ACTION_TYPE_COUNT) {
>                 /* Keep ROC_NPC_ACTION_TYPE_COUNT_ACT always at the end
> diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c b/drivers/common/cnxk/roc_npc_mcam_dump.c
> index 01c4212567..ebd2dd69c2 100644
> --- a/drivers/common/cnxk/roc_npc_mcam_dump.c
> +++ b/drivers/common/cnxk/roc_npc_mcam_dump.c
> @@ -496,6 +496,10 @@ npc_flow_dump_rx_action(FILE *file, uint64_t npc_action)
>                 plt_strlcpy(index_name, "Multicast/mirror table index",
>                             NPC_MAX_FIELD_NAME_SIZE);
>                 break;
> +       case NIX_RX_ACTIONOP_DEFAULT:
> +               fprintf(file, "NIX_RX_ACTIONOP_DEFAULT (%" PRIu64 ")\n",
> +                       (uint64_t)NIX_RX_ACTIONOP_DEFAULT);
> +               break;
>         default:
>                 plt_err("Unknown NIX_RX_ACTIONOP found");
>                 return;
> --
> 2.39.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-31 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31  2:56 [dpdk-dev] [PATCH ] common/cnxk: fix setting default flow action psatheesh
2023-07-31 12:47 ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).