From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E83EA0C50; Wed, 21 Jul 2021 10:55:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF54D410DA; Wed, 21 Jul 2021 10:55:00 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by mails.dpdk.org (Postfix) with ESMTP id 3F04B4113A for ; Wed, 21 Jul 2021 10:54:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKYsj/jU+EUrQ/rmnStKkapn3CES4+ZsJWsU442UZg70Bk+5lCumjDAhOkHuEmRjDKYd3Lv5hevew/ZAVsjXHGuI3KUsaPOpDw13sRpab/ufq/mWz6lnkkEJXz4jAfWIvmCuuMqXDyZZcDgYEGPGo4yxcOQAP4oPZ5Rsm8C5jauKAp3hFnXs7UBDH0RgEwzFyVWfgYr1mJ1b6ymPu4acVxoc1it6OOjPaeFxRqJaMFsShpCk+iimdlmLJ9K2vuEjG0o33fftgCjhLrcfIzrjOoFkSVa3Qypvj2BSEhuSnp2GKc1tYRp3FhTKljtxtogUC4d7z2jfV8AzXUZ6t7GhSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gPT/D4OUyafIFfbnM8678HTNoT1Fuyc5Di7P+uxxdPc=; b=j92wL6Qm8tbdrxOw559l8DIRoWz5pUsyRNqRqIG5cHCMFUGETM1NPXaUzbL6xcNjxx1lHRX1RUNOdcOJ2Uz8IbSRpj/PdIUoT8TtqVtjfJe8PNUWPSMIopMdQwc5y2r1pUMY6wM+HDKqRuegX4xEyse0+Wj8aECFoBJ38E16lpxm6T80rzHGMa6DpUm2sgRyRGKyNyQHburE7hwhAR6Jnp0YPplpYlOlNf+0z9IJw6L12E86Tbf2ooZFxIwh34Ms6rvvFtFeylFKDlOoj0zbZwlXARttP1oEF3RIBUfR4uqotEhjhrnEyWaoSjR3z0QDogmecxAihdDw4z0DTO/bnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gPT/D4OUyafIFfbnM8678HTNoT1Fuyc5Di7P+uxxdPc=; b=qHrAO1UhiXvxZZGwPMTeaiCWiKs2zZOJJMat1DjU7yWdAx4SIanBfYxI8bbgEkYeYOxauJnJwD3SmKUk50aB/DCq/DBNKm5PTKMbiJsRsVudjUzRbwjPbv/SbKEKoImUtg+9SI5TBpwtwNGRLGqt3BiFNOYVlhCRQcBd9H9sGA/kElLB9Wz88wffq7Dc8IjbHjZ/6kX2j69l+LqlYJuUpuQEa/n8Vpzq8q/vySnGXD5+WC/TB9OQr2ba3RPeNSbMgFdjqhyEt6BLQNUIdiSQP3SVbNlW1kHd0s5+zk63hR526NZy92Ha+MqxDd2eGVJBHK7MfUlK2BFRjkMn3Q0RxQ== Received: from MWHPR04CA0029.namprd04.prod.outlook.com (2603:10b6:300:ee::15) by CY4PR12MB1623.namprd12.prod.outlook.com (2603:10b6:910:6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Wed, 21 Jul 2021 08:54:55 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ee:cafe::22) by MWHPR04CA0029.outlook.office365.com (2603:10b6:300:ee::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 08:54:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 08:54:54 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jul 2021 08:54:52 +0000 From: Bing Zhao To: , CC: , , , , , Date: Wed, 21 Jul 2021 11:54:21 +0300 Message-ID: <20210721085421.13111-8-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210721085421.13111-1-bingz@nvidia.com> References: <20210705155756.21443-1-bingz@nvidia.com> <20210721085421.13111-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: acfba583-b706-480e-e743-08d94c2535d9 X-MS-TrafficTypeDiagnostic: CY4PR12MB1623: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PGMS95B6/tsJ9vJ38vqDTg+h00eC/bH7uuUU6vsuusHBNifu0Mj43uNsoaWERwnCxWY5PwrMKOxtRsrce65CDbO11uYY1xdpQT20Fmec3jAOigKH1UG8jHspWi5YaSD30xC8y071ukMT9m9XV6HSEgtSDcvEn7MTzjfe57yOCwUXsHhBbFroHYb5USXpYeaYpgULdHsP5qG0pEZCFx1X1aUGwkxOtBjz52auZmT2yqigaTy+UBR8Bq2fi9Qaw2Yfk5SmyPbT73C5Tgo8nV+qFexAHWQ43SiOGdY4cRQ7Lo+rZLNP8p+L5tokw7tYRTIr8qBxEmmaAAs8JwBeY5cBDd0wWOC3mKxm8Yg8MhL4ralXR3nyEbST4tpKiqZYKmi00sJgYL78iB05mWshhhIDw4jgrh2RmiyqxgwZ3dLgGGGd00ZbPJlCEYFo35V5HXBVXpyLS4I7I/wYuj8ZSZ6FUiFWDlQNxOrPSYE0Hv5Z3MEWRDJZlhtU9NOomVe4Ag5zCbglG2BAy8HMld/IGcbY8e8TdLA5lZJIRhDGgeyhqdZWmfQnAORECc3W33MithQQgzInjbbHZ9ur18TL2j6a8N9NY36JztRehVZSPYja8AbwOAoyRRLD7AZOqXsuYJj6uMWjSS2j99S8raonOlXCGaiGbG9DpVyfGgcXeehiE/0RnHJmWcgGZOxCbjnygmHGZjBaPnF5O71Fs+afTKbPoQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(39860400002)(346002)(396003)(376002)(36840700001)(46966006)(86362001)(36906005)(47076005)(1076003)(6286002)(30864003)(356005)(110136005)(83380400001)(55016002)(70206006)(336012)(7696005)(70586007)(478600001)(5660300002)(426003)(7636003)(82310400003)(186003)(82740400003)(6666004)(6636002)(4326008)(16526019)(316002)(8936002)(107886003)(36756003)(2616005)(36860700001)(8676002)(2906002)(54906003)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 08:54:54.9210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acfba583-b706-480e-e743-08d94c2535d9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1623 Subject: [dpdk-dev] [PATCH v3 7/7] net/mlx5: add meter support for trTCM profiles 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" The support of RFC2698 and RFC4115 are added in mlx5 PMD. Only the ASO metering supports these two profiles. Signed-off-by: Bing Zhao --- doc/guides/nics/mlx5.rst | 1 + doc/guides/rel_notes/release_21_08.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 5 +- drivers/net/mlx5/mlx5_flow_aso.c | 23 ++++- drivers/net/mlx5/mlx5_flow_meter.c | 112 ++++++++++++++++--------- 5 files changed, 98 insertions(+), 44 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 1f5b6fb954..ae267d315f 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -433,6 +433,7 @@ Limitations - RED: must be DROP. - Policy actions of RSS for green and yellow should have the same configuration except queues. - meter profile packet mode is supported. + - meter profiles of RFC2697, RFC2698 and RFC4115 are supported. - Integrity: diff --git a/doc/guides/rel_notes/release_21_08.rst b/doc/guides/rel_notes/release_21_08.rst index 03d4fd059a..e159615deb 100644 --- a/doc/guides/rel_notes/release_21_08.rst +++ b/doc/guides/rel_notes/release_21_08.rst @@ -92,6 +92,7 @@ New Features * Added support for matching on VXLAN header last 8-bits reserved field. * Optimized multi-thread flow rule insertion rate. * Added support for metering policy actions of yellow color. + * Added support for metering trTCM RFC2698 and RFC4115. * **Added Wangxun ngbe PMD.** diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 7950070976..88705be9d6 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -3031,11 +3031,12 @@ struct mlx5_aso_mtr_dseg { #define ASO_DSEG_VALID_OFFSET 31 #define ASO_DSEG_BO_OFFSET 30 #define ASO_DSEG_SC_OFFSET 28 +#define ASO_DSEG_BBOG_OFFSET 27 #define ASO_DSEG_MTR_MODE 24 #define ASO_DSEG_CBS_EXP_OFFSET 24 #define ASO_DSEG_CBS_MAN_OFFSET 16 -#define ASO_DSEG_CIR_EXP_MASK 0x1F -#define ASO_DSEG_CIR_EXP_OFFSET 8 +#define ASO_DSEG_XIR_EXP_MASK 0x1F +#define ASO_DSEG_XIR_EXP_OFFSET 8 #define ASO_DSEG_EBS_EXP_OFFSET 24 #define ASO_DSEG_EBS_MAN_OFFSET 16 #define ASO_DSEG_EXP_MASK 0x1F diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index 23e22e560a..e11327a11b 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -747,10 +747,27 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq, wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm = RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) | (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET)); - /* Only needed for RFC2697. */ - if (fm->profile->srtcm_prm.ebs_eir) + switch (fmp->profile.alg) { + case RTE_MTR_SRTCM_RFC2697: + /* Only needed for RFC2697. */ + if (fm->profile->srtcm_prm.ebs_eir) + wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm |= + RTE_BE32(1 << ASO_DSEG_BO_OFFSET); + break; + case RTE_MTR_TRTCM_RFC2698: wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm |= - RTE_BE32(1 << ASO_DSEG_BO_OFFSET); + RTE_BE32(1 << ASO_DSEG_BBOG_OFFSET); + break; + case RTE_MTR_TRTCM_RFC4115: + default: + break; + } + /* + * Note: + * Due to software performance reason, the token fields will not be + * set when posting the WQE to ASO SQ. It will be filled by the HW + * automatically. + */ sq->head++; sq->pi += 2;/* Each WQE contains 2 WQEBB's. */ rte_io_wmb(); diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index 4f57b7e04e..2d91a6fcf0 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -55,7 +55,7 @@ mlx5_flow_meter_action_create(struct mlx5_priv *priv, MLX5_SET(flow_meter_parameters, fmp, cbs_exponent, val); val = (cbs_cir >> ASO_DSEG_CBS_MAN_OFFSET) & ASO_DSEG_MAN_MASK; MLX5_SET(flow_meter_parameters, fmp, cbs_mantissa, val); - val = (cbs_cir >> ASO_DSEG_CIR_EXP_OFFSET) & ASO_DSEG_EXP_MASK; + val = (cbs_cir >> ASO_DSEG_XIR_EXP_OFFSET) & ASO_DSEG_EXP_MASK; MLX5_SET(flow_meter_parameters, fmp, cir_exponent, val); val = (cbs_cir & ASO_DSEG_MAN_MASK); MLX5_SET(flow_meter_parameters, fmp, cir_mantissa, val); @@ -194,18 +194,18 @@ mlx5_flow_meter_profile_validate(struct rte_eth_dev *dev, NULL, "Metering algorithm not supported."); } -/** - * Calculate mantissa and exponent for cir. +/* + * Calculate mantissa and exponent for cir / eir. * - * @param[in] cir + * @param[in] xir * Value to be calculated. * @param[out] man * Pointer to the mantissa. * @param[out] exp * Pointer to the exp. */ -static void -mlx5_flow_meter_cir_man_exp_calc(int64_t cir, uint8_t *man, uint8_t *exp) +static inline void +mlx5_flow_meter_xir_man_exp_calc(int64_t xir, uint8_t *man, uint8_t *exp) { int64_t _cir; int64_t delta = INT64_MAX; @@ -216,8 +216,8 @@ mlx5_flow_meter_cir_man_exp_calc(int64_t cir, uint8_t *man, uint8_t *exp) for (m = 0; m <= 0xFF; m++) { /* man width 8 bit */ for (e = 0; e <= 0x1F; e++) { /* exp width 5bit */ _cir = (1000000000ULL * m) >> e; - if (llabs(cir - _cir) <= delta) { - delta = llabs(cir - _cir); + if (llabs(xir - _cir) <= delta) { + delta = llabs(xir - _cir); _man = m; _exp = e; } @@ -227,7 +227,7 @@ mlx5_flow_meter_cir_man_exp_calc(int64_t cir, uint8_t *man, uint8_t *exp) *exp = _exp; } -/** +/* * Calculate mantissa and exponent for xbs. * * @param[in] xbs @@ -237,7 +237,7 @@ mlx5_flow_meter_cir_man_exp_calc(int64_t cir, uint8_t *man, uint8_t *exp) * @param[out] exp * Pointer to the exp. */ -static void +static inline void mlx5_flow_meter_xbs_man_exp_calc(uint64_t xbs, uint8_t *man, uint8_t *exp) { int _exp; @@ -275,37 +275,63 @@ mlx5_flow_meter_param_fill(struct mlx5_flow_meter_profile *fmp, struct mlx5_flow_meter_srtcm_rfc2697_prm *srtcm = &fmp->srtcm_prm; uint8_t man, exp; uint32_t cbs_exp, cbs_man, cir_exp, cir_man; - uint32_t ebs_exp, ebs_man; - uint64_t cir, cbs, ebs; + uint32_t eir_exp, eir_man, ebs_exp, ebs_man; + uint64_t cir, cbs, eir, ebs; - if (fmp->profile.alg != RTE_MTR_SRTCM_RFC2697) - return -rte_mtr_error_set(error, ENOTSUP, + if (!priv->sh->meter_aso_en) { + /* Legacy FW metering will only support srTCM. */ + if (fmp->profile.alg != RTE_MTR_SRTCM_RFC2697) + return -rte_mtr_error_set(error, ENOTSUP, RTE_MTR_ERROR_TYPE_METER_PROFILE, - NULL, "Metering algorithm not supported."); - if (!priv->sh->meter_aso_en && fmp->profile.packet_mode) - return -rte_mtr_error_set(error, ENOTSUP, - RTE_MTR_ERROR_TYPE_METER_PROFILE, - NULL, "Metering algorithm packet mode not supported."); - if (priv->sh->meter_aso_en && fmp->profile.packet_mode) { - cir = fmp->profile.srtcm_rfc2697.cir << - MLX5_MTRS_PPS_MAP_BPS_SHIFT; - cbs = fmp->profile.srtcm_rfc2697.cbs << - MLX5_MTRS_PPS_MAP_BPS_SHIFT; - ebs = fmp->profile.srtcm_rfc2697.ebs << - MLX5_MTRS_PPS_MAP_BPS_SHIFT; - } else { + NULL, "Metering algorithm is not supported."); + if (fmp->profile.packet_mode) + return -rte_mtr_error_set(error, ENOTSUP, + RTE_MTR_ERROR_TYPE_METER_PROFILE, NULL, + "Metering algorithm packet mode is not supported."); + } + switch (fmp->profile.alg) { + case RTE_MTR_SRTCM_RFC2697: cir = fmp->profile.srtcm_rfc2697.cir; cbs = fmp->profile.srtcm_rfc2697.cbs; + eir = 0; ebs = fmp->profile.srtcm_rfc2697.ebs; + break; + case RTE_MTR_TRTCM_RFC2698: + MLX5_ASSERT(fmp->profile.trtcm_rfc2698.pir > + fmp->profile.trtcm_rfc2698.cir && + fmp->profile.trtcm_rfc2698.pbs > + fmp->profile.trtcm_rfc2698.cbs); + cir = fmp->profile.trtcm_rfc2698.cir; + cbs = fmp->profile.trtcm_rfc2698.cbs; + /* EIR / EBS are filled with PIR / PBS. */ + eir = fmp->profile.trtcm_rfc2698.pir; + ebs = fmp->profile.trtcm_rfc2698.pbs; + break; + case RTE_MTR_TRTCM_RFC4115: + cir = fmp->profile.trtcm_rfc4115.cir; + cbs = fmp->profile.trtcm_rfc4115.cbs; + eir = fmp->profile.trtcm_rfc4115.eir; + ebs = fmp->profile.trtcm_rfc4115.ebs; + break; + default: + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_PROFILE, NULL, + "Metering algorithm mode is invalid"); + } + /* Adjust the values for PPS mode. */ + if (fmp->profile.packet_mode) { + cir <<= MLX5_MTRS_PPS_MAP_BPS_SHIFT; + cbs <<= MLX5_MTRS_PPS_MAP_BPS_SHIFT; + eir <<= MLX5_MTRS_PPS_MAP_BPS_SHIFT; + ebs <<= MLX5_MTRS_PPS_MAP_BPS_SHIFT; } /* cir = 8G * cir_mantissa * 1/(2^cir_exponent)) Bytes/Sec */ - mlx5_flow_meter_cir_man_exp_calc(cir, &man, &exp); + mlx5_flow_meter_xir_man_exp_calc(cir, &man, &exp); /* Check if cir mantissa is too large. */ - if (exp > ASO_DSEG_CIR_EXP_MASK) + if (exp > ASO_DSEG_XIR_EXP_MASK) return -rte_mtr_error_set(error, ENOTSUP, RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, - "meter profile parameter cir is" - " not supported."); + "meter profile parameter cir is not supported."); cir_man = man; cir_exp = exp; /* cbs = cbs_mantissa * 2^cbs_exponent */ @@ -314,25 +340,33 @@ mlx5_flow_meter_param_fill(struct mlx5_flow_meter_profile *fmp, if (exp > ASO_DSEG_EXP_MASK) return -rte_mtr_error_set(error, ENOTSUP, RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, - "meter profile parameter cbs is" - " not supported."); + "meter profile parameter cbs is not supported."); cbs_man = man; cbs_exp = exp; srtcm->cbs_cir = rte_cpu_to_be_32(cbs_exp << ASO_DSEG_CBS_EXP_OFFSET | cbs_man << ASO_DSEG_CBS_MAN_OFFSET | - cir_exp << ASO_DSEG_CIR_EXP_OFFSET | + cir_exp << ASO_DSEG_XIR_EXP_OFFSET | cir_man); + mlx5_flow_meter_xir_man_exp_calc(eir, &man, &exp); + /* Check if eir mantissa is too large. */ + if (exp > ASO_DSEG_XIR_EXP_MASK) + return -rte_mtr_error_set(error, ENOTSUP, + RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, + "meter profile parameter eir is not supported."); + eir_man = man; + eir_exp = exp; mlx5_flow_meter_xbs_man_exp_calc(ebs, &man, &exp); /* Check if ebs mantissa is too large. */ if (exp > ASO_DSEG_EXP_MASK) return -rte_mtr_error_set(error, ENOTSUP, RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, - "meter profile parameter ebs is" - " not supported."); + "meter profile parameter ebs is not supported."); ebs_man = man; ebs_exp = exp; srtcm->ebs_eir = rte_cpu_to_be_32(ebs_exp << ASO_DSEG_EBS_EXP_OFFSET | - ebs_man << ASO_DSEG_EBS_MAN_OFFSET); + ebs_man << ASO_DSEG_EBS_MAN_OFFSET | + eir_exp << ASO_DSEG_XIR_EXP_OFFSET | + eir_man); if (srtcm->cbs_cir) fmp->g_support = 1; if (srtcm->ebs_eir) @@ -1008,7 +1042,7 @@ mlx5_flow_meter_action_modify(struct mlx5_priv *priv, cbs_mantissa, val); } if (modify_bits & MLX5_FLOW_METER_OBJ_MODIFY_FIELD_CIR) { - val = (cbs_cir >> ASO_DSEG_CIR_EXP_OFFSET) & + val = (cbs_cir >> ASO_DSEG_XIR_EXP_OFFSET) & ASO_DSEG_EXP_MASK; MLX5_SET(flow_meter_parameters, attr, cir_exponent, val); @@ -1389,7 +1423,7 @@ mlx5_flow_meter_modify_state(struct mlx5_priv *priv, &srtcm, modify_bits, 0, 0); else ret = mlx5_flow_meter_action_modify(priv, fm, - &fm->profile->srtcm_prm, + &fm->profile->srtcm_prm, modify_bits, 0, 1); if (ret) return -rte_mtr_error_set(error, -ret, -- 2.27.0