net/mlx5: update flow meter capability flags names

Message ID 6c27535bc36dbf513f57aec4b99d5a922fdb1062.1612099678.git.dekelp@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: update flow meter capability flags names |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-testing warning Testing issues

Commit Message

Dekel Peled Jan. 31, 2021, 1:29 p.m. UTC
  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 |  8 ++++----
 drivers/common/mlx5/mlx5_devx_cmds.h | 12 +++++++++---
 drivers/common/mlx5/mlx5_prm.h       |  4 ++--
 drivers/net/mlx5/linux/mlx5_os.c     |  4 ++--
 drivers/net/mlx5/mlx5_flow_meter.c   |  4 ++--
 5 files changed, 19 insertions(+), 13 deletions(-)
  

Comments

Raslan Darawsheh Feb. 1, 2021, 1:24 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled
> Sent: Sunday, January 31, 2021 3:30 PM
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: update flow meter capability flags
> names
> 
> 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>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index adeeb811f7..b075af9f6d 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -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 =
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index dbcbee16bc..3e2a0a24f9 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -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;
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 4c764d09cf..751dda2537 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -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];
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index a8cc5f3116..9b95b9fe31 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1145,7 +1145,7 @@  mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		}
 #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 @@  mlx5_dev_spawn(struct rte_device *dpdk_dev,
 							      - 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);
 			}
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 03a5e79eb8..dbc574b508 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -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 |