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 7506DA034F; Tue, 1 Mar 2022 21:26:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2220242706; Tue, 1 Mar 2022 21:26:32 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by mails.dpdk.org (Postfix) with ESMTP id 14DAA426DE for ; Tue, 1 Mar 2022 21:26:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dcRaaKjPeTs827bPUz5wuxukPWvnxhsJfRALeE9UOkK5bRX86SsHv8mi/AqDkdAiK8L7RNnEZN98NQfSVBHpnyYRzYyfFrEKSacqkcmEGywQQr1XRc4LdG8GN6gO8L+3NxX89Q4Voe7cS36Ox8LbZ9QrWIm8G24k+8HHfTo3JgyegE/+EC8Euy92AcsHWBjHhpk4S7M4c5WPGDnLOXlyuOBHYoHiBXOqeBssj8B4iJIhDUU9rxYI7GfRnSMAvcWByPBIwOB/ulGEawGuOonkYP8nDUd3aAnn4CznqYMY3vVWWExpFl3IfE220BqbZzN9c6r5o5KYmn30Q1z3RFE86Q== 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=gK2BYWr5yAR2bLLFim3SjCTfWQwrD+uV9y5feEskxYE=; b=EmAAdo+gfbh/3rhKMcDqJ6KdyKLpqSxQSyo/Fak8VxroIHmzbREJVXdvkia25KbnNsv2gQeWLj7zqklYefJ8I0qFd3Q7KlWgWLxNU9Qxj5g9SBcwVhiE3Ar50/wYnlMbH5A1hbQrXNzQ+n6xFSvIdsfi1OXRWtNMS+6SgmvxK6C+HjAuTil1VW0gOCr64lUGidNu5jf++M8yTbTHUQkiu+8BP4HdSVIXJPPiOC11KEgKqGxpn5/1J833TcSV6Sl9LLSQtJT+IxiKY2REdKLx3nm4BAph1KM8fJacB6TH3Y/WduGEEjbAcCf6i1aWLmx8/iity8OEUbhSNd4vT7gWAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=intel.com 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=gK2BYWr5yAR2bLLFim3SjCTfWQwrD+uV9y5feEskxYE=; b=iJaGY46wFQlgF53SUxUnsBCVs2KU21ZsKGb6bYamNrElemdXssfVqRaMaQqHeoWQl6iiYSl6VKOdCoeijO916IVGgZuKhUuMS5EZ1eWDBgO5aCYHTAHMEFDCN5J8e6jp4N3sZK3R4Erip/e12DkD5MoL7GHe7tGYFmqC5uytb8M6JIn9BEKje+5LhnoQHXw4JPo2/SKu8Rzjbp+FL7M32PbMX0pNwOK9f+mgcE3pRJ710c5+NGkyOsFcQRaqByyFbEe/Po5FILwNWnUtAfF+21JGH2zXjDKpxeU6IoYEBujwwUtso8jTwL19ZjEbxwxawtjGWV3JjBp98O/fSv8gsA== Received: from DS7PR03CA0221.namprd03.prod.outlook.com (2603:10b6:5:3ba::16) by DM5PR12MB1194.namprd12.prod.outlook.com (2603:10b6:3:6e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25; Tue, 1 Mar 2022 20:26:27 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::99) by DS7PR03CA0221.outlook.office365.com (2603:10b6:5:3ba::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Tue, 1 Mar 2022 20:26:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Tue, 1 Mar 2022 20:26:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 1 Mar 2022 20:26:26 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.9; Tue, 1 Mar 2022 12:26:25 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Tue, 1 Mar 2022 12:26:24 -0800 From: Michael Baum To: CC: Xiaoyun Li , Aman Singh , Yuying Zhang , Matan Azrad Subject: [PATCH 2/2] app/testpmd: add test for external RxQ Date: Tue, 1 Mar 2022 22:26:15 +0200 Message-ID: <20220301202615.4103972-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220301202615.4103972-1-michaelba@nvidia.com> References: <20220301202615.4103972-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ecefcdf9-6ab6-4091-85aa-08d9fbc1c376 X-MS-TrafficTypeDiagnostic: DM5PR12MB1194:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MjMwIn4XCDemtNGn34RDnmNpkjM2g1P1wT/cuWV/sulhkxt/z9WbRGjrSZn54G7alIkE3jQ1fgEriSSTtWd7vsVthb/QyHTKsw+YVd0NNjo7KuLg7jRBHxLsmo7etlK1/KYIGG3LshIYK1jkP6+HhqfAaYZyZwSBa807TlrhZOPSHZLax3rbnDXFAbEZAIzO6Kpp7kfc0Zjd7JqmxDBGVC2T2vaq1a0ku9QOAzk5n+v8fXXzwsTDs3kFuXRuJ96tUrcH3+mD9XyfySWlNfaS7VAm/mBETfX8bqDvJgHwqmEhP7Tf3Rq0rgK9k3mxzGFTi+mTzp4A6AUJnHl+HaT4PIHxUdsWZ/7kk4gvgjMY+Jqtb4Sjt+ZuJoYbWv5jj+cU/0rpAVDVZp2IUA5qHa65X1PYbNvYtV9kTATAKvCSYfvmgr2HQs7jaxh29q0wCXgzAHAc2zIKm0t/FSNLfhGDiu/hXEnd0NPq/qBNNREhEv8y3+9uaWRNVlx32+QfMAt1RV5rzfN7X8l+WeimABKmAnyxQgQMpWi6kl6sXxERVsX5IA+DdU5LrU9c3aHcKGrqo3AoK/d5RTD7K7JjPZHcT9nEpNTApvg3xDmHBEmamEuYEHXOXg7xQqnvOTWeXd03l6b8/X8Eqqov665fR3ckQ/jwcSL4ql7onnSyB39yMyVJJpkHljTMsMU2drbmiLRqJ7SCvjl6HwyPAXoObqusXw== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(1076003)(316002)(5660300002)(8936002)(2616005)(86362001)(107886003)(82310400004)(8676002)(70206006)(70586007)(4326008)(2906002)(6286002)(26005)(186003)(36756003)(7696005)(356005)(81166007)(6666004)(55016003)(508600001)(6916009)(54906003)(426003)(336012)(36860700001)(40460700003)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 20:26:27.4970 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecefcdf9-6ab6-4091-85aa-08d9fbc1c376 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1194 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 Add mlx5 internal test for map and unmap external RxQs. This patch adds to Testpmd app a runtime function to test the mapping API. For insert mapping use this command: testpmd> port (port_id) ext_rxq map (rte_queue_id) (hw_queue_id) For insert mapping use this command: testpmd> port (port_id) ext_rxq unmap (rte_queue_id) Signed-off-by: Michael Baum Acked-by: Matan Azrad --- app/test-pmd/cmdline.c | 158 ++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 +++ 2 files changed, 178 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 479e0290c4..929680f5cb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -63,6 +63,9 @@ #ifdef RTE_NET_BNXT #include #endif +#ifdef RTE_NET_MLX5 +#include +#endif #include "testpmd.h" #include "cmdline_mtr.h" #include "cmdline_tm.h" @@ -917,6 +920,15 @@ 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" + +#ifdef RTE_NET_MLX5 + "port (port_id) ext_rxq map (rte_queue_id) (hw_queue_id)\n" + " Map HW queue index (32 bit) to rte_flow queue" + " index (16 bit) for external RxQ\n\n" + + "port (port_id) ext_rxq unmap (rte_queue_id)\n" + " Unmap external Rx queue rte_flow index mapping\n\n" +#endif ); } @@ -17817,6 +17829,148 @@ cmdline_parse_inst_t cmd_show_port_flow_transfer_proxy = { } }; +#ifdef RTE_NET_MLX5 + +/* Map HW queue index to rte queue index. */ +struct cmd_map_ext_rxq { + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t ext_rxq; + cmdline_fixed_string_t map; + uint16_t rte_queue_id; + uint32_t hw_queue_id; +}; + +cmdline_parse_token_string_t cmd_map_ext_rxq_port = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, port, "port"); +cmdline_parse_token_num_t cmd_map_ext_rxq_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_map_ext_rxq_ext_rxq = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, ext_rxq, "ext_rxq"); +cmdline_parse_token_string_t cmd_map_ext_rxq_map = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, map, "map"); +cmdline_parse_token_num_t cmd_map_ext_rxq_rte_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, rte_queue_id, RTE_UINT16); +cmdline_parse_token_num_t cmd_map_ext_rxq_hw_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, hw_queue_id, RTE_UINT32); + +static void +cmd_map_ext_rxq_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_map_ext_rxq *res = parsed_result; + int ret; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_mlx5_external_rx_queue_id_map(res->port_id, + res->rte_queue_id, + res->hw_queue_id); + switch (ret) { + case 0: + break; + case -EINVAL: + fprintf(stderr, "invalid rte_flow index (%u), out of range\n", + res->rte_queue_id); + break; + case -ENODEV: + fprintf(stderr, "invalid port_id %u\n", res->port_id); + break; + case -ENOTSUP: + fprintf(stderr, "function not implemented or supported\n"); + break; + case -EEXIST: + fprintf(stderr, "mapping with index %u already exists\n", + res->rte_queue_id); + break; + default: + fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + } +} + +cmdline_parse_inst_t cmd_map_ext_rxq = { + .f = cmd_map_ext_rxq_parsed, + .data = NULL, + .help_str = "port ext_rxq map ", + .tokens = { + (void *)&cmd_map_ext_rxq_port, + (void *)&cmd_map_ext_rxq_port_id, + (void *)&cmd_map_ext_rxq_ext_rxq, + (void *)&cmd_map_ext_rxq_map, + (void *)&cmd_map_ext_rxq_rte_queue_id, + (void *)&cmd_map_ext_rxq_hw_queue_id, + NULL, + } +}; + +/* Unmap HW queue index to rte queue index. */ +struct cmd_unmap_ext_rxq { + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t ext_rxq; + cmdline_fixed_string_t unmap; + uint16_t queue_id; +}; + +cmdline_parse_token_string_t cmd_unmap_ext_rxq_port = + TOKEN_STRING_INITIALIZER(struct cmd_unmap_ext_rxq, port, "port"); +cmdline_parse_token_num_t cmd_unmap_ext_rxq_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_unmap_ext_rxq, port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_unmap_ext_rxq_ext_rxq = + TOKEN_STRING_INITIALIZER(struct cmd_unmap_ext_rxq, ext_rxq, "ext_rxq"); +cmdline_parse_token_string_t cmd_unmap_ext_rxq_unmap = + TOKEN_STRING_INITIALIZER(struct cmd_unmap_ext_rxq, unmap, "unmap"); +cmdline_parse_token_num_t cmd_unmap_ext_rxq_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_unmap_ext_rxq, queue_id, RTE_UINT16); + +static void +cmd_unmap_ext_rxq_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_unmap_ext_rxq *res = parsed_result; + int ret; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_mlx5_external_rx_queue_id_unmap(res->port_id, + res->queue_id); + switch (ret) { + case 0: + break; + case -EINVAL: + fprintf(stderr, "invalid rte_flow index (%u), " + "out of range, doesn't exist or still referenced\n", + res->queue_id); + break; + case -ENODEV: + fprintf(stderr, "invalid port_id %u\n", res->port_id); + break; + case -ENOTSUP: + fprintf(stderr, "function not implemented or supported\n"); + break; + default: + fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + } +} + +cmdline_parse_inst_t cmd_unmap_ext_rxq = { + .f = cmd_unmap_ext_rxq_parsed, + .data = NULL, + .help_str = "port ext_rxq unmap ", + .tokens = { + (void *)&cmd_unmap_ext_rxq_port, + (void *)&cmd_unmap_ext_rxq_port_id, + (void *)&cmd_unmap_ext_rxq_ext_rxq, + (void *)&cmd_unmap_ext_rxq_unmap, + (void *)&cmd_unmap_ext_rxq_queue_id, + NULL, + } +}; + +#endif /* RTE_NET_MLX5 */ + /* ******************************************************************************** */ /* list of instructions */ @@ -18103,6 +18257,10 @@ cmdline_parse_ctx_t main_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, +#ifdef RTE_NET_MLX5 + (cmdline_parse_inst_t *)&cmd_map_ext_rxq, + (cmdline_parse_inst_t *)&cmd_unmap_ext_rxq, +#endif NULL, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index d6490947c4..de5665c886 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2502,6 +2502,26 @@ To cleanup txq mbufs currently cached by driver:: If the value of ``free_cnt`` is 0, driver should free all cached mbufs. + +port map external RxQ +~~~~~~~~~~~~~~~~~~~~~ + +MLX5 internal API for external RxQ mapping management. + +Map HW queue index (32 bit) to rte_flow queue index (16 bit) for external RxQ:: + + testpmd> port (port_id) ext_rxq map (rte_queue_id) (hw_queue_id) + +Unmap external Rx queue rte_flow index mapping:: + + testpmd> port (port_id) ext_rxq unmap (rte_queue_id) + +where: + +* ``rte_queue_id``: queue index in reage [64536, 65535]. +* ``hw_queue_id``: queue index given by HW in queue creation. + + Device Functions ---------------- -- 2.25.1