[v5,0/7] ethdev: separate metering and marking from policing
Message ID | 20220926145745.3962600-1-akozyrev@nvidia.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 08431A00C2; Mon, 26 Sep 2022 16:58:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE56F40DF7; Mon, 26 Sep 2022 16:58:27 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.42]) by mails.dpdk.org (Postfix) with ESMTP id 123A04069B for <dev@dpdk.org>; Mon, 26 Sep 2022 16:58:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kTvj0LFjQp+8UhuhNJMLmEfYOu04yYwXQ4zjZK1CBipDFdeDB1BfN91pTjXUPRwhLq0rPPqw1IWW521wrveESvTs+and7EvXcBkk8gH5cQEzVnWsjIshjuFAc6IJZKqjbNEEV+gn81Zun5PCabSyksEvbaFp/2HH7cudW0z9WItalWi53SmLD3BRmAHiFX1vgVmBAjrnDPA7v7rR7nU47fQ5ZQY+vKmSCcijlrloTrsXKYlHEFUPgL1ayM8oUKEzZ/2ZkT0DvcTdTbtKDtS3HOo3fF4ha8/EDzu0fwKzkd+miqIcN7FfJs4vvgUoxnl6BPETKUJY3MdWAqSFuHt8LA== 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=cXKb3XxvZHp8IOLFdv5jmbeytHSm6JH3j3VR+99BBF8=; b=h5qIIFwfS/FTVaK4c+Vo/jl3EjhEpF1yvC1DFpNphcT/QEjxwM3TgXPVKT0wBaNp8J9hJJoRZZBdu+B+cNGWz7tMc8+we8Ut5qEaf1xcqR2mU7azfvPYF72p1ARcFGcS+XkUaN5o6nPIfVwJpsvP7EXvKS34dl+LTmgz7wpvupQhwRSZB3tiJfL/WBV0khQhUiIu4m4H1eG+PGubgUOw8izIVmztfOGB8vl0x3ryLx2KJIEkRvOm0TyAbegC9ToYUw802TYmmYsk9NGN1Ue4HSurDDLJ7lE1RsOEs2P3e6ypUx+/lfIalcRaiq5qV7Ziq1kwR0AyZcn1nR6Lon2ZeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org 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=cXKb3XxvZHp8IOLFdv5jmbeytHSm6JH3j3VR+99BBF8=; b=TtekpStd1bVUsnvkTzuRmLFCwhRHn0R6ll7q1/roGXEmb0AMUslVZR6YugFu+Rq9X7mSLEBJSKEwwUvPJMbvUA3IAiK00d0Gl7kvA0m6/3UZfdKKxNvCJPCWJQUOCkNfz/2GvAkh5HPZQqqz2g7JNIyiLmO/SSx+HFTYc+o6QF0KbUViqBzsm4tw0sKQcSy2ZCEqGjnxnMMssfwqj00TIqTP+CKNmtQ1dWuxfcORB1iAtQXtAQTLrsMggNxDsuPj2E3UwxJZ/9FYckPudhKjadRggJI88W1AX/fAcKl4xV3oSIHUUqydVIHIVVvexvLzjHs9GV4FBncV0yxpEWEkzQ== Received: from DM5PR07CA0056.namprd07.prod.outlook.com (2603:10b6:4:ad::21) by MN0PR12MB6176.namprd12.prod.outlook.com (2603:10b6:208:3c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Mon, 26 Sep 2022 14:58:24 +0000 Received: from DM6NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ad:cafe::fe) by DM5PR07CA0056.outlook.office365.com (2603:10b6:4:ad::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25 via Frontend Transport; Mon, 26 Sep 2022 14:58:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT005.mail.protection.outlook.com (10.13.172.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 14:58:23 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Mon, 26 Sep 2022 07:58:13 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.231.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.29; Mon, 26 Sep 2022 07:58:09 -0700 From: Alexander Kozyrev <akozyrev@nvidia.com> To: <dev@dpdk.org> CC: <cristian.dumitrescu@intel.com>, <jerinjacobk@gmail.com>, <orika@nvidia.com>, <thomas@monjalon.net>, <ivan.malov@oktetlabs.ru>, <andrew.rybchenko@oktetlabs.ru>, <ferruh.yigit@xilinx.com>, <mohammad.abdul.awal@intel.com>, <qi.z.zhang@intel.com>, <jerinj@marvell.com>, <ajit.khaparde@broadcom.com>, <bruce.richardson@intel.com> Subject: [PATCH v5 0/7] ethdev: separate metering and marking from policing Date: Mon, 26 Sep 2022 17:57:38 +0300 Message-ID: <20220926145745.3962600-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220921021133.2982954-1-akozyrev@nvidia.com> References: <20220921021133.2982954-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.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-TrafficTypeDiagnostic: DM6NAM11FT005:EE_|MN0PR12MB6176:EE_ X-MS-Office365-Filtering-Correlation-Id: 5de1314c-47fe-4a48-59d5-08da9fcf8f76 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g8pl6rHcoDQTyK7pC3LecsTsq8bIRG6SgoG12ELd7ppi9e27uQ16BfzI9cpmN2MxyrZAFm/Nl2M5sXk3+OKz/p0qyk9DZQB0aH1tKW2n53CoFTV05NyvQSxJXy2lB33wYvwSUEsgQ+4MvrkTkUxzdbtiZjsSyvdAyg2rej38fDNdjIBDEjTi8WUTgTBRpbj7j+VDW9l5/7o7ap/szX0hGd0OSdMw+n+7DUNrBk0SvzsxBdNsnRmoc9XzzO69LJpV0SoDyoR3+Dq0+QiU0GiKPzI1jaujuouknwIdY77o6Kln4hM92mPCzr1ocxCxqgPni1klh7/P4BMHtFcyXd9puFKs15TzvnkfdHWMQxzaZZtWRZeEm7C+a/G06QAWH1Q3BiB0Hj6DStx6i1D0PvsZDbvtdeb9HgIFrASCghMaJNmxKRihnnUwSdeAjyypik1Bn351z+eBofJmBwcg6d/++krh1+pl60PqxPBSRnH6SulUuBVOPKMUi0kyzR2YHsK08lwkrzD5qib8Fe4MwWaWCYLqDZ7DNZE62sTXWvgqUdced6sANOIaR+oxcgZ5i21OxPsRRWEk574AZ3iUx6kdXHC8eL0oyhxKhKAIULVBdaIldVgApuAYsyMrF+3YeefjpNcdFidDNR9Hxcpsfb9JQtd+FHQiiNMUsvVH0JqhGGTxbSbtw+q/Ok5mRHTcAzZRrd1yZyKPWgWJ0t53g69g6SLWqcuk4WFjM1qtsGQnPWHaR3wySROdQ467Xd9C6tJ0bJxA/b0X2AbgkGduNT2raW0DCXO6bMkXI7r19cX7UAjeyPYwNYUEdJMg1gjZSBZrf3i7qR19O+wJGvGGpLVUhHzoUV34FWrbVq86hPLSvMA= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(40470700004)(46966006)(36840700001)(47076005)(6916009)(54906003)(966005)(316002)(82740400003)(356005)(478600001)(82310400005)(7636003)(5660300002)(40480700001)(26005)(1076003)(186003)(8676002)(40460700003)(70206006)(70586007)(4326008)(36860700001)(6666004)(41300700001)(7416002)(8936002)(36756003)(426003)(2906002)(86362001)(2616005)(83380400001)(16526019)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 14:58:23.8885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5de1314c-47fe-4a48-59d5-08da9fcf8f76 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6176 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Message
Alexander Kozyrev
Sept. 26, 2022, 2:57 p.m. UTC
Extend Metering and Marking support in the Flow API:
1. Add METER_COLOR item to match Color Marker set by a Meter.
2. Add the ability to set Color Marker via modify_field Flow API.
3. Add Meter API to get profile/policy objects.
4. Add METER_MARK action to perform Meter color metering and marking.
Provide greater flexibility in how Metering can be used.
RFC: https://patchwork.dpdk.org/project/dpdk/cover/20220502200439.4100965-1-akozyrev@nvidia.com/
Traditional Meter Usage:
profile_id = rte_mtr_meter_profile_add(RFC_params);
policy_id = rte_mtr_meter_policy_add(actions[RED/YELLOW/GREEN]);
meter_id = rte_mtr_create(profile_id, policy_id);
rte_flow_create(pattern=5-tuple,actions=METER(meter_id));
The METER action effectively translates to the following:
1. Metering a packet stream.
2. Marking packets with an appropriate color.
3. Jump to a policy group.
4. Match on a color.
5. Execute assigned policy actions for the color.
New Meter Usage Model:
profile_id = rte_mtr_meter_profile_add(RFC_params);
*profile_obj_ptr = rte_mtr_meter_profile_get(profile_id);
rte_flow_create(pattern=5-tuple,
actions=METER(profile_obj_ptr),JUMP);
rte_flow_create(pattern=COLOR, actions=...);
The METER_MARK action effectively translates to the following:
1. Metering a packet stream.
2. Marking packets with an appropriate color.
A user is able to match the color later with the COLOR item.
In order to do this we add the JUMP action after the METER action.
3. Jump to a policy group.
4. Match on a color.
5. Execute actions for the color.
Here we decoupled the meter profile usage from the meter policy usage
for greater flexibility and got rid of any locks related to meter_id lookup.
Another example of the meter creation to mimic the old model entirely:
profile_id = rte_mtr_meter_profile_add(RFC_params);
*profile_obj_ptr = rte_mtr_meter_profile_get(profile_id);
policy_id = rte_mtr_meter_policy_add(actions[RED/YELLOW/GREEN]);
*policy_obj_ptr = rte_mtr_meter_policy_get(policy_id);
rte_flow_create(pattern=5-tuple,
actions=METER(profile_obj_ptr, policy_obj_ptr));
In this case, we define the policy actions right away.
The main advantage is not having to lookup for profile_id/policy_id.
To free the meter obects we need to do the following:
rte_flow_destroy(flow_handle);
rte_mtr_meter_policy_delete(policy_id);
rte_mtr_meter_profile_delete(profile_id);.
profile_obj_ptr and policy_obj_ptr are no longer valid after that.
The meter profile configuration cannot be updated dynamically
with the current set of patches, but can be supported later on.
Now you have to destroy flows and profiles and recreate them.
But rte_mtr_meter_profile_update()/rte_mtr_meter_policy_update()
can have the corresponding siblings without mtr_id parameters.
In this case, we can update the config and all the flows using them.
The meter sharing is done via the indirect action Flow API:
profile_id = rte_mtr_meter_profile_add(RFC_params);
*profile_obj_ptr = rte_mtr_meter_prof8ile_get(profile_id);
handle = rte_flow_action_handle_create(action=METER(profile_obj_ptr, NULL));
flow1 = rte_flow_create(pattern=5-tuple-1, actions=INDIRECT(handle));
flow2 = rte_flow_create(pattern=5-tuple-2, actions=INDIRECT(handle));
Once we are done with the flow rules we can free everything.
rte_flow_destroy(flow1);
rte_flow_destroy(flow2);
rte_flow_action_handle_destroy(handle);
rte_mtr_meter_profile_delete(profile_id);
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
v5: added color-aware mode to METER_MARK and ability to update the action
Alexander Kozyrev (7):
ethdev: add meter color flow matching item
ethdev: allow meter color marker modification
ethdev: get meter profile/policy objects
ethdev: add meter color mark flow action
app/testpmd: add meter color flow matching item
app/testpmd: allow meter color marker modification
app/testpmd: add meter color mark flow action
app/test-pmd/cmdline_flow.c | 238 +++++++++++++++++-
app/test-pmd/config.c | 45 +++-
app/test-pmd/testpmd.h | 4 +
doc/guides/prog_guide/rte_flow.rst | 32 +++
.../traffic_metering_and_policing.rst | 7 +
doc/guides/rel_notes/release_22_11.rst | 8 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 +
lib/ethdev/rte_flow.c | 2 +
lib/ethdev/rte_flow.h | 95 +++++++
lib/ethdev/rte_mtr.c | 41 +++
lib/ethdev/rte_mtr.h | 40 +++
lib/ethdev/rte_mtr_driver.h | 19 ++
lib/ethdev/version.map | 4 +
13 files changed, 544 insertions(+), 3 deletions(-)