common/mlx5: check connection tracking offload capability
authorBing Zhao <bingz@nvidia.com>
Wed, 5 May 2021 12:23:13 +0000 (15:23 +0300)
committerRaslan Darawsheh <rasland@nvidia.com>
Wed, 5 May 2021 12:30:10 +0000 (14:30 +0200)
During startup, the ASO connection tracking offload capability could
be queried via HCA_CAP_QUERY command. If the HW doesn't support ASO
CT, the value would be 0 by default. The following initialization
should be skipped and the creation of the CT object should return
a failure directly.

The following CT creation should also check this capability. With
the old driver, the pre-processing macro should be used in order to
make the compiling pass.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
doc/guides/nics/mlx5.rst
doc/guides/rel_notes/release_21_05.rst
drivers/common/mlx5/linux/meson.build
drivers/common/mlx5/mlx5_devx_cmds.c
drivers/common/mlx5/mlx5_devx_cmds.h
drivers/common/mlx5/mlx5_prm.h

index e7aeb77..e3544bb 100644 (file)
@@ -108,6 +108,7 @@ Features
   flow group.
 - Flow metering, including meter policy API.
 - Flow integrity offload API.
+- Connection tracking.
 
 Limitations
 -----------
@@ -1695,6 +1696,11 @@ Supported hardware offloads
    |                       | | rdma-core 35  | | rdma-core 35  |
    |                       | | ConnectX-5    | | ConnectX-5    |
    +-----------------------+-----------------+-----------------+
+   | Connection tracking   | |               | | DPDK 21.05    |
+   |                       | |     N/A       | | OFED 5.3      |
+   |                       | |               | | rdma-core 35  |
+   |                       | |               | | ConnectX-6 Dx |
+   +-----------------------+-----------------+-----------------+
 
 .. table:: Minimal SW/HW versions for shared action offload
    :name: sact
index 04c1244..30dec1c 100644 (file)
@@ -169,6 +169,7 @@ New Features
   * Added support for ASO (Advanced Steering Operation) meter.
   * Added support for ASO metering by PPS (packet per second).
   * Added support for the monitor policy of Power Management API.
+  * Added support for connection tracking.
 
 * **Updated NXP DPAA driver.**
 
index 3334bd5..007834a 100644 (file)
@@ -189,6 +189,8 @@ has_sym_args = [
             'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ],
         [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h',
             'mlx5dv_dump_dr_rule' ],
+        [ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h',
+            'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ],
 ]
 config = configuration_data()
 foreach arg:has_sym_args
index 23ae5da..9d0ed6f 100644 (file)
@@ -878,6 +878,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
        attr->crypto = MLX5_GET(cmd_hca_cap, hcattr, crypto);
        if (attr->crypto)
                attr->aes_xts = MLX5_GET(cmd_hca_cap, hcattr, aes_xts);
+       attr->ct_offload = !!(MLX5_GET64(cmd_hca_cap, hcattr,
+                                        general_obj_types) &
+                             MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD);
        if (attr->qos.sup) {
                MLX5_SET(query_hca_cap_in, in, op_mod,
                         MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP |
index 94c079f..80465c3 100644 (file)
@@ -139,6 +139,7 @@ struct mlx5_hca_attr {
        uint32_t qp_ts_format:2;
        uint32_t regex:1;
        uint32_t reg_c_preserve:1;
+       uint32_t ct_offload:1; /* General obj type ASO CT offload supported. */
        uint32_t crypto:1; /* Crypto engine is supported. */
        uint32_t aes_xts:1; /* AES-XTS crypto is supported. */
        uint32_t dek:1; /* General obj type DEK is supported. */
index 54a0ccb..26761f5 100644 (file)
@@ -1244,6 +1244,8 @@ enum {
                        (1ULL << MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO)
 #define MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT \
                        (1ULL << MLX5_GENERAL_OBJ_TYPE_GENEVE_TLV_OPT)
+#define MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD \
+                       (1ULL << MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD)
 #define MLX5_GENERAL_OBJ_TYPES_CAP_DEK \
                        (1ULL << MLX5_GENERAL_OBJ_TYPE_DEK)
 #define MLX5_GENERAL_OBJ_TYPES_CAP_IMPORT_KEK \
@@ -2607,6 +2609,7 @@ enum {
        MLX5_GENERAL_OBJ_TYPE_FLEX_PARSE_GRAPH = 0x0022,
        MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO = 0x0024,
        MLX5_GENERAL_OBJ_TYPE_FLOW_HIT_ASO = 0x0025,
+       MLX5_GENERAL_OBJ_TYPE_CONN_TRACK_OFFLOAD = 0x0031,
 };
 
 struct mlx5_ifc_general_obj_in_cmd_hdr_bits {