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 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 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: 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; -- 2.18.2