From patchwork Fri Feb 17 10:50:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 124118 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 A965841CBE; Fri, 17 Feb 2023 11:50:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E4F140EE3; Fri, 17 Feb 2023 11:50:54 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2068.outbound.protection.outlook.com [40.107.95.68]) by mails.dpdk.org (Postfix) with ESMTP id 3B16440EE1 for ; Fri, 17 Feb 2023 11:50:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M37rXJfo2EvMXQXZncVm452/4SXZ5D3wczvTpfNhjOHfHRai6LKUoJ92UcBh7ZY9D1f+NnXnQftn9aMjwSbdhlWMUhjoht2DdJySfXiVx0iUprs3CQHj8dG0Zy/jK1Uo7+PMwvQ1g2nH8zNf2jKdKOkTPDVHwpRfFCMtzCXw0ZyGp1kibo1QC3m+lmImJy7xdkva7n61B8VqORNTe76qJNgEfyE6PYCNb6PSLu3MHad/7rucT3xOZIpFHyGtiF/UVojxCfin9Yg5/5rRZ0veTgWmtWgygocARenag87VRq+3rz8Nj1JoZZBgcT4p85X4j/XVNyT2haPjhhR3VfMR4Q== 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=xEV9SMo/03gbY9Kq6bSrhE2oLc4v4ngwTke2aa27ITY=; b=W4fePObCwySImKZF9afEgHrbrbuJnmoGw0+tr4LhnBjPXChFI/uF0O0g08t5WAJtbSXRY1EM9HMCSKRHafcRBlXCtxFEbqZrGYPebLtYmShasqleHGkCBrqNZHmbl295stcuaDSUgIZVdHxTzXu+L/Q5PYz75XGdPN8xKeYxm4ux7sO8KWnbDcwpL00TcxUgClB2n6+4lhdXEJvZGUR51sgXFpRO+rFuz/dEkLdqPt5gTXoC7ADGeq0gMwJI7vgZc3fEJwF6EvfZ9AbKwkgASSzffL88zcEkujrR/SmXURzo4QxumTCNnIptTJFf9Mz5rmiDTUbOygHmH0WSQQk66w== 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=xEV9SMo/03gbY9Kq6bSrhE2oLc4v4ngwTke2aa27ITY=; b=YwADFFx/E0y1n/10KlyjdU3PZn86+O3wmu8tEs629Iz964DkJwGAb+lsOUCXU8OQ8IoUFeOOQ3zl14rpdlMIUD3ksBRNDr+7ZCMwgR+Nr2rnlbw39cJ7uVJLatoYRWvljAjT5sb9khDVSMTgXAOLg39/7ARup8/CAedLcwxH6MkcLi9mofuB5AHx2Ot9+vS8+sTQ4ke66/xcgjlu+Ksb8FIsbOnbzDv6CBWvyyg8HitInrfhTMXPDZxrXsvTB3KRgWqaVSucsz7RgQGE0990Pd1mK4/tyKaumFq2yj6x8rJCDtLF/KIa1sFIH9XRG+u202EFdcaCYH9/K5KM5kfxvQ== Received: from MW4PR04CA0091.namprd04.prod.outlook.com (2603:10b6:303:83::6) by SN7PR12MB7274.namprd12.prod.outlook.com (2603:10b6:806:2ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Fri, 17 Feb 2023 10:50:49 +0000 Received: from CO1NAM11FT091.eop-nam11.prod.protection.outlook.com (2603:10b6:303:83:cafe::4e) by MW4PR04CA0091.outlook.office365.com (2603:10b6:303:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.15 via Frontend Transport; Fri, 17 Feb 2023 10:50:49 +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 CO1NAM11FT091.mail.protection.outlook.com (10.13.175.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13 via Frontend Transport; Fri, 17 Feb 2023 10:50:48 +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; Fri, 17 Feb 2023 02:50:41 -0800 Received: from nvidia.com (10.126.231.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; Fri, 17 Feb 2023 02:50:39 -0800 From: Jiawei Wang To: , , , , CC: , Subject: [PATCH v6 0/2] Add Tx queue mapping of aggregated ports Date: Fri, 17 Feb 2023 12:50:24 +0200 Message-ID: <20230217105026.12927-1-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230203050717.46914-1-jiaweiw@nvidia.com> References: <20230203050717.46914-1-jiaweiw@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.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: CO1NAM11FT091:EE_|SN7PR12MB7274:EE_ X-MS-Office365-Filtering-Correlation-Id: d68ffe7b-67c2-4107-a4f6-08db10d4d4a1 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: LWI1WSv9TmD2r9xaESH7ui1dIzT73smkFlfYimpUTNJlDIdT8p5bFbKOkqSDikRAB1XUJ/y35hMBGUUIJopRWuJqczCQcXmu67hkJn1BRi3FwX/48mdFzvqOXP/cB10eDwTRI83L21GhSDNUaxa2toNF+RMSa2G9dHVVcF+yaDPxPxFUHHrDXG3qNYXBfECxh0J5CjZHTUZyEFAosKJfdkFL948KSHoSYTURNpOSlT8tbdNTP2HhU2iV84wP49Ongl+BtOHEghNzlEdJUc1QEaL/Bz5T76kudBq5iJpMkBGOC6PlDbBJkANv/t8y9V58AUu3pa4Gr7Cf/1wASupN6XcLsgq3DSp3/4ns6eVtBmoIeStYAFC3Thp0Auw2ZoyyQ5YF/HQvdnhJ50XicrvRc+DG/2xu2CtdomrJQkreLiq0nKArsZT9OvajhetrIefWZYxGMdjT6ImMU4BQEI6OOWsZgItuG6R62xRR79wda92AdG9/YkgZG0E6G7VdqeRD/3rTvdGoWbeH0BkI8dTBEKy9yuymKxKnkjpWDcYWmuBUHfh7YXuLjJSY8jFqZHjLqus74qXbMAhPmgWcNgPtzQ1l/vFiUZxXypKiVsg160YO1oz0vz5GN64TNmgf1G9LC2ioVpNKizC7ReuiJWDYAnW5XOR0EgoQwX4BDOMEta3GmeFb3M8NaXqJ/DFM0WQulayGyD+VcB6KOYkL1DAfhTwjrX139DjFmSQbjZw8O0LmGoWf1ZpQ68LvyqnGMvJx 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)(346002)(39860400002)(376002)(396003)(136003)(451199018)(36840700001)(46966006)(40470700004)(41300700001)(8936002)(5660300002)(36756003)(2906002)(110136005)(4326008)(70586007)(478600001)(8676002)(966005)(54906003)(316002)(7696005)(70206006)(6286002)(82310400005)(7636003)(82740400003)(55016003)(356005)(47076005)(336012)(107886003)(426003)(2616005)(1076003)(16526019)(36860700001)(186003)(6666004)(26005)(86362001)(40480700001)(40460700003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 10:50:48.7969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d68ffe7b-67c2-4107-a4f6-08db10d4d4a1 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: CO1NAM11FT091.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7274 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 When multiple ports are aggregated into a single DPDK port, (example: Linux bonding, DPDK bonding, failsafe, etc.), we want to know which port is used for Rx and Tx. This patch introduces the new ethdev API rte_eth_dev_map_aggr_tx_affinity(), it's used to map a Tx queue with an aggregated port of the DPDK port (specified with port_id), The affinity is the number of the aggregated port. Value 0 means no affinity and traffic could be routed to any aggregated port, this is the default current behavior. The maximum number of affinity is given by rte_eth_dev_count_aggr_ports(). This patch allows to map a Rx queue with an aggregated port by using a flow rule. The new item is called RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY. While uses the aggregated affinity as a matching item in the flow rule, and sets the same affinity value by call rte_eth_dev_map_aggr_tx_affinity(), then the packet can be sent from the same port as the receiving one. The affinity numbering starts from 1, then trying to match on aggr_affinity 0 will result in an error. RFC: http://patches.dpdk.org/project/dpdk/cover/20221221102934.13822-1-jiaweiw@nvidia.com/ v6: * Update the commit titles. * Return 0 by default if dev_ops.count_aggr_ports is not defined. * Adds the dev_configure and affinity value checking before call map_aggr_tx_affinity. * Update the rte_eth_dev_count_aggr_ports description. v5: * Adds rte_eth_dev_map_aggr_tx_affinity() to map a Tx queue to an aggregated port. * Adds rte_eth_dev_count_aggr_ports() to get the number of aggregated ports. * Updates the flow item RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY. v4: * Rebase the latest code * Update new field description * Update release release note * Reword the commit log to make clear v3: * Update exception rule * Update the commit log * Add the description for PHY affinity and numbering definition * Add the number of physical ports into device info * Change the patch order v2: Update based on the comments Jiawei Wang (2): ethdev: add Tx queue mapping of aggregated ports ethdev: add flow matching of aggregated port app/test-pmd/cmdline.c | 92 +++++++++++++++++++++ app/test-pmd/cmdline_flow.c | 28 +++++++ doc/guides/prog_guide/rte_flow.rst | 8 ++ doc/guides/rel_notes/release_23_03.rst | 8 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 18 ++++ lib/ethdev/ethdev_driver.h | 39 +++++++++ lib/ethdev/ethdev_trace.h | 17 ++++ lib/ethdev/ethdev_trace_points.c | 6 ++ lib/ethdev/rte_ethdev.c | 72 ++++++++++++++++ lib/ethdev/rte_ethdev.h | 50 +++++++++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 35 ++++++++ lib/ethdev/version.map | 2 + 13 files changed, 376 insertions(+)