When relaxed mode is set, definer only programs the fields with
mask in the pattern template.

Assume a template like "ipv6_routing_ext ext_next_hdr mask 0xff ext_type
mask 0xff  / udp dst mask 0xffff" and rule like "ipv6_routing_ext
ext_next_hdr spec 17 ext_next_hdr mask 0xff ext_type spec 4 ext_type
mask 0xff / udp dst spec 100 dst mask 0xffff", there is a potential
mis-matching.

1. User sends first packet as:
   Ether()/IPv6()/IPv6ExtHdrSegmentRouting()/UDP(sport=100,dport=200)
   Miss due to unexpected UDP dport.
2. User sends 2nd packet as:
   Ether()/IPv6()/UDP(sport=100,dport=100)
   Packet hit. Hardware cached the IPv6 routing extension information
   in the 1st packet and plus the UDP dport in the 2nd packet, it
   matches the rule by mistake.

Signed-off-by: Rongwei Liu <rongw...@nvidia.com>
Cc: sta...@dpdk.org

Reviewed-by: Erez Shitrit <ere...@nvidia.com>
Acked-by: Suanming Mou <suanmi...@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c 
b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 7dffbfb9b9..c0ccde64e1 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -2143,6 +2143,9 @@ mlx5dr_definer_conv_item_ipv6_routing_ext(struct 
mlx5dr_definer_conv_data *cd,
                        fc->tag_mask_set = &mlx5dr_definer_ones_set;
                        DR_CALC_SET(fc, eth_l3, protocol_next_header, inner);
                }
+       } else {
+               rte_errno = ENOTSUP;
+               return rte_errno;
        }
 
        if (!m)
-- 
2.27.0

Reply via email to