Search code examples
dpdk

rte flow for arp packet with dpdk


Is there a way using rte_flow to send arp and ndp packet to specific rx queue with dpdk

In the rte_flow_item_type I don’t see an entry for arp or ndp

For ipv4 I did the following way

                                                pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
                                                pattern[0].spec = NULL;

                                                pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
                                                pattern[1].spec = NULL;

What do i ned to do for arp and ndp? There is no RTE_FLOW_ITEM_TYPE_ARP

  • Dpdk version: 19.11
  • NIC: mlx5, 100G mellanox card,

Solution

  • Since v18.05-rc1, there has been item type RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. That being said, it might be unsupported by the PMD in question.

    Consider matching on the EtherType field instead:

    #include <rte_byteorder.h>
    #include <rte_ether.h>
    #include <rte_flow.h>
    
            struct rte_flow_item_eth  item_eth_mask = {};
            struct rte_flow_item_eth  item_eth_spec = {};
    
            item_eth_spec.hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_ARP);
            item_eth_mask.hdr.ether_type = RTE_BE16(0xFFFF);
    
            pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
            pattern[0].mask = &item_eth_mask;
            pattern[0].spec = &item_eth_spec;
    

    In what comes to NDP, perhaps it pays to check out RTE_FLOW_ITEM_TYPE_ICMP6_ND_*. Again, these might be unsupported by the PMD in question. If that is the case, consider the use of RTE_FLOW_ITEM_TYPE_ICMP6 to redirect all of ICMPv6 to the dedicated queue.