IB/mlx5: Expose MPLS related tunneling offloads
authorAriel Levkovich <lariel@mellanox.com>
Sun, 13 May 2018 11:33:35 +0000 (14:33 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 17 May 2018 03:32:55 +0000 (21:32 -0600)
This patch reports the device's capbilities to offload
encapsulated MPLS tunnel protocols to user-space:
- Capability to offload MPLS over GRE.
- Capability to offload MPLS over UDP.

Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c
include/linux/mlx5/device.h
include/linux/mlx5/mlx5_ifc.h
include/uapi/rdma/mlx5-abi.h

index 8792248034cbfa1c7a2254da227a577c48f67e94..ab8cd5c034a2a0e082e7573e4186992b091d839a 100644 (file)
@@ -1084,6 +1084,14 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
                if (MLX5_CAP_ETH(mdev, tunnel_stateless_gre))
                        resp.tunnel_offloads_caps |=
                                MLX5_IB_TUNNELED_OFFLOADS_GRE;
+               if (MLX5_CAP_GEN(mdev, flex_parser_protocols) &
+                   MLX5_FLEX_PROTO_CW_MPLS_GRE)
+                       resp.tunnel_offloads_caps |=
+                               MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE;
+               if (MLX5_CAP_GEN(mdev, flex_parser_protocols) &
+                   MLX5_FLEX_PROTO_CW_MPLS_UDP)
+                       resp.tunnel_offloads_caps |=
+                               MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP;
        }
 
        if (uhw->outlen) {
index fd1a9341edfacab79aece6e878620685cae7aba3..5004ddc702e3895d1f6b6a754fbe378a881598be 100644 (file)
@@ -1001,6 +1001,11 @@ enum mlx5_mpls_supported_fields {
        MLX5_FIELD_SUPPORT_MPLS_TTL   = 1 << 3
 };
 
+enum mlx5_flex_parser_protos {
+       MLX5_FLEX_PROTO_CW_MPLS_GRE   = 1 << 4,
+       MLX5_FLEX_PROTO_CW_MPLS_UDP   = 1 << 5,
+};
+
 /* MLX5 DEV CAPs */
 
 /* TODO: EAT.ME */
index 3fee2f74d09da23c29f276acc71e3136114f4ab3..68f756ea550d7b963dd94e752737a038f3c2826c 100644 (file)
@@ -1138,7 +1138,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 
        u8         reserved_at_500[0x20];
        u8         num_of_uars_per_page[0x20];
-       u8         reserved_at_540[0x40];
+
+       u8         flex_parser_protocols[0x20];
+       u8         reserved_at_560[0x20];
 
        u8         reserved_at_580[0x3d];
        u8         cqe_128_always[0x1];
index fdaf00e206498cc3bf382c53a4515aa157a1938b..508ea8c82da7a08e715fd1fd492745ac7cc685e2 100644 (file)
@@ -233,7 +233,9 @@ enum mlx5_ib_query_dev_resp_flags {
 enum mlx5_ib_tunnel_offloads {
        MLX5_IB_TUNNELED_OFFLOADS_VXLAN  = 1 << 0,
        MLX5_IB_TUNNELED_OFFLOADS_GRE    = 1 << 1,
-       MLX5_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2
+       MLX5_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2,
+       MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE = 1 << 3,
+       MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP = 1 << 4,
 };
 
 struct mlx5_ib_query_device_resp {