What can I help you with?
NVIDIA DPDK Documentation MLNX_DPDK_22.11_2310.5.1 LTS

Yellow Meter Hierarchy with Color Aware

Added a new color (yellow) to the meter hierarchy. The yellow action can also use the same meter as green action in a meter hierarchy, so both green/yellow packets will all go to the next meter. The color aware mode can be configured when creating the next meter, so the green/yellow packets can be distinguished by subsequent meters in hierarchy.

Copy
Copied!
            

testpmd> add port meter profile srtcm_rfc4115 0 1 100000 100000 5000 50000 0 testpmd> add port meter policy 0 1 g_actions queue index 1 / end y_actions queue index 2 / end r_actions drop / end testpmd> create port meter 0 1 1 1 yes 0xffff 0 1 testpmd> add port meter profile srtcm_rfc4115 0 2 200000 200000 5000 50000 0 testpmd> add port meter policy 0 2 g_actions meter mtr_id 1 / end y_actions meter  mtr_id 1 / end r_actions drop / end testpmd> create port meter 0 2 2 2 yes 0xffff 0 0 testpmd> flow create 0 priority 3 ingress group 0 pattern eth / end actions  jump group 1 / count / end testpmd> flow create 0 priority 2 ingress group 1 pattern eth / end actions meter mtr_id 2 / end

Copy
Copied!
            

uint16_t port_id = 0; int shared = 1; struct rte_mtr_error error;     // Create next meter with color aware enabled. uint32_t next_profile_id = 1; uint32_t next_policy_id = 1; uint32_t next_mtr_id = 1;     struct rte_mtr_params params = {}; params.meter_profile_id = next_profile_id; params.use_prev_mtr_color = 1; params.meter_enable = 1; params.stats_mask = 0xffff; params.meter_policy_id = next_policy_id;     rte_mtr_create(port_id, next_mtr_id, params, shared, &error); ……   // Create hierarchy policy whose green/yellow both go to next meter struct rte_mtr_meter_policy_params policy; uint32_t policy_id = 2; int ret;   struct rte_flow_action_meter next_meter = {.mtr_id = next_mtr_id};   struct rte_flow_action g_actions[] = {     {            .type = RTE_FLOW_ACTION_TYPE_METER,            .conf = &next_meter,     },     {            .type = RTE_FLOW_ACTION_TYPE_END,     }, };     struct rte_flow_action y_actions[] = {     {            .type = RTE_FLOW_ACTION_TYPE_METER,            .conf = &next_meter,     },     {            .type = RTE_FLOW_ACTION_TYPE_END,     }, };   struct rte_flow_action r_actions[] = {     {            .type = RTE_FLOW_ACTION_TYPE_DROP,     },     {            .type = RTE_FLOW_ACTION_TYPE_END,     }, };     policy.action[RTE_COLOR_GREEN] = g_actions; policy.action[RTE_COLOR_YELLOW] = y_actions; policy.action[RTE_COLOR_RED] = r_actions;   ret = rte_mtr_meter_policy_add(port_id, policy_id, &policy, &error); if (ret)     print_mtr_err_msg(&error); …

© Copyright 2024, NVIDIA. Last updated on Jan 9, 2025.