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 B4BF7A04FD; Mon, 3 Oct 2022 18:35:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DD0240DFB; Mon, 3 Oct 2022 18:35:24 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by mails.dpdk.org (Postfix) with ESMTP id 46ACD40695 for ; Mon, 3 Oct 2022 18:35:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CgCuUyXWqp3Gn+u6GIWnjWentOBbr3f3/kVdaXfMEMR4rJvfaWifI3IUI8U4zXowie161+0ZMbMDmYm8Wov3hBxOCnEYF6bjEwJyURyZyEVzNKO/dZSYOO+eXN3TTMTm4Vgue3A60p8BVuH+xq+260tM/IwtYYP9P4cX2owAd2sgCTYtGNDexmeIuXaPqHc5JbvW5jhzmX7MPJ7wm8XjaKutu7I/4Kb2JVwtaDWq8A9kXrauj76kQoeikhFKKX9oEqc7GxbbmVxOD/VFbNryPXBvV3VKDioXnQ5M0OH3i37lCZR4Oj2aVG8q8r8PuVj9w+KqPemmjLtBQdFUPfQV+Q== 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=GzipNLrNJnXEgEDO7ANmh4gwHJDbnjG4JTnBKiZgRmo=; b=n1CRl0gm9E5k7dt0UU2jcOqNu0IpzKV1r95SISIRAtZq/o2POvx+50PdXatPJuw/hPwXH4q1i1YIOvw1lgh9/yvNPoPPbPeMM9JIu5j0saifZh35ECD4O56M7OgFN/AsYncFlAi3mJzi/8wCCBr9R5k8vxXx7v3Kbg9Hxe1iC1OP2g9Boulh+bwYmxuGtVn+f0IAabzWg+j8u96ZM7yE9HNO6d9Uvx+AZPKLHEj/4n5EApZx0E+p3p7ZwZ7rX8q3QeSHDCmTu45Ym19rtaBnkY8zEtk7OjwrHwMs4l+3BGgQ+10aejv+ku6ySInSW72PCjoUOS8cQ1ODC8nNJ/ox6Q== 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=GzipNLrNJnXEgEDO7ANmh4gwHJDbnjG4JTnBKiZgRmo=; b=Gyk1NaV8Ggkn5Ir/jW3io3E5v2XKI0VITBzg0xQbdLBe4Yjnyyxs07VurwORgy5MxileGBwWtAFMGuiM668Ba0vTPgTG0vXt3ydGlYgRjplFx2SZNmi6t4y/7e+T/OxT5vC6smRUd3nd2lXTcFX9XnnOB9/4ggZAH1qCdIaxQf+k7w8X/y2oMtI7Fc9ujymOZwEEhuAURx13iPssPFrjwxr9PXb3RWWGNQ2hzsxsWffKC9h2qoSXHOmFVcC1wFU+3S2Tmh5S7+hkx/kIjlDXznByb1LKKx51QqCEV6dL2ESoktrZgNS9T8IbFMHlthko54PIcqxX48ccbvwqki50lw== Received: from BN0PR04CA0023.namprd04.prod.outlook.com (2603:10b6:408:ee::28) by CO6PR12MB5475.namprd12.prod.outlook.com (2603:10b6:5:354::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.20; Mon, 3 Oct 2022 16:35:21 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::7) by BN0PR04CA0023.outlook.office365.com (2603:10b6:408:ee::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.28 via Frontend Transport; Mon, 3 Oct 2022 16:35:20 +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 BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Mon, 3 Oct 2022 16:35:20 +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; Mon, 3 Oct 2022 09:35:10 -0700 Received: from nvidia.com (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.29; Mon, 3 Oct 2022 09:35:07 -0700 From: Michael Savisko To: CC: , , , , Aman Singh , Yuying Zhang , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH v5] ethdev: add send to kernel action Date: Mon, 3 Oct 2022 19:34:49 +0300 Message-ID: <20221003163449.279791-1-michaelsav@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220929145445.181369-1-michaelsav@nvidia.com> References: <20220929145445.181369-1-michaelsav@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-TrafficTypeDiagnostic: BN8NAM11FT004:EE_|CO6PR12MB5475:EE_ X-MS-Office365-Filtering-Correlation-Id: aeff81e6-c27f-40dc-bf28-08daa55d4379 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: FJFNJyBht3Tp5Y096LDEBQ8uBfdotZ7RpH5HLMWiifbVgGjzBep7lExHMY2BA3Y/kUJtFGXnEAMlb/8734gxEgb5rA20NVM5u+Hz4P4bbtP/SJuAXgWulHZD5MV6ho3g0IM2TH/tsh9FmBwZXRLptStV+lFLQmp260gfkt8Ez75K/fjvNOhKyrBXjwM2WRE1Ybo3kYp0f/YnPCNztjOHTKkcZ9obaOhTsNEy9jzQtycAUSE0DiurMPuNGwRkgg3Pr4CTIdslI7MBWjr7B8d84maNj5ap1TLyPWgATdAMDYf5Jmm27/jRmUP740kHscQkour6Z+kYmWeoFJp6kOg6KwaBF/5gJg/3f+uiYy4CEggOKkGOm3lR4B2hBur5QZFsblBKJA1lh2reyM4VH0rhr6FRhilthBsZtz3Jmz4R8pdKJjLnhS30QV5hCwxsZ7agjAqBGhtnRzA79Mu8BAGkyrNmUlpIsAcEpj8/halxLtBL3rGvt+iIXqEnBwWDTFFfpVclbVPSIDQHfCHFGPb6152xaaRFsTjD2N4TUhtu/uSw2+5mZyiYaYKd+me4kGda0JCIY1N5TTYQghr5OviOmo0/NqooKADSoE7m+HojRNHgo2rAJZThi/bjbPRme4+mJedDMZoVJ66ANLHqUk4UQ0mq/bUMEDo585OHj1BoJfpqoXcBhn229+OUsiPkEtFFTBZu+K1EDRbhvlpRH4XqtrA+KeTvIfk7tabBt49z8ChxHTv9WXDH0OFtv80DcaJruu7ju5xc9xqB51aqV4NQUZNOfYv9Y7uR6vlVMuv0PZzOZBY8w6aWMEWdHdKWLXy8lTcDFoZbjpJMbEbdq5FzKy74MyeYiRUiQmQkVpTYXKHBvAyitqnll/jxksmR9wvVNBa9soh8p7kRNGPPwe7OvA== 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)(346002)(376002)(39860400002)(136003)(396003)(451199015)(46966006)(40470700004)(36840700001)(5660300002)(8936002)(55016003)(336012)(82740400003)(7696005)(8676002)(966005)(82310400005)(83380400001)(426003)(316002)(2906002)(16526019)(6286002)(36756003)(40480700001)(26005)(36860700001)(86362001)(4326008)(70586007)(70206006)(47076005)(6916009)(356005)(40460700003)(7636003)(6666004)(186003)(1076003)(2616005)(54906003)(41300700001)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2022 16:35:20.6752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aeff81e6-c27f-40dc-bf28-08daa55d4379 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: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5475 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 --- v5: - added description of the feature to release notes v4: - improve description comment above RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL http://patches.dpdk.org/project/dpdk/patch/20220929145445.181369-1-michaelsav@nvidia.com/ 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/rel_notes/release_22_11.rst | 5 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 12 ++++++++++++ 5 files changed, 30 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 91c6950b60..9e299b8335 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -622,6 +622,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. */ @@ -1888,6 +1889,7 @@ static const enum index next_action[] = { ACTION_CONNTRACK_UPDATE, ACTION_PORT_REPRESENTOR, ACTION_REPRESENTED_PORT, + ACTION_SEND_TO_KERNEL, ZERO, }; @@ -6098,6 +6100,13 @@ static const struct token token_list[] = { width)), .call = parse_vc_conf, }, + [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. */ [SET] = { .name = "set", diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index c6bcb45100..7783eeb489 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -114,6 +114,11 @@ New Features * Added ``rte_event_eth_tx_adapter_queue_stop`` to stop the Tx Adapter from enqueueing any packets to the Tx queue. +* **Added new rte_flow action SEND_TO_KERNEL.** + + Added new rte_flow action which allows application to re-route packets + directly to the kernel without software involvement. + Removed Items ------------- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index b4e9d978ba..a5b6fb12e3 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3691,6 +3691,9 @@ This section lists supported pattern items and their attributes, if any. - ``color {value}``: Meter color value(green/yellow/red). +- ``send_to_kernel``: send packets to kernel. + + Actions list ^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index fd802f87a2..a6b1bf21c4 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -257,6 +257,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { 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)), + MK_FLOW_ACTION(SEND_TO_KERNEL, 0), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 49aaf05b67..c895c574cd 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2797,6 +2797,18 @@ enum rte_flow_action_type { * See file rte_mtr.h for MTR profile object configuration. */ RTE_FLOW_ACTION_TYPE_METER_MARK, + + /** + * 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, }; /** -- 2.27.0