raw_encap/decap Action with Indirect Action Handle
Encap/decap actions sharing the same variants in a table may be much less than the expected maximal rules. Pre-allocating the reformat actions with this number is a misusage of hardware resources therefore, indirect action for encap/decap is recommended in such scenarios. An indirect encap/decap action can be shared by different flow rules among different tables, thus, it reduces any memory footprint and cache-misses, increases overall PPS and enables use of higher scale of flows through optimized resources.
port stop all
set raw_decap 0
eth src is 10
:22
:33
:44
:55
:60
dst is a0:bb:cc:dd:ee:f2 / ipv4 src is 1.1
.1.1
dst is 2.2
.2.2
ttl is 10
/ gre protocol is 0x800
/ end_set
set raw_decap 2
eth src is 10
:22
:33
:44
:55
:60
dst is a0:bb:cc:dd:ee:f2 / ipv6 src is 1
::1
dst is 2
::2
/ gre protocol is 0x86dd
/ end_set
set raw_encap 0
eth src is 10
:22
:33
:44
:55
:60
dst is a0:bb:cc:dd:ee:f2 type is 0x800
/ end_set
set raw_encap 2
eth src is 10
:00
:00
:00
:00
:10
dst is 20
:00
:00
:00
:00
:20
type is 0x86dd
/ end_set
flow indirect_action 0
create action_id 10
transfer list actions raw_decap index 0
/ raw_encap index 0
/ end
flow indirect_action 0
create action_id 11
transfer list actions raw_decap index 2
/ raw_encap index 2
/ end
flow pattern_template 0
create transfer relaxed no pattern_template_id 1
template represented_port ethdev_port_id is 0
/ eth / end
flow actions_template 0
create transfer actions_template_id 1
template indirect_list handle 10
/ represented_port ethdev_port_id 1
/ end mask indirect_list / represented_port ethdev_port_id 0
/ end
If ID is provided in the action template mask, it means all rules share the same indirect reformat actions, otherwise, each rule can specify its unique action. The indirect action in flow rules must be the same type as the one in action template like L2_ENCAP/DECAP, L3_ENCAP/DECAP
.
Create Indirect Actions List REFORMAT
const
struct rte_flow_action reformat_indirect_actions_list_obj[3
] = { [0
] = { .type = RTE_FLOW_ACTION_TYPE_RAW_DECAP, .conf = {.size = decap_size} }, [1
] = { .type = RTE_FLOW_ACTION_TYPE_RAW_ENCAP, .conf = {.data = encap_buffer, .size = encap_size} }, [2
] = { .type = RTE_FLOW_ACTION_TYPE_END } };const
struct struct rte_flow_indir_action_conf conf = { .transfer =1
}; struct rte_flow_action_list_handle *reformat_indirect_list_handle = rte_flow_action_list_handle_create(port_id, &conf, reformat_indirect_actions_list_obj, error);Create Flow Rule
const
struct rte_flow_action_indirect_list reformat_actions_list_conf = { .handle = reformat_indirect_list_handle, .conf = NULL };const
struct rte_flow_action flow_actions[] = { [0
] = { .type = RTE_FLOW_ACTION_TYPE_INDIRECT_LIST, .conf = &reformat_indirect_actions_list_conf [1
] = { .type = RTE_FLOW_ACTION_TYPE_JUMP, .conf = &jump_conf }, [2
] = { .type = RTE_FLOW_ACTION_TYPE_END, }, };