From patchwork Thu Feb 24 13:40:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suanming Mou X-Patchwork-Id: 108270 Return-Path: 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 5868FA034E; Thu, 24 Feb 2022 14:41:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2363241155; Thu, 24 Feb 2022 14:41:17 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2074.outbound.protection.outlook.com [40.107.100.74]) by mails.dpdk.org (Postfix) with ESMTP id 798324114D for ; Thu, 24 Feb 2022 14:41:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=djQRE4r61hbkA3uEMgM8p7KutOHB4aCxUMIxCqaq5YpYqKI8/woH+cqRlFoUgQAnTEJjt1iH5gmuGYcXPVKsMttla9qDqXx+d5ZzR6gwX5Ehr1YR1f3WONJZpnnjhowv6ilZBOTGEWbpTR/hyJ2B4qrBetaWx+lhFjR6S1ifHhm8sYXEiETzl/rL35X5xGKoFCw5b8oBx1JAQPj7kLl6dsYl02xVgP4msaH1QGuM5IyCnLVz1DFVLL1ysjwqMqs69ieYHEYDvW9a52p66p0mcXca2/gRoBnLymQNjzmrGi7aFy6NcSXf5Vjfj3COWZE4mFCdScrvzuN2fnAFUwmLhA== 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=y8E9Ft1uZcFw7gVwDq/aL6TA79wC2fB9JCEjmlLSqkA=; b=c+TctSimfDJkNImp8581xFThaikK9Oajcq5ajLQdj5+KsB4DX6El55lXSmNzGO6PnY+fDsqWEhYgB2eXuoYwjypqokgUyRot/QHiZdGe2gqima78EpmZcIB8ikjlzwZvvf9nh094fu+Lcj6ioc9qEMdJ9YEBVjUVYmgLZH70Rc72mDFEXfe0fvbb106M3yXrF7vjn3xJNYIuBBXlV9ZPkNjw2lWfmzd5WASBFoKsWrEtcidl4Uaa0uoH90epMb55Gj0yOun5CW3JR+6eIMC4KeWdpEkhUz+Bk6S8wT/FwcOJ2W8715RFUOikyowAJk1IhOn6IaPBZm2RswHc8Z93bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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=y8E9Ft1uZcFw7gVwDq/aL6TA79wC2fB9JCEjmlLSqkA=; b=YWUyM1DGKQH6VsXBYExEmYAhM4+UTYEGYsqfludQ+UEF7Bkx7TZpGNmcatFuTD2rN5xLlCcgQaiQOw+ULnhRMt9iQKS/1Ro5nJVXdMLXX5X0xVKOtMVJIR6vDQ7p67sNCYkmvVlNmAulr4KKIDXLqS6b+FOFSJEc3mesoy3xMZa/1T1cA8cjzwgr9xHybJTzZ+EdETJkKD3bPEAmroPDpYjCkEk9dADAysB6iCm8O8hifQthnbYhtExW4sm+Sp4XlqXoqowkDYM2Rb34NhkSgp9M/xVmIz57aNDH2wi2KiBrdqven0AA5mBh1CMDjLVrlV5h3Sbuw/Oi9L7hgYAqZw== Received: from DM6PR03CA0036.namprd03.prod.outlook.com (2603:10b6:5:40::49) by SA0PR12MB4382.namprd12.prod.outlook.com (2603:10b6:806:9a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Thu, 24 Feb 2022 13:41:13 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::ed) by DM6PR03CA0036.outlook.office365.com (2603:10b6:5:40::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24 via Frontend Transport; Thu, 24 Feb 2022 13:41:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 13:41:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 13:41:12 +0000 Received: from nvidia.com (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.9; Thu, 24 Feb 2022 05:41:09 -0800 From: Suanming Mou To: , CC: , , Subject: [PATCH v4 00/14] net/mlx5: add hardware steering Date: Thu, 24 Feb 2022 15:40:37 +0200 Message-ID: <20220224134051.18167-1-suanmingm@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20220210162926.20436-1-suanmingm@nvidia.com> References: <20220210162926.20436-1-suanmingm@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 336ffbe9-c8ec-4799-48dd-08d9f79b5301 X-MS-TrafficTypeDiagnostic: SA0PR12MB4382:EE_ 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: ZRk/mpmVT95yHXnvu7kdYJpmEBGDLoL6HdUdv3kUVDRC4y+NlRbQ2tVvfXJmjM704cqXSZBLKbv+I5thh4IEj0vyv6PjkPTl0TrMxjIqAfB+Jjs9ZfywY+sVF06KXYCRO9D2HkeWvuZrw3eFFRoQNwa4cdJ46xCuvGSHnYjWdI9Slvz2IEq48CYejnsoSLP8foB/sZcmjgBLDTiqPYrz+Y5ISpl5uc0l8HO+6PgjuO6XTlh/0MVhaRm0rVKP/ETfFbw1oWF5hA5spVqcUhlgZ6gt5Mjv9dvPQV1HodP5ZK2qJpW32shf7rXITO3lbiqj0kGzlE/RMhDVqAzvLfziO4J6AhUk4IhlM2cR/9uRtuvUhRnxa2LhhKwna1drCoAtEocjickXL8q1xZ/mcpHdsT0fF9jLmdrEQUjXcpB9b3eHga59qQOmE5XlPLVRurmJRBcsNd2C6byW8leb6noMrTj07ZoaPsts67fHDXaKH4cS/halKaTmgSHIK6zNHmihWXr5oFjoIb/RDevCsbchfk3iVbioOjoNvgR0nebSgDN1ATCLhRm0eTiXbSmzRXX0IDgZfenJSiOExSRxBqQG41Vfsx42zTum0Q3P2pHTXmpY70akWf0+s/UI1Xy23sPqGLcL/nB9Q+NpZAwPeMbA61hz9uFoH/RYG4d69LbHKz/rc2BYbSuZz6o5ntdKI0PiB8BpOeGE3XtKN3DFGAqa1g== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(86362001)(36756003)(2906002)(316002)(40460700003)(4326008)(70586007)(8676002)(70206006)(81166007)(356005)(36860700001)(8936002)(7696005)(2616005)(83380400001)(55016003)(336012)(1076003)(426003)(110136005)(6636002)(6286002)(16526019)(5660300002)(47076005)(6666004)(82310400004)(54906003)(26005)(508600001)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 13:41:13.2970 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 336ffbe9-c8ec-4799-48dd-08d9f79b5301 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4382 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 Connect-X steering is a lookup hardware mechanism that accesses flow tables, matches packets to the rules, and performs specified actions. Historically, mlx5 PMD implements several software engines to manage steering hardware facility: - FW Steering - Verbs/Direct Verbs, uses FW calls to manage flows - SW Steering - DevX/mlx5dv, uses WQEs to access table memory directly However, there are still some disadvantages: - performance is limited, we should invoke firmware either to manage the entire flow, or to handle some internal steering objects - organizing and preparing flow infrastructure (actions, matchers, groups, etc.) on the flow inserting is sure to cause slow flow insertion - security, exposing the low-level steering entries directly to the userspace may cause security risks A new hardware WQE based steering operation with codename "HW Steering" is going to be introduced to get rid of the security risks. And it will take advantage of the recently new introduced async queue-based rte_flow APIs to prepare everything in advance to achieve high insertion rate. In this new HW steering engine, the original SW steering rte_flow API will not be supported in the first implementation, only the new async queue-based flow operations is going to be supported. A new steering mode parameter for dv_flow_en will be introduced and user will be able to engage the new steering engine. --- v4: v3: - rebase to the latest version. v2: - New HW steering low-level abstract code added. - commit message improvement. - add protection for rte_flow and rte_flow_async callbacks. - rebase to rte_flow_async v9. - fix some rte_flow error not filled bugs. Suanming Mou (14): net/mlx5: introduce hardware steering operation net/mlx5: add HW steering low-level abstract code net/mlx5: introduce hardware steering enable routine net/mlx5: add port flow configuration net/mlx5: add pattern template management net/mlx5: add action template management net/mlx5: add table management net/mlx5: add basic flow queue operation net/mlx5: add flow flush function net/mlx5: add flow jump action net/mlx5: add queue and RSS action net/mlx5: add mark action net/mlx5: add indirect action net/mlx5: add header reformat action doc/guides/nics/mlx5.rst | 19 +- doc/guides/rel_notes/release_22_03.rst | 1 + drivers/net/mlx5/linux/mlx5_flow_os.h | 1 + drivers/net/mlx5/linux/mlx5_os.c | 22 +- drivers/net/mlx5/meson.build | 2 + drivers/net/mlx5/mlx5.c | 55 +- drivers/net/mlx5/mlx5.h | 66 +- drivers/net/mlx5/mlx5_devx.c | 10 + drivers/net/mlx5/mlx5_dr.c | 383 ++++ drivers/net/mlx5/mlx5_dr.h | 456 +++++ drivers/net/mlx5/mlx5_flow.c | 721 ++++++- drivers/net/mlx5/mlx5_flow.h | 287 +++ drivers/net/mlx5/mlx5_flow_dv.c | 186 +- drivers/net/mlx5/mlx5_flow_hw.c | 2337 +++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 7 +- drivers/net/mlx5/mlx5_rx.h | 9 +- drivers/net/mlx5/mlx5_rxq.c | 85 +- drivers/net/mlx5/windows/mlx5_flow_os.h | 1 + 18 files changed, 4468 insertions(+), 180 deletions(-) create mode 100644 drivers/net/mlx5/mlx5_dr.c create mode 100644 drivers/net/mlx5/mlx5_dr.h create mode 100644 drivers/net/mlx5/mlx5_flow_hw.c