DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@nvidia.com>
To: matan@nvidia.com, shahafs@nvidia.com, viacheslavo@nvidia.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: update flow meter capability flags names
Date: Sun, 31 Jan 2021 15:29:40 +0200	[thread overview]
Message-ID: <6c27535bc36dbf513f57aec4b99d5a922fdb1062.1612099678.git.dekelp@nvidia.com> (raw)

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(-)

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 |
-- 
2.25.1


             reply	other threads:[~2021-01-31 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 13:29 Dekel Peled [this message]
2021-02-01 13:24 ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c27535bc36dbf513f57aec4b99d5a922fdb1062.1612099678.git.dekelp@nvidia.com \
    --to=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).