Use this DPDK API example to configure the SmartNIC to forward IP fragments to a dedicated queue in the host.
Forwarding IP fragments to a queue
It is possible to identify all fragments and forward to a specific queue as shown in the
following
example.
/* Create group 0 flow to forward IPv4 fragments to queue 1. */ struct rte_flow_attr attr = { .group = 0, .ingress = 1 }; struct rte_flow_item_ipv4 ipv4 = { .hdr = { .fragment_offset = RTE_BE16(0xffff) }}; struct rte_flow_item pattern[] = { [0] = { .type = RTE_FLOW_ITEM_TYPE_IPV4, .spec = &ipv4, .mask = &ipv4 }, [1] = { .type = RTE_FLOW_ITEM_TYPE_END }}; struct rte_flow_action_queue queue = { .index = 1 }; struct rte_flow_action action[] = { [0] = { .type = RTE_FLOW_ACTION_TYPE_QUEUE, .conf = &queue }, [1] = { .type = RTE_FLOW_ACTION_TYPE_END }}; struct rte_flow_error error; struct rte_flow *flow = rte_flow_create(PORT_ID, &attr, pattern, action, &error); if (!flow) { /* Error handling */ }This example creates a flow rule with a group ID of 1 for frames received on port 1. The pattern array includes an IPv4 item with a specific mask matching the fragment offset field for all fragments. The action is defined to forward the traffic to queue 1.
Note: IP fragments must be processed in the application because the flow of subsequent
fragments may not be detected as the same flow as the first fragment in the SmartNIC.