[v7,11/12] net/octeontx2: support port representor flow action

Message ID 20211013173448.28621-12-ivan.malov@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: rework transfer flow API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ivan Malov Oct. 13, 2021, 5:34 p.m. UTC
  From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Action PORT_ID implementation assumes ingress only. Its semantics
suggests that support for equal action PORT_REPRESENTOR be added.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 doc/guides/nics/features/octeontx2.ini  |  1 +
 doc/guides/nics/octeontx2.rst           |  5 ++++-
 drivers/net/octeontx2/otx2_flow_parse.c | 16 ++++++++++++----
 3 files changed, 17 insertions(+), 5 deletions(-)
  

Comments

Kiran Kumar Kokkilagadda Oct. 20, 2021, 2:33 a.m. UTC | #1
> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Wednesday, October 13, 2021 11:05 PM
> To: dev@dpdk.org
> Cc: Ferruh Yigit <ferruh.yigit@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Ori Kam <orika@nvidia.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>;
> Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> Subject: [EXT] [PATCH v7 11/12] net/octeontx2: support port representor flow
> action
> 
> External Email
> 
> ----------------------------------------------------------------------
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> 
> Action PORT_ID implementation assumes ingress only. Its semantics suggests
> that support for equal action PORT_REPRESENTOR be added.
> 
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>


Acked-by: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>


> ---
>  doc/guides/nics/features/octeontx2.ini  |  1 +
>  doc/guides/nics/octeontx2.rst           |  5 ++++-
>  drivers/net/octeontx2/otx2_flow_parse.c | 16 ++++++++++++----
>  3 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/guides/nics/features/octeontx2.ini
> b/doc/guides/nics/features/octeontx2.ini
> index fa32bc7890..e0277988d4 100644
> --- a/doc/guides/nics/features/octeontx2.ini
> +++ b/doc/guides/nics/features/octeontx2.ini
> @@ -91,6 +91,7 @@ of_set_vlan_pcp      = Y
>  of_set_vlan_vid      = Y
>  pf                   = Y
>  port_id              = Y
> +port_representor     = Y
>  queue                = Y
>  rss                  = Y
>  security             = Y
> diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index
> e35c8116f7..eae32f0afe 100644
> --- a/doc/guides/nics/octeontx2.rst
> +++ b/doc/guides/nics/octeontx2.rst
> @@ -403,10 +403,13 @@ Actions:
>     +----+-----------------------------------------+
>     | 12 | RTE_FLOW_ACTION_TYPE_PORT_ID            |
>     +----+-----------------------------------------+
> +   | 13 | RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR   |
> +   +----+-----------------------------------------+
> 
>  .. note::
> 
> -   ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its
> VFs.
> +   ``RTE_FLOW_ACTION_TYPE_PORT_ID``,
> ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR``
> +   are only supported between PF and its VFs.
> 
>  .. _table_octeontx2_supported_egress_action_types:
> 
> diff --git a/drivers/net/octeontx2/otx2_flow_parse.c
> b/drivers/net/octeontx2/otx2_flow_parse.c
> index 30a232f033..79b92fda8a 100644
> --- a/drivers/net/octeontx2/otx2_flow_parse.c
> +++ b/drivers/net/octeontx2/otx2_flow_parse.c
> @@ -900,7 +900,6 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,  {
>  	struct otx2_eth_dev *hw = dev->data->dev_private;
>  	struct otx2_npc_flow_info *npc = &hw->npc_flow;
> -	const struct rte_flow_action_port_id *port_act;
>  	const struct rte_flow_action_mark *act_mark;
>  	const struct rte_flow_action_queue *act_q;
>  	const struct rte_flow_action_vf *vf_act; @@ -977,9 +976,18 @@
> otx2_flow_parse_actions(struct rte_eth_dev *dev,
>  			break;
> 
>  		case RTE_FLOW_ACTION_TYPE_PORT_ID:
> -			port_act = (const struct rte_flow_action_port_id *)
> -				actions->conf;
> -			port_id = port_act->id;
> +		case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
> +			if (actions->type ==
> RTE_FLOW_ACTION_TYPE_PORT_ID) {
> +				const struct rte_flow_action_port_id
> *port_act;
> +
> +				port_act = actions->conf;
> +				port_id = port_act->id;
> +			} else {
> +				const struct rte_flow_action_ethdev
> *ethdev_act;
> +
> +				ethdev_act = actions->conf;
> +				port_id = ethdev_act->port_id;
> +			}
>  			if (rte_eth_dev_get_name_by_port(port_id, if_name)) {
>  				errmsg = "Name not found for output port id";
>  				errcode = EINVAL;
> --
> 2.20.1
  

Patch

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index fa32bc7890..e0277988d4 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -91,6 +91,7 @@  of_set_vlan_pcp      = Y
 of_set_vlan_vid      = Y
 pf                   = Y
 port_id              = Y
+port_representor     = Y
 queue                = Y
 rss                  = Y
 security             = Y
diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst
index e35c8116f7..eae32f0afe 100644
--- a/doc/guides/nics/octeontx2.rst
+++ b/doc/guides/nics/octeontx2.rst
@@ -403,10 +403,13 @@  Actions:
    +----+-----------------------------------------+
    | 12 | RTE_FLOW_ACTION_TYPE_PORT_ID            |
    +----+-----------------------------------------+
+   | 13 | RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR   |
+   +----+-----------------------------------------+
 
 .. note::
 
-   ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
+   ``RTE_FLOW_ACTION_TYPE_PORT_ID``, ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR``
+   are only supported between PF and its VFs.
 
 .. _table_octeontx2_supported_egress_action_types:
 
diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c
index 30a232f033..79b92fda8a 100644
--- a/drivers/net/octeontx2/otx2_flow_parse.c
+++ b/drivers/net/octeontx2/otx2_flow_parse.c
@@ -900,7 +900,6 @@  otx2_flow_parse_actions(struct rte_eth_dev *dev,
 {
 	struct otx2_eth_dev *hw = dev->data->dev_private;
 	struct otx2_npc_flow_info *npc = &hw->npc_flow;
-	const struct rte_flow_action_port_id *port_act;
 	const struct rte_flow_action_mark *act_mark;
 	const struct rte_flow_action_queue *act_q;
 	const struct rte_flow_action_vf *vf_act;
@@ -977,9 +976,18 @@  otx2_flow_parse_actions(struct rte_eth_dev *dev,
 			break;
 
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
-			port_act = (const struct rte_flow_action_port_id *)
-				actions->conf;
-			port_id = port_act->id;
+		case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
+			if (actions->type == RTE_FLOW_ACTION_TYPE_PORT_ID) {
+				const struct rte_flow_action_port_id *port_act;
+
+				port_act = actions->conf;
+				port_id = port_act->id;
+			} else {
+				const struct rte_flow_action_ethdev *ethdev_act;
+
+				ethdev_act = actions->conf;
+				port_id = ethdev_act->port_id;
+			}
 			if (rte_eth_dev_get_name_by_port(port_id, if_name)) {
 				errmsg = "Name not found for output port id";
 				errcode = EINVAL;