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 35B8DA034C; Wed, 21 Sep 2022 04:12:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20D2D42B73; Wed, 21 Sep 2022 04:12:36 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by mails.dpdk.org (Postfix) with ESMTP id B59F74282B for ; Wed, 21 Sep 2022 04:12:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EF9Qw3gXurS9O/hpqWTbhfaaKY2sEpacrOhyfig1/jt+SaHCnc9gFXI05Z1hpV5j5cu67hi18aINUAIt1wyBqB1KKsd/Hd9fdDxYmFLzHIPaeYT9+D4+hGxG9pM8Tgdok+Au95xM1vjSc0t+0O4U2LG/NmrgR6OCWrXyMj2VJxMto8lDepuEFaYKMTeaFyAUJWgtPURnZkBQX2Tc9tceMWo3w0AVVSmCNot0wDXD/EezPd4363Irk2HFg797X9vDgUmMS7u+73/0g1oPDz+uwn7F5KGlTBP/e3tJPxsZel/SFOHDHhCYOuARzKvHJERewInrDdMvikTqjnb+KDNEGg== 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=3CMiC0LqO6QiblJ7orKtG3xxOEJls2efsSpOcqFTauE=; b=CciOtcXZQ4otuD/o5iY+yRSgYYhSJexh53CgaKgyNL8ioA4ssW36YkVgXLLb6PpIumZs7ho8JFk0sf2YYUNKT4zw16NqK1yES0Wc6AflTl99+MoaPAzaWRvByXLCT6jR1DI7bJMlcxjQW6PHRp8Hcw96hhhqi5tXtcFgoecDU888WO26ZdYBFPIbd+pnK2Np6BHSBvbYbiX5rVio1nZafbtdu1mVF0EQu/+7FmixBjoV5MoboS+f8R+DCqbmgEV4Oough+2P1AUeXHFXkHNh7Iu8+qZFFgkbIV0JaQ7eYmhumk7SLEm7MhxV7Oa/KOMbJd1tf3HSAbDiIRkDd/ihUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=3CMiC0LqO6QiblJ7orKtG3xxOEJls2efsSpOcqFTauE=; b=bXFlPckwx1WL+XjoLN7GdwzrAKTbkE9GL57/RfnY87tEMUoiZbZygZQsj+vDz1TXyymhidXGe91LIOOyOQ6+EJvQOHwhiArGRLrbKrVPS8gq50afNd/wM3DaK3TIB2cxqw3I+Ae3ztWO9xqX+wgunQLSNdSXoz9ROneE/+fsDbM6MkZZkj52TUPlZu3WhoeQzpGcys+K3SObzDf21y2pkqy6xSauwL0sRsHfILnGC5ztO/ugg2CYtaVALCRhl7uNrqOGtsJY6RXpLDs9YG7cy13KjZf1TxUgDJ41o4HRB1tQ0lqyV6lh0N7+YUBv0SYk7cIWs5Gb3Xhhpy8+qYed6Q== Received: from MWH0EPF00056D0F.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:11) by PH7PR12MB6786.namprd12.prod.outlook.com (2603:10b6:510:1ac::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.19; Wed, 21 Sep 2022 02:12:32 +0000 Received: from CO1NAM11FT105.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::209) by MWH0EPF00056D0F.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.4 via Frontend Transport; Wed, 21 Sep 2022 02:12:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT105.mail.protection.outlook.com (10.13.175.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Wed, 21 Sep 2022 02:12:32 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 20 Sep 2022 19:12:17 -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; Tue, 20 Sep 2022 19:12:13 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , , , Subject: [PATCH v4 4/7] ethdev: add meter color mark flow action Date: Wed, 21 Sep 2022 05:11:30 +0300 Message-ID: <20220921021133.2982954-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220921021133.2982954-1-akozyrev@nvidia.com> References: <20220601034408.2579943-1-akozyrev@nvidia.com> <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: CO1NAM11FT105:EE_|PH7PR12MB6786:EE_ X-MS-Office365-Filtering-Correlation-Id: 76526430-b0bc-44ea-225b-08da9b76be38 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: TSMcv+3Nttecq2FLl5WKDD1dVy/d2pHklDkVYBLVC7yyTKCrzuDpODX9bmraF3aO+uSEeGXa1lbmVzBHouAibRBktj3A1tKpKag4R/0SjxouJyUsdQDXIhKntOdaDn9RI6nE/f3mQlbqFcEDoTYEoNqUivj2lmsQoO50XmjkR8rM6MF9BOcDSppfgDCsAU1Uo8FWGgAEztFTYqIzNbam4q2DzYlRwfO33kcf60Tp/3KrcgarQ6F1sn3l1orYQ5Bp0C7wt+UzifbZCxoq5HLQuO9B8SZDcBVb+Mmz/OwmQUvUSkAska9Fysjxd1cskMVMHPYVPGnvCFSXR44pkSz4jnY9bnvUOhiHkdsUseBK3KcPjGL066mrtUIhIwWXlOO3sDW773BL049tFZKZ6qeh1NiEXBDttHbjYuxOqdW401sLCQxJRPZU1aQFrN/iTjN2lvWQWUyhyAZn1pcoW9xMfr4xwgTWmBHuvixA4A6fuCdtLbs0Wu20xXB9BcS7UnI6uFatkt0A+rFacH9b9JSAefZNm8wiXYKxEZ+Ml8HMUqsRg6GrVAn6SYtNtp7lzATNc4TzfqdYHaEtYd/URKNWNFAgzH9ruhtrd9b1ASCKUwtoaJ+fsGqKhi4ILu2DiO1wsEJ8YQex9mmgx/3y//b0D0FQZL/40HBTwh6FLNY3g4zjavRCm6bX/vEd/nOfKMIz+/9OHWLbeDcntLKPktEuxUnsfOKOPZvB9770s4Lyi1qRhFVCKApsL0wOmv07av+OxTBxVPASVDyFmlFBVVehjg== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199015)(40470700004)(36840700001)(46966006)(70586007)(70206006)(4326008)(40480700001)(8676002)(7636003)(356005)(6916009)(54906003)(7416002)(5660300002)(316002)(86362001)(8936002)(2906002)(186003)(83380400001)(36860700001)(1076003)(16526019)(426003)(36756003)(2616005)(26005)(336012)(47076005)(82740400003)(478600001)(40460700003)(82310400005)(41300700001)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 02:12:32.4423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76526430-b0bc-44ea-225b-08da9b76be38 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6786 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 a packet stream and marks its packets with colors. The marking is done on a metadata, not on a packet field. 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 mandatory here. Signed-off-by: Alexander Kozyrev --- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++ doc/guides/rel_notes/release_22_11.rst | 1 + lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 28 ++++++++++++++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 018def1033..5b87d9f61e 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 a 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_11.rst b/doc/guides/rel_notes/release_22_11.rst index 7969609788..401552ff84 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -60,6 +60,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. Removed Items ------------- diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 99247b599d..7ff024f33e 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -260,6 +260,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(CONNTRACK, sizeof(struct rte_flow_action_conntrack)), MK_FLOW_ACTION(PORT_REPRESENTOR, sizeof(struct rte_flow_action_ethdev)), MK_FLOW_ACTION(REPRESENTED_PORT, sizeof(struct rte_flow_action_ethdev)), + MK_FLOW_ACTION(METER_MARK, sizeof(struct rte_flow_action_meter_mark)), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index edf69fc44f..74e7ddf73a 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2903,6 +2903,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, }; /** @@ -3774,6 +3783,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 a 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 assigned 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; + /**< Policy 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; -- 2.18.2