From patchwork Sat Jan 28 13:08:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 122613 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 8423B424AA; Sat, 28 Jan 2023 14:09:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0872B40A82; Sat, 28 Jan 2023 14:09:28 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2074.outbound.protection.outlook.com [40.107.101.74]) by mails.dpdk.org (Postfix) with ESMTP id 697304068E for ; Sat, 28 Jan 2023 14:09:26 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8/Jpa6qOElGElQB+r3CaKUWQPZylZ+CaLc8VeAn9VnHcKfr1irLXqBJKdbsdwJCjeSBGibYAGwvlMhfv+8DvXi5FMZhtVoKZQ8xkQ8o3jvywzMFJNSQf2xJHqto3kt+Atd+YMFrRnLba3ncNnqjQPc90DCzXWDE5S40n3AYvTjxOo/SMUsUcig8wJYH5uPXLlhTlKOwZV2UmNIopLiAaCjhvNgIz/D9CJ9xYJgNUBeXc1b2rBXNgDXf2CiK4+MY8MZX+wwPN7A7G7e8ezlVyFHZoDd6uHNGnZsb1HLPm1pKSXrE6OweSE0l4yQY9iIhkWpDgTU574hHYBJrtLtaxg== 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=Sdcy+b33zqPwYyFI33Ya73btsy1CySRcqnSEU8aC8Wg=; b=K8x2dlwzaqIPYiTWiGJebxK4T9dI0Qt7gBfNw0WuXfp2fYNJexhw/MbyBpRzTLkJQ0QMM+6yhxLWbQq3VQrrcAY/oRPJnquP4cpoZE1EAYJsvXEsFLbbwauaDu7fTegar5XhZFZxNIrXw4GzDnuASmOQDcrbepplYJjFUUzrHkvBA2sKpJNMGYoqjT8iSqNJI29xNDkEcztMMWSb/ETHRulqo6UPqJKxQPhdWxAzeazRaHZ06fPGmcGHVBvnyNSYLxxOUouebtcYbctfpD8GDYeHZf8uZVW8S9nWg/31A8hXFPjAXDil/jxKqZ+RbxBJzFUUZkh/43Ixn4BwLqreoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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=Sdcy+b33zqPwYyFI33Ya73btsy1CySRcqnSEU8aC8Wg=; b=rYBrREraS4etjqNkZOIWcKjCfoUn5W1AvKCQauXeKjyGpxrx02BBgpgVbnAXEJifqLaPJvLoLng2vrujfzsSUECMKaRH7PHITf9oOE/j7Jz0zFd8fOl6s92WNTBuN6u8NfW1BsXdyJvK4axOW63I5I0PD2+GKcEJGB7dGo98SqjoOJwiJFgtw7KxfQKvpWxnQfj99xHCICL87qEVzuRRdRw07N39M8ZyX3kzMEPN/wlW56miN5jt42fht3TL8KY4QlUU51bJT4tzNAwmSFek/dGbcUJh0TfIoQpbqD0T7wx2sN7sxrTo+5SWm9cFx79p9Y5FU023BSX3PSOVikma+g== Received: from CY5PR03CA0026.namprd03.prod.outlook.com (2603:10b6:930:8::21) by IA1PR12MB6185.namprd12.prod.outlook.com (2603:10b6:208:3e7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Sat, 28 Jan 2023 13:09:23 +0000 Received: from CY4PEPF0000C96D.namprd02.prod.outlook.com (2603:10b6:930:8:cafe::29) by CY5PR03CA0026.outlook.office365.com (2603:10b6:930:8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.30 via Frontend Transport; Sat, 28 Jan 2023 13:09:23 +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 CY4PEPF0000C96D.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16 via Frontend Transport; Sat, 28 Jan 2023 13:09:23 +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.36; Sat, 28 Jan 2023 05:09:20 -0800 Received: from nvidia.com (10.126.230.37) 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.36; Sat, 28 Jan 2023 05:09:17 -0800 From: Jiawei Wang To: , , , "Aman Singh" , Yuying Zhang , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH 1/2] ethdev: add mhpsdp hardware port match item Date: Sat, 28 Jan 2023 15:08:56 +0200 Message-ID: <20230128130857.17399-2-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230128130857.17399-1-jiaweiw@nvidia.com> References: <20230128130857.17399-1-jiaweiw@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] 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: CY4PEPF0000C96D:EE_|IA1PR12MB6185:EE_ X-MS-Office365-Filtering-Correlation-Id: cd21c3e5-6e83-477f-2d26-08db0130e02e 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: MtQyy4zTbjzmdIgGEWPuO8NJ9UlO2U5i4naDQcVQG6/iBW1hJf9M/uyFNrp99CaHk1ha48duOIpF4BrxABlXw4TutXEPjofufBel3rB7pqNHctlOE8cEPW1sHQH11ACYKFGoRPhmsz0rRXWwDGD0qgao274hZu0oO5duT/LUERyaaf2c0FUpQEKmw0aKZwF1sJt9/1ucb8DD9Fbh3K0dysMCVj5qU5UJP56x6Ak+yfE1+vyEVGHYXbSWzeQlDAUUmQcvaViJEtUp3LiYjwJ1NFwXVg4fWAOdlYQEaqAd6Kav+5WyT4SfMyRVUTNlgs2bzIGmZLSINzZvUEaTEj1ktu+0FdbHZluApeHK/3Pv2Ocltqn5MP/MdCdfjmXd5YrgnH5fWoHRfbey98rmtnIwCQWnX8MGffnqxfbTWPO0B8ciIMY/OW1m2hwfGqBuiDQ6gqfAARed3Tq4cAtvMaQp4yIQ9P6R+wSJgnnw9SBkOLnwlaZgE+ESo0cFsBC4Y690yKhQrgy0mdoOvmCW5fuHGPLdrN9vCbvurZPqB00xH24y+LwTrpoG22dkqYHZkuknZprEXJXfhOQ8wPS3PRC98msgl8Ck2MmRwWD962BV7yWKmT5EaCac+rZeDUuBKTmFUY8mv5g/e5ah1kzCfeDSjIK3iMMXIdIX+Xhe3cUqFGNVeCkJWEm5u74Afzm2/abGY/7vs4wvFXGBhO0VGDbOf37w36dJ1Sx6bCV4QYB9tEM= 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:(13230025)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199018)(46966006)(40470700004)(36840700001)(82310400005)(1076003)(6286002)(36860700001)(2616005)(8936002)(40460700003)(356005)(2906002)(110136005)(7636003)(82740400003)(7696005)(316002)(41300700001)(478600001)(40480700001)(186003)(426003)(86362001)(55016003)(26005)(83380400001)(107886003)(16526019)(6666004)(54906003)(336012)(70586007)(47076005)(8676002)(70206006)(5660300002)(4326008)(36756003)(40753002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2023 13:09:23.2831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd21c3e5-6e83-477f-2d26-08db0130e02e 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: CY4PEPF0000C96D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6185 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 For the multiple hardware ports connect to a single DPDK port (mhpsdp), currently there is no information to indicate the packet belongs to which hardware port. This patch introduces a new hardware port item in rte flow API, and the port value reflects the hardware port of the received packets. While uses the hardware port as a matching item in the flow, and sets the same port value on the tx queue, then the packet can be sent from the same hardware port with received. This patch also adds the testpmd command line to match the new item: flow create 0 ingress group 0 pattern mhpsdp_hw_port hwport is 1 / end actions queue index 0 / end The above command means that creates a flow on a single DPDK port and matches the packet from the first physical port (the hwport 1 stands for the first port) and redirects these packets into RxQ 0. Signed-off-by: Jiawei Wang --- app/test-pmd/cmdline_flow.c | 29 +++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 8 ++++++ doc/guides/rel_notes/release_23_03.rst | 5 ++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 32 +++++++++++++++++++++ 6 files changed, 80 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 88108498e0..fb9c0cc622 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -465,6 +465,8 @@ enum index { ITEM_METER, ITEM_METER_COLOR, ITEM_METER_COLOR_NAME, + ITEM_MHPSDP_HW_PORT, + ITEM_MHPSDP_HW_PORT_VALUE, /* Validate/create actions. */ ACTIONS, @@ -1355,6 +1357,7 @@ static const enum index next_item[] = { ITEM_L2TPV2, ITEM_PPP, ITEM_METER, + ITEM_MHPSDP_HW_PORT, END_SET, ZERO, }; @@ -1821,6 +1824,12 @@ static const enum index item_meter[] = { ZERO, }; +static const enum index item_mhpsdp_hw_port[] = { + ITEM_MHPSDP_HW_PORT_VALUE, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -6443,6 +6452,23 @@ static const struct token token_list[] = { ARGS_ENTRY(struct buffer, port)), .call = parse_mp, }, + [ITEM_MHPSDP_HW_PORT] = { + .name = "mhpsdp_hw_port", + .help = "match on the hardware port of the" + " received packet.", + .priv = PRIV_ITEM(MHPSDP_HW_PORT, + sizeof(struct rte_flow_item_mhpsdp_hw_port)), + .next = NEXT(item_mhpsdp_hw_port), + .call = parse_vc, + }, + [ITEM_MHPSDP_HW_PORT_VALUE] = { + .name = "hwport", + .help = "hardware port value", + .next = NEXT(item_mhpsdp_hw_port, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_mhpsdp_hw_port, + hwport)), + }, }; /** Remove and return last entry from argument stack. */ @@ -10981,6 +11007,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_METER_COLOR: mask = &rte_flow_item_meter_color_mask; break; + case RTE_FLOW_ITEM_TYPE_MHPSDP_HW_PORT: + mask = &rte_flow_item_mhpsdp_hw_port_mask; + break; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3e6242803d..175ffec288 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1544,6 +1544,14 @@ Matches Color Marker set by a Meter. - ``color``: Metering color marker. +Item: ``MHPSDP_HW_PORT`` +^^^^^^^^^^^^^^^^^^^^^^^ + +Matches on the hardware port of the received packet, the hardware port in the +group of physical ports connected to a single DPDK port. + +- ``hwport``: Hardware port value. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index c15f6fbb9f..b5b3ab8886 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -69,6 +69,11 @@ New Features ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter required for eth_rx, eth_tx, crypto and timer eventdev adapters. +* **Added rte_flow support for matching MHPSDP_HW_PORT fields.** + + For the multiple hardware ports connect to a single DPDK port (mhpsdp), + Added ``mhpsdp_hw_port`` item in rte_flow to support hardware port of + the packets. Removed Items ------------- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 0037506a79..7be7c55d63 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3712,6 +3712,11 @@ This section lists supported pattern items and their attributes, if any. - ``color {value}``: meter color value (green/yellow/red). +- ``mhpsdp_hw_port``: match hardware port in the group of multiple ports connect + to a single DPDK port. + + - ``hwport {value}``: hardware port value. + - ``send_to_kernel``: send packets to kernel. diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7d0c24366c..92115a792a 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -157,6 +157,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)), MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)), MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)), + MK_FLOW_ITEM(MHPSDP_HW_PORT, sizeof(struct rte_flow_item_mhpsdp_hw_port)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index b60987db4b..53f99a20c8 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -624,6 +624,13 @@ enum rte_flow_item_type { * See struct rte_flow_item_meter_color. */ RTE_FLOW_ITEM_TYPE_METER_COLOR, + + /** + * Matches on the physical port of the received packet. + * + * See struct rte_flow_item_mhpsdp_hw_port. + */ + RTE_FLOW_ITEM_TYPE_MHPSDP_HW_PORT, }; /** @@ -2103,6 +2110,31 @@ static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_MHPSDP_HW_PORT + * + * For the multiple hardware ports connect to a single DPDK port (mhpsdp), + * use this item to match the hardware port of the packets. + */ +struct rte_flow_item_mhpsdp_hw_port { + /** + * Hardware port in the group of multiple ports connect + * to a single DPDK port. Value 1 means the first hw port. + */ + uint8_t hwport; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_MHPSDP_HW_PORT. */ +#ifndef __cplusplus +static const struct rte_flow_item_mhpsdp_hw_port +rte_flow_item_mhpsdp_hw_port_mask = { + .hwport = 0xff, +}; +#endif + /** * Action types. * From patchwork Sat Jan 28 13:08:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 122614 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 EFEE7424AA; Sat, 28 Jan 2023 14:09:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CEA2410DC; Sat, 28 Jan 2023 14:09:34 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2049.outbound.protection.outlook.com [40.107.92.49]) by mails.dpdk.org (Postfix) with ESMTP id B9E4042BAC for ; Sat, 28 Jan 2023 14:09:32 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CRAy/cmKHJ8JZ9Hyi4RcHhkJyk140kcivpWGlrHbE2bla/Rc0OfXna3YzqxgdTOEL9NHUNlY/6PhmCFvDJYEY9TfsryFr2Wh1DThKiMAiISJIzu/dcGdDDJ6UiuJYQZKVYiF3IOm7PdCNFrjPE2UhKSgLYm7bov8sDcg8RK4p5OaGDcOacaAar9Yj2T3B0yQYZn3V6acAAyZbEyrZrLCxwIZ+KSDzE9NNnHSFFioIeQFJMuqUU3GTwmWKrUE83t86i11Ne3hkCBd6SIZzS/roAJNj/6WEOyeR1bvC8kVeQ34Um+T/ieKUyhjeJe8w8Op3NrWnmMfilB7HBEYrDqw1A== 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=DeTlW9MDpP8DtweU1GQSdqk3GSHIDobmZKglR8Lc9Ck=; b=l5ap971/4LCwclAhK3OvqC3m26Ubs9KdSa6LxhZXuiywKbrDngWKzKvq8mZzXLLcghsikunEPZiIY2myPoU5Ij0nkz9n2yMoA4/0aif/NUA4GR2aUtAc/iNxLbOEERl3u0UKO/SVmj3czssBaWqrg1UnNEHULPvWzI2sGf9vibTm0LIdoynh/24AIPSH/C/IE+qvuphhQABJQeQxUGVCxMu/9Ta3QxAmL8FyZKN/eaUtKUix0SjlBnKtYxQiRSNEF90CmKAGTvMf+3HqKg1ZN9CVZsf0DjPZDwd8IWAsSlVmEISbWVpuemuUUooVpoXzEDv+1AS2rA+f+l1RbCHyeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=DeTlW9MDpP8DtweU1GQSdqk3GSHIDobmZKglR8Lc9Ck=; b=hoJuMmZqimwKRCaPl05SV5tegpmTZj2ZdcjeLyVZgTv+6hC1b1XGHwiGpt7m//K70orPmeG7H1lsfFEWKif+729mSD+r4x71ZqK2tNo2zRDhFVJpbe8PyF131E0A/jT9WkPRTvX5SRWG2e+CBVY/whdrJSAYHCIW5ebsT2e6skSRs87QGnbcKH58CxgxtcFQl139YgSmhR/adhLAyrBdYIYsNXBaaHrvU29tzc6CqMYXUc5KSFIpt16IwrgIAkwH5hpXEPkjIrhx3tPKA78fso1TLmkCHmdUmjRpX7fIwv5yuMXHcAi4tlk2hM91R/AIMkNjU89LWa0EDNQQfSc2cA== Received: from DS7PR05CA0086.namprd05.prod.outlook.com (2603:10b6:8:56::7) by SA1PR12MB7245.namprd12.prod.outlook.com (2603:10b6:806:2bf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.28; Sat, 28 Jan 2023 13:09:30 +0000 Received: from DM6NAM11FT081.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::14) by DS7PR05CA0086.outlook.office365.com (2603:10b6:8:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13 via Frontend Transport; Sat, 28 Jan 2023 13:09:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT081.mail.protection.outlook.com (10.13.172.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Sat, 28 Jan 2023 13:09:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sat, 28 Jan 2023 05:09:25 -0800 Received: from nvidia.com (10.126.230.37) 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.36; Sat, 28 Jan 2023 05:09:22 -0800 From: Jiawei Wang To: , , , "Aman Singh" , Yuying Zhang , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH 2/2] ethdev: introduce the mhpsdp hwport field in Tx queue API Date: Sat, 28 Jan 2023 15:08:57 +0200 Message-ID: <20230128130857.17399-3-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230128130857.17399-1-jiaweiw@nvidia.com> References: <20230128130857.17399-1-jiaweiw@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] 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: DM6NAM11FT081:EE_|SA1PR12MB7245:EE_ X-MS-Office365-Filtering-Correlation-Id: a13a163c-d49e-4add-343c-08db0130e3f7 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: m2hamVKGSGDGDG1wFKx8J0/3lkuas0O0c3J3LpEDGnOl189o2+YU8ueGi6QGeqQxbudFj5v/dJ7DF0knyiW1AvSXE8WkrlD3tn34v6/h8ZjflLpFav1tJTK0IgVx0O6v+enPZvdXfTz03HoAXYra0qcWyrulp2BS5IIFHgy/3wSQ+IAhgbyZnhLgdTezYtOslHDV2IQMDrKGq9ro4GHzumV6Z023i4nYw3CihBrcfBiicpkD0lOgY/UAhD3Q04dlw6/FA61+6HmiBslpQAPpvbbO1NYJNdJHOW451bdNuYGjIKfoY/d6h7dCSJQaC+IJhGo7vckA9FBl4Id14kxG9Qo4e0i6A74cauDlHmp+okUq5SFURnnRFlSk07XIPyD16jGp4ZvCW7f1lrwtWT1GlduG9CEcV1i5wzLJhkslMN/2X2s+1JFrOTzYE/V49XLxUYNk69pNwQKMFNNzeeeWXYLkym2lg4dNeSgm6p1ro0sljEbZxDzxjWZQP3/TyruOF4VZUXbd9ZWvBMoVw3wVMowy8y1YvF3iG1Qaybbl9HSlno4HliM2k7AY3cwQVeDkZbOLF6IWxe423f48nqscyjiHDs3whlcR0Sv0ySHq31cvnTV6gpUj/mcTmA3VNYKbD9dhqjT32klMtneTYipH+16iVg+ZX36k0VhJBPpnwYs69Y2vCNm+pqCBC91m75a7EqWrZAFurdKf/QPi0HEhdDlICmf3hQpyPJ02pSZmc8M= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(136003)(346002)(376002)(396003)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(356005)(478600001)(40460700003)(7696005)(2906002)(36756003)(2616005)(83380400001)(426003)(336012)(54906003)(47076005)(55016003)(40480700001)(316002)(16526019)(86362001)(186003)(6286002)(82310400005)(82740400003)(6666004)(107886003)(7636003)(36860700001)(26005)(110136005)(1076003)(5660300002)(8936002)(41300700001)(70206006)(70586007)(4326008)(8676002)(40753002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2023 13:09:29.6337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a13a163c-d49e-4add-343c-08db0130e3f7 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT081.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7245 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 For the multiple hardware ports connect to a single DPDK port (mhpsdp), the previous patch introduces the new rte flow item to match the hardware port of the received packets. This patch adds the tx_mhpsdp_hwport setting in Tx queue API, the hwport value reflects packets be sent to which hardware port. 0 is no port assigned and traffic will be routed between different hardware ports, if 0 is disabled then try to match on MHPSDP_HW_PORT with 0 will result in an error. Adds the new tx_mhpsdp_hwport field into the padding hole of rte_eth_txconf structure, the size of rte_eth_txconf keeps the same. Adds a suppress type for structure change in the ABI check file. This patch adds the testpmd command line: testpmd> port config (port_id) txq (queue_id) mhpsdp_hwport (value) For example, there're two hardware ports 0 and 1 connected to a single DPDK port (port id 0), and mhpsdp_hwport 1 stood for hardware port 0 and mhpsdp_hwport 2 stood for hardware port 1, used the below command to config tx mhpsdp_hwport for per Tx Queue: port config 0 txq 0 mhpsdp_hwport 1 port config 0 txq 1 mhpsdp_hwport 1 port config 0 txq 2 mhpsdp_hwport 2 port config 0 txq 3 mhpsdp_hwport 2 These commands config the TxQ index 0 and TxQ index 1 with mhpsdp_hwport 1, uses TxQ 0 or TxQ 1 send packets, these packets will be sent from the hardware port 0, and similar with hardware port 1 if sending packets with TxQ 2 or TxQ 3. Signed-off-by: Jiawei Wang --- app/test-pmd/cmdline.c | 84 +++++++++++++++++++++ devtools/libabigail.abignore | 5 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++ lib/ethdev/rte_ethdev.h | 8 ++ 4 files changed, 110 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b32dc8bfd4..db9ea8b18a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -764,6 +764,10 @@ static void cmd_help_long_parsed(void *parsed_result, "port cleanup (port_id) txq (queue_id) (free_cnt)\n" " Cleanup txq mbufs for a specific Tx queue\n\n" + + "port config (port_id) txq (queue_id) mhpsdp_hwport (value)\n" + " Set the hwport value in mhpsdp " + "on a specific Tx queue\n\n" ); } @@ -12621,6 +12625,85 @@ static cmdline_parse_inst_t cmd_show_port_flow_transfer_proxy = { } }; +/* *** configure port txq mhpsdp_hwport value *** */ +struct cmd_config_tx_mhpsdp_hwport { + cmdline_fixed_string_t port; + cmdline_fixed_string_t config; + portid_t portid; + cmdline_fixed_string_t txq; + uint16_t qid; + cmdline_fixed_string_t mhpsdp_hwport; + uint16_t value; +}; + +static void +cmd_config_tx_mhpsdp_hwport_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_config_tx_mhpsdp_hwport *res = parsed_result; + struct rte_port *port; + + if (port_id_is_invalid(res->portid, ENABLED_WARN)) + return; + + if (res->portid == (portid_t)RTE_PORT_ALL) { + printf("Invalid port id\n"); + return; + } + + port = &ports[res->portid]; + + if (strcmp(res->txq, "txq")) { + printf("Unknown parameter\n"); + return; + } + if (tx_queue_id_is_invalid(res->qid)) + return; + + port->txq[res->qid].conf.tx_mhpsdp_hwport = res->value; + + cmd_reconfig_device_queue(res->portid, 0, 1); +} + +cmdline_parse_token_string_t cmd_config_tx_mhpsdp_hwport_port = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + port, "port"); +cmdline_parse_token_string_t cmd_config_tx_mhpsdp_hwport_config = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + config, "config"); +cmdline_parse_token_num_t cmd_config_tx_mhpsdp_hwport_portid = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + portid, RTE_UINT16); +cmdline_parse_token_string_t cmd_config_tx_mhpsdp_hwport_txq = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + txq, "txq"); +cmdline_parse_token_num_t cmd_config_tx_mhpsdp_hwport_qid = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + qid, RTE_UINT16); +cmdline_parse_token_string_t cmd_config_tx_mhpsdp_hwport_hwport = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + mhpsdp_hwport, "mhpsdp_hwport"); +cmdline_parse_token_num_t cmd_config_tx_mhpsdp_hwport_value = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_mhpsdp_hwport, + value, RTE_UINT16); + +static cmdline_parse_inst_t cmd_config_tx_mhpsdp_hwport = { + .f = cmd_config_tx_mhpsdp_hwport_parsed, + .data = (void *)0, + .help_str = "port config txq mhpsdp_hwport ", + .tokens = { + (void *)&cmd_config_tx_mhpsdp_hwport_port, + (void *)&cmd_config_tx_mhpsdp_hwport_config, + (void *)&cmd_config_tx_mhpsdp_hwport_portid, + (void *)&cmd_config_tx_mhpsdp_hwport_txq, + (void *)&cmd_config_tx_mhpsdp_hwport_qid, + (void *)&cmd_config_tx_mhpsdp_hwport_hwport, + (void *)&cmd_config_tx_mhpsdp_hwport_value, + NULL, + }, +}; + /* ******************************************************************************** */ /* list of instructions */ @@ -12851,6 +12934,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_show_capability, (cmdline_parse_inst_t *)&cmd_set_flex_is_pattern, (cmdline_parse_inst_t *)&cmd_set_flex_spec_pattern, + (cmdline_parse_inst_t *)&cmd_config_tx_mhpsdp_hwport, NULL, }; diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index 7a93de3ba1..cbbde4ef05 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -20,6 +20,11 @@ [suppress_file] soname_regexp = ^librte_.*mlx.*glue\. +; Ignore fields inserted in middle padding of rte_eth_txconf +[suppress_type] + name = rte_eth_txconf + has_data_member_inserted_between = {offset_after(tx_deferred_start), offset_of(offloads)} + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Experimental APIs exceptions ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 7be7c55d63..a05fd0e7d0 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1605,6 +1605,19 @@ Enable or disable a per queue Tx offloading only on a specific Tx queue:: This command should be run when the port is stopped, or else it will fail. +config per queue Tx mhpsdp_hwport +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Configure a mhpsdp_hwport value per queue Tx offloading only on a specific Tx queue:: + + testpmd> port (port_id) txq (queue_id) mhpsdp_hwport (value) + +* ``mhpsdp_hwport``: reflects packet can be sent to which hardware port. + uses it on multiple hardware ports connect to + a single DPDK port (mhpsdp). + +This command should be run when the port is stopped, or else it will fail. + Config VXLAN Encap outer layers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index c129ca1eaf..c1cef9e21d 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1138,6 +1138,14 @@ struct rte_eth_txconf { less free descriptors than this value. */ uint8_t tx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */ + /** + * Hardware port index for mhpsdp. + * Value 0 is no port assigned and traffic could be routed between different + * hardware ports, if 0 is disabled then try to match on MHPSDP_HW_PORT with + * 0 will result in an error. + * Value starts from 1 means that the first hw port in the mhpsdp. + */ + uint8_t tx_mhpsdp_hwport; /** * Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_* flags. * Only offloads set on tx_queue_offload_capa or tx_offload_capa