From patchwork Sun Jan 31 13:29:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 87577 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15A3FA0A0D; Sun, 31 Jan 2021 14:29:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A847F40693; Sun, 31 Jan 2021 14:29:44 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 8ED7040692 for ; Sun, 31 Jan 2021 14:29:43 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@nvidia.com) with SMTP; 31 Jan 2021 15:29:42 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.228.136.74]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10VDTfHe003611; Sun, 31 Jan 2021 15:29:41 +0200 From: Dekel Peled To: matan@nvidia.com, shahafs@nvidia.com, viacheslavo@nvidia.com Cc: dev@dpdk.org Date: Sun, 31 Jan 2021 15:29:40 +0200 Message-Id: <6c27535bc36dbf513f57aec4b99d5a922fdb1062.1612099678.git.dekelp@nvidia.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/mlx5: update flow meter capability flags names X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Matan Azrad --- 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 |