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 E84C1A0C46; Sun, 18 Jul 2021 19:19:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62900411A4; Sun, 18 Jul 2021 19:19:18 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by mails.dpdk.org (Postfix) with ESMTP id 953D940683 for ; Sun, 18 Jul 2021 19:19:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DF+p8NCfjCo/UTy7dFRujzkhfJ9AtgqVjxXF47206jt1hUbvtWWkrtFHYrJM0MzgPph9IrkKcMqJBVhy1k6S1UW7OGmLLF2OWPGCtzHcTPl5Ty4HNDZpZnfO9O7oARvwE7T62R/aTy4SY5iqqx83yZxAO+l36gIKsZohUT6dOU95c6nOuykSYdvWqyip7797oaVVekqf9V4MpiiXOGZKTpB/TyC8T33+GoG7m4kQBXrdH2+hcf0kwjQKFTQ5LnItoOJwdEvPktwjH0x4MK5AF9LVaT0EniH+a5wJW1zHqVN6lQrRCpWwxSDNa70IGjioL+F2+dB6Y/84gichCXqsvg== 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=4k7bKQMe5F83fMW/OF34pinK41yFkWnbt+LbJ90dmdE=; b=aBd7+5XFcIiseLkEVcIr9+hhSd1LWQoUtYmoYrP7+kxFWx+faObEBcXoMEvpfZkqafCCNd/KEswAFNNKAx0k0AmoDQcVN1O585Qt3XoZamlI/DwqGTgOBc0IiR/CXSsc4k5PYj6oIEahVESAgbIYDCvIAJb0CZVol+fPQPmkuaiOgMWCwepcZSj93DvKhHEWt+zOTkyswz3Ybpz9imthAs33ehJGNug7dZno7It/OSFprkRwneI5tjdkKFYZTkTSvPsQEp18ZbP3tS/EKUiEOsxmINbxxr7etljAjektPbwCkSzZ5diQFrWeQHBWjZGW1q/iz+lXmhe+4c6fuBRXSg== 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=4k7bKQMe5F83fMW/OF34pinK41yFkWnbt+LbJ90dmdE=; b=iYwV6nC/TQgFV/bNibg0Rz+AElxycvt+hrHt1obrQ7VLY5F3os7P2a1XuBSnMhEBdhdc6ozQgQzq9y4HtsDfEXUy0cCyNwE8MXREQ5UmeHKe93QuEoe727VSusNnCiqGUoCzQKjOI58rVab6miwQEEBNh9Q9KBVOaTnoXsGf+8ljPuBfIL0SPuVVQZ8W8xXMzDbk/wHr8OKgubM+VZMWMZYCsfsXQO/l/J1OcgdC64SK/nlFRpWMUY8E/V44VjGcrbvKDAb09w7g1W8+gfLtQReIoHRNmWkF9Zk8VHfCFev6/KPMhuTwy7tt8I3FkmEZraeQoksudSn5fJX8hZzcTg== Received: from BN8PR16CA0025.namprd16.prod.outlook.com (2603:10b6:408:4c::38) by CO6PR12MB5490.namprd12.prod.outlook.com (2603:10b6:303:13d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Sun, 18 Jul 2021 17:19:15 +0000 Received: from BN8NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:408:4c:cafe::d2) by BN8PR16CA0025.outlook.office365.com (2603:10b6:408:4c::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Sun, 18 Jul 2021 17:19:15 +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 BN8NAM11FT057.mail.protection.outlook.com (10.13.177.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4331.21 via Frontend Transport; Sun, 18 Jul 2021 17:19:14 +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; Sun, 18 Jul 2021 17:19:11 +0000 From: Bing Zhao To: , CC: , , , , , Date: Sun, 18 Jul 2021 20:18:17 +0300 Message-ID: <20210718171817.23822-8-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210718171817.23822-1-bingz@nvidia.com> References: <20210705155756.21443-1-bingz@nvidia.com> <20210718171817.23822-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1e04c57-3e8c-466b-ea06-08d94a102b0a X-MS-TrafficTypeDiagnostic: CO6PR12MB5490: 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: ZqFIhkDdcmwRjTt6o5wFfafwZNs9Ecz0FZbCgxl9EEahDdGIxhDf5xlqASybmjliSo7BMRuT+wtQMXCgunooQuivzP+Og4PFy/uwCU6LtKGxsdow9WAXY4WZW/bV3dzY2G/mcKX+/2VB5AeVe61Voy73gsZHVIY/Ltve5Ld8zk2HDP+s1cj+KtJOa2jZtJc4toviivZcqDgkG5MFXnmevZXXQfOWKcpS61QSupkWMeaGNr/LkmUUM6UBgqcBQei2A/jb4p4AO2ZNf01gYjtsH9IjETl5H6rnNCg1UX5SquxgBrfhw+yfnGObn1ojqM/yNp53L5it+BH5bHJtGZsJP8VxQWyjaYzfy9QrqEz8CP4kxuS+I1gM9vm9xc+1DMcnoV/EmeWrEg7cHnFG5HqjF8i8c+UZVH1Xheo9hiohTSTSIoTpjF+Qp5ZjNJhG+3j7zLcLMNEkrIE5TT6sBsE3/V7iCrDLFADKRQH3lahGCrUyssfjP36zatfnhnTHUACOSxqhmahuDIooGfEuQLPB4HiOxZscp67CNh5XlLiYRaXG/QOahnW9Iot8jxwPNRX69waFWo/C9Jd7lqV5KgRQKsteM8CLOJatPGhD2pWvU29nHRU5CEFI/IeWcJI95sAgi8Tlkji5G+P/OWpYDr9PCK9GmuOks4dMEkfKXcQmGIqcGJboZgH0beduJMqP9uEHJPbQAue1Y73jIKinrl6wUPRTwPF5ZpajU4Ih5YcyiQk= 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)(46966006)(36840700001)(6286002)(55016002)(47076005)(54906003)(6636002)(356005)(336012)(26005)(2616005)(1076003)(426003)(2906002)(186003)(16526019)(508600001)(36756003)(7696005)(86362001)(5660300002)(82310400003)(34020700004)(4326008)(70206006)(107886003)(83380400001)(70586007)(7636003)(110136005)(8676002)(36860700001)(8936002)(36906005)(30864003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2021 17:19:14.9145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1e04c57-3e8c-466b-ea06-08d94a102b0a 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: BN8NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5490 Subject: [dpdk-dev] [PATCH v2 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 9396074b5a..e20d02d607 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -434,6 +434,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 cf3fb8aa9d..b077a01896 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