[06/13] app/testpmd: add port steering targets to sample flow action

Message ID 20220812191827.3187441-7-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 success coding style OK

Commit Message

Ivan Malov Aug. 12, 2022, 7:18 p.m. UTC
  Allow the use of actions PORT_REPRESENTOR / REPRESENTED_PORT
as targets in "set sample_actions" command.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 app/test-pmd/cmdline_flow.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 7f50028eb7..23889f7ab1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -781,6 +781,8 @@  struct action_vxlan_encap_data sample_vxlan_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_nvgre_encap_data sample_nvgre_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
+struct rte_flow_action_ethdev sample_port_representor[RAW_SAMPLE_CONFS_MAX_NUM];
+struct rte_flow_action_ethdev sample_represented_port[RAW_SAMPLE_CONFS_MAX_NUM];
 
 static const char *const modify_field_ops[] = {
 	"set", "add", "sub", NULL
@@ -10872,6 +10874,18 @@  cmd_set_raw_parsed_sample(const struct buffer *in)
 			parse_setup_nvgre_encap_data(&sample_nvgre_encap[idx]);
 			action->conf = &sample_nvgre_encap[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
+			size = sizeof(struct rte_flow_action_ethdev);
+			rte_memcpy(&sample_port_representor[idx],
+					(const void *)action->conf, size);
+			action->conf = &sample_port_representor[idx];
+			break;
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
+			size = sizeof(struct rte_flow_action_ethdev);
+			rte_memcpy(&sample_represented_port[idx],
+					(const void *)action->conf, size);
+			action->conf = &sample_represented_port[idx];
+			break;
 		default:
 			fprintf(stderr, "Error - Not supported action\n");
 			return;