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

ECN in IP Header Modification

ECN field in the IPv4/IPv6 header can now be modified using the modify field action which now can be modified in the meter policy.

Users can set the ECN field to 3 with the below command:

Copy
Copied!
            

testpmd> flow create 0 ingress pattern eth / ipv4 / end actions modify_field op set dst_type ipv4_ecn src_type value src_value 0x03 witdh 2 / queue index 0 / end

Users can also use the modify field action in the meter as below:

Copy
Copied!
            

testpmd> add port meter profile srtcm_rfc2697 0 11 100 100 0 1 testpmd> add port meter policy 0 21 g_actions port_id id 1 / end y_actions end r_actions drop / end testpmd> add port meter policy 0 21 g_actions modify_field op set dst_type ipv4_ecn src_type value src_value 3 width 2 / port_id id 1 / end y_actions end r_actions drop / end testpmd> flow create 0 ingress transfer pattern eth / ipv4 / end actions meter mtr_id 1 / end

Copy
Copied!
            

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_queue queue = { .index = 1 };   memset(&attr, 0, sizeof(struct rte_flow_attr));   attr.ingress = 1; attr.group = 1; attr.priority = 1;   pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4; pattern[2].type = RTE_FLOW_ITEM_TYPE_END;   struct rte_flow_action_modify_field modify_field = {        .opreation = RTE_FLOW_MODIFY_SET,        .dst = {                .field = RTE_FLOW_FIELD_IPV4_ECN,        };        .src = {                .field = RTE_FLOW_FIELD_VALUE,                .value = 3,        },        .width = 2, };   action[0].type = RTE_FLOW_ACTION_TYPE_MODIFY_FIELD; action[0].conf = &modify_field; action[1].type = RTE_FLOW_ACTION_TYPE_QUEUE; action[1].conf = &queue; action[2].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;

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