[dpdk-dev] [PATCH 3/8] librte_ethdev: add map action

Bernard Iremonger bernard.iremonger at intel.com
Wed Jun 3 16:20:04 CEST 2020


add MK_FLOW_ACTION(MAP, sizeof(struct rte_flow_action_map))
add case RTE_FLOW_ACTION_TYPE_MAP

Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
 lib/librte_ethdev/rte_flow.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 1685be5..b963d9f 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -173,6 +173,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct rte_flow_action_set_dscp)),
 	MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct rte_flow_action_set_dscp)),
 	MK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)),
+	MK_FLOW_ACTION(MAP, sizeof(struct rte_flow_action_map)),
 };
 
 int
@@ -596,11 +597,13 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
 			const struct rte_flow_action_rss *rss;
 			const struct rte_flow_action_vxlan_encap *vxlan_encap;
 			const struct rte_flow_action_nvgre_encap *nvgre_encap;
+			const struct rte_flow_action_map *map;
 		} src;
 		union {
 			struct rte_flow_action_rss *rss;
 			struct rte_flow_action_vxlan_encap *vxlan_encap;
 			struct rte_flow_action_nvgre_encap *nvgre_encap;
+			struct rte_flow_action_map *map;
 		} dst;
 		size_t tmp;
 		int ret;
@@ -665,6 +668,17 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
 			off += ret;
 		}
 		break;
+	case RTE_FLOW_ACTION_TYPE_MAP:
+		src.map = action->conf;
+		dst.map = buf;
+		rte_memcpy(dst.map,
+			   (&(struct rte_flow_action_map){
+				.pctype = src.map->pctype,
+				.flowtype = src.map->flowtype,
+			   }),
+			   size > sizeof(*dst.map) ? sizeof(*dst.map) : size);
+		off = sizeof(*dst.map);
+		break;
 	default:
 		off = rte_flow_desc_action[action->type].size;
 		rte_memcpy(buf, action->conf, (size > off ? off : size));
-- 
2.7.4



More information about the dev mailing list