[04/13] net/dpaa2: support represented port flow action

Message ID 20220812191827.3187441-5-ivan.malov@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series ethdev: proceed with flow subsystem rework |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ivan Malov Aug. 12, 2022, 7:18 p.m. UTC
  There's been support for similar actions PHY_PORT and PORT_ID
for some time already, but these actions are being deprecated.
Support action REPRESENTED_PORT to prepare for the transition.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 doc/guides/nics/features/dpaa2.ini     |  1 +
 doc/guides/rel_notes/release_22_11.rst |  4 ++++
 drivers/net/dpaa2/dpaa2_flow.c         | 12 +++++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)
  

Patch

diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini
index 4c06841a87..53148ad467 100644
--- a/doc/guides/nics/features/dpaa2.ini
+++ b/doc/guides/nics/features/dpaa2.ini
@@ -48,4 +48,5 @@  drop                 = Y
 phy_port             = Y
 port_id              = Y
 queue                = Y
+represented_port     = Y
 rss                  = Y
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index b74e90d27f..6ab0cae78b 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -55,6 +55,10 @@  New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated dpaa2 PMD.**
+
+  * Added support for flow action REPRESENTED_PORT.
+
 
 Removed Items
 -------------
diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index bf55eb70a3..25616b0035 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -85,6 +85,7 @@  enum rte_flow_action_type dpaa2_supported_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_QUEUE,
 	RTE_FLOW_ACTION_TYPE_PHY_PORT,
 	RTE_FLOW_ACTION_TYPE_PORT_ID,
+	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
 	RTE_FLOW_ACTION_TYPE_RSS
 };
 
@@ -92,7 +93,8 @@  static const
 enum rte_flow_action_type dpaa2_supported_fs_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_QUEUE,
 	RTE_FLOW_ACTION_TYPE_PHY_PORT,
-	RTE_FLOW_ACTION_TYPE_PORT_ID
+	RTE_FLOW_ACTION_TYPE_PORT_ID,
+	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
 };
 
 /* Max of enum rte_flow_item_type + 1, for both IPv4 and IPv6*/
@@ -3294,6 +3296,11 @@  dpaa2_flow_redirect_dev(struct dpaa2_dev_priv *priv,
 					action->conf;
 		if (!port_id->original)
 			idx = port_id->id;
+	} else if (action->type == RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT) {
+		const struct rte_flow_action_ethdev *ethdev;
+
+		ethdev = (const struct rte_flow_action_ethdev *)action->conf;
+		idx = ethdev->port_id;
 	} else {
 		return NULL;
 	}
@@ -3337,6 +3344,7 @@  dpaa2_flow_verify_action(
 				return -1;
 			}
 			break;
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 		case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
 			if (!dpaa2_flow_redirect_dev(priv, &actions[j])) {
@@ -3514,6 +3522,7 @@  dpaa2_generic_flow_set(struct rte_flow *flow,
 	while (!end_of_list) {
 		switch (actions[j].type) {
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 		case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
 			memset(&action, 0, sizeof(struct dpni_fs_action_cfg));
@@ -4088,6 +4097,7 @@  int dpaa2_flow_destroy(struct rte_eth_dev *dev,
 
 	switch (flow->action) {
 	case RTE_FLOW_ACTION_TYPE_QUEUE:
+	case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 	case RTE_FLOW_ACTION_TYPE_PHY_PORT:
 	case RTE_FLOW_ACTION_TYPE_PORT_ID:
 		if (priv->num_rx_tc > 1) {