From patchwork Fri Feb 17 15:47:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 124129 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 E8DA241CC1; Fri, 17 Feb 2023 16:48:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D83242D32; Fri, 17 Feb 2023 16:48:30 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.46]) by mails.dpdk.org (Postfix) with ESMTP id 6B6FE42B71 for ; Fri, 17 Feb 2023 16:48:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LwCX5KSa7tLTtf9VCuVtUT56OGzN0l55F3g/7VSFgtjvzMP1rPxV2bYuTfJr7DxVxSKccz1y12zNq6R7xYNDIVdH7AE9h1CP2yzjskWhfuzEdQsPdg6OHoMw3K2gC2/5fzezrSxqOfKLILSlwyCO2pZT+Dd7f68eRCCR2gl0xxbCo4HbazBRlsEHA91/VPaeap/wMxFw4NQw5QW3+QT1oYO2LOSBmYgu7e8ZWCKBsfAta7lKeO3hvAQhfbq2aSnDLtuf0d/J7qAoVoGBXQkJ7aThHv5gZ+8KCDIj0Qnae6X7vskKrhdHuoB1AuCeRRZhIxUEiKWo6/GEeV4/GeaRcg== 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=R6c2jliJ6Z8cVv/kryS3My4zBugmcz3PdA/4LE/j/Zc=; b=h08Pgsm77Erg7tzZXKLOPdaMV86W96PKiAjxw6eal7zHW5qsfRhxvN7uSb8DE+CNvDaDKmyrEZiqhsXP7vGr302YUxN4WHwOnkJ1y0AEwFvR3kSWsdEx8/pGR4xBXLc2kb9qtZ0UCTtIiingyF4NL2DktBQYyx+Qb2Cf8zoIq4LFfxWwtdxVOquHP+GYzRTcFw1lF8pqalKG9rg7zjdOv2jP9TDQLpLkadYF7PhZ1Mnp2DkQvoSR/zgaUSStG2+FJphiwaXEvH3c032c4Wvl5KjbVpwG6IrQUzM0WhnT0CjnYxOQv4U518+reLTIEuY7caeF1tnkRXABm22lt9ICMQ== 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=R6c2jliJ6Z8cVv/kryS3My4zBugmcz3PdA/4LE/j/Zc=; b=g+ImTV3SQqD6rzTQlkIJ20ujV1z7AXYoIUOSYMCvnZObOHBMyGgSm1K1zTZ5wilmmjXx5JATweOsZPhYIysxyXpgTyE+NK7c4Osh7uJ6sBdWPVKc49W/GMqYRoSqcq50+nkS6mfbYOY4Zrc7mvYTIOVTRjPRq24OOY6+yuPrVgnltUcHkbrFcJW0LrwDBabq0z5LOrnKbFVZ8Xt5Ut16CXr1QCEhmj6crKMpZZA3i4vvB7A0tlZJOVoM2ndhX63yKbasOfU5Gcfn/7wBoxQ9QUzf1U+xnVmJxH5MTNoa5o43fSCzgzQqUjn9BHxhUi+q9KgTltfiM6IQGAJh78jS4A== Received: from DM6PR18CA0008.namprd18.prod.outlook.com (2603:10b6:5:15b::21) by CY8PR12MB7314.namprd12.prod.outlook.com (2603:10b6:930:52::19) 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 15:48:28 +0000 Received: from DM6NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::90) by DM6PR18CA0008.outlook.office365.com (2603:10b6:5:15b::21) 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 15:48:28 +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 DM6NAM11FT028.mail.protection.outlook.com (10.13.173.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17 via Frontend Transport; Fri, 17 Feb 2023 15:48:27 +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; Fri, 17 Feb 2023 07:48:16 -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; Fri, 17 Feb 2023 07:48:14 -0800 From: Jiawei Wang To: , , , , CC: , Subject: [PATCH v7 0/2] Add Tx queue mapping of aggregated ports Date: Fri, 17 Feb 2023 17:47:45 +0200 Message-ID: <20230217154747.12401-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.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: DM6NAM11FT028:EE_|CY8PR12MB7314:EE_ X-MS-Office365-Filtering-Correlation-Id: 13bd2881-1d84-4972-34f4-08db10fe696a 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: 32H1SnezEX79ws8eaYrPj7XaJYcM/nVLE46TrKr6BWzkHd2bDLVT1fKn1EkYg20bPX+SSVbPG1EtUrCp0FOwlgwzqau33RG+cnG9fBTpLVcPAxlhJfgh8V6+/FVTghkxRU5S8Gp7T6gqj5rD/zhrRB+kAakoRtRyupObr907W9JbTA4SnBpumo1JK99iR0pg+Buv8ypC+Y510hVgF5LdoLnx/BmH/3PEhvsYoSIMqLqXAGpNGQpHAGlo9KyWF3CFdCPdTt+tZ0UADatKaZ98wUKz1ylLRAIai0I/ne9e3rPCj7cLG2/Nxa+vs+b3otHk2BxyFJ92MOgnjHZIxICQxOgxlROQBUyHrQBVpjSlH8XPhHBz/Th7iURqs8gcvZ/w5O49+Fbc1sDQ7G3wN658bFZc87hYspeh/euoSmOqUTzrJnjSjHi8H9+wkdEraG90/VdmQFIQBkN2EqGdh8c7kqembETLAd+8QBO5uMywTozWwwERCgYHcLzMj0PHpKMKcPlwEbaIsaoPfxMH2/4QBiToPrX+YKhjKjLjx0zR40b3hQDTPyGZYRTlT8G7iRcn28KrgeuxOAOzD8riS/xKo1vxHJjiN3B+Po+BblFPHCN6f/SM4XeclXqmLhSW80bamf61/U+SSnHieuUgmrVZZ34eEfGFLN2y8w590fPCSKR7IeuOUgfxE8Um7m7xW92NyKTczM3eStp8dBNRJqANCbI0eR5GBwv/XIyJr2scmFVb/P8pH+eBjLtGe6vODn5h 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)(39860400002)(376002)(136003)(346002)(396003)(451199018)(46966006)(36840700001)(40470700004)(2906002)(36860700001)(86362001)(7636003)(82740400003)(82310400005)(356005)(47076005)(7696005)(478600001)(426003)(16526019)(26005)(186003)(6286002)(336012)(40480700001)(55016003)(966005)(36756003)(70586007)(83380400001)(54906003)(40460700003)(8676002)(70206006)(2616005)(316002)(41300700001)(4326008)(6666004)(107886003)(1076003)(110136005)(5660300002)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 15:48:27.7956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13bd2881-1d84-4972-34f4-08db10fe696a 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: DM6NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7314 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/ v7: * Remove the -ENOTSUP return value since no need anymore. * Use the rte_eth_dev as argument in the internal function. 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 | 37 +++++++++ lib/ethdev/ethdev_trace.h | 17 ++++ lib/ethdev/ethdev_trace_points.c | 6 ++ lib/ethdev/rte_ethdev.c | 72 ++++++++++++++++ lib/ethdev/rte_ethdev.h | 49 +++++++++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 35 ++++++++ lib/ethdev/version.map | 2 + 13 files changed, 373 insertions(+)