]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net/mlx5: HWS, Disallow matcher IP version mixing
authorVlad Dogaru <vdogaru@nvidia.com>
Tue, 22 Apr 2025 09:25:40 +0000 (12:25 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 24 Apr 2025 01:48:11 +0000 (18:48 -0700)
commitf41f3edf0b15d7ce0b0f71c00a6125e8d7ca735f
treec659fa237f9777319a14edb7ec1937174a069b2e
parent6991a975e416154576b0f5f06256aec13e23b0a7
net/mlx5: HWS, Disallow matcher IP version mixing

Signal clearly to the user, via an error, that mixing IPv4 and IPv6
rules in the same matcher is not supported. Previously such cases
silently failed by adding a rule that did not work correctly.

Rules can specify an IP version by one of two fields: IP version or
ethertype. At matcher creation, store whether the template matches on
any of these two fields. If yes, inspect each rule for its corresponding
match value and store the IP version inside the matcher to guard against
inconsistencies with subsequent rules.

Furthermore, also check rules for internal consistency, i.e. verify that
the ethertype and IP version match values do not contradict each other.

The logic applies to inner and outer headers independently, to account
for tunneling.

Rules that do not match on IP addresses are not affected.

Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250422092540.182091-4-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c