From patchwork Thu Sep 29 14:54:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Savisko X-Patchwork-Id: 117145 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 D5506A034C; Thu, 29 Sep 2022 16:55:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A84140694; Thu, 29 Sep 2022 16:55:29 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) by mails.dpdk.org (Postfix) with ESMTP id 1247840395 for ; Thu, 29 Sep 2022 16:55:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kN2WBypWtvsjZEQLQXJGHQvN2gPGXJJ7J+H98Onkoemr0FEnRiKf/yD+YH5a1Zf5x0MJtYT/LXn3X8pEGPDTqya56EKBXqYVSIRt7OBrZWwuQILQM8lgr954JQOwd0bZATF7FeS1xr+2T/fBQ3hxfllShxEqPx1+Swmx4fKyD9k7Dcaq9kEXIgmdaXlWek4mNUnhEvNGL5V00ObIw/PYJ24PGtvuIdYobV440raDXIdm/sz2tjvIyLVF/+8UCpimrPlayotQ4TCH6bwpv3+PNMabvOgjRCytuoR201i2l3vAldHIkEKuV3rc9aE9QvsoDdbUaNEzjVfwDgjqOilfXA== 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=aUtka2IqEItb4klln53sVzrK+s7dcdlEZGUxjRe+BR4=; b=IheCro2aA7GmJSBsR4H2JbsI8PUfyTccX4uyNRSz+0O95NBeMZ96RYg6ebzrS97XeZfujDFLOumEYUi7BEfGw+iL10zTPKH33/c1QkX0JtA527mQL/CItk9P6q9YdWXTVX7xiNnQmwtmPZrR3Cjar78aygcoGWkn0TNqGZNbJkmrxS1vUz1eEeKWEUBFmCEFhtuySJ/t7TFdT+pxJ+ehm4HLTQBgIB644VXhIg9aq0JhDb+4dkifQrlxiPaUg2BbwZs/nGOkdQvkgE+nYFSyiCa7r/Cc9yalbM9ldQFIOAUQGulYWL9lsjQQDxzB5Sna2RsAB6xNEUlzsQ/VRZ7Buw== 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=aUtka2IqEItb4klln53sVzrK+s7dcdlEZGUxjRe+BR4=; b=NYWJqmux/84gKMg/ts9TAYxYV1Xr8BKw3fCMUVXSywcx/kS4sPTxPNvnDBvjz1fmW0kh93pDIFySLY2E+p0FuRw6QlvSUpAprLrNw0vKc0jEpJa7Et3m5Ra4eLMnEvCz0FDXflPLismDmwVvr0Hnqb91143cP5xYZMVYvbixyQFlqYfSRhgp8o1Q4oTbbA2YbsFRtTwjjDWX8PmbuULGwVf6LVsdGS5V1C32XoUxxt4tHKyTDfKGkKwCNN+Ik9H8MAFbxHEqFBMmXSnP4R8ZCnJ1rohvOSleo8rvo7EL0VPMoH9XeSZpKsJktadwpk5J34QKzRiNESai5ZtkpAztTg== Received: from MW2PR16CA0030.namprd16.prod.outlook.com (2603:10b6:907::43) by MW6PR12MB7088.namprd12.prod.outlook.com (2603:10b6:303:238::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Thu, 29 Sep 2022 14:55:22 +0000 Received: from CO1NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:907:0:cafe::1) by MW2PR16CA0030.outlook.office365.com (2603:10b6:907::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25 via Frontend Transport; Thu, 29 Sep 2022 14:55:22 +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 CO1NAM11FT037.mail.protection.outlook.com (10.13.174.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Thu, 29 Sep 2022 14:55:21 +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; Thu, 29 Sep 2022 07:55:07 -0700 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.29; Thu, 29 Sep 2022 07:55:04 -0700 From: Michael Savisko To: CC: , , , , Aman Singh , Yuying Zhang , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH v4] ethdev: add send to kernel action Date: Thu, 29 Sep 2022 17:54:45 +0300 Message-ID: <20220929145445.181369-1-michaelsav@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220919155013.61473-1-michaelsav@nvidia.com> References: <20220919155013.61473-1-michaelsav@nvidia.com> MIME-Version: 1.0 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-TrafficTypeDiagnostic: CO1NAM11FT037:EE_|MW6PR12MB7088:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fa1f3cb-8ac0-4f57-8c81-08daa22aa243 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: HkedrEgizTgQhswdQgbRnUU/J9haPQKBu6IkVXtYV4Zn7vIMtMtzQmK6s/ItFeQXRjLAumQ2xM6rQwxKMGmMcN6FF1EesIfu+pDF3hm/UXWW1YxKpZCSfRXHA8llyrr0PMNiAWNgpAL3b1g4kg7gVpJ4+j0ZY+zko035ahkoIx4dVc4linovOq+kwG0wVFqjpM+hh0o730VWeyJ05FDUsysXDhx784JlSIc6s+rf/o3+T3SGM+NVf6QbpVTIxxUZIFuQnJvJRGZQxtXzZCJfig8Sz60KK033MgphVMU1ym7Hxd7xJm6T4Km/6Tm98NQtOJtKDCn5lUX6JaRjjXwwiI4Ey0xKkxK6v6yKFTC8/OSb7TGgLxzAJYtz3Maompz6ZpVIiu/5Fn2gCcD8xbYNcYK52KKzQp9JfToTtme34B5/DJ192zd/syKzj40KM/QSAk/sNnnf9vTfrzAyZWmR6synr4dPlV5pNhuMzxCzfifExGL57xY9eJc1WnDTKvSv0P8XNVl93Kcq98/B2bl1Y3eiHTJtK0TVq0uKFQOSsQRxYEoO5Y8BRGdsv79cmcU0UxZ0ZjNdJcXBFHFeG3fQEjkwBeROZLQmdwCpAmWRlYB/WQBPz4CUN5PDhX2s9AgUbq0St2sCO/d+aIhUp7uS1qm5ST8OxGq/uYB14yWrukdY48bwImOQsyRxKIUEGJ9JL4iok9JTc4g/26b908/KFVSxnKZcgTEQquzbfhwzL1KAvrmgfBDjoJ5FxyJ03Du4X/KFPwWfMnjI8hApoS3QFNql/5fYV20/nNmjHhszyqtwD2sMT1VcUaThBQ722mFwpv0FYoldfsqKrWAGDPVLyYoj0+eV6UWk6wKLB7Jl5peqwUQxBlCgIsf012T4wEZ37AhpkwjY7HhIBEWu+vIE3A== 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)(346002)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(6916009)(5660300002)(47076005)(40480700001)(41300700001)(426003)(70206006)(70586007)(356005)(86362001)(2906002)(1076003)(186003)(16526019)(7636003)(36756003)(336012)(8936002)(966005)(6666004)(55016003)(26005)(54906003)(478600001)(7696005)(82310400005)(40460700003)(83380400001)(36860700001)(316002)(82740400003)(8676002)(4326008)(2616005)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 14:55:21.9446 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fa1f3cb-8ac0-4f57-8c81-08daa22aa243 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: CO1NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7088 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 In some cases application may receive a packet that should have been received by the kernel. In this case application uses KNI or other means to transfer the packet to the kernel. With bifurcated driver we can have a rule to route packets matching a pattern (example: IPv4 packets) to the DPDK application and the rest of the traffic will be received by the kernel. But if we want to receive most of the traffic in DPDK except specific pattern (example: ICMP packets) that should be processed by the kernel, then it's easier to re-route these packets with a single rule. This commit introduces new rte_flow action which allows application to re-route packets directly to the kernel without software involvement. Add new testpmd rte_flow action 'send_to_kernel'. The application may use this action to route the packet to the kernel while still in the HW. Example with testpmd command: flow create 0 ingress priority 0 group 1 pattern eth type spec 0x0800 type mask 0xffff / end actions send_to_kernel / end Signed-off-by: Michael Savisko Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- v4: - improve description comment above RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL v3: http://patches.dpdk.org/project/dpdk/patch/20220919155013.61473-1-michaelsav@nvidia.com/ v2: http://patches.dpdk.org/project/dpdk/patch/20220914093219.11728-1-michaelsav@nvidia.com/ --- app/test-pmd/cmdline_flow.c | 9 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 ++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 12 ++++++++++++ 4 files changed, 24 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 7f50028eb7..042f6b34a6 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -612,6 +612,7 @@ enum index { ACTION_PORT_REPRESENTOR_PORT_ID, ACTION_REPRESENTED_PORT, ACTION_REPRESENTED_PORT_ETHDEV_PORT_ID, + ACTION_SEND_TO_KERNEL, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -1872,6 +1873,7 @@ static const enum index next_action[] = { ACTION_CONNTRACK_UPDATE, ACTION_PORT_REPRESENTOR, ACTION_REPRESENTED_PORT, + ACTION_SEND_TO_KERNEL, ZERO, }; @@ -6341,6 +6343,13 @@ static const struct token token_list[] = { .help = "submit a list of associated actions for red", .next = NEXT(next_action), }, + [ACTION_SEND_TO_KERNEL] = { + .name = "send_to_kernel", + .help = "send packets to kernel", + .priv = PRIV_ACTION(SEND_TO_KERNEL, 0), + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc, + }, /* Top-level command. */ [ADD] = { diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 330e34427d..c259c8239a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4189,6 +4189,8 @@ This section lists supported actions and their attributes, if any. - ``ethdev_port_id {unsigned}``: ethdev port ID +- ``send_to_kernel``: send packets to kernel. + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 501be9d602..627c671ce4 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -259,6 +259,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(SEND_TO_KERNEL, 0), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index a79f1e7ef0..2c15279a3b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2879,6 +2879,18 @@ enum rte_flow_action_type { * @see struct rte_flow_action_ethdev */ RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, + + /** + * Send packets to the kernel, without going to userspace at all. + * The packets will be received by the kernel driver sharing + * the same device as the DPDK port on which this action is + * configured. This action is mostly suits bifurcated driver + * model. + * This is an ingress non-transfer action only. + * + * No associated configuration structure. + */ + RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL, }; /**