DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type
@ 2021-10-05  3:30 psatheesh
  2021-10-05  3:30 ` [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID psatheesh
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: psatheesh @ 2021-10-05  3:30 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Ray Kinsella
  Cc: dev, Satheesh Paul

From: Satheesh Paul <psatheesh@marvell.com>

This patch adds ROC API to support rte flow port ID action type.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc.c   | 35 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_npc.h   | 11 ++++++++++-
 drivers/common/cnxk/version.map |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index b724ff9401..658b9054d3 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -341,11 +341,38 @@ roc_npc_fini(struct roc_npc *roc_npc)
 	return 0;
 }
 
+int
+roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+			       struct roc_npc *roc_npc_dst)
+{
+	struct roc_nix *roc_nix_src = roc_npc_src->roc_nix;
+	struct nix *nix_src = roc_nix_to_nix_priv(roc_nix_src);
+	struct roc_nix *roc_nix_dst = roc_npc_dst->roc_nix;
+	struct nix *nix_dst = roc_nix_to_nix_priv(roc_nix_dst);
+
+	if (roc_nix_is_pf(roc_npc_dst->roc_nix)) {
+		plt_err("Output port should be VF");
+		return -EINVAL;
+	}
+
+	if (nix_dst->dev.vf >= nix_src->dev.maxvf) {
+		plt_err("Invalid VF for output port");
+		return -EINVAL;
+	}
+
+	if (nix_src->dev.pf != nix_dst->dev.pf) {
+		plt_err("Output port should be VF of ingress PF");
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static int
 npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	const struct roc_npc_action_port_id *act_portid;
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_queue *act_q;
@@ -407,6 +434,14 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 			pf_func = (pf_func | (vf_id + 1));
 			break;
 
+		case ROC_NPC_ACTION_TYPE_PORT_ID:
+			act_portid = (const struct roc_npc_action_port_id *)
+					     actions->conf;
+			pf_func &= (0xfc00);
+			pf_func = (pf_func | (act_portid->id + 1));
+			req_act |= ROC_NPC_ACTION_TYPE_VF;
+			break;
+
 		case ROC_NPC_ACTION_TYPE_QUEUE:
 			act_q = (const struct roc_npc_action_queue *)
 					actions->conf;
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index 65d4bd6edc..113e850b54 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -58,7 +58,7 @@ struct roc_npc_flow_item_raw {
 	const uint8_t *pattern; /**< Byte string to look for. */
 };
 
-#define ROC_NPC_MAX_ACTION_COUNT 12
+#define ROC_NPC_MAX_ACTION_COUNT 18
 
 enum roc_npc_action_type {
 	ROC_NPC_ACTION_TYPE_END = (1 << 0),
@@ -77,6 +77,7 @@ enum roc_npc_action_type {
 	ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),
 	ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),
 	ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),
+	ROC_NPC_ACTION_TYPE_PORT_ID = (1 << 16),
 };
 
 struct roc_npc_action {
@@ -94,6 +95,12 @@ struct roc_npc_action_vf {
 	uint32_t id;		/**< VF ID. */
 };
 
+struct roc_npc_action_port_id {
+	uint32_t original : 1;	/**< Use original DPDK port ID if possible. */
+	uint32_t reserved : 31; /**< Reserved, must be zero. */
+	uint32_t id;		/**< port ID. */
+};
+
 struct roc_npc_action_queue {
 	uint16_t index; /**< Queue index to use. */
 };
@@ -234,4 +241,6 @@ int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,
 					      uint32_t count);
 int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc,
 						    struct roc_npc_flow *flow);
+int __roc_api roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+					     struct roc_npc *roc_npc_dst);
 #endif /* _ROC_NPC_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 926d5c2167..4cfdbf38f5 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -286,6 +286,7 @@ INTERNAL {
 	roc_npc_mcam_write_entry;
 	roc_npc_mcam_read_counter;
 	roc_npc_profile_name_get;
+	roc_npc_validate_portid_action;
 	roc_plt_init;
 	roc_plt_init_cb_register;
 	roc_sso_dev_fini;
-- 
2.25.4


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

* [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID
  2021-10-05  3:30 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type psatheesh
@ 2021-10-05  3:30 ` psatheesh
  2021-10-20 18:33 ` [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type Jerin Jacob
  2021-10-21  5:11 ` [dpdk-dev] [PATCH v2 " psatheesh
  2 siblings, 0 replies; 6+ messages in thread
From: psatheesh @ 2021-10-05  3:30 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Satheesh Paul

From: Satheesh Paul <psatheesh@marvell.com>

This patch adds support for rte flow action type port_id to
enable directing packets from an input port PF to an output
port which is a VF of the input port PF.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 doc/guides/nics/cnxk.rst          |  5 +++++
 doc/guides/nics/features/cnxk.ini |  1 +
 drivers/net/cnxk/cnxk_rte_flow.c  | 36 +++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst
index dd955d31b0..a719bae427 100644
--- a/doc/guides/nics/cnxk.rst
+++ b/doc/guides/nics/cnxk.rst
@@ -304,6 +304,11 @@ RTE flow GRE support
 - ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
   bits in the GRE header are equal to 0.
 
+RTE flow action port_id support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
+
 Custom protocols supported in RTE Flow
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
index 1ced3ee903..0b27a62d3d 100644
--- a/doc/guides/nics/features/cnxk.ini
+++ b/doc/guides/nics/features/cnxk.ini
@@ -84,6 +84,7 @@ of_push_vlan         = Y
 of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
 pf                   = Y
+port_id              = Y
 queue                = Y
 rss                  = Y
 security             = Y
diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c
index 32c1b5dee5..426552fe9f 100644
--- a/drivers/net/cnxk/cnxk_rte_flow.c
+++ b/drivers/net/cnxk/cnxk_rte_flow.c
@@ -110,8 +110,14 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 		 struct roc_npc_action in_actions[], uint32_t *flowkey_cfg)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const struct rte_flow_action_port_id *port_act;
 	const struct rte_flow_action_count *act_count;
 	const struct rte_flow_action_queue *act_q;
+	struct roc_npc *roc_npc_src = &dev->npc;
+	struct rte_eth_dev *portid_eth_dev;
+	char if_name[RTE_ETH_NAME_MAX_LEN];
+	struct cnxk_eth_dev *hw_dst;
+	struct roc_npc *roc_npc_dst;
 	int i = 0, rc = 0;
 	int rq;
 
@@ -154,6 +160,36 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 			in_actions[i].conf = actions->conf;
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;
+			in_actions[i].conf = actions->conf;
+			port_act = (const struct rte_flow_action_port_id *)
+					   actions->conf;
+			if (rte_eth_dev_get_name_by_port(port_act->id,
+							 if_name)) {
+				plt_err("Name not found for output port id");
+				goto err_exit;
+			}
+			portid_eth_dev = rte_eth_dev_allocated(if_name);
+			if (!portid_eth_dev) {
+				plt_err("eth_dev not found for output port id");
+				goto err_exit;
+			}
+			if (strcmp(portid_eth_dev->device->driver->name,
+				   eth_dev->device->driver->name) != 0) {
+				plt_err("Output port not under same driver");
+				goto err_exit;
+			}
+			hw_dst = portid_eth_dev->data->dev_private;
+			roc_npc_dst = &hw_dst->npc;
+
+			rc = roc_npc_validate_portid_action(roc_npc_src,
+							    roc_npc_dst);
+
+			if (rc)
+				goto err_exit;
+			break;
+
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 			act_q = (const struct rte_flow_action_queue *)
 					actions->conf;
-- 
2.25.4


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

* Re: [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type
  2021-10-05  3:30 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type psatheesh
  2021-10-05  3:30 ` [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID psatheesh
@ 2021-10-20 18:33 ` Jerin Jacob
  2021-10-21  5:11 ` [dpdk-dev] [PATCH v2 " psatheesh
  2 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2021-10-20 18:33 UTC (permalink / raw)
  To: Satheesh Paul
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Ray Kinsella, dpdk-dev

On Tue, Oct 5, 2021 at 9:00 AM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> This patch adds ROC API to support rte flow port ID action type.
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>

Could you rebase this series to  next-net-mrvl


> ---
>  drivers/common/cnxk/roc_npc.c   | 35 +++++++++++++++++++++++++++++++++
>  drivers/common/cnxk/roc_npc.h   | 11 ++++++++++-
>  drivers/common/cnxk/version.map |  1 +
>  3 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
> index b724ff9401..658b9054d3 100644
> --- a/drivers/common/cnxk/roc_npc.c
> +++ b/drivers/common/cnxk/roc_npc.c
> @@ -341,11 +341,38 @@ roc_npc_fini(struct roc_npc *roc_npc)
>         return 0;
>  }
>
> +int
> +roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
> +                              struct roc_npc *roc_npc_dst)
> +{
> +       struct roc_nix *roc_nix_src = roc_npc_src->roc_nix;
> +       struct nix *nix_src = roc_nix_to_nix_priv(roc_nix_src);
> +       struct roc_nix *roc_nix_dst = roc_npc_dst->roc_nix;
> +       struct nix *nix_dst = roc_nix_to_nix_priv(roc_nix_dst);
> +
> +       if (roc_nix_is_pf(roc_npc_dst->roc_nix)) {
> +               plt_err("Output port should be VF");
> +               return -EINVAL;
> +       }
> +
> +       if (nix_dst->dev.vf >= nix_src->dev.maxvf) {
> +               plt_err("Invalid VF for output port");
> +               return -EINVAL;
> +       }
> +
> +       if (nix_src->dev.pf != nix_dst->dev.pf) {
> +               plt_err("Output port should be VF of ingress PF");
> +               return -EINVAL;
> +       }
> +       return 0;
> +}
> +
>  static int
>  npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
>                   const struct roc_npc_action actions[],
>                   struct roc_npc_flow *flow)
>  {
> +       const struct roc_npc_action_port_id *act_portid;
>         struct npc *npc = roc_npc_to_npc_priv(roc_npc);
>         const struct roc_npc_action_mark *act_mark;
>         const struct roc_npc_action_queue *act_q;
> @@ -407,6 +434,14 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
>                         pf_func = (pf_func | (vf_id + 1));
>                         break;
>
> +               case ROC_NPC_ACTION_TYPE_PORT_ID:
> +                       act_portid = (const struct roc_npc_action_port_id *)
> +                                            actions->conf;
> +                       pf_func &= (0xfc00);
> +                       pf_func = (pf_func | (act_portid->id + 1));
> +                       req_act |= ROC_NPC_ACTION_TYPE_VF;
> +                       break;
> +
>                 case ROC_NPC_ACTION_TYPE_QUEUE:
>                         act_q = (const struct roc_npc_action_queue *)
>                                         actions->conf;
> diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
> index 65d4bd6edc..113e850b54 100644
> --- a/drivers/common/cnxk/roc_npc.h
> +++ b/drivers/common/cnxk/roc_npc.h
> @@ -58,7 +58,7 @@ struct roc_npc_flow_item_raw {
>         const uint8_t *pattern; /**< Byte string to look for. */
>  };
>
> -#define ROC_NPC_MAX_ACTION_COUNT 12
> +#define ROC_NPC_MAX_ACTION_COUNT 18
>
>  enum roc_npc_action_type {
>         ROC_NPC_ACTION_TYPE_END = (1 << 0),
> @@ -77,6 +77,7 @@ enum roc_npc_action_type {
>         ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),
>         ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),
>         ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),
> +       ROC_NPC_ACTION_TYPE_PORT_ID = (1 << 16),
>  };
>
>  struct roc_npc_action {
> @@ -94,6 +95,12 @@ struct roc_npc_action_vf {
>         uint32_t id;            /**< VF ID. */
>  };
>
> +struct roc_npc_action_port_id {
> +       uint32_t original : 1;  /**< Use original DPDK port ID if possible. */
> +       uint32_t reserved : 31; /**< Reserved, must be zero. */
> +       uint32_t id;            /**< port ID. */
> +};
> +
>  struct roc_npc_action_queue {
>         uint16_t index; /**< Queue index to use. */
>  };
> @@ -234,4 +241,6 @@ int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,
>                                               uint32_t count);
>  int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc,
>                                                     struct roc_npc_flow *flow);
> +int __roc_api roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
> +                                            struct roc_npc *roc_npc_dst);
>  #endif /* _ROC_NPC_H_ */
> diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
> index 926d5c2167..4cfdbf38f5 100644
> --- a/drivers/common/cnxk/version.map
> +++ b/drivers/common/cnxk/version.map
> @@ -286,6 +286,7 @@ INTERNAL {
>         roc_npc_mcam_write_entry;
>         roc_npc_mcam_read_counter;
>         roc_npc_profile_name_get;
> +       roc_npc_validate_portid_action;
>         roc_plt_init;
>         roc_plt_init_cb_register;
>         roc_sso_dev_fini;
> --
> 2.25.4
>

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

* [dpdk-dev] [PATCH v2 1/2] common/cnxk: add support for rte flow port ID action type
  2021-10-05  3:30 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type psatheesh
  2021-10-05  3:30 ` [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID psatheesh
  2021-10-20 18:33 ` [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type Jerin Jacob
@ 2021-10-21  5:11 ` psatheesh
  2021-10-21  5:11   ` [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID psatheesh
  2 siblings, 1 reply; 6+ messages in thread
From: psatheesh @ 2021-10-21  5:11 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Ray Kinsella
  Cc: dev, Satheesh Paul

From: Satheesh Paul <psatheesh@marvell.com>

This patch adds ROC API to support rte flow port ID action type.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc.c   | 35 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_npc.h   |  9 +++++++++
 drivers/common/cnxk/version.map |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 3ab8daa7ed..0a7966b52e 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -261,11 +261,38 @@ roc_npc_fini(struct roc_npc *roc_npc)
 	return 0;
 }
 
+int
+roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+			       struct roc_npc *roc_npc_dst)
+{
+	struct roc_nix *roc_nix_src = roc_npc_src->roc_nix;
+	struct nix *nix_src = roc_nix_to_nix_priv(roc_nix_src);
+	struct roc_nix *roc_nix_dst = roc_npc_dst->roc_nix;
+	struct nix *nix_dst = roc_nix_to_nix_priv(roc_nix_dst);
+
+	if (roc_nix_is_pf(roc_npc_dst->roc_nix)) {
+		plt_err("Output port should be VF");
+		return -EINVAL;
+	}
+
+	if (nix_dst->dev.vf >= nix_src->dev.maxvf) {
+		plt_err("Invalid VF for output port");
+		return -EINVAL;
+	}
+
+	if (nix_src->dev.pf != nix_dst->dev.pf) {
+		plt_err("Output port should be VF of ingress PF");
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static int
 npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	const struct roc_npc_action_port_id *act_portid;
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_meter *act_mtr;
@@ -328,6 +355,14 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 			pf_func = (pf_func | (vf_id + 1));
 			break;
 
+		case ROC_NPC_ACTION_TYPE_PORT_ID:
+			act_portid = (const struct roc_npc_action_port_id *)
+					     actions->conf;
+			pf_func &= (0xfc00);
+			pf_func = (pf_func | (act_portid->id + 1));
+			req_act |= ROC_NPC_ACTION_TYPE_VF;
+			break;
+
 		case ROC_NPC_ACTION_TYPE_QUEUE:
 			act_q = (const struct roc_npc_action_queue *)
 					actions->conf;
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index 10d1ac82a4..ef85073b17 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -77,6 +77,7 @@ enum roc_npc_action_type {
 	ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),
 	ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),
 	ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),
+	ROC_NPC_ACTION_TYPE_PORT_ID = (1 << 16),
 	ROC_NPC_ACTION_TYPE_METER = (1 << 17),
 };
 
@@ -95,6 +96,12 @@ struct roc_npc_action_vf {
 	uint32_t id;		/**< VF ID. */
 };
 
+struct roc_npc_action_port_id {
+	uint32_t original : 1;	/**< Use original DPDK port ID if possible. */
+	uint32_t reserved : 31; /**< Reserved, must be zero. */
+	uint32_t id;		/**< port ID. */
+};
+
 struct roc_npc_action_queue {
 	uint16_t index; /**< Queue index to use. */
 };
@@ -240,4 +247,6 @@ int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,
 					      uint32_t count);
 int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc,
 						    struct roc_npc_flow *flow);
+int __roc_api roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+					     struct roc_npc *roc_npc_dst);
 #endif /* _ROC_NPC_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index f5de985224..8d4d42f476 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -302,6 +302,7 @@ INTERNAL {
 	roc_npc_mcam_write_entry;
 	roc_npc_mcam_read_counter;
 	roc_npc_profile_name_get;
+	roc_npc_validate_portid_action;
 	roc_plt_init;
 	roc_plt_init_cb_register;
 	roc_sso_dev_fini;
-- 
2.25.4


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

* [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID
  2021-10-21  5:11 ` [dpdk-dev] [PATCH v2 " psatheesh
@ 2021-10-21  5:11   ` psatheesh
  2021-10-21 17:03     ` Jerin Jacob
  0 siblings, 1 reply; 6+ messages in thread
From: psatheesh @ 2021-10-21  5:11 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Satheesh Paul

From: Satheesh Paul <psatheesh@marvell.com>

This patch adds support for rte flow action type port_id to
enable directing packets from an input port PF to an output
port which is a VF of the input port PF.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 doc/guides/nics/cnxk.rst          |  5 +++++
 doc/guides/nics/features/cnxk.ini |  1 +
 drivers/net/cnxk/cnxk_rte_flow.c  | 36 +++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst
index d3d9682501..05c66d94b1 100644
--- a/doc/guides/nics/cnxk.rst
+++ b/doc/guides/nics/cnxk.rst
@@ -305,6 +305,11 @@ RTE flow GRE support
 - ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
   bits in the GRE header are equal to 0.
 
+RTE flow action port_id support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
+
 Custom protocols supported in RTE Flow
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
index f0586457ca..03af0da302 100644
--- a/doc/guides/nics/features/cnxk.ini
+++ b/doc/guides/nics/features/cnxk.ini
@@ -85,6 +85,7 @@ of_push_vlan         = Y
 of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
 pf                   = Y
+port_id              = Y
 queue                = Y
 rss                  = Y
 security             = Y
diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c
index ad89a2e105..dfc33ba865 100644
--- a/drivers/net/cnxk/cnxk_rte_flow.c
+++ b/drivers/net/cnxk/cnxk_rte_flow.c
@@ -110,7 +110,13 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 		 struct roc_npc_action in_actions[], uint32_t *flowkey_cfg)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const struct rte_flow_action_port_id *port_act;
 	const struct rte_flow_action_queue *act_q;
+	struct roc_npc *roc_npc_src = &dev->npc;
+	struct rte_eth_dev *portid_eth_dev;
+	char if_name[RTE_ETH_NAME_MAX_LEN];
+	struct cnxk_eth_dev *hw_dst;
+	struct roc_npc *roc_npc_dst;
 	int i = 0, rc = 0;
 	int rq;
 
@@ -146,6 +152,36 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 			in_actions[i].conf = actions->conf;
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;
+			in_actions[i].conf = actions->conf;
+			port_act = (const struct rte_flow_action_port_id *)
+					   actions->conf;
+			if (rte_eth_dev_get_name_by_port(port_act->id,
+							 if_name)) {
+				plt_err("Name not found for output port id");
+				goto err_exit;
+			}
+			portid_eth_dev = rte_eth_dev_allocated(if_name);
+			if (!portid_eth_dev) {
+				plt_err("eth_dev not found for output port id");
+				goto err_exit;
+			}
+			if (strcmp(portid_eth_dev->device->driver->name,
+				   eth_dev->device->driver->name) != 0) {
+				plt_err("Output port not under same driver");
+				goto err_exit;
+			}
+			hw_dst = portid_eth_dev->data->dev_private;
+			roc_npc_dst = &hw_dst->npc;
+
+			rc = roc_npc_validate_portid_action(roc_npc_src,
+							    roc_npc_dst);
+
+			if (rc)
+				goto err_exit;
+			break;
+
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 			act_q = (const struct rte_flow_action_queue *)
 					actions->conf;
-- 
2.25.4


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

* Re: [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID
  2021-10-21  5:11   ` [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID psatheesh
@ 2021-10-21 17:03     ` Jerin Jacob
  0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2021-10-21 17:03 UTC (permalink / raw)
  To: Satheesh Paul, Ferruh Yigit
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao, dpdk-dev

On Thu, Oct 21, 2021 at 10:41 AM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> This patch adds support for rte flow action type port_id to
> enable directing packets from an input port PF to an output
> port which is a VF of the input port PF.
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>


Series Acked-by: Jerin Jacob <jerinj@marvell.com>
Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.


> ---
>  doc/guides/nics/cnxk.rst          |  5 +++++
>  doc/guides/nics/features/cnxk.ini |  1 +
>  drivers/net/cnxk/cnxk_rte_flow.c  | 36 +++++++++++++++++++++++++++++++
>  3 files changed, 42 insertions(+)
>
> diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst
> index d3d9682501..05c66d94b1 100644
> --- a/doc/guides/nics/cnxk.rst
> +++ b/doc/guides/nics/cnxk.rst
> @@ -305,6 +305,11 @@ RTE flow GRE support
>  - ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
>    bits in the GRE header are equal to 0.
>
> +RTE flow action port_id support
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +- ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
> +
>  Custom protocols supported in RTE Flow
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
> index f0586457ca..03af0da302 100644
> --- a/doc/guides/nics/features/cnxk.ini
> +++ b/doc/guides/nics/features/cnxk.ini
> @@ -85,6 +85,7 @@ of_push_vlan         = Y
>  of_set_vlan_pcp      = Y
>  of_set_vlan_vid      = Y
>  pf                   = Y
> +port_id              = Y
>  queue                = Y
>  rss                  = Y
>  security             = Y
> diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c
> index ad89a2e105..dfc33ba865 100644
> --- a/drivers/net/cnxk/cnxk_rte_flow.c
> +++ b/drivers/net/cnxk/cnxk_rte_flow.c
> @@ -110,7 +110,13 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
>                  struct roc_npc_action in_actions[], uint32_t *flowkey_cfg)
>  {
>         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
> +       const struct rte_flow_action_port_id *port_act;
>         const struct rte_flow_action_queue *act_q;
> +       struct roc_npc *roc_npc_src = &dev->npc;
> +       struct rte_eth_dev *portid_eth_dev;
> +       char if_name[RTE_ETH_NAME_MAX_LEN];
> +       struct cnxk_eth_dev *hw_dst;
> +       struct roc_npc *roc_npc_dst;
>         int i = 0, rc = 0;
>         int rq;
>
> @@ -146,6 +152,36 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
>                         in_actions[i].conf = actions->conf;
>                         break;
>
> +               case RTE_FLOW_ACTION_TYPE_PORT_ID:
> +                       in_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;
> +                       in_actions[i].conf = actions->conf;
> +                       port_act = (const struct rte_flow_action_port_id *)
> +                                          actions->conf;
> +                       if (rte_eth_dev_get_name_by_port(port_act->id,
> +                                                        if_name)) {
> +                               plt_err("Name not found for output port id");
> +                               goto err_exit;
> +                       }
> +                       portid_eth_dev = rte_eth_dev_allocated(if_name);
> +                       if (!portid_eth_dev) {
> +                               plt_err("eth_dev not found for output port id");
> +                               goto err_exit;
> +                       }
> +                       if (strcmp(portid_eth_dev->device->driver->name,
> +                                  eth_dev->device->driver->name) != 0) {
> +                               plt_err("Output port not under same driver");
> +                               goto err_exit;
> +                       }
> +                       hw_dst = portid_eth_dev->data->dev_private;
> +                       roc_npc_dst = &hw_dst->npc;
> +
> +                       rc = roc_npc_validate_portid_action(roc_npc_src,
> +                                                           roc_npc_dst);
> +
> +                       if (rc)
> +                               goto err_exit;
> +                       break;
> +
>                 case RTE_FLOW_ACTION_TYPE_QUEUE:
>                         act_q = (const struct rte_flow_action_queue *)
>                                         actions->conf;
> --
> 2.25.4
>

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

end of thread, other threads:[~2021-10-21 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05  3:30 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type psatheesh
2021-10-05  3:30 ` [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID psatheesh
2021-10-20 18:33 ` [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type Jerin Jacob
2021-10-21  5:11 ` [dpdk-dev] [PATCH v2 " psatheesh
2021-10-21  5:11   ` [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID psatheesh
2021-10-21 17:03     ` 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).