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 8D7B4A034C; Wed, 21 Dec 2022 11:30:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E6C842D1A; Wed, 21 Dec 2022 11:30:40 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2046.outbound.protection.outlook.com [40.107.93.46]) by mails.dpdk.org (Postfix) with ESMTP id D89F742D10 for ; Wed, 21 Dec 2022 11:30:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=naLKLLjEdVpALWh2vRoLiyaE9hKwOnbzSW3umAzzQM0FnrhOmHyJjwkxIN8fcmZh7eXwZZCoJ0zYMv+GvBJ1UIiTmMYd8Y+2uAGnHCclKpNLOoih2xBu/mcHRqdfzrv17cDcxXHFBSDOrGkh2HAyh9+fnBRP99TMQf4O53/+Gu3oxe4002dlmFTuKShoWqHsuWCleEP6/ac+n37+gB9joJMnALbe02cpLy/6lqtEwBW1F8V8k1Fw5G0L4CHu2Oub7j5KsTr2iDWsfvul1KF9AdPM1lNHXOR02YGvAHXWATa4rX1N8HexPCrLE8u5AuYDmvO39U+jjsXO9iftYaESOA== 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=eWLr/jFi1t6FGv3HUK58mnYULlD/ENZHg28h7uW1As8=; b=QqGosQYPnO22xuoAreHYMf24LnPVSNsJKa4zEi9Z1Bz0ngAY7sfb46I4BTJcoDa6/nHtFkSJIoGs7dsKuDQCFacsMJC9G5KwcHvWQTzdktFLDXxlg0fcAbtnQc+MNtOdku8PmH0tEvMLaz0Fkxe8ZGq+aBeZqvAr0Uq5AEZ4iT+WsxkEwSZXLhFCoQ1lZI8Tq4VSEhR+9tQ9OXJGhtt8HKWg7IdYzp+VyeckVPY5VhML04oq6Hfl/scqzD4M2S/K9wEhSYiZUthR1JL9HV7ng1SKahMFOAf6q+FoLJKltQwakIImUGB5VXwaEUMC8N4lsQLjqExeXc0MNixJwiV9+Q== 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=eWLr/jFi1t6FGv3HUK58mnYULlD/ENZHg28h7uW1As8=; b=l3LRGZh+IZlO4n8TZ9cZH6lQuqgkWKw/KV9mTygvQlrSd9PirwNPgGNZRafLHUSmZ1bk2M5ELx6HkLT+4ciWSmJeokLnEfMCQXZEOu/QV6u+jNOssj+Hgsd9DVjBvd2DxV+6+OA7+KOvhVqyDZR5trfyTrbTHnZ0nB43gWmc23MIZLPjAnn43q7cjNZNCz36AxDCGfXBFPiRSZ1L2V001mBZYF8ERZDXjNP1k2ds5eiHtbughVrVtrr2Bc7LzrX+RQt5aM/KLeRQUVh4PMSCbmDNg8n6NVW3i7eyd8zQR/oGXIJF4s6bw0kh7vdxjC8V3YT5xzzFKFsBCVq3Jja6/A== Received: from MN2PR15CA0031.namprd15.prod.outlook.com (2603:10b6:208:1b4::44) by PH7PR12MB6539.namprd12.prod.outlook.com (2603:10b6:510:1f0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 10:30:36 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:1b4:cafe::8c) by MN2PR15CA0031.outlook.office365.com (2603:10b6:208:1b4::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 10:30:36 +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 BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.8 via Frontend Transport; Wed, 21 Dec 2022 10:30:35 +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; Wed, 21 Dec 2022 02:30:18 -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; Wed, 21 Dec 2022 02:30:15 -0800 From: Jiawei Wang To: , , , "Aman Singh" , Yuying Zhang , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [RFC 2/5] ethdev: introduce the affinity field in Tx queue API Date: Wed, 21 Dec 2022 12:29:31 +0200 Message-ID: <20221221102934.13822-3-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20221221102934.13822-1-jiaweiw@nvidia.com> References: <20221221102934.13822-1-jiaweiw@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain 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: BL02EPF00010206:EE_|PH7PR12MB6539:EE_ X-MS-Office365-Filtering-Correlation-Id: c566ff9c-b85c-4843-a415-08dae33e65cd 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: dl/WGJvaV3hvcsL/advadQ/riWiIygvdahffAtaHrBOt+jIXZxdE7l5Tes1jfAHbu+w1ilzEBqbJGX3oDKhvC0JFDqDIB0TZalR1IA6Ahnd+KowT+cSJKOQMoVcz4R6koOV9lvdxKGS6gig+4q9ZPdYPkjsS2u50/WVmL86XWz83orequEaEwDVbbVh59ITxk9Nmjs984uIT9sbyuxFNeGJ8qxfUgIqSnBzQbMpSHEiDQNe9ceyPm9OqalIs5HQg3wqux/ncAH1DCirGETwc8SYP5Lwp/8bSu0VpR1Qsjw/caySKoHleVdZuEcmLuW8PdJ3X3feGzeH1HSFo7B2TKe/qiMWuDHseM94zENC0FHAKzgXb/+1AXlPKA4KvQ/PiW98eLRF+vAcvhU9b9N8ab9Gj2dyrYqTEmHDRUuKXzGGgTPrK7RQxuiN7grD29f59as6jt5zU2OGr/MHf+2UMDmy5bXuNme7/Mt/jHLawMQOHdCv6yo1YESImXECzIA4wpN9dyQbTQy+kET9d/iuQTu2QmhlA4nGQBfpdpYkkMVHrDKf5DDf0LVskatqwfz9w/6/bC/yAuqLCmKByGSUaiVGCjqBJKdq6dDO3+3iM2F+WI55oFcR/0hXRKXJwukUPcnZBoVNic6hn/kXvbijYhDuDt2/eMbWsI/ZG/uPfVG2JP37jc+lhoZ48RrMLC4GxCnr/zOGaBV7n2uiu4spTMw== 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:(13230022)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199015)(40470700004)(36840700001)(46966006)(26005)(186003)(6286002)(316002)(336012)(110136005)(54906003)(4326008)(8676002)(16526019)(70206006)(70586007)(2616005)(1076003)(7696005)(6666004)(478600001)(107886003)(426003)(5660300002)(47076005)(8936002)(2906002)(41300700001)(40460700003)(36756003)(36860700001)(82740400003)(356005)(7636003)(83380400001)(55016003)(82310400005)(86362001)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 10:30:35.9612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c566ff9c-b85c-4843-a415-08dae33e65cd 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: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6539 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 port affinity of the received packets. This patch adds the tx_affinity setting in Tx queue API, the affinity value reflects packets be sent to which hardware port. Adds the new tx_affinity 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) affinity (value) For example, there're two hardware ports connects to a single DPDK port (port id 0), and affinity 1 stood for hard port 1 and affinity 2 stood for hardware port 2, used the below command to config tx affinity for each TxQ: port config 0 txq 0 affinity 1 port config 0 txq 1 affinity 1 port config 0 txq 2 affinity 2 port config 0 txq 3 affinity 2 These commands config the TxQ index 0 and TxQ index 1 with affinity 1, uses TxQ 0 or TxQ 1 send packets, these packets will be sent from the hardware port 1, and similar with hardware port 2 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/rel_notes/release_22_03.rst | 4 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++ lib/ethdev/rte_ethdev.h | 1 + 5 files changed, 107 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b32dc8bfd4..683cae1cab 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 txq affinity \n" + " Set the port affinity value " + "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 affinity value *** */ +struct cmd_config_tx_affinity { + 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 affinity; + uint16_t value; +}; + +static void +cmd_config_tx_affinity_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_config_tx_affinity *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_affinity = res->value; + + cmd_reconfig_device_queue(res->portid, 0, 1); +} + +cmdline_parse_token_string_t cmd_config_tx_affinity_port = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_affinity, + port, "port"); +cmdline_parse_token_string_t cmd_config_tx_affinity_config = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_affinity, + config, "config"); +cmdline_parse_token_num_t cmd_config_tx_affinity_portid = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_affinity, + portid, RTE_UINT16); +cmdline_parse_token_string_t cmd_config_tx_affinity_txq = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_affinity, + txq, "txq"); +cmdline_parse_token_num_t cmd_config_tx_affinity_qid = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_affinity, + qid, RTE_UINT16); +cmdline_parse_token_string_t cmd_config_tx_affinity_affine = + TOKEN_STRING_INITIALIZER(struct cmd_config_tx_affinity, + affinity, "affinity"); +cmdline_parse_token_num_t cmd_config_tx_affinity_value = + TOKEN_NUM_INITIALIZER(struct cmd_config_tx_affinity, + value, RTE_UINT16); + +static cmdline_parse_inst_t cmd_config_tx_affinity = { + .f = cmd_config_tx_affinity_parsed, + .data = (void *)0, + .help_str = "port config txq affinity ", + .tokens = { + (void *)&cmd_config_tx_affinity_port, + (void *)&cmd_config_tx_affinity_config, + (void *)&cmd_config_tx_affinity_portid, + (void *)&cmd_config_tx_affinity_txq, + (void *)&cmd_config_tx_affinity_qid, + (void *)&cmd_config_tx_affinity_affine, + (void *)&cmd_config_tx_affinity_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_affinity, 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/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst index 8acd3174f6..0d81ae7bc3 100644 --- a/doc/guides/rel_notes/release_22_03.rst +++ b/doc/guides/rel_notes/release_22_03.rst @@ -212,6 +212,10 @@ API Changes * ethdev: Old public macros and enumeration constants without ``RTE_ETH_`` prefix, which are kept for backward compatibility, are marked as deprecated. +* ethdev: added a new field: + + - Tx affinity per-queue ``rte_eth_txconf.tx_affinity`` + * cryptodev: The asymmetric session handling was modified to use a single mempool object. An API ``rte_cryptodev_asym_session_pool_create`` was added to create a mempool with element size big enough to hold the generic asymmetric diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index c0ace56c1f..0c3317ee06 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 affinity +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Configure a affinity value per queue Tx offloading only on a specific Tx queue:: + + testpmd> port (port_id) txq (queue_id) affinity (value) + +* ``affinity``: 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 882ca585f2..813dbb34b5 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1138,6 +1138,7 @@ struct rte_eth_txconf { less free descriptors than this value. */ uint8_t tx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */ + uint8_t tx_affinity; /**< Drives the setting of affinity per-queue. */ /** * 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 -- 2.18.1