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

Matching Network Service Header (NSH)

Network Service Header (NSH) provides a mechanism for metadata exchange along the instantiated service paths. The NSH is the Service Function Chaining (SFC) encapsulation required to support the SFC architecture (defined in RFC 7665).

NSH, a data-plane protocol can be matched now using the existed item: RTE_FLOW_ITEM_TYPE_NSH. Currently this is supported ONLY when NSH follows VXLAN-GPE, and the “l3_vxlan_en=1” and “dv_flow_en=1” (Default) is set.

Note

NSH fields matching is not supported.

To match on NSH to port_id 1:

Copy
Copied!
            

flow create 0 transfer group 0 pattern eth / end actions count / jump group 1 / end flow create 0 transfer group 1 pattern eth / ipv6 / udp dst is 250 / vxlan-gpe / nsh / eth / end actions port_id id 1 / end

Copy
Copied!
            

struct rte_flow_attr attr = {0}; struct rte_flow_item pattern[MAX_PATTERNS_NUM] = {0}; struct rte_flow_action action[MAX_ACTIONS_NUM] = {0}; struct rte_flow_action_port_id port_id = {.id = 1}; struct rte_flow_item_udp  spec = {0}; struct rte_flow_item_udp  mask = {0}; struct rte_flow *flow = NULL; struct rte_flow_error error; uint16_t port = 0; int ret;   attr.transfer = 1; attr.group = 1; attr.priority = 0;   pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV6;   pattern[2].type = RTE_FLOW_ITEM_TYPE_UDP; spec.hdr.dst_port = RTE_BE16(250); mask.hdr.dst_port = RTE_BE16(0xffff); pattern[2].spec = &spec; pattern[2].mask = &mask;   pattern[3].type = RTE_FLOW_ITEM_TYPE_VXLAN_GPE; pattern[4].type = RTE_FLOW_ITEM_TYPE_NSH; pattern[5].type = RTE_FLOW_ITEM_TYPE_ETH; pattern[6].type = RTE_FLOW_ITEM_TYPE_END;   action[0].type = RTE_FLOW_ACTION_TYPE_PORT_ID; action[0].conf = &port_id; action[1].type = RTE_FLOW_ACTION_TYPE_END;   ret = rte_flow_validate(port, &attr, pattern, action, &error); if (!ret) flow = rte_flow_create(port, &attr, pattern, action, &error); return flow;

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