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 9D82BA034C; Mon, 2 May 2022 22:05:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 869BA410FB; Mon, 2 May 2022 22:05:04 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2050.outbound.protection.outlook.com [40.107.95.50]) by mails.dpdk.org (Postfix) with ESMTP id CEBB640C35 for ; Mon, 2 May 2022 22:05:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=odA6yX/nMzY5yw/eAPGQgmR8C/+HbgZ8zg684VExammiOkuQlXptrId65j1tsJMb7fAyurP11MRtGIAfQybQYlRrNHyyvL6voipvY6p9UAEByCRn2zDHQQuz3FGnKgc8bBNUku00ShmPOeNj4RPFyGu25oxgwytsd9VQIEW1na8kC8Hm7qgMA4+H/Pt+rrzpZyGG8xUaWJG29uY5uPREHX9leT7oseYmxPXVPBtTZ8ocP5wRrZPGlv1uUNoolyRgoqHyr2PoBtmSJ4VEOeJyj1v5YpfSbOOQLlT3ZDDQfsDI1fK96tc2ygh86Gxzg7vzASDDYh1kC9bfkplN1R5KiQ== 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=74FzPNw1mWadAGMhFSSm6QmhU7R4utHiy12sjxP9mxw=; b=QOBTZisoFnRixF4cmzdpW9IsTxWQNhypBKJ9Axl3cHLKJRVead4BP3FHvg/3noMC9dSomzBqhNjV9ZBEPpcYETZgQepPvp8M1a5/KEVxsXuGGUoJMLZGBy5Yfbpijr8uBrZSVbFWVZLr6JposPelvk3yS9+1YdFwsnaZnYHD4R6JQ/arpuvK/zHePnRx36w07Zg2w/DpSPT8o/vnkZPeBrTeDSwa7wapyGBFBAH0r8XYO2m4z1F8BldekiAtsb4oXSmBVwX2lGTc4AZs4NceH+Pm4Ja0Ap/GtIq7VUkeDmz/vFYdDH+gWObXg5kryRs2Y3QUw5zrXfqove5E2jdujg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=74FzPNw1mWadAGMhFSSm6QmhU7R4utHiy12sjxP9mxw=; b=SjHl2ZZVs67W+f1B4ahdCtdYdPUilAJauQnOCXGAAf98BGnFSa4cZVUfKa/+K2OEmvh/ssoYmCuEmo9KjDNhvSeS5kNzwUrFpPKBRFmG2FNt49QRzb2prKW4HAo+wLFhdzZNOd1PT3/ItQUR9N9wqLbozf2R0Zaxi3fqbUAVYgWARiaPBilSXBsWX8jEqkf+Ovp5XIg163HmgMyNYdXk5cDbMNcNwvoy6aViXtVFrDjlCbtB3U3L7/qsZsgNQfdfGXUf9wGzHn6SDDdVXU650mRDCZh3OFSuf3mAobeWqZ3E8ltwr0PY3SFjtSmW+HHHPS4OTcqae/IkRaiKZPoTPA== Received: from BN8PR04CA0041.namprd04.prod.outlook.com (2603:10b6:408:d4::15) by MWHPR1201MB0254.namprd12.prod.outlook.com (2603:10b6:301:57::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Mon, 2 May 2022 20:05:01 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::53) by BN8PR04CA0041.outlook.office365.com (2603:10b6:408:d4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13 via Frontend Transport; Mon, 2 May 2022 20:05:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5206.12 via Frontend Transport; Mon, 2 May 2022 20:05:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 2 May 2022 20:04:59 +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; Mon, 2 May 2022 13:04:55 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , , , , Subject: [RFC v2 0/3] ethdev: datapath-focused meter actions Date: Mon, 2 May 2022 23:04:36 +0300 Message-ID: <20220502200439.4100965-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220408024658.2004918-1-akozyrev@nvidia.com> References: <20220408024658.2004918-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: dc7144a1-791a-4d7c-61d2-08da2c7709ef X-MS-TrafficTypeDiagnostic: MWHPR1201MB0254: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: 9Ur1tQvYlFlv4i94Iyp093uYSRYgBZy2RuqVHrqY+kOKE1lHp1GnjK254Q7o3L1iRoTsGIDmVkGU5vBT/irRKhAUlbWLMNfLsO1ueR6TTUVa6LbSv/s7QxUgZuX3MHBCG6rVX+cjzsyP2A3rJLK38EGaSSZgEnjMvGG8mMIzt/VEc9g3k9F/ZTkQo55y3T1JMyH643d3sZev8WtiFf27XpHnHKzn6/cTfcK/6fscUrDRHHVZatwqsch/rrrbkFwXT4KICOMn861LK3W/MqQBjnxVbfj6Z41x5wFrxHYr/0mZaIOdEj8suQCNpD5rjepNB1ixHYFLP/lAPpz4IGMht6C0tvk8d6kpos9f5GX2owTSAA2YTgeEXcH+IAS637IZPMS0t+BJ7lBM13cA2PDBNGeIM8YvJpNQBHwOqcURKkLI6HhZyls6jxrtoKc3VtV3kGR/wA5za/SIYtRynpqVBqJSNPdQVy4F7yP+a3134m6fbBG8mtryWqwKe/7q/JYZhjYf1jx7BgV8hXVR0D7U9O6EEa+pG9WJMwzh/O/4MpFHm4jGK7XZ5Y0sAO8wezek4j28e48vrOv8tomXcrlXJ09l+BaUgIW0WXK4bgnDHWVQ47AWGSYWBHZHyvk5nzdgZbbnE8bizC3I3huqqvgmD9+KW++J4Jo+uyubl27bjmmzz2vI8ErMKfUWj3VKsCSAwEB3roKkFE+wMZgUX2upIw== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(1076003)(70206006)(186003)(40460700003)(2616005)(508600001)(70586007)(8676002)(4326008)(356005)(16526019)(81166007)(26005)(6666004)(6916009)(54906003)(47076005)(426003)(336012)(316002)(83380400001)(2906002)(86362001)(82310400005)(8936002)(7416002)(5660300002)(36756003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2022 20:05:00.4041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc7144a1-791a-4d7c-61d2-08da2c7709ef 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0254 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 The introduction of asynchronous flow rules operations allowed users to create/destroy flow rules as part of the datapath without blocking on Flow API and slowing the packet processing down. That applies to every possible action that has no preparation steps. Unfortunately, one notable exception is the meter action. There is a separate API to prepare a meter profile and a meter policy before any meter object can be used as a flow rule action. The application logic is the following: 1. rte_mtr_meter_profile_add() is called to create the meter profile first to define how to classify incoming packets and to assign an appropriate color to them. 2. rte_mtr_meter_policy_add() is invoked to define the fate of a packet, based on its color (practically creating flow rules, matching colors). 3. rte_mtr_create() is then needed to search (with locks) for previously created profile and policy in order to create the meter object. 4. rte_flow_create() is now finally can be used to specify the created meter as an action. This approach doesn't fit into the asynchronous rule creation model and can be improved with the following proposal: 1. Creating a policy may be replaced with the creation of a group with up to 3 different rules for every color using asynchronous Flow API. That requires the introduction of a new pattern item - meter color. Then creation a flow rule with the meter means a simple jump to a group: rte_flow_async_create(group=1, pattern=color, actions=...); rte_flow_async_create(group=0, pattern=5-tuple, actions=meter,jump group 1); This allows to classify packets and act upon their color classifications. The Meter action assigns a color to a packet and an appropriate action is selected based on the Meter color in group 1. 2. Preparing a meter object should be the part of flow rule creation and use the same flow queue to benefit from asynchronous operations: rte_flow_async_create(group=0, pattern=5-tuple, actions=meter id 1 profile rfc2697, jump group 1); Creation of the meter object takes time and flow creation must wait until it is ready before inserting the rule. Using the same queue allows ensuring that. There is no need to create a meter object outside of the Flow API, but this approach won't affect the old Meter API in any way. 3. Another point of optimization is to prepare all the resources needed in advance in rte_flow_configure(). All the policy rules can be created during the initialization stage easily and put into several groups. These groups can be used by many meter objects by simple jump action to an appropriate group. Meter objects can be preallocated as well and configured with required profile parameters later at the flow rule creation stage. The number of pre-allocated profiles/policies is specified in the Flow engine resources settings. These optimizations alongside already existing pattern/actions templates can improve the insertion rate significantly and allow meter usage as part of the datapath. The introduction of the new API is intended to be used with the asynchronous Flow API. Deprecation of the old Meter API is not planned at this point. Signed-off-by: Alexander Kozyrev Alexander Kozyrev (3): ethdev: add meter color matching to Flow API ethdev: allow meter color modification ethdev: add extended meter action to Flow API lib/ethdev/rte_flow.h | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) -- 2.18.2