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 57AC5A034C; Tue, 22 Feb 2022 22:05:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDCD74114E; Tue, 22 Feb 2022 22:04:41 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) by mails.dpdk.org (Postfix) with ESMTP id 4E72E41165 for ; Tue, 22 Feb 2022 22:04:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=axqngbrO/pFBiyO1J90Dfc5gTFUxByWwWfwbFxRP2EUNi78d/yTh700jYvvUkVI66BC9fnRImP99F+mPk0qNdPgp0ehfSNZXFUCwcBPfgNOB9alXYNqN8fxWA4zzRuxHljrDkk98DVpJWneef5nWKvfeYrwyN1QCOP4ZLYHGhUt1NLU7dTh+Jfb0nUWMoGB4BfmIVEDevKbFfvPRycPXkDPeHvLdZ6X1pFSfzPYm+Bwad5ZGXGoWfpbXY5FId90aofY1/7TBvJdZZ+wDBfxraXo4TyOmiQiwJonqEemi7Z8oVkw92Y+WYtVLcdiQJTI3NlZvjRQ1BlN6UA0QWobBFQ== 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=5dDaLIWbLxoa6ySKiwHsiL1+HiBpVjfEsPuFJ0bggVg=; b=iqNM99bBSpTQMUD/i7STlaiHZJudrbKIiiKvvkpDQjLsnEGbrongrgrAtg94cle/RvDhzeKE4X2aIzkcdF1cmiOd5U8XngPnXUM5grKtL3LOfgcdI4dfGg0JYDtsILQXivpqsdn32nTFoDwL1JWNwpaBvgf3HYp1rb23Yxf3L+6O3GZHMuLkmA/B0HR8npp9Dljb72oeb2hc5WBn8HC8LNju2FgWa4UxNGwLQY8x7L05UOk5Xffy9nkDQjQSoMP4saUYzJJIkm/xLOxlarGy355ujgxhUFBshX2wCoh8amHp+QeYaePNsOi3V1DY/HmhQuP9uvy0Ne6xrV2a5s3IBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org 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=5dDaLIWbLxoa6ySKiwHsiL1+HiBpVjfEsPuFJ0bggVg=; b=Ak5Vt3i6rxTiFBrZwS2up/8PjPDX48jUkxU3sC+LeCrgWoBnH23H+MGRETNrDm/eyzj1mR2VFOj2ieozlS2885/ayAQfAI4VS70tiKVpXR8YXpp7zM2+veDOt38j4ZDOU0AOuv8lN8iqVvbV7R03zUjBXUMrdBhKbDaE5SujrR67TIUvlSRUVglY/dUIroL0NORtrc8svUiu9xPlCzp3kDcnyaAOP9/yqZBKnLlqrb+n9RFZOb4O3w2r1AJIWEhXhXxw46XkX4qQliQF2tcWoMf3Fd9mEYWL5m0A3Lr6wAUe8epZ/H3kRqgL+SicG/CqnkHWOhHWLvj4rbK4VyWWzg== Received: from MW4P223CA0015.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::20) by DM5PR12MB1179.namprd12.prod.outlook.com (2603:10b6:3:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Tue, 22 Feb 2022 21:04:36 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::ed) by MW4P223CA0015.outlook.office365.com (2603:10b6:303:80::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16 via Frontend Transport; Tue, 22 Feb 2022 21:04:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Tue, 22 Feb 2022 21:04:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Feb 2022 21:04:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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, 22 Feb 2022 13:04:34 -0800 Received: from nvidia.com (10.127.8.13) by mail.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 via Frontend Transport; Tue, 22 Feb 2022 13:04:33 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Subject: [PATCH 6/6] app/testpmd: add test for external RxQ Date: Tue, 22 Feb 2022 23:04:16 +0200 Message-ID: <20220222210416.2669519-7-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222210416.2669519-1-michaelba@nvidia.com> References: <20220222210416.2669519-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: a968a8bf-7c7e-4bcb-8e6e-08d9f646ee75 X-MS-TrafficTypeDiagnostic: DM5PR12MB1179: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: LpZXG91hL99qj18cRS1vfpwHLXtT7q842Eq7iVhx0WJcCbMlfBYxyeCXcR/o+VfbJ6Ic80wQXQGZLsuJP+h9wIwBHhGbwdKDU1EcxpPiQ6LA16ia/Y5kpT5Aq/RbAHACfOQuS+YDE9KPjoH8iw8/t4yFi97ErkfBOCwjl9r1O3rausXh0cc40ka13CG+xH/Qux0tMws+UG+2QK3QdDiz3NOOGDCyKf6kVrwMsxzMoR1Yc5RdOdVxaqUE5ruyOvjoNjDbQiP/Y5JiaHse88NzXHWNb0OcR4b3OMh0+AgfH6nlTjCBs422fZEcT/nzlttZavRxao977BbOQ8t0FgTyfodVIqBnWdPpDrqCI4joPyd0tXWemJjIJYgTATUzAt+d9tJiGy1lsShBpE85N+eXkkk/QkcPkyC3TD1Q9IWyeIXMStu3Oz25e6NwLWNq5Yvv+sil6SoTUF2HmOD8KK0+haShMokAEY4FcdvxEChOpo8DztcstjqiwSWgWwSn3vWz+JJOX36/RpFXLwXADoybdmfkuZQvXb6TuolK2kkHC0wTSZr6vExwCbZRAFcM8QT5EAEFZPZhY+3l/56lAuVd9aA7dPxYZ2FKvODnl17CPrEAIQtCTzye9d4rsJ/HHbHFIRFhSI2bX+aRNcNWTPYqYW3UczkGOweRQnBprUaZMv1V+W66A9ZR+De3Fk1e8kTMHWR4mfKACAOReDlxPPzUPw== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(186003)(26005)(426003)(55016003)(4326008)(8676002)(316002)(6916009)(81166007)(336012)(86362001)(54906003)(47076005)(356005)(1076003)(6286002)(82310400004)(2616005)(70586007)(40460700003)(70206006)(508600001)(5660300002)(36860700001)(6666004)(7696005)(2906002)(36756003)(107886003)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2022 21:04:35.7211 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a968a8bf-7c7e-4bcb-8e6e-08d9f646ee75 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1179 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 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 --- app/test-pmd/cmdline.c | 157 ++++++++++++++++++++ app/test-pmd/meson.build | 3 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 16 ++ 3 files changed, 176 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ba8da2b0..c0899ca6c5 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" @@ -911,6 +914,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 ); } @@ -17806,6 +17818,147 @@ 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 or doesn't exist\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 */ @@ -18092,6 +18245,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/app/test-pmd/meson.build b/app/test-pmd/meson.build index 43130c8856..c4fd379e67 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -73,3 +73,6 @@ endif if dpdk_conf.has('RTE_NET_DPAA') deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa'] endif +if dpdk_conf.has('RTE_NET_MLX5') + deps += 'net_mlx5' +endif diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9cc248084f..613d281923 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2462,6 +2462,22 @@ 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 +~~~~~~~~~~~~~~~~~~~~~ + +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