METER_MARK Action API Change
The "init_color" and "init_color_valid" members are removed from the "rte_flow_action_meter_mark" structure.
The "init_color" attribute is changeable and can be set per flow rule when the meter_mark action has "color_mode" property set to 1 (Color-Aware).
port stop all
flow configure 0 queues_number 4 queues_size 64 meters_number 64
port start all
add port meter profile srtcm_rfc2697 0 20 0x1000 0x600 0x400 0
# base indirect flow action list command
# create indirect meter_mark color-aware action
flow indirect_action 0 create action_id 10 ingress list \
actions meter_mark mtr_profile 20 mtr_state 1 mtr_color_mode 1 / end
# prepare indirect action list update – can be applied to any handle of the same type, on all ports.
# yellow can be used as the init_color as well.
flow indirect_action 0 create action_id 11 flow_conf actions meter_mark_conf mtr_update_init_color red / end
# create flows
flow pattern_template 0 create ingress pattern_template_id 1 template eth / ipv4 / udp / end
flow actions_template 0 create ingress actions_template_id 1 \
template indirect_list handle 10 / jump / end \
mask indirect_list / jump / end
# init_color is not green, the output cannot be green
flow template_table 0 create table_id 1 group 1 priority 0 ingress rules_number 64 pattern_template 1 actions_template 1flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no \
pattern eth / ipv4 / udp / end \
actions indirect_list handle 10 conf 11 / jump group 10 / end
const struct rte_flow_action meter_mark_indirect_actions_list_obj[2] = {
[0] = {
.type = RTE_FLOW_ACTION_TYPE_METER_MARK,
.conf = {.profile = meter_profile, .color_mode = 1, .state = 1},
},
[1] = { .type = RTE_FLOW_ACTION_TYPE_END },
};
const struct struct rte_flow_indir_action_conf conf = { .ingress = 1 };
struct rte_flow_action_list_handle *meter_mask_indirect_list_handle =
rte_flow_action_list_handle_create(port_id, &conf,
meter_mark_indirect_actions_list_obj, error);
const struct rte_flow_action_indirect_list indirect_actions_list_conf = {
.handle = meter_mask_indirect_list_handle,
.conf = {
[0] = & (const struct rte_flow_indirect_update_flow_meter_mark) {
.init_color = RTE_COLOR_RED, /* Or Yellow */
},
},
};
const struct rte_flow_action flow_actions[] = {
[0] = {
.type = RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
.conf = &indirect_actions_list_conf,
[1] = {
.type = RTE_FLOW_ACTION_TYPE_JUMP,
.conf = &jump_conf,
},
[2] = {
.type = RTE_FLOW_ACTION_TYPE_END,
},
};