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 06FADA0503; Wed, 18 May 2022 06:35:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD25342825; Wed, 18 May 2022 06:35:34 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by mails.dpdk.org (Postfix) with ESMTP id 848F14281D for ; Wed, 18 May 2022 06:35:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UvvbyGDsBEhkbbK7MqqZc/BpAnN8WXm4jBjYhsq15yaZX6E/J4rQI40nVIZWwYCAQZURrsyWg97zrXxf+DU5zYyPsbjaroNhsdRXuNJrTJsqLiacUIq6f7oVsLFmhV5H0zNIlep3C0qWGVG+LtsmyQgnCcIKnm00kHGrLAv0UCYpA81zi90A+JU+Xj/9vu/fBHJNocKTwagXQcS90CynImlLB1Iiy0b+UROwUx0fwrnOgHNZxeoh55qN8QOFgswnpuBsZ2XRp8yDsYE0LgMtRzaZxVO5+LD98z8WuyJecxcr+HJtmBLLY2AUi3kPYEJr2PQs6NdPOQiwwTSOUPuLiQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iP3CExUaZRqrL51e5XtFofxTo0b/k7BGKWdxLQogXaE=; b=drWiOOVtTaVbbXDUUvFDj3axDLjvc39UDtR2wC4ZPfZJf5OY1QhcboAhqCMLEGH7qmJdC/5fkUU43ftEPPPQAo9VrEbMaBedYo6rsHlccmoWKLAUmhGpAG/zjAiorZNarK2yH3I2YxeyzahNAy02/QiuKIGWzFNiOcOiQpjEbwm7zp2+5s97yFe+DwTnroAhzycKQ0KDXWyEHWCAxRI7swu3CcozEtwoXFjBUqDrkXkvwsLXgxA+Z07FglZX+tq2rue9huucftuCuIcmq0+0tQFFKkNm6houkK+Ka5wNxlrmtRYsTWVmC9KoJGCuMRSjp8lLyvaeLFscwtQnwR6tUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=iP3CExUaZRqrL51e5XtFofxTo0b/k7BGKWdxLQogXaE=; b=btXdCV4VjNstSesUdt2ZiIQJLLtrr77QRY5rz+b3WFPOEXp9jhJHP3p1NIKdj/N0XLyy01GzgiqbLZWpFCkT48NI9aa2HWDZsmgOAki5YIUg4YhqEk0GALyFDiViy/X5WsvuVy07cZXV3RCCYF0ExFfO6ohAl/qyzvjbO0sS9e92ehmwElSEW9/qwiu61S4nvvtt92IPLp68i13v4uO4QAbaWE9JcDmXGQ2KZU8y9DCrZAAWitYlFNAs8rNkMR1CDK10qiymbLo5dBH9l8MpY9oGjNSSnD0UeKhDQosMV9tUnjmmureta5q7jbs98CXb3YnG7uUgEhsYOVm+wAziaw== Received: from MW4PR02CA0030.namprd02.prod.outlook.com (2603:10b6:303:16d::18) by MN2PR12MB4359.namprd12.prod.outlook.com (2603:10b6:208:265::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Wed, 18 May 2022 04:35:30 +0000 Received: from CO1NAM11FT043.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::af) by MW4PR02CA0030.outlook.office365.com (2603:10b6:303:16d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14 via Frontend Transport; Wed, 18 May 2022 04:35:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT043.mail.protection.outlook.com (10.13.174.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 04:35:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 18 May 2022 04:35:29 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 17 May 2022 21:35:25 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , , , Subject: [PATCH 3/4] ethdev: add meter profile config calculation Date: Wed, 18 May 2022 07:34:58 +0300 Message-ID: <20220518043459.1281590-4-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220518043459.1281590-1-akozyrev@nvidia.com> References: <20220502200439.4100965-1-akozyrev@nvidia.com> <20220518043459.1281590-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ecd21b8-0b0b-4048-f5b2-08da3887d67c X-MS-TrafficTypeDiagnostic: MN2PR12MB4359:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RdUM4VSo9yEju4dhGIbjeG5OddcLtbVg2+KDtRVgqFcxw1LR78GRQggbHuJqDjjohmD5kITdjTZO8dq3Q9JfQLY45RJ3l9zh6Ew4BBwgl7aBUNLDBPl4HBZFroGmQoerQCdchAI3yvdaGStbdUsg/Q0OkklpnnchDCyTkd8EqFII/Q4hySbxDbHp3QjkwG8QeLLj42ki/j/QmWanhzMzqvCh+T/MLMhx1MBXn7wpK7h/vlN35JvqRRW1mSR55Io6Gflo/22Iz+PuBDkW7CYbqdEf3dgDaQu0cyKxMFpOpCA2Y9QgbL5v+t+QVkM15n8CHJKBD6E3p5J5Zss750fRWY5sogZuDvceF2Pr2ByM2hUeYh0M/KWzwkQsUbhk17cdzrES2ADHnB6pSkebIpQb7mALlPOCa70bphIb3/yjwq4VvfDO1b912TFLybudlFhD7CoyFVoaIhS5S3mz6h5nQJura2gKqsiQH2bfVNW67KIG/s8R0xpVwuqyI7m77j68MS1VDQPaeNXe2SKRhARmOmpq9HBIg49Vg/VDwcilYJIGZqdSpQaX2p2UpP/PfXG7oOrByls2mmqQKF/3pZ3l6kI5+eLZm2+rF9F5d1i6xLQb+DLwhGcwS3udrcnQRIfyQd9a0dD/zRtHetRtr9MU/xG/pyifiLJrjBVlkdX+2A+Abv5M6BmD0hAwNk9f2ooYjKeQsARw8Q0XBHX5awskOw== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(4326008)(8676002)(1076003)(16526019)(2616005)(47076005)(83380400001)(70586007)(2906002)(36756003)(8936002)(7416002)(40460700003)(508600001)(82310400005)(186003)(426003)(6666004)(5660300002)(336012)(26005)(81166007)(356005)(6916009)(316002)(86362001)(54906003)(36860700001)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 04:35:29.5506 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ecd21b8-0b0b-4048-f5b2-08da3887d67c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT043.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4359 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 Introduce a new Meter API to calculate PMD-specific profile configuration values based on user-provided CIR, CBS and EBS. That will allow fast Meter configuration in hardware without the need to convert these values every time we use a profile. Signed-off-by: Alexander Kozyrev --- .../traffic_metering_and_policing.rst | 2 ++ doc/guides/rel_notes/release_22_07.rst | 1 + lib/ethdev/rte_mtr.c | 12 ++++++++++ lib/ethdev/rte_mtr.h | 24 +++++++++++++++++++ lib/ethdev/rte_mtr_driver.h | 9 +++++++ lib/ethdev/version.map | 3 +++ 6 files changed, 51 insertions(+) diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst index ceb5a96488..99c25f8937 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -105,3 +105,5 @@ traffic meter and policing library. * Adding one (or multiple) actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``) specified per color as show in :numref:`figure_rte_mtr_chaining`. +#. Traffic metering algorithm configuration may be converted to the PDM-specific + values using ``rte_mtr_meter_profile_calculate()`` API function for reuse. diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index ec83178d98..5f19223663 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -64,6 +64,7 @@ New Features * Added METER_COLOR item to match Color Marker set by a Meter. * Added ability to set Color Marker via modify_field Flow API. + * Added Meter API to calculate a profile configuration values. * **Updated Intel iavf driver.** diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index e49fcf271c..e236cac09b 100644 --- a/lib/ethdev/rte_mtr.c +++ b/lib/ethdev/rte_mtr.c @@ -91,6 +91,18 @@ rte_mtr_meter_profile_delete(uint16_t port_id, meter_profile_id, error); } +/** MTR meter profile calculate */ +int +rte_mtr_meter_profile_calculate(uint16_t port_id, + uint32_t meter_profile_id, + void *meter_profile_cfg, + struct rte_mtr_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + return RTE_MTR_FUNC(port_id, meter_profile_calculate)(dev, + meter_profile_id, meter_profile_cfg, error); +} + /* MTR meter policy validate */ int rte_mtr_meter_policy_validate(uint16_t port_id, diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index 40df0888c8..d7b916b168 100644 --- a/lib/ethdev/rte_mtr.h +++ b/lib/ethdev/rte_mtr.h @@ -524,6 +524,30 @@ rte_mtr_meter_profile_delete(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_error *error); +/** + * Meter profile calculate + * + * Calculate CIR, CBS and EBS values for a given meter profile ID. + * Convert user-provided values to PMD-specific configuration. + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] meter_profile_id + * Meter profile ID. Needs to be the valid. + * @param[out] meter_profile_cfg + * Meter profile configuration filled by PMD. + * @param[out] error + * Error details. Filled in only on error, when not NULL. + * @return + * 0 on success, non-zero error code otherwise. + */ +__rte_experimental +int +rte_mtr_meter_profile_calculate(uint16_t port_id, + uint32_t meter_profile_id, + void *meter_profile_cfg, + struct rte_mtr_error *error); + /** * Check whether a meter policy can be created on a given port. * diff --git a/lib/ethdev/rte_mtr_driver.h b/lib/ethdev/rte_mtr_driver.h index ee8c6ef7ad..f1982ff220 100644 --- a/lib/ethdev/rte_mtr_driver.h +++ b/lib/ethdev/rte_mtr_driver.h @@ -41,6 +41,12 @@ typedef int (*rte_mtr_meter_profile_delete_t)(struct rte_eth_dev *dev, uint32_t meter_profile_id, struct rte_mtr_error *error); +/** @internal MTR meter profile calculate. */ +typedef int (*rte_mtr_meter_profile_calculate_t)(struct rte_eth_dev *dev, + uint32_t meter_profile_id, + void *meter_profile_cfg, + struct rte_mtr_error *error); + /** @internal MTR meter policy validate. */ typedef int (*rte_mtr_meter_policy_validate_t)(struct rte_eth_dev *dev, struct rte_mtr_meter_policy_params *policy, @@ -156,6 +162,9 @@ struct rte_mtr_ops { /** MTR object meter policy update */ rte_mtr_meter_policy_update_t meter_policy_update; + + /** MTR meter profile calculate */ + rte_mtr_meter_profile_calculate_t meter_profile_calculate; }; /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 20391ab29e..76024331cb 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -279,6 +279,9 @@ EXPERIMENTAL { rte_flow_async_action_handle_create; rte_flow_async_action_handle_destroy; rte_flow_async_action_handle_update; + + # added in 22.07 + rte_mtr_meter_profile_calculate; }; INTERNAL { -- 2.18.2