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 97D5EA00C2; Thu, 16 Jun 2022 19:10:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25C7E410E8; Thu, 16 Jun 2022 19:10:35 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by mails.dpdk.org (Postfix) with ESMTP id AAF1E427EB for ; Thu, 16 Jun 2022 19:10:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jpQ1wTbNt6qy2+gkachZXRUiqO7ZcFFof2u921YU4qJrPiidG/TIaQnFXsHUpOhKC8NWU6ADBLg1UjUBqlMUimy6Rtzlo4e2q0syVrfNNdl2xCXs8PqcdI9N0f4UkL01ocSDxOaix33xYlhRF5kru2lwzuOxlK2RdpRtVm/7qXJWnCN1GS9izJc4tIQ+R/76bPFpqLKKUdpLawCQkZP6R2E/Y9ozMgg4i5ItsKVnCzm3pCrMBIhaYkh3jIK095xf/p30bCzSZ0Kh7wLiCMWVaY43G7Cvi6/fFnRbtGKY7+aXu0SUwNWarwS7r7BjTZXWADUf0k9I4xyqRNW19roscw== 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=UJnmfg+6W7OYv1zsqpNLVM8NrwKfyW20DA5SNUwwVkQ=; b=Gak5cxLSIIAXWIfR5mgbsGkTtYrgtxhju7gGKxTX1qFRMAzZmOmjHuuT43M5e85+uCwOkU9hzw7CZJ0peU6y7ePZpp4JaPkN6kSo0prJmLSHagPaVyDr0SvfNAx9h/IOOvvkn/2WT4eIVJiVm6G29dZOCf9zkPeXBExN+fXem0HvvXzZ0XodRk43MXp8hupEr9LIZoviw9xN3/dAqJC3rnVdjll7jep81nP+4X+7Beplno/dQPllcTlIhLn+UnzaSop5yaXZKzdljMPPXS9tS+pLCkRQiLvDA85i6vmDJZ4E7nfpZIpHaPgFL/keMJljANByM3QzZgKP0etgHXFB2Q== 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=UJnmfg+6W7OYv1zsqpNLVM8NrwKfyW20DA5SNUwwVkQ=; b=cGl+Xwfrb2wJ9RkbnAzuns5TAXyFVK+cFOrmQZxo0yS1mhHXSWTHoe9p29pvg42g+hTmoN+HMRJX5OcIxATFXT/4/gYgdyp09qOE/uHwg/Yk9mTsVt2o6RgYqiz2YznpsE11nFe1JljkA14fU8I4k2eLGc4MdNuq35cCgmegFdB4LYC6kFmWsDwZrXcKuiZNXOafeO31x3u9+5oQYjfQxC1g4Q2L306jVjniVa8zgS9zN5hDFmLdbVHQ/H8okg6VdJbicOAm2KhDBnV6St+yQ8XnVHCuXIadlu3394LmjZEJwU8PepZbscWR4ImJ2lvh9F1Y0D7wXpwYazele3FQJA== Received: from DM5PR1101CA0010.namprd11.prod.outlook.com (2603:10b6:4:4c::20) by SN1PR12MB2368.namprd12.prod.outlook.com (2603:10b6:802:32::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 17:10:31 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:4:4c:cafe::42) by DM5PR1101CA0010.outlook.office365.com (2603:10b6:4:4c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.18 via Frontend Transport; Thu, 16 Jun 2022 17:10:31 +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; pr=C Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5332.12 via Frontend Transport; Thu, 16 Jun 2022 17:10:31 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 16 Jun 2022 17:10:30 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 16 Jun 2022 10:10:29 -0700 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.22 via Frontend Transport; Thu, 16 Jun 2022 10:10:28 -0700 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Subject: [PATCH v2 2/2] app/testpmd: add test for external RxQ Date: Thu, 16 Jun 2022 20:10:17 +0300 Message-ID: <20220616171017.2597941-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616171017.2597941-1-michaelba@nvidia.com> References: <20220301202615.4103972-1-michaelba@nvidia.com> <20220616171017.2597941-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: b483e00b-ec62-44fa-b9ea-08da4fbb1e64 X-MS-TrafficTypeDiagnostic: SN1PR12MB2368: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: bdOERbXoWXD1eCn+gGXbbx47uaTREFfP5xA4xEZXzOtgOH1sHTuW9/B7W/W/XA3iYbh7U3ZBJOLggVQl0+PmyCtt+wnpWwc1BhtAJJfFWiuJUNiXTfIrY7lW5TXtZZ8BqYjqRNP+CYb1ldWgCAJR/SW40/Z9l75sXoYdRUbRJQUmAK7bDgp++eZCOdS7eKV3EpRQKR7ogvG50iUVDRKR8Pmn2K+7pOeLr7uoxxCNcs01uv1iUV2E/n/spICLRZigZh5D80VuttbXPOhvkeFuEKBbbmnZHTURINHXLdu0fUCWvVT/d0AySrmRI468c8aH0jhzzC4jijFTCxRiQpZWWK2UTcpDHAki+gi9EAUGsNhzNGlE8wLSmivC+AQzSUJc9z2SqqJazfBlOl3gcFfQDWJxyrgPpji+zmMuhnY1r2220A2Fnpnw7wepQYSr5r6AlcmrmWzOuavVJV+hK1NUALHUCKgZR4X6EjbY0xxZpajunlgTS2GvF3F6UcN8UTq+IxcPozQY5oX/Bcrd0Ti+1J3TTJHKHA0184OuQYCHE6Gkc37Tv5cv/BKC8ELSPUUbueQjcS/KQaHQYM9NFAsl/tbsZRsmzfux7Q3iaaLyMLIiorb+ZsjQwR+MHUHNwsgIdGS6w4dWQ9lvw7p13anwZH1gZhUMRaHBZ7MeUdnfoCLMdW7+NdmuLKAviu8CST/eEz0DbAr/3mbAo1pL3JOTPg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(46966006)(40470700004)(36840700001)(107886003)(1076003)(81166007)(47076005)(6286002)(8936002)(2616005)(5660300002)(82310400005)(186003)(55016003)(8676002)(6666004)(7696005)(54906003)(2906002)(86362001)(36860700001)(356005)(70206006)(70586007)(4326008)(6916009)(336012)(426003)(83380400001)(508600001)(316002)(40460700003)(36756003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 17:10:31.2492 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b483e00b-ec62-44fa-b9ea-08da4fbb1e64 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2368 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 --- doc/guides/nics/mlx5.rst | 19 ++++ drivers/net/mlx5/mlx5_testpmd.c | 153 +++++++++++++++++++++++++++++++- 2 files changed, 170 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 392292cc95..9007bfcac9 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -1821,3 +1821,22 @@ socket path is ``/var/run/import_ipc_socket``. Port 0 is attached. Now total ports is 1 Done + +port map external RxQ +~~~~~~~~~~~~~~~~~~~~~ + +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 range [64536, 65535]. + This range is the highest 1000 numbers represented by 16 bits. +* ``hw_queue_id``: queue index given by HW in queue creation. diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c index 46444f06e6..7007ee8a2c 100644 --- a/drivers/net/mlx5/mlx5_testpmd.c +++ b/drivers/net/mlx5/mlx5_testpmd.c @@ -334,13 +334,162 @@ static cmdline_parse_inst_t mlx5_test_cmd_port_host_shaper = { } }; +/* 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, + } +}; + static struct testpmd_driver_commands mlx5_driver_cmds = { .commands = { { .ctx = &mlx5_test_cmd_port_host_shaper, .help = "mlx5 set port (port_id) host_shaper avail_thresh_triggered (on|off)" - "rate (rate_num):\n" - " Set HOST_SHAPER avail_thresh_triggered and rate with port_id\n\n", + "rate (rate_num):\n" + " Set HOST_SHAPER avail_thresh_triggered and rate with port_id\n\n", + }, + { + .ctx = &cmd_map_ext_rxq, + .help = "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", + }, + { + .ctx = &cmd_unmap_ext_rxq, + .help = "port (port_id) ext_rxq unmap (rte_queue_id)\n" + " Unmap external Rx queue rte_flow index mapping\n\n", }, { .ctx = NULL, -- 2.25.1