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 E1470A0552; Wed, 1 Jun 2022 05:44:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E0F042B73; Wed, 1 Jun 2022 05:44:47 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2044.outbound.protection.outlook.com [40.107.237.44]) by mails.dpdk.org (Postfix) with ESMTP id 3B96A42B71 for ; Wed, 1 Jun 2022 05:44:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DSxj9nkn2JL/HTffE8mb+Fpyys2+m0NvUihqlOjswfkbrc+oCblCEnadkx0wN+Pe8hrUrJmXgEqM2hxkZp85cXSraOA//pKiCzD5rUlpqLbZhP9dTuUvwwhVUyuwZ/GTyG+cqxXierSM5uzi8I8f8XhkUANMV2fvvjTZiw/V+WBqpw/BbOnylkbR2UKeGJyQjJiooue2m/9+aK5TXb0RhPFDO079y6CVrCksuJIN83oCn8Yt1qV121/+TDBkuAyw7/DessHUQqITQevR9xscDhKPFl/IBVzj+5tAbkA2gJytGGFkG4mWU6lI0p3tGTSMLRaklIQeNx2OOYxWEcs9Qg== 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=dp1p1doztMofSOWz6CNGn4646AtWD5/BgXxAR1lS4+U=; b=FfStFZIwmmUoIVLxHUp/EldOeEIhf3ApVAenntEtx3ETMX7sheAAUQtdMkVfWKR9tHeDZr5uUrWVih90tnK2x3ea1TdGwsQOb8Id57W/3ekW5TCpyz8ZmVIgiZ7Ba+lRsPUxg+QPVtvXs2M3vwmvzISKRZvAUxeiDnIaxOXo4GRV6Gi9OUdFOROmFtHc1qGASPy63CFMqzVkGLiqpRNmqiltHfVJZE3OxeEq2JCbvR0LxgBmWLuAB2lnUur/zK13HHLW8DK5q5viqgeuhQV4VUJ6nT1VwJaGE2xKExa4oZsbNR8Sl4J+KAgKFsB/Sh0ir1kxRQtErwP7a7qi21PIaQ== 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=dp1p1doztMofSOWz6CNGn4646AtWD5/BgXxAR1lS4+U=; b=eIac0ASLmxWad8v3iGRsEoPDdn/KjOe6fJPbjloBh83EdphzwDusAn9wo84Il0tPDvuh/p4zMZLSiykYArZbZ6DisELB9YucRedLBYDZCsHU6jtHH3wsjhfbySzwxmEDrIKmQ55i1fxuJ3t7J7N+9CQCmm5uRhRTueAojEP8lT4XpYFJWjGsGq7TaECQltaVXIHKc1NRQh06lqB09UKPSw9U8MMhMyH6m/0OqCIFXUSa629nEnfxtfudNx9q736y5/OjE+R4PYi0O+ocwbNdrL3hqhzz8KxM4oH6Zx56pDctqiNWlcancQsW5jnwf5YZqGCWwdZZLP1KZStXsgt6ZQ== Received: from DM6PR03CA0050.namprd03.prod.outlook.com (2603:10b6:5:100::27) by BYAPR12MB3093.namprd12.prod.outlook.com (2603:10b6:a03:dc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Wed, 1 Jun 2022 03:44:42 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::f1) by DM6PR03CA0050.outlook.office365.com (2603:10b6:5:100::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.15 via Frontend Transport; Wed, 1 Jun 2022 03:44:42 +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 DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 03:44:42 +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; Wed, 1 Jun 2022 03:44:41 +0000 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.22; Tue, 31 May 2022 20:44:37 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , , , Subject: [PATCH v3 4/7] ethdev: add meter color mark flow action Date: Wed, 1 Jun 2022 06:44:05 +0300 Message-ID: <20220601034408.2579943-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220601034408.2579943-1-akozyrev@nvidia.com> References: <20220522105102.1692526-1-akozyrev@nvidia.com> <20220601034408.2579943-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-Office365-Filtering-Correlation-Id: 4ebaa08f-fa44-490b-13af-08da43810ff5 X-MS-TrafficTypeDiagnostic: BYAPR12MB3093: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: uK26rGoLJ8MK+gFzAb6VdaI0pgLkGa24zRMH7ac+fbmq0KxOuX/DfNScPnKkm+UXMtnnKy8IvneLc+8qtA2b4OUrVzhnA0/rqHmrG57cyIjbWg3JrMgwLVHWsjLBrAjOzlRsdOQV5zqji4vymztbSKVhNGStrq1DkkrF8vlh0xTGc7PvClbeGpD93A9+5iL/WhSV/NI0TGOANciooSJ8AglU0UwTGtNUEP559d5lrDuoAH2pCw1OYjJ4ENVM/XBxCyQFK1hwLUnmYUd1z/FiM3I70M8ZPe5lQ3aF+EWPywTTDMiUXjseao7/q8BiNYV3Dvr5qIV7n1hf/wWFSnMpNgyClh/nvUn+DC4yOkkmehy1wUlDtkEm1Zzd6qxQVQBZElwohpUHOSWKqFoEwzBf3G3NdgWgbL0laF96skUB1ZtFW+DNAKdvQ+CgAm1DerrUyCRsVc8eVMi3LvVTDTrHu54E+KHi01ZrT7p9MtICRRqvTSHH1ftQ8unTLgBF/AWWCS24+Eg2MeeJWGXpz18ktkQIKfMoCvYsLnvXQrlYbJZEfE56qMB8Mrb8qYKPXy6B75aw3KEybLlFQTzG1noxM7GrcMiw6JK4L3j+ZC/PqUVRQ89JH2c69cSvaNETMUDuRLqymX032cVYleG05Wc18UcyndpwpbG8FUoT789tc7p+36aXVcVTPjHdtVhYTn+lXl/Gk7YwwSjFgUqMEA5mKA== 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)(5660300002)(8936002)(7416002)(26005)(86362001)(16526019)(186003)(2616005)(336012)(508600001)(1076003)(47076005)(426003)(2906002)(40460700003)(8676002)(83380400001)(4326008)(70586007)(82310400005)(81166007)(70206006)(36756003)(356005)(6916009)(36860700001)(316002)(54906003)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 03:44:42.2658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ebaa08f-fa44-490b-13af-08da43810ff5 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: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3093 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 mandatory 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.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..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.c b/lib/ethdev/rte_flow.c index 07d7e998c0..9049d3bad3 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -262,6 +262,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 9754f6630a..2dc80ad9ef 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 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