NVIDIA DPDK Documentation MLNX_DPDK_22.11_2310.5.1 LTS

Traffic Metering with Yellow Color Policy

The steering mechanism for metering is enhanced to allow actions to be triggered by the yellow color. The actions supported for the yellow color are the same as that supported for the green. RSS actions could be used for both green and yellow in a single policy, and only the queues attribute could be different. A policy with yellow color action can only be the final one in a metering hierarchy.

Note

To mark the packets with yellow color as well, the EBS (or PBS) should be specified when creating a profile.

Copy
Copied!
            

// Creating a profile with CBS and EBS 5000B and for green color - RSS to queues with mark and for yellow color – specific queue testpmd> add port meter profile srtcm_rfc2697 0 1 10000 5000 50000 0 testpmd> add port meter policy 0 1 g_actions rss queues 0 2 end / mark id 0x10 / end y_actions queue index 3 / mark id 0x20 / end r_actions drop / end testpmd> create port meter 0 1 1 1 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 1 / end

Copy
Copied!
            

struct rte_mtr_meter_policy_params policy; struct rte_mtr_error error; uint32_t policy_id = 10; int ret;   uint16_t queues[4] = {3,1,2,0}; struct rte_flow_action_rss action_rss = {      .func = RTE_ETH_HASH_FUNCTION_DEFAULT,      .level = 0,      .types = ETH_RSS_IP,      .key_len = 40,      .queue_num = 4,      .queue = queues, };   struct rte_flow_action g_actions[] = {      {             .type = RTE_FLOW_ACTION_TYPE_RSS,             .conf = &action_rss,      },      {             .type = RTE_FLOW_ACTION_TYPE_END,      }, };   struct rte_flow_action_queue action_queue = {      .index = 0; };   struct rte_flow_action y_actions[] = {      {             .type = RTE_FLOW_ACTION_TYPE_QUEUE,             .conf = &action_queue,      },      {             .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(0, policy_id,                                 &policy, &error); if (ret)      print_mtr_err_msg(&error); …

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