[dpdk-users] Flow director struct rte_flow_item_raw guild

Adrien Mazarguil adrien.mazarguil at 6wind.com
Fri May 10 15:44:27 CEST 2019


On Fri, May 10, 2019 at 02:38:56PM +0800, 曾懷恩 wrote:
> Hi Adrien, thanks for reply and explanation 
> 
> I can understand the principle now.
> 
> However, I try to merge your rewriting code to mine and the ICMP packets seem not to fit this rule.
> 
> My ethernet card is Connectx-4 lx.

Bad news then, you can't match ICMP using RAW pattern items with mlx5
yet. According to "git grep -l RTE_FLOW_ITEM_TYPE_RAW drivers/net" so far
only e1000/igb, enic, i40e, ixgbe and softnic PMDs provide some form of
support for RTE_FLOW_ITEM_RAW.

> Can you give me some suggestion?

Since RTE_FLOW_ITEM_TYPE_ICMP is neither supported by mlx5, how about
directly matching the protocol field inside IPv4 headers?

 struct rte_flow_item_ipv4 item_ipv4[] = {
     {
         .hdr.next_proto_id = 0x01,
     },
     {
         .hdr.next_proto_id = 0xff,
     },
 };
 struct rte_flow_pattern pattern[] = {
     {
         .type = RTE_FLOW_ITEM_TYPE_IPV4,
         .spec = &item_ipv4[0],
         .mask = &item_ipv4[1],
     },
     {
         .type = RTE_FLOW_ITEM_TYPE_END,
     },
 };

Should be all it takes to match ICMPv4 packets. Compared to the RAW
approach, this one should also match ICMP traffic inside recognized VLAN,
QinQ and tunnel types (e.g. VXLAN) at no extra cost.

-- 
Adrien Mazarguil
6WIND


More information about the users mailing list