Commit 41e684ef authored by Alex Vesker's avatar Alex Vesker Committed by Jason Gunthorpe

IB/mlx5: Replace tunnel mpls capability bits for tunnel_offloads

Until now the flex parser capability was used in ib_query_device() to
indicate tunnel_offloads_caps support for mpls_over_gre/mpls_over_udp.

Newer devices and firmware will have configurations with the flexparser
but without mpls support.

Testing for the flex parser capability was a mistake, the tunnel_stateless
capability was intended for detecting mpls and was introduced at the same
time as the flex parser capability.

Otherwise userspace will be incorrectly informed that a future device
supports MPLS when it does not.

Link: https://lore.kernel.org/r/20200305123841.196086-1-leon@kernel.org
Cc: <stable@vger.kernel.org> # 4.17
Fixes: e818e255 ("IB/mlx5: Expose MPLS related tunneling offloads")
Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
Reviewed-by: default avatarAriel Levkovich <lariel@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 0897f301
...@@ -1192,12 +1192,10 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, ...@@ -1192,12 +1192,10 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
if (MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) if (MLX5_CAP_ETH(mdev, tunnel_stateless_gre))
resp.tunnel_offloads_caps |= resp.tunnel_offloads_caps |=
MLX5_IB_TUNNELED_OFFLOADS_GRE; MLX5_IB_TUNNELED_OFFLOADS_GRE;
if (MLX5_CAP_GEN(mdev, flex_parser_protocols) & if (MLX5_CAP_ETH(mdev, tunnel_stateless_mpls_over_gre))
MLX5_FLEX_PROTO_CW_MPLS_GRE)
resp.tunnel_offloads_caps |= resp.tunnel_offloads_caps |=
MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE; MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE;
if (MLX5_CAP_GEN(mdev, flex_parser_protocols) & if (MLX5_CAP_ETH(mdev, tunnel_stateless_mpls_over_udp))
MLX5_FLEX_PROTO_CW_MPLS_UDP)
resp.tunnel_offloads_caps |= resp.tunnel_offloads_caps |=
MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP; MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP;
} }
......
...@@ -877,7 +877,11 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { ...@@ -877,7 +877,11 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
u8 swp_csum[0x1]; u8 swp_csum[0x1];
u8 swp_lso[0x1]; u8 swp_lso[0x1];
u8 cqe_checksum_full[0x1]; u8 cqe_checksum_full[0x1];
u8 reserved_at_24[0x5]; u8 tunnel_stateless_geneve_tx[0x1];
u8 tunnel_stateless_mpls_over_udp[0x1];
u8 tunnel_stateless_mpls_over_gre[0x1];
u8 tunnel_stateless_vxlan_gpe[0x1];
u8 tunnel_stateless_ipv4_over_vxlan[0x1];
u8 tunnel_stateless_ip_over_ip[0x1]; u8 tunnel_stateless_ip_over_ip[0x1];
u8 reserved_at_2a[0x6]; u8 reserved_at_2a[0x6];
u8 max_vxlan_udp_ports[0x8]; u8 max_vxlan_udp_ports[0x8];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment