From patchwork Mon Mar 18 09:21:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shani Peretz X-Patchwork-Id: 138448 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 4403A43CE2; Mon, 18 Mar 2024 11:49:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EC3E4027F; Mon, 18 Mar 2024 11:49:36 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id A0EE64027F for ; Mon, 18 Mar 2024 10:21:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B5xf6X9QbJIQNM94nJi4x8SFqD1dR5M9d3QLScSSYWt0IjLc5P/1a4cPgye/p3JbgYwpPhNsB6G3VZTkbNSkhe5gn/KuG953Uy3NiD7jOGzYKYlLnEQT6t0xNhieAqyRKNgO7CUyTYmeiCHuG2KUyDgb6TGW+Xf/2xWbJZFE5C6GPAGxI+oq8/bp6altOeeFF29v/9XewvngLg9uVBSr8U+i1USyz65khV7tIfRFIjD2uQf50xPpQKk0aE9OQrFETECeWzoB9feqAuzD4MSYC01oeqlsnRwy3v4C1fWiA6MhFeLjKwuBmFSbGk3yQtdSr4xfVY/jm4k2HmFZOWVFGQ== 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=wlO4CL+Uh8kfUjVqBGzbs8ElbpTHRZSaYn+PyX6tg+Y=; b=i1xiHxHVsrMlhL9PByt78hHAINPBXFepPEOrAMOH077hDGFE9d6MB8vOH8e5O/+DXOdlVC/8Oy1pk7OwxpNp8birJG62eiASN5DWiOzHQ4zxqLe9w4EPkM8AmgCajKGmWC3maObC39dtTIGokrXJV5NDinTHAyUtZJFZ/qExvuNaXYVRZ1bgbxcnHASnziZBP35NJYlNAsu6bDaNh9C5hNeda3/J/55VU/8c3MmubfTc6TY8Gd/YK3tSKyb7XSfs+9a44SnLezfBfCIiOngiUo/Ph7M0tqqjg35gIQjEoCVfdA3UQP73nXhBFSeBdvlMjw6eVAndS++CRUMsysSrmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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 (0) 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=wlO4CL+Uh8kfUjVqBGzbs8ElbpTHRZSaYn+PyX6tg+Y=; b=Xi68o1AMZwuULIxdb/nz6zcu8yZ1sdxB1yjpgx78NlOGwzzPm2Qck2qZl6Oq5ALqEIWvOPLgbpQmUhSXzMk0Nyp+BEooIxruwaU3RDZJxKoXLi4fOA2ZJsKYz4Dp9+5iew2f9IsIRLYpjdDxd/Cq0CDrWUQwVVLYCEMYXGVv/FWc4QTuu9gebhvm/TuvslbQ1CWilHsX2Kh7c714hUVGbHLnSI+qq+IMQrktR3YgusXUbwo864gB2zKLVw1ENWcuwdueOspNGU12+DaELHI/QyYnIx2hkM2sdXodnwUHl8BD+QsKQAEDU8tRO35tGbd408Ya7k12TSKfSuFSEqnd4w== Received: from CH0P220CA0007.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::15) by SA3PR12MB8762.namprd12.prod.outlook.com (2603:10b6:806:31f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.25; Mon, 18 Mar 2024 09:21:36 +0000 Received: from CH2PEPF00000149.namprd02.prod.outlook.com (2603:10b6:610:ef:cafe::6e) by CH0P220CA0007.outlook.office365.com (2603:10b6:610:ef::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Mon, 18 Mar 2024 09:21:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by CH2PEPF00000149.mail.protection.outlook.com (10.167.244.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 09:21:35 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 18 Mar 2024 02:21:30 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Mon, 18 Mar 2024 02:21:29 -0700 Received: from nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Mon, 18 Mar 2024 02:21:27 -0700 From: Shani Peretz To: CC: , , Ori Kam , Aman Singh , Yuying Zhang , Gregory Etelson Subject: [PATCH] app/testpmd: fix auto completion for indirect list action Date: Mon, 18 Mar 2024 11:21:09 +0200 Message-ID: <20240318092109.87656-1-shperetz@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000149:EE_|SA3PR12MB8762:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ab9a687-5587-4deb-75b0-08dc472ccf28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h1pUIGji2mDS6y6p5tUv6l26OafSRylnc+2m06Xg6+oBTnXCqkAPVdYrImGxp2BEB23zAQg2JKapDLejW9zIfOC7Tv8ZbqQBKOC6NjRhAiCVs9vipCajYHDSUbU2XQtliKQxceKYHh37ctCt76V4XLgzq3D9S+yfvH3PGgMUwUa3//ssAns6LGQ/Fb7Kwep2y1MdNvrC5oRiUwGKlUfqio1UZA+llYqFStymv3nvEaB/BCdFHJ1Ansim+0oVIZHgvb0d6S1BZqEDqxMlm0aOuTHnOxyfVQWnm6Q5aV0cojluwjMLgmEX5WtVIHIcxBlA4u2xM/sHFG2IrIQDCLLKkEvRNCsqztDC318r8Z63LTELaH0i/9A7UK8JDAk7/3PyJKWEYoZORsIm9rtInROK3VnubnhekP0T5oU5FTcr6D/y6h+l8Ck4HJntDzTi7ct1apNgKEfiQG4RFcasseZL71hi5fxItUiB3j1Gr4miuDCzW1zNX8QpUBYXr0rsUt6INl4+XTacY2T9RglgkSL03ta4gw3xdLCArY+QAEAT7sZYNysv1clro0ljZQq+wXXiYHSb7VUo1P1TCBy2V268sxVbNx3c99vmboAZ2+9Lp9ttWh0GAXVXAcv8gjOk+Q43+vU+tY8zJk+ECBa+GsLA22jDWNGh+laNUP4G3ryiTxhUMR+loBGiYLXIT+j+6wjxWVw5NSk8pzT0c+RE7H0uEafxmjYuAthtpAZKeKVz5sXsrwyvK6KEi/sopZi020kR X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(36860700004)(82310400014)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 09:21:35.7873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ab9a687-5587-4deb-75b0-08dc472ccf28 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000149.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8762 X-Mailman-Approved-At: Mon, 18 Mar 2024 11:49:35 +0100 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 In the process of auto completion of a command in testpmd, the parser splits the command into tokens, where each token represents an argument and defines a parsing function. The parsing function of the indirect_list action argument was returning before having the opportunity to handle the argument. The fix ensures that the function appropriately handles the argument before finishing. Fixes: 72a3dec7126f ("ethdev: add indirect flow list action") Signed-off-by: Shani Peretz Tested-by: Ferruh Yigit --- app/test-pmd/cmdline_flow.c | 46 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index fd6c51f72d..60ee9337cf 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -7839,11 +7839,13 @@ static const struct token token_list[] = { .type = "UNSIGNED", .help = "unsigned integer value", .call = parse_indlst_id2ptr, + .comp = comp_none, }, [INDIRECT_LIST_ACTION_ID2PTR_CONF] = { .type = "UNSIGNED", .help = "unsigned integer value", .call = parse_indlst_id2ptr, + .comp = comp_none, }, [ACTION_SHARED_INDIRECT] = { .name = "shared_indirect", @@ -11912,34 +11914,36 @@ parse_indlst_id2ptr(struct context *ctx, const struct token *token, uint32_t id; int ret; - if (!action) - return -1; ctx->objdata = 0; ctx->object = &id; ctx->objmask = NULL; ret = parse_int(ctx, token, str, len, ctx->object, sizeof(id)); + ctx->object = action; if (ret != (int)len) return ret; - ctx->object = action; - action_conf = (void *)(uintptr_t)action->conf; - action_conf->conf = NULL; - switch (ctx->curr) { - case INDIRECT_LIST_ACTION_ID2PTR_HANDLE: - action_conf->handle = (typeof(action_conf->handle)) - port_action_handle_get_by_id(ctx->port, id); - if (!action_conf->handle) { - printf("no indirect list handle for id %u\n", id); - return -1; + + /* set handle and conf */ + if (action) { + action_conf = (void *)(uintptr_t)action->conf; + action_conf->conf = NULL; + switch (ctx->curr) { + case INDIRECT_LIST_ACTION_ID2PTR_HANDLE: + action_conf->handle = (typeof(action_conf->handle)) + port_action_handle_get_by_id(ctx->port, id); + if (!action_conf->handle) { + printf("no indirect list handle for id %u\n", id); + return -1; + } + break; + case INDIRECT_LIST_ACTION_ID2PTR_CONF: + indlst_conf = indirect_action_list_conf_get(id); + if (!indlst_conf) + return -1; + action_conf->conf = (const void **)indlst_conf->conf; + break; + default: + break; } - break; - case INDIRECT_LIST_ACTION_ID2PTR_CONF: - indlst_conf = indirect_action_list_conf_get(id); - if (!indlst_conf) - return -1; - action_conf->conf = (const void **)indlst_conf->conf; - break; - default: - break; } return ret; }