[dpdk-dev] [PATCH v1 11/12] net/octeontx2: support ethdev flow action

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Fri Oct 1 15:47:15 CEST 2021


PORT_ID action implementation works for ingress only and has the same
semantics as ETHDEV action.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
---
 drivers/net/octeontx2/otx2_flow_parse.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c
index 63a33142a5..5dd8464ec9 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_count *act_count;
 	const struct rte_flow_action_mark *act_mark;
 	const struct rte_flow_action_queue *act_q;
@@ -987,9 +986,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_ETHDEV:
+			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->id;
+			}
 			if (rte_eth_dev_get_name_by_port(port_id, if_name)) {
 				errmsg = "Name not found for output port id";
 				errcode = EINVAL;
-- 
2.30.2



More information about the dev mailing list