Matching Port Representor
Added port representor item support in PMD for matching traffic from port representor.
This feature is for SWS only, not for HWS.
To match on traffic from port representor 1 and redirect to port 2:
testpmd> flow create 0
ingress transfer pattern eth / port_representor port_id is 1
/ end actions represented_port ethdev_id is 2
/ end
/* With rte_flow API */
struct rte_flow_attr attr;
struct rte_flow_error error;
struct rte_flow_item pattern[MAX_PATTERN_NUM];
struct rte_flow_action action[MAX_ACTION_NUM];
struct rte_flow_action_ethdev represented_port = { .port_id = 2
};
memset(&attr, 0
, sizeof(struct rte_flow_attr));
attr.ingress = 1
;
attr.transfer = 1
;
attr.group = 1
;
attr.priority = 1
;
struct rte_flow_item_ethdev port_representor_spec = {
.port_id = RTE_BE16(1
),
};
pattern[0
].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[1
].type = RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR;
pattern[1
].spec = &port_representor_spec;
pattern[2
].type = RTE_FLOW_ITEM_TYPE_END;
action[0
].type = RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT;
action[0
].conf = &represented_port;
action[1
].type = RTE_FLOW_ACTION_TYPE_END;
res = rte_flow_validate(port_id, &attr, pattern, action, &error);
if
(!res)
flow = rte_flow_create(port_id, &attr, pattern, action, &error);
return
flow;