net/ice: support original represented_port action

Message ID 20220826072545.18127-1-zhichaox.zeng@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/ice: support original represented_port action |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing warning apply patch failure
ci/intel-Testing success Testing PASS

Commit Message

Zhichao Zeng Aug. 26, 2022, 7:25 a.m. UTC
  From: Zhichao Zeng <zhichaox.zeng@intel.com>

Add support to send matching traffic to the original DCF port
with represented_port action by using DCF port id as ethdev_port_id.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index da81e49bfa..dbcb8bdfdc 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1623,6 +1623,7 @@  ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 	const struct rte_eth_dev *repr_dev;
 	enum rte_flow_action_type action_type;
 	uint16_t rule_port_id, backer_port_id;
+	const char *pf_dev_name;
 
 	for (action = actions; action->type !=
 				RTE_FLOW_ACTION_TYPE_END; action++) {
@@ -1638,8 +1639,11 @@  ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 
 			rule_port_id = ad->parent.pf.dev_data->port_id;
 			backer_port_id = repr_dev->data->backer_port_id;
+			pf_dev_name = ad->parent.pf.dev_data->name;
 
-			if (backer_port_id != rule_port_id)
+			if (backer_port_id != rule_port_id &&
+					strncmp(pf_dev_name, repr_dev->data->name,
+							strlen(pf_dev_name)))
 				goto invalid;
 
 			rule_info->sw_act.vsi_handle = repr_dev->data->representor_id;