From patchwork Sun May 22 10:50:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 111579 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 41190A00C2; Sun, 22 May 2022 12:51:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B4494113D; Sun, 22 May 2022 12:51:28 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by mails.dpdk.org (Postfix) with ESMTP id 0252F40A82 for ; Sun, 22 May 2022 12:51:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxQiVKLjaZ3O+uBP6udJQ8JNdw5xVNPmNUSRF2wxlddrB9K/h1XeFmXW7tgGXOxGKRT5IUXhRBNQNq8X2EvSa4sMyu6bcwDsdCnqnAI93ZvPNGFbMVFHpmFHRPdFrbwcYlDjuGZ4xeWHAxGWJ+rP1VrFdExd/mPJmyEM6jy2g4N8zK2QRkGFAx2zBWhDwT3Db7nU1byzvY19P1S3MnZfN+YZuDeYr5+GXNblCq9RA1Uy8yoa9OXfDipgrm+VfgBpd52wfbW/RgYz+MaUxk4Kxjtx/xSI9JfCzSF2mpuDxgF2U2WDWBPkoIPShhfUG2WsGvhR//asbp4enziUvkning== 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=99OQTBeI3vYDMpm92s3ntNBUJVKzzgRnQZd9ZUO7Fdg=; b=EqIztMCosx/sGRc+EsCeZatm0T69DlyFW4rx/Yi2MqX1nEP4Fby8EvFswV+I7ATTmv4OYGPIjN6ZaOgs8rOAtmhLRVTN6dxB1oqXs0j+6KRQm1fwQxYaHvF86LozrwPguwz+MT77gTrF7iUIrRHmUFZZbZABHr4UcFoOCx/HPVn1GD2PmGY62rygcl3nnVbcW48fdsKbDJd+jFxA788dDorx7Cc6B2g0XG1yX+iobf9ZqOjgtanXcv0psYCURIebUXcBouWz1VEKYJ1FB+qemd46e5V6WdDXAg7KPlh4jFhCWwq0wJe018hkduc2PMF78az+btKI2R3vjxIqHbeNJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=99OQTBeI3vYDMpm92s3ntNBUJVKzzgRnQZd9ZUO7Fdg=; b=Mlab0gXGyE9tj6Kbxj1GM1nQV7iH/PwkaMhncnuQsUZIKlrsfxkmrbw5UyZU1nV8yijIotSh068xq4Jg0WkavxVRftZVHArwGdntmsuf/P5/KMi3rFclTIXdWOIZsoDd6Y244+ztu6pqsbP4Z3VN9X7kqbzOzBl/tSTU13eh0KXSNz10+TPoRrgdcWSha1kbdkawoPtCdt96eIHXRNyWpJCMqa3lW3E11pfT4X45OrOL7w6jerllZ+muiuYRPzr8TBlaHDZ2UDj4qx0hv//8FQ32Oz6uoXirdNlygG64l3+pV0ewG29cMJbSZGay0AUPXIeE2K+XOYIkGs6dqROv8Q== Received: from DS7PR03CA0294.namprd03.prod.outlook.com (2603:10b6:5:3ad::29) by DM6PR12MB4619.namprd12.prod.outlook.com (2603:10b6:5:7c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Sun, 22 May 2022 10:51:24 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::1) by DS7PR03CA0294.outlook.office365.com (2603:10b6:5:3ad::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.19 via Frontend Transport; Sun, 22 May 2022 10:51:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5273.14 via Frontend Transport; Sun, 22 May 2022 10:51:24 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 22 May 2022 10:51:23 +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; Sun, 22 May 2022 03:51:19 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v2 1/4] ethdev: add meter color flow matching item Date: Sun, 22 May 2022 13:50:59 +0300 Message-ID: <20220522105102.1692526-2-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220522105102.1692526-1-akozyrev@nvidia.com> References: <20220518043459.1281590-1-akozyrev@nvidia.com> <20220522105102.1692526-1-akozyrev@nvidia.com> MIME-Version: 1.0 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: 19b48447-7f43-4732-b873-08da3be103a4 X-MS-TrafficTypeDiagnostic: DM6PR12MB4619: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: T7/656ZIa2bUFoqZgdicOEhyttLSP6O+bT8agw7Mq2g5YKqP4GLLMu6yYyLUS9Kstd9e1jt41l7jllFRnDkGwu75NKIAqPtndrqlhW/N3O2dvEommatv83ZkFKyUrtgGzoaAYZeuKpY5k+YHbXHL/qOCUUADVE4xnTgsgX/XXPqUEAQBenKHBlN9bArpdrDecITvG1/7ZLF95rnJG5GKI8tdz5m+OmLver8UL8Wa6gKH+CKTrLVYR9Bea5Wk6JOstrA3LffeWON7d669jkJatq4M4E7nS7W6T5q5JgJMkByaCDPqS3EZ2ECbWq1cxjEJjcNf2dlwIIt+NSysSPHPrHKtIb190xcM6wSzA6YsOuT5lzAbkCE9tZltdq7FZj8STfUM67KEzEBQLLSuczT0dib9ojnMXRlEpO6f+O2e96lPNG8i6fZIi8bUC8pgr8XDQ7uYNv4PiKt+ZsQyscZjUrNXJJTnnMOLxC1H/v0uUbfoc3RrWijim7dhv6/Q+pIX1w1Wgq5rXiut+bnEAichAA8c/ZvoIss8OY58Lhfvw6vNf7NR8dqVZb+TpYZG3Mcike5ZyfdrJ4x+fymcaNCBwlPa6UUB0pzQahGqBsnV01P5vKSubQLDKuG7WGsZOz+P+B2vPKJX1FUFgBQKI4vUCz6asGbm4ZsidOP89FnRbBSj1KlsSe6LM5CpbTwMLJF6lGXGkjoaPDxRvgoB8jxdDw== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(70206006)(70586007)(7416002)(81166007)(2616005)(426003)(47076005)(336012)(82310400005)(8936002)(356005)(2906002)(26005)(8676002)(4326008)(1076003)(5660300002)(83380400001)(36860700001)(86362001)(508600001)(36756003)(316002)(54906003)(6916009)(6666004)(16526019)(40460700003)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 10:51:24.0059 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19b48447-7f43-4732-b873-08da3be103a4 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4619 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 Provide an ability to use a Color Marker set by a Meter as a matching item in Flow API. The Color Marker reflects the metering result by setting the metadata for a packet to a particular codepoint: green, yellow or red. Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 7 +++++++ doc/guides/rel_notes/release_22_07.rst | 4 ++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 588914b231..018def1033 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1651,6 +1651,13 @@ Matches a PPP header. - ``proto_id``: PPP protocol identifier. - Default ``mask`` matches addr, ctrl, proto_id. +Item: ``METER_COLOR`` +^^^^^^^^^^^^^^^^^^^^^ + +Matches Color Marker set by a Meter. + +- ``color``: Metering color marker. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 0ed4f92820..c1804bc74f 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -69,6 +69,10 @@ New Features Added an API which can get the number of in-flight packets in vhost async data path without using lock. +* **Extended Metering and Marking support in the Flow API.** + + * Added METER_COLOR item to match Color Marker set by a Meter. + * **Updated Intel iavf driver.** * Added Tx QoS queue rate limitation support. diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 2c35a2f13e..07d7e998c0 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -161,6 +161,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { rte_flow_item_flex_conv), MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)), MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)), + MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index d8827dd184..75ec6621ac 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -671,6 +671,14 @@ enum rte_flow_item_type { * See struct rte_flow_item_gre_opt. */ RTE_FLOW_ITEM_TYPE_GRE_OPTION, + + /** + * Matches Meter Color Marker. + * + * See struct rte_flow_item_meter_color. + */ + + RTE_FLOW_ITEM_TYPE_METER_COLOR, }; /** @@ -2201,6 +2209,22 @@ struct rte_flow_item_flex_conf { uint32_t nb_outputs; }; +/** + * RTE_FLOW_ITEM_TYPE_METER_COLOR. + * + * Matches Color Marker set by a Meter. + */ +struct rte_flow_item_meter_color { + enum rte_color color; /**< Meter color marker. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */ +#ifndef __cplusplus +static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = { + .color = RTE_COLORS, +}; +#endif + /** * Action types. * From patchwork Sun May 22 10:51:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 111580 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 15F7DA00C2; Sun, 22 May 2022 12:51:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F02FE427F3; Sun, 22 May 2022 12:51:31 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2045.outbound.protection.outlook.com [40.107.220.45]) by mails.dpdk.org (Postfix) with ESMTP id 6FC64427F2 for ; Sun, 22 May 2022 12:51:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kw2xKB2cjLSpGvik3Ok2GsEBhfmOo6DdK0d5nd8ZSvyTG9A9ZCn+cMFDSqGJilG7l/aIdCkl1+bTRh+lnKMYGX/vnJ9edWaB6DQMCqbKwRsxiir9MCUIxFH7a1hP+NvowbAR6m/rDLUfVhPkalP/VQoql625rsIpiFQfZ+jTjOxaFZMYLzre7XJRXFuHR9l9ZA9aBe0HHU4+t8JQBCyq6aCBAEYJ2xxBrjLlILyVq+4KoThm6JKgeNr0jg4JMQd+nlrmGYYLFd1bzIUZA4JPM53rHHq17mFHjg+6Wdz+TExwqarHlr8EeRvqpMHl6lpfgi5yw0ozfzqCQSitAEPphA== 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=0DM7/A8Is9BSFxuoV1PL+1bf+hV07Nl/TEcZjxb2wwY=; b=m38wYfaV4vDx+UIlNDMpkWOjAuRHDd3Bm1Zajiz7CZ6NsoMkdlyD8k2yE3twVv3l2zZY8o4EeYsZDKjx+UFHEEN0wuxSuEDI1DUPmvcV2H+mi8J8uyYcyfXxt2gLIgwBXOhUjPlCDZn/bZRwattBUHnTYrw2ZYIh0VUyHw78qAYU960ztr9L3wwXvmW7y/ekCGutR9FnjRxOKYz2Qy0Fmne10FlHHmPvo54Hos4NZv9dI/QVNbpiVLacdjQuayOad2xE2QIXBj2EwdfTOaP9YhDiVpvIz1bo1ySpY91sVQOHw8BlB5eaRI8yIUV3bzCS7CHuvLNsxYRML1H89nLGbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=0DM7/A8Is9BSFxuoV1PL+1bf+hV07Nl/TEcZjxb2wwY=; b=p0n9SuSvnBu/5maHApyTUU14wqcLC4vngu4JBvNlWoQvKiDB4V9JozEITUyNTLw+I++OzJ8tm2ktEVox7SrWYapUi3LeNJulKZKQS8XJXbzVqgScvTmYr3ly/sRNO108q9dlp1RCbVZgooCQj0WKe+WHCc+uEC6inC0lROyW8Bxoti6Uzs8HFWpWTiIlYLwEZBo3LD+I04q2me7b4j1KabWS/6t5ewUoXj2ABTLdcwS89giC7T2ZmKuF8/ta5Uyo93h6A4vBwpo7nM5g2rlq8zRHF2CeVS9vH4QbU0QNlVFZBUILwKxno4BrE0cD4eijhCM1K+uWV9+hNjxd53EKsg== Received: from MWHPR02CA0011.namprd02.prod.outlook.com (2603:10b6:300:4b::21) by DS7PR12MB6286.namprd12.prod.outlook.com (2603:10b6:8:95::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.21; Sun, 22 May 2022 10:51:28 +0000 Received: from CO1NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:300:4b:cafe::46) by MWHPR02CA0011.outlook.office365.com (2603:10b6:300:4b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17 via Frontend Transport; Sun, 22 May 2022 10:51:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT014.mail.protection.outlook.com (10.13.175.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5273.14 via Frontend Transport; Sun, 22 May 2022 10:51:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 22 May 2022 10:51:26 +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; Sun, 22 May 2022 03:51:23 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v2 2/4] ethdev: allow meter color marker modification Date: Sun, 22 May 2022 13:51:00 +0300 Message-ID: <20220522105102.1692526-3-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220522105102.1692526-1-akozyrev@nvidia.com> References: <20220518043459.1281590-1-akozyrev@nvidia.com> <20220522105102.1692526-1-akozyrev@nvidia.com> MIME-Version: 1.0 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: ee642541-bbd5-4a3e-4fba-08da3be105e0 X-MS-TrafficTypeDiagnostic: DS7PR12MB6286: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: 5N0Tg8eszhlFabkv1B02LAwV07tAWqmTZp+t3rZ9OB4UIDLKPgc0vuKOIKMZ5vTh4uzFir1E6hZohn17nIQe6HkJbRhBm+erE9S7yy6CF4waw3CF/pr09eETmLbN7XH3/fDdzZxPWVRUv+1fWCO4xksMuCBI2BPmE4DyQil1BezLmv7cCy9e/Q5k48/ek44AsBBgBgCy1jRjybTPKCrWw7MUfZ6kSzwbMaCVTjkZ8DhO+S2Ym4hA7L/c24dRpqV0dAMjGlPdHoKnXNbBKl5SPURlVlH4JhFU9QftBTeHi+xpZILx7rpvqtMlbyV8gzq9LYpRMvZ/BoVD7RONFaYd9rraz87QKid1PRciqYqHqf+8xXi167E3lmDg82f936ImraDAgpgwM5pkP984BaD/mRo1mMyzbLHut8OkL1nbUx1lmEMyxz0eB9oa4gU7I5mibsH+0eOw23UURSOgtmDXgSQ6xaJZaM9gCxQUPuy0FZtC9p+JV7mj75Gw/NK3HDbiB0yIYawTtPPi/5CkNenAgCGasSnmBIsOBrQeatKByixZvTtphtbmWzaYmHfJQw7o2hMisQFOSuneuqWRVJ5L26OkbH3EwLp1cv7xGvNXAwO8UyYGD5Cikh44aQ/Uhx4FWp3m3TjuAbByRlNl21Xd/jmbvIcMil6HdKjAqRUTTqNISYhQvXE7Ly5P4VkAd+dzqkyAblUv5NuD/wjAEajHeA== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(336012)(7416002)(47076005)(356005)(426003)(36860700001)(508600001)(6666004)(1076003)(83380400001)(8936002)(2906002)(5660300002)(36756003)(81166007)(40460700003)(86362001)(82310400005)(26005)(2616005)(316002)(6916009)(54906003)(4326008)(8676002)(186003)(70206006)(70586007)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 10:51:27.7519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee642541-bbd5-4a3e-4fba-08da3be105e0 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6286 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 Extend modify_field Flow API with support of Meter Color Marker modifications. It allows setting the packet's metadata to any color marker: green, yellow or red. User is able to specify an initial packet color for Meter API or create simple Metering and Marking flow rules based on his own coloring algorithm. Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam --- doc/guides/rel_notes/release_22_07.rst | 1 + lib/ethdev/rte_flow.h | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index c1804bc74f..451ff8d460 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -72,6 +72,7 @@ New Features * **Extended Metering and Marking support in the Flow API.** * Added METER_COLOR item to match Color Marker set by a Meter. + * Added ability to set Color Marker via modify_field Flow API. * **Updated Intel iavf driver.** diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 75ec6621ac..68af109554 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3714,6 +3714,7 @@ enum rte_flow_field_id { RTE_FLOW_FIELD_META, /**< Metadata value. */ RTE_FLOW_FIELD_POINTER, /**< Memory pointer. */ RTE_FLOW_FIELD_VALUE, /**< Immediate value. */ + RTE_FLOW_FIELD_METER_COLOR, /**< Meter color marker. */ }; /** From patchwork Sun May 22 10:51:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 111582 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 A0966A00C2; Sun, 22 May 2022 12:51:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C38242B72; Sun, 22 May 2022 12:51:41 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2047.outbound.protection.outlook.com [40.107.94.47]) by mails.dpdk.org (Postfix) with ESMTP id 4851142B71 for ; Sun, 22 May 2022 12:51:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEfFumoMKxQctusqRSlR5wHnNvPxjDT+pAHV6kCkn7JJNZ9Zc9zBJbA8vYKXv/SvLFT4repFnD+Ywyz+d9fT9hBlWRvGJmYnDIdUbE1y4Sa+dDQA1jMBOvs0e8Ax6lhbG0GL3SFEl3rcvhJaMPoCqtzoMs4D69CsFsCDy9rDytYx/zJXWpH5NnTs6nXAoOdsJfUFA5d3PK0lomBTx0kGepnUb+7KgQcFJpyxsRpxVLX03VaGvoWrZ5isX3R7QSzVsNOFojLi+nCCnU3TuVlRkFYASqt/Bqaxy3oU1ozH8A7578OMK0dImRgXJ0rdJCmg8InjW+0GABEM33TQAi59tg== 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=r/Hthp1MCbbqPT1N4v84DfmdO2hAgUOtfV8IjGTlCO4=; b=BAoJdgP7jVFGIZaByrW8hKIOZeGe+lxtJbPgivWf5a+PIcXyGJadEUXOT7oSteSxGlmu+Y08oDV+t/RmHgqOKHTwK4wqaMXELQbNz4RDr2QQd4O8K4VGIcgiJxNO+ktgtrrxcFcjOxyZp7uSNwgFLbxVa6PIpcDmalBevGjHyIjkoWSKfrvzGjtB/x7HK9lPtFUmB5Kf6HksjLN3aAhW0/AMoFKS140OoUlsjbW7EjrPjkgUXmFNpEi55cX9dz8PX5renNCHUR4ETyVXq9aMxYn6qhxNVLnaTgULTjWxG8O8br92JMcnH9/XbzgQsTvJnvK4Xf7XjlB7VRTRqv6aZA== 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=r/Hthp1MCbbqPT1N4v84DfmdO2hAgUOtfV8IjGTlCO4=; b=k/HIx5fYXbK9qNg3QkKd/dw/ifByjYoTNxyhexB7aQ5uIIED0m2C3jUWVWtt+xbhNAwC/0vDFRq3W0atv7l4Yg+Rh7uul+mlFKOgx7gd/8qvclAvICCOR3a2dmL7px4iBeF1y08Hf0KVW5YzU8yfaU+DKdMxeF4L+JMP9IkZi5xpPiSrDIzktnhwpomhMWSGlUlnn/4Psqfkck+OeEAmMwDDUfWrIf9ge3AHOWRf/QuUdevzVPP5pJNybh261TXK5D7czFNVXol4ct+2V3mENycjXEv+afybBdiDYAzgDEYquItPinZIISA/1B1jw+pudYoSMRD19XDpO8ZIzNOBnQ== Received: from BN8PR15CA0006.namprd15.prod.outlook.com (2603:10b6:408:c0::19) by MWHPR12MB1456.namprd12.prod.outlook.com (2603:10b6:301:f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17; Sun, 22 May 2022 10:51:34 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:c0:cafe::c5) by BN8PR15CA0006.outlook.office365.com (2603:10b6:408:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.21 via Frontend Transport; Sun, 22 May 2022 10:51:33 +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 BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5273.14 via Frontend Transport; Sun, 22 May 2022 10:51:32 +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; Sun, 22 May 2022 10:51:30 +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; Sun, 22 May 2022 03:51:26 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v2 3/4] ethdev: get meter profile/policy objects Date: Sun, 22 May 2022 13:51:01 +0300 Message-ID: <20220522105102.1692526-4-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220522105102.1692526-1-akozyrev@nvidia.com> References: <20220518043459.1281590-1-akozyrev@nvidia.com> <20220522105102.1692526-1-akozyrev@nvidia.com> MIME-Version: 1.0 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: 6196d732-6558-4090-8406-08da3be10909 X-MS-TrafficTypeDiagnostic: MWHPR12MB1456: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: w6r4tmn341Lw5bjHosH4AeKvIV8Eq4NVgwLgXEBVF5pptFOUTUOqxmMg3FV0U3W+1PfNC2rZtVpt3sQucJtbe+tBLR1KSgJ92xbPLu1ggT6Wk66zmbwIX+RSdunfwC/rXY89mN7eCytNrzwh8BaoQcYvNy7GA61gk4UjT8AtQav2Lj6aUGBVASWM5Ie8eCF+Zm51sUG38gb8UYLb++Meb9kIPoLz3zp0JEI8j/oYhL6i1rqJQpomDOwNvILFXCDcp0bU1Pi10pxSmaAYEv2m7X9trpBvNKY/BmHS/iza32H/TyXBpx7z9VXKRLfuJNi+Avt23V0SV3wKrKBMEM33rupp3ou2HDi3kreAqG67R/nGZpHkLTBm2caMsE3P1NX3dmPYUbXxrzv1OaWBdWSlUpxm/4GOks7tQTVMs0ocgTQ5PYYhyHeWfHv2Kh58V7BPogRrzyq77ejlTUMZiSiOfIuqfwhB+ievzOh7jAVttCg8iyje1vLvlqUXb0F4zVM+SC/bMNENXuM5d8zTq4ymZLcwXtg7X8i+YlXBGJagiJygFXUMXHimQztfxEOhVDwZUzwrzwPsyeljGsUb7+P7w9jUnBBFu/Rtoo36k6DtU/jAaV0cJh33vevxsw++kMrZ7fuhF6iPdxzVtzGd5NuTNW2oIKVlstWEWdHrJzEUkgOaJBaQADT7LYTtJblAYqzCDAqFNQUsngQkKXDgbzICrw== 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)(40470700004)(36840700001)(6666004)(82310400005)(316002)(7416002)(36756003)(5660300002)(86362001)(36860700001)(26005)(2906002)(40460700003)(4326008)(8676002)(2616005)(6916009)(8936002)(81166007)(70206006)(426003)(54906003)(16526019)(47076005)(186003)(508600001)(1076003)(83380400001)(356005)(336012)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 10:51:32.9926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6196d732-6558-4090-8406-08da3be10909 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: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1456 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 retrieve a Meter profile and policy objects using the profile/policy ID previously created with meter_profile_add() and meter_policy_create() functions. That allows to save the pointer and avoid any lookups in the corresponding lists for a quick access during a flow rule creation. Also, it eliminates the need for CIR, CBS and EBS calculations and conversion to a PMD-specific format when the profile is used. Signed-off-by: Alexander Kozyrev --- .../traffic_metering_and_policing.rst | 7 ++++ doc/guides/rel_notes/release_22_07.rst | 1 + lib/ethdev/rte_flow.h | 7 ++++ lib/ethdev/rte_mtr.c | 41 +++++++++++++++++++ lib/ethdev/rte_mtr.h | 40 ++++++++++++++++++ lib/ethdev/rte_mtr_driver.h | 19 +++++++++ lib/ethdev/version.map | 2 + 7 files changed, 117 insertions(+) diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst index d1958a023d..cae35bccf6 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -107,6 +107,13 @@ traffic meter and policing library. to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``) specified per color as show in :numref:`figure_rte_mtr_chaining`. +#. The ``rte_mtr_meter_profile_get()`` and ``rte_mtr_meter_policy_get()`` + API functions are available for getting the object pointers directly. + These pointers allow quick access to profile/policy objects and are + required by the ``RTE_FLOW_ACTION_TYPE_METER_MARK`` action. + This action may omit the polciy definition to preovide a flexibility + to match a color later with the ``RTE_FLOW_ITEM_TYPE_METER_COLOR`` item. + Protocol based input color selection ------------------------------------ diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 451ff8d460..6d030bead5 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -73,6 +73,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 get a pointer to profile/policy by their ID. * **Updated Intel iavf driver.** diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 68af109554..9754f6630a 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3827,6 +3827,13 @@ struct rte_flow_action { */ struct rte_flow; +/** + * Opaque type for Meter profile object returned by MTR API. + * + * This handle can be used to create Meter actions instead of profile ID. + */ +struct rte_flow_meter_profile; + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index 441ea1dca9..90fd277040 100644 --- a/lib/ethdev/rte_mtr.c +++ b/lib/ethdev/rte_mtr.c @@ -57,6 +57,25 @@ rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error) ops->func; \ }) +#define RTE_MTR_HNDL_FUNC(port_id, func) \ +({ \ + const struct rte_mtr_ops *ops = \ + rte_mtr_ops_get(port_id, error); \ + if (ops == NULL) \ + return NULL; \ + \ + if (ops->func == NULL) { \ + rte_mtr_error_set(error, \ + ENOSYS, \ + RTE_MTR_ERROR_TYPE_UNSPECIFIED, \ + NULL, \ + rte_strerror(ENOSYS)); \ + return NULL; \ + } \ + \ + ops->func; \ +}) + /* MTR capabilities get */ int rte_mtr_capabilities_get(uint16_t port_id, @@ -91,6 +110,17 @@ rte_mtr_meter_profile_delete(uint16_t port_id, meter_profile_id, error); } +/** MTR meter profile get */ +struct rte_flow_meter_profile * +rte_mtr_meter_profile_get(uint16_t port_id, + uint32_t meter_profile_id, + struct rte_mtr_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + return RTE_MTR_HNDL_FUNC(port_id, meter_profile_get)(dev, + meter_profile_id, error); +} + /* MTR meter policy validate */ int rte_mtr_meter_policy_validate(uint16_t port_id, @@ -125,6 +155,17 @@ rte_mtr_meter_policy_delete(uint16_t port_id, policy_id, error); } +/** MTR meter policy get */ +struct rte_flow_meter_policy * +rte_mtr_meter_policy_get(uint16_t port_id, + uint32_t policy_id, + struct rte_mtr_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + return RTE_MTR_HNDL_FUNC(port_id, meter_policy_get)(dev, + policy_id, error); +} + /** MTR object create */ int rte_mtr_create(uint16_t port_id, diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index 008bc84f0d..58f0d26215 100644 --- a/lib/ethdev/rte_mtr.h +++ b/lib/ethdev/rte_mtr.h @@ -623,6 +623,26 @@ rte_mtr_meter_profile_delete(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_error *error); +/** + * Meter profile object get + * + * Get meter profile object for a given meter profile ID. + * + * @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] error + * Error details. Filled in only on error, when not NULL. + * @return + * A valid handle in case of success, NULL otherwise. + */ +__rte_experimental +struct rte_flow_meter_profile * +rte_mtr_meter_profile_get(uint16_t port_id, + uint32_t meter_profile_id, + struct rte_mtr_error *error); + /** * Check whether a meter policy can be created on a given port. * @@ -679,6 +699,26 @@ rte_mtr_meter_policy_add(uint16_t port_id, struct rte_mtr_meter_policy_params *policy, struct rte_mtr_error *error); +/** + * Meter policy object get + * + * Get meter policy object for a given meter policy ID. + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] policy_id + * Meter policy ID. Needs to be the valid. + * @param[out] error + * Error details. Filled in only on error, when not NULL. + * @return + * A valid handle in case of success, NULL otherwise. + */ +__rte_experimental +struct rte_flow_meter_policy * +rte_mtr_meter_policy_get(uint16_t port_id, + uint32_t policy_id, + struct rte_mtr_error *error); + /** * Define meter policy action list: * GREEN - GREEN, YELLOW - YELLOW, RED - RED diff --git a/lib/ethdev/rte_mtr_driver.h b/lib/ethdev/rte_mtr_driver.h index f7dca9a54c..948a629b93 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 get. */ +typedef struct rte_flow_meter_profile * +(*rte_mtr_meter_profile_get_t)(struct rte_eth_dev *dev, + uint32_t meter_profile_id, + 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, @@ -57,6 +63,13 @@ typedef int (*rte_mtr_meter_policy_delete_t)(struct rte_eth_dev *dev, uint32_t policy_id, struct rte_mtr_error *error); +/** @internal MTR meter policy get. */ +typedef struct rte_flow_meter_policy * +(*rte_mtr_meter_policy_get_t)(struct rte_eth_dev *dev, + uint32_t policy_id, + struct rte_mtr_error *error); + + /** @internal MTR object create. */ typedef int (*rte_mtr_create_t)(struct rte_eth_dev *dev, uint32_t mtr_id, @@ -194,6 +207,12 @@ struct rte_mtr_ops { /** MTR object meter policy update */ rte_mtr_meter_policy_update_t meter_policy_update; + + /** MTR meter profile get */ + rte_mtr_meter_profile_get_t meter_profile_get; + + /** MTR meter policy get */ + rte_mtr_meter_policy_get_t meter_policy_get; }; /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index daca7851f2..2609f2e709 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -285,6 +285,8 @@ EXPERIMENTAL { rte_mtr_color_in_protocol_priority_get; rte_mtr_color_in_protocol_set; rte_mtr_meter_vlan_table_update; + rte_mtr_meter_profile_get; + rte_mtr_meter_policy_get; }; INTERNAL { From patchwork Sun May 22 10:51:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 111581 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 C9D94A00C2; Sun, 22 May 2022 12:51:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DA9E4281C; Sun, 22 May 2022 12:51:38 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by mails.dpdk.org (Postfix) with ESMTP id 2BCD240695 for ; Sun, 22 May 2022 12:51:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HiTkeZtmwHkRj0k8aCJERxDhiH/VRlb8Zli2c6/oWLr3pSYYOQDgrYHLmOrppNYPx94Wx90iEAsOR2GGS5sIBYVIEEYfZtJqrO4tS8JKzonnxlwdsvzcIcqkKynj9fZ5EqX2GQATnlUKnbbaDs1NvsXqTB8/arJDqj8ehX+73xtiKj05UqJZpStdpX34Wm5NnloB9hxO6ikObhBHQOMNcv39wbO5BQPeBSpkDV7voXaRIbj9jn/TrRY4o2K1vFFAo1jTvOHWSvSRGFgTeoiVbykZBgtrl/kVcsJ+lBLueZCoCTtssYMKJoRy6qDWDaG2yBRI+5faxzklhwaNDq1evA== 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=T6GJhah9bg+iqwqiBlsKLo/w1iJYQNIQBUDYniHb0ww=; b=g5RWQVqiKO3xC6NffhnK40eij8LINAgGk2+nX+OCpO+kZXbTSOPR5IPhXQjJT57dadtWqXmXMJEW4OVwUzmwY9EsrSb58bYbOCZe0+RuEi52t3S/E84VpMj6HMthO0y5n1uaBfQfZSQ+QjUGQgy6FSUaiOW1QWc4NjxaQ/6FP/hxCaAdbiVgYViDxZ662ZFIAWVUCDA+STE6dSpop/zrlRi+84FMCzsaygjbXXNNYkuMcwttqeasOX7LO1IcCaOZKi/1/yeq8PLegrpDvQXRUnUP8AdJSjqv0FE2WGPhOL8hARBQ6YgSDzohjy6CWkgIIVQoDnLH2Fx4cjeBN+KgQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=T6GJhah9bg+iqwqiBlsKLo/w1iJYQNIQBUDYniHb0ww=; b=tMdzUDlrvUApHrjQ5xfHT2KtOPeqLznHg/+HpmV/vMc00BPu38lBCjiYzG6dRRAXoXx2EmDphE4ku43k1oeuBZgULKjKk96/+FapYqbX6+sKNepzOvuOH3+cfuAEG8v6zJUtQwvl62OPaTYB2Bj9IWA4wtfjYiE7KAsJUPrcHCS2/4C9dShuR42jYNMb8kulrXiTZ5DBBweZhlrMeWx5SPmnp7aPGzU9Ce1/VUgcgOH3RJEzVyo4KrseTm2dL7lvgO9mMx0Il6QHWqyPxwQCNMawwEap83EUAdhTIHzkdUEHJyDVTqwcciBqgI7BXFPXPuojTjfqfIbi5J5Gwkzpvw== Received: from DM5PR07CA0152.namprd07.prod.outlook.com (2603:10b6:3:ee::18) by BY5PR12MB5543.namprd12.prod.outlook.com (2603:10b6:a03:1d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Sun, 22 May 2022 10:51:34 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ee:cafe::a6) by DM5PR07CA0152.outlook.office365.com (2603:10b6:3:ee::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17 via Frontend Transport; Sun, 22 May 2022 10:51:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5273.14 via Frontend Transport; Sun, 22 May 2022 10:51:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 22 May 2022 10:51:33 +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; Sun, 22 May 2022 03:51:29 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v2 4/4] ethdev: add meter color mark flow action Date: Sun, 22 May 2022 13:51:02 +0300 Message-ID: <20220522105102.1692526-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220522105102.1692526-1-akozyrev@nvidia.com> References: <20220518043459.1281590-1-akozyrev@nvidia.com> <20220522105102.1692526-1-akozyrev@nvidia.com> MIME-Version: 1.0 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: d40d48fd-1c83-4654-e718-08da3be10998 X-MS-TrafficTypeDiagnostic: BY5PR12MB5543: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: VlX9Mq/SaKh2IAIVRxXMZdGAPvv+sg3nJEribsI3t2lTJmILYlfSCRm2k75DkxXllhvpBDUy/vG/9MlYjbcXmwPLPLXfRJp3sUsCiS5ON+bgk0zOuOM3GGsYigY7MORd2WPEOlu4j/NsWI8XidK3pkJpqcrioPyEcqRRm/M8S5Q1n5MbRlTXksHn/FLXIbAjSs4XsH6v/ypH9umxCa51pRaqUPLszIUz9jWhtRalfvkqXEnvIlUZgH8YUjhUKfD4ZRRjVV7GSZhzUfGWoEheEOzBd+Itpp+2nT7zCLOpwazesaskTzRn3W84jjI+3f8UfTi4k3oiAFQv7ZtSRvv/lmyNho63B2FdhqFS4QQyDjQGLucjRczl7y3oSH33R1zJ/RbJm8DQ7RvSClUl8HcBWY1aILDCNbKiUhgJEafH42qFRIdo+8CI0vSudS79WMnhrLXGBWUeLPybfw0tA7ahte/IMxHOhpv6ohGi93lz/RF28J89XC2JcQp9ryBR/C98ybfzwM+cWDbZEM1X72t7DW2KoqnFWqz4UpFAXqrSw5zLjEprqslPVffXRZDTCufDHaRWs/wpx1jRtTjyXozNxEL59z/QbrFLvBMBG9ffkaJFn5Qw94Zo33DF61vWWWe37087iO/akUBDYzwN6OBjb5QXc/61o3ORWY46YGeI6Uee8huUDeEzQ/3qAAugaEGSSV0k5Ii4A7ooBpb/Egk+6g== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(336012)(426003)(54906003)(6916009)(47076005)(36860700001)(1076003)(2616005)(186003)(16526019)(83380400001)(6666004)(86362001)(508600001)(82310400005)(70206006)(26005)(316002)(8676002)(4326008)(8936002)(70586007)(81166007)(36756003)(356005)(40460700003)(2906002)(7416002)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 10:51:33.9948 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d40d48fd-1c83-4654-e718-08da3be10998 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5543 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 Create a new Flow API action: METER_MARK. It Meters an IP packet stream and marks its packets with colors. Unlike the METER action, it performs no policing at all. A user has the flexibility to create any policies with the help of the METER_COLOR item later, only meter profile is required here. Signed-off-by: Alexander Kozyrev --- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++ doc/guides/rel_notes/release_22_07.rst | 1 + lib/ethdev/rte_flow.h | 28 ++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 018def1033..90f0ebc9bc 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3411,6 +3411,31 @@ This action is meant to use the same structure as `Action: PORT_REPRESENTOR`_. See also `Item: REPRESENTED_PORT`_. +Action: ``METER_MARK`` +^^^^^^^^^^^^^^^^^^^^^^ + +Meters an IP packet stream and marks its packets with colors. + +Unlike the ``METER`` action, policing is optional and may be +performed later with the help of the ``METER_COLOR`` item. +The profile and/or policy objects have to be created +using the rte_mtr_profile_add()/rte_mtr_policy_add() API. +Pointers to these objects are used as action parameters +and need to be retrieved using the rte_mtr_profile_get() API +and rte_mtr_policy_get() API respectively. + +.. _table_rte_flow_action_meter_mark: + +.. table:: METER_MARK + + +------------------+----------------------+ + | Field | Value | + +==================+======================+ + | ``profile`` | Meter profile object | + +------------------+----------------------+ + | ``policy`` | Meter policy object | + +------------------+----------------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 6d030bead5..fca7d07e4b 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -74,6 +74,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 get a pointer to profile/policy by their ID. + * Added METER_MARK action for Metering with lockless profile/policy access. * **Updated Intel iavf driver.** diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 9754f6630a..bb16108f16 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2906,6 +2906,15 @@ enum rte_flow_action_type { * @see struct rte_flow_action_ethdev */ RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, + + /** + * Traffic metering and marking (MTR). + * the entity represented by the given ethdev. + * + * @see struct rte_flow_action_meter_mark + * See file rte_mtr.h for MTR profile object configuration. + */ + RTE_FLOW_ACTION_TYPE_METER_MARK, }; /** @@ -3775,6 +3784,25 @@ struct rte_flow_action_modify_field { uint32_t width; /**< Number of bits to use from a source field. */ }; +/** + * RTE_FLOW_ACTION_TYPE_METER_MARK + * + * Traffic metering and marking (MTR). + * + * Meters an IP packet stream and marks its packets either + * green, yellow, or red according to the specified profile. + * The policy is optional and may be specified for defining + * subsequent actions based on a color asigned by MTR. + * Alternatively, the METER_COLOR item may be used for this. + */ +struct rte_flow_action_meter_mark { + + /**< Profile config retrieved with rte_mtr_profile_get(). */ + struct rte_flow_meter_profile *profile; + /**< Profile config retrieved with rte_mtr_policy_get(). */ + struct rte_flow_meter_policy *policy; +}; + /* Mbuf dynamic field offset for metadata. */ extern int32_t rte_flow_dynf_metadata_offs;