common/mlx5: query preserve capability via DevX
authorJiawei Wang <jiaweiw@nvidia.com>
Tue, 12 Jan 2021 10:29:15 +0000 (12:29 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:07 +0000 (18:16 +0100)
Update function mlx5_devx_cmd_query_hca_attr() to add the
reg_c_preserve bit query.

The stored metadata in register C may be lost in NIC Tx and
FDB egress while doing one of the following operations:
 - packet encapsulation.
 - packet mirroring (multiple processing paths).
 - packet sampling (using Flow Sampler).

If the reg_c_preserve bit is set to 1, then the above
limitation is obsolete, the all metadata registers Cx
preserve their values even through the operations mentioned
above.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/common/mlx5/mlx5_devx_cmds.c
drivers/common/mlx5/mlx5_devx_cmds.h
drivers/common/mlx5/mlx5_prm.h

index 33acd73..adeeb81 100644 (file)
@@ -732,6 +732,8 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
        attr->log_max_pd = MLX5_GET(cmd_hca_cap, hcattr, log_max_pd);
        attr->log_max_srq = MLX5_GET(cmd_hca_cap, hcattr, log_max_srq);
        attr->log_max_srq_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_srq_sz);
+       attr->reg_c_preserve =
+               MLX5_GET(cmd_hca_cap, hcattr, reg_c_preserve);
        attr->mmo_dma_en = MLX5_GET(cmd_hca_cap, hcattr, dma_mmo);
        attr->mmo_compress_en = MLX5_GET(cmd_hca_cap, hcattr, compress);
        attr->mmo_decompress_en = MLX5_GET(cmd_hca_cap, hcattr, decompress);
index 696a981..dbcbee1 100644 (file)
@@ -116,6 +116,7 @@ struct mlx5_hca_attr {
        uint32_t scatter_fcs_w_decap_disable:1;
        uint32_t flow_hit_aso:1; /* General obj type FLOW_HIT_ASO supported. */
        uint32_t regex:1;
+       uint32_t reg_c_preserve:1;
        uint32_t regexp_num_of_engines;
        uint32_t log_max_ft_sampler_num:8;
        uint32_t geneve_tlv_opt;
index 05f1176..694677b 100644 (file)
@@ -1182,7 +1182,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
        u8 regexp[0x1];
        u8 reserved_at_a1[0x3];
        u8 regexp_num_of_engines[0x4];
-       u8 reserved_at_a8[0x3];
+       u8 reserved_at_a8[0x1];
+       u8 reg_c_preserve[0x1];
+       u8 reserved_at_aa[0x1];
        u8 log_max_srq[0x5];
        u8 reserved_at_b0[0x3];
        u8 regexp_log_crspace_size[0x5];