net/mlx5: update flow meter capability flags names
authorDekel Peled <dekelp@nvidia.com>
Sun, 31 Jan 2021 13:29:40 +0000 (15:29 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 2 Feb 2021 23:48:11 +0000 (00:48 +0100)
Existing names of the flags denoting flow meter capability are unclear
and may be misleading.

This patch updates the names to align with the updated documentation.
Comments were edited, describing the names clearly.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/common/mlx5/mlx5_devx_cmds.c
drivers/common/mlx5/mlx5_devx_cmds.h
drivers/common/mlx5/mlx5_prm.h
drivers/net/mlx5/linux/mlx5_os.c
drivers/net/mlx5/mlx5_flow_meter.c

index adeeb81..b075af9 100644 (file)
@@ -758,14 +758,14 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
                        return -1;
                }
                hcattr = MLX5_ADDR_OF(query_hca_cap_out, out, capability);
-               attr->qos.srtcm_sup =
-                               MLX5_GET(qos_cap, hcattr, flow_meter_srtcm);
+               attr->qos.flow_meter_old =
+                               MLX5_GET(qos_cap, hcattr, flow_meter_old);
                attr->qos.log_max_flow_meter =
                                MLX5_GET(qos_cap, hcattr, log_max_flow_meter);
                attr->qos.flow_meter_reg_c_ids =
                                MLX5_GET(qos_cap, hcattr, flow_meter_reg_id);
-               attr->qos.flow_meter_reg_share =
-                               MLX5_GET(qos_cap, hcattr, flow_meter_reg_share);
+               attr->qos.flow_meter =
+                               MLX5_GET(qos_cap, hcattr, flow_meter);
                attr->qos.packet_pacing =
                                MLX5_GET(qos_cap, hcattr, packet_pacing);
                attr->qos.wqe_rate_pp =
index dbcbee1..3e2a0a2 100644 (file)
@@ -38,11 +38,17 @@ struct mlx5_devx_mkey_attr {
 /* HCA qos attributes. */
 struct mlx5_hca_qos_attr {
        uint32_t sup:1; /* Whether QOS is supported. */
-       uint32_t srtcm_sup:1; /* Whether srTCM mode is supported. */
+       uint32_t flow_meter_old:1; /* Flow meter is supported, old version. */
        uint32_t packet_pacing:1; /* Packet pacing is supported. */
        uint32_t wqe_rate_pp:1; /* Packet pacing WQE rate mode. */
-       uint32_t flow_meter_reg_share:1;
-       /* Whether reg_c share is supported. */
+       uint32_t flow_meter:1;
+       /*
+        * Flow meter is supported, updated version.
+        * When flow_meter is 1, it indicates that REG_C sharing is supported.
+        * If flow_meter is 1, flow_meter_old is also 1.
+        * Using older driver versions, flow_meter_old can be 1
+        * while flow_meter is 0.
+        */
        uint8_t log_max_flow_meter;
        /* Power of the maximum supported meters. */
        uint8_t flow_meter_reg_c_ids;
index 4c764d0..751dda2 100644 (file)
@@ -1474,13 +1474,13 @@ struct mlx5_ifc_qos_cap_bits {
        u8 reserved_at_4[0x1];
        u8 packet_pacing_burst_bound[0x1];
        u8 packet_pacing_typical_size[0x1];
-       u8 flow_meter_srtcm[0x1];
+       u8 flow_meter_old[0x1];
        u8 reserved_at_8[0x8];
        u8 log_max_flow_meter[0x8];
        u8 flow_meter_reg_id[0x8];
        u8 wqe_rate_pp[0x1];
        u8 reserved_at_25[0x7];
-       u8 flow_meter_reg_share[0x1];
+       u8 flow_meter[0x1];
        u8 reserved_at_2e[0x17];
        u8 packet_pacing_max_rate[0x20];
        u8 packet_pacing_min_rate[0x20];
index a8cc5f3..9b95b9f 100644 (file)
@@ -1145,7 +1145,7 @@ err_secondary:
                }
 #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
                if (config->hca_attr.qos.sup &&
-                   config->hca_attr.qos.srtcm_sup &&
+                   config->hca_attr.qos.flow_meter_old &&
                    config->dv_flow_en) {
                        uint8_t reg_c_mask =
                                config->hca_attr.qos.flow_meter_reg_c_ids;
@@ -1173,7 +1173,7 @@ err_secondary:
                                                              - 1 + REG_C_0;
                                priv->mtr_en = 1;
                                priv->mtr_reg_share =
-                                     config->hca_attr.qos.flow_meter_reg_share;
+                                     config->hca_attr.qos.flow_meter;
                                DRV_LOG(DEBUG, "The REG_C meter uses is %d",
                                        priv->mtr_color_reg);
                        }
index 03a5e79..dbc574b 100644 (file)
@@ -136,7 +136,7 @@ mlx5_flow_meter_profile_validate(struct rte_eth_dev *dev,
                                          NULL,
                                          "Meter profile already exists.");
        if (profile->alg == RTE_MTR_SRTCM_RFC2697) {
-               if (priv->config.hca_attr.qos.srtcm_sup) {
+               if (priv->config.hca_attr.qos.flow_meter_old) {
                        /* Verify support for flow meter parameters. */
                        if (profile->srtcm_rfc2697.cir > 0 &&
                            profile->srtcm_rfc2697.cir <= MLX5_SRTCM_CIR_MAX &&
@@ -313,7 +313,7 @@ mlx5_flow_mtr_cap_get(struct rte_eth_dev *dev,
        cap->shared_n_flows_per_mtr_max = 4 << 20;
        /* 2M flows can share the same meter. */
        cap->chaining_n_mtrs_per_flow_max = 1; /* Chaining is not supported. */
-       cap->meter_srtcm_rfc2697_n_max = qattr->srtcm_sup ? cap->n_max : 0;
+       cap->meter_srtcm_rfc2697_n_max = qattr->flow_meter_old ? cap->n_max : 0;
        cap->meter_rate_max = 1ULL << 40; /* 1 Tera tokens per sec. */
        cap->policer_action_drop_supported = 1;
        cap->stats_mask = RTE_MTR_STATS_N_BYTES_DROPPED |