From patchwork Thu Jun 16 09:15:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Etelson X-Patchwork-Id: 112864 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 04823A00C2; Thu, 16 Jun 2022 11:16:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC36F42BFC; Thu, 16 Jun 2022 11:16:03 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2071.outbound.protection.outlook.com [40.107.93.71]) by mails.dpdk.org (Postfix) with ESMTP id 150154281E; Thu, 16 Jun 2022 11:16:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gyODfzQQi2UHo5+CS1r3IbbYymvCzvvNVFr0B2D5eTRxFCUihHF4Z5BVVDYTG8xx7otjwZ61D66BkYv/jeQe1al3jy9dJ5wFHCzlhrlYutwZuPgJOkLdomvZ62mSeKEoTHWzVHJS/rWvRPheabBQzf4+0/KuSGf13hyK8llUCJDuvtOMjlTSgENZHXH1WvAXLBaIZ+qoxNLMsWXZvBskZKc+eURL6BWmj2e7DovZTr29lPdpDXnIp+Cx7L9ahlQ4U4U4nU19A0k+IUsTpSvLiwIuuyN45Md6XKMqg2LMTf6wx1UBcaeNybEDKIYCVbf+HLj4anq/hqinaVsDg8eluw== 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=r8xYIKCzKqxY6DjKEbLPsQy5OiuVtn4mxdYLvkhklGA=; b=QjaSY+28L2BenY+VJPfiqlr3nqrUd6IkTyHiOLXIkJ1YbZf8rYbilbIV7QjJqK5Xq8uga3IT5ZX/kNOsnIMx63Y5bbVP76yuvkKn+e9goFPeT3uGAWTqxZfRcxnkt4T9/8M4V2pJWZLEitbuHLs4xp4r8I1tfsWu1OubVa3/yiLg/GAmzjrDoKOKmCM5OZ7dCOPOdQHrudJIOIbxatP02zk3+qUk5uUPSK4CmzZ4V5StuJM6IqHIFo0hd2hHlyuwAz7cAJBKjmQ8Kk4yZCFIjb1s8aM7U8UvCFpGIVTLaagMYGq86tjeZe3cLaMeiYfcAl4YRHOBwBpD1Ox9gcXYBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=r8xYIKCzKqxY6DjKEbLPsQy5OiuVtn4mxdYLvkhklGA=; b=IBNIi3QGD/G0XUD62L/QFfJolSaGxoZRNanu559yG37vv9CtoV3bU8cq8d4ZD8RTjxGJJXUZD4aznnA60rkomL9KIJeyThRsQHwAJhtIURwec2Q6F26ZrtmZXOj1FXF42dqtD65qSqeK8a3m7arM5JPQM9CfcM6xPrkMW8nYohZnKwClPYhwp7Fw1LBj8N5alUhKpQOkC8jOvGAGZcgMVxa8/kSp5XlnhMMkEcYiXuwRw9W87brz8sEJybQTxFLXig/V39mHRRCQ4h3WnUYPvvdPb2Wmepzp5CngzkHNeM7JDAm0KvdyonTPtjEklm1LZSPAdfFCxSymeSIDrtYVMA== Received: from BN9P222CA0023.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::28) by BN8PR12MB3412.namprd12.prod.outlook.com (2603:10b6:408:65::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.16; Thu, 16 Jun 2022 09:15:58 +0000 Received: from BN8NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10c:cafe::65) by BN9P222CA0023.outlook.office365.com (2603:10b6:408:10c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15 via Frontend Transport; Thu, 16 Jun 2022 09:15:58 +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 BN8NAM11FT011.mail.protection.outlook.com (10.13.176.140) 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 09:15:58 +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.32; Thu, 16 Jun 2022 09:15:57 +0000 Received: from nvidia.com (10.126.231.35) 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.22; Thu, 16 Jun 2022 02:15:54 -0700 From: Gregory Etelson To: CC: , , , , Viacheslav Ovsiienko , Xiaoyun Li , Aman Singh , Yuying Zhang Subject: [PATCH v2] app/testpmd: fix flex parser destroy command Date: Thu, 16 Jun 2022 12:15:35 +0300 Message-ID: <20220616091535.26349-1-getelson@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220616080744.5832-1-getelson@nvidia.com> References: <20220616080744.5832-1-getelson@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ec21b88-2554-4eca-6e8c-08da4f78d366 X-MS-TrafficTypeDiagnostic: BN8PR12MB3412: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: Dw+Xngjf67iToAHVd2FJts5FDwnAIZ8SmqqGcDB/0Iscuz2mScObkD1QcuZ8U2qPC/5w31hHSJv90W0m7VtvzoG2h5gNqOMJaVs7vcNDfwLZQ3Ot4Ev2V/XCHBnj3wUjYJTlUQCDkM/7Vp+jmWx0r0KBDrj7+jTWNVPtrlhSFvRQnRG/rxeQ9BKYc4Fh5FkxukjQFDlcPO1+e9ni2mTScnf+D+GOKgILxlt/azSAuZTLl7/JtrkygTBxqanFtVOhWXLe/iJsic3CfiYZ0rt6JfNXtizHIB6Wd8Hfq2IfnORGkSuuD4dZ0HCyDt48ZX+Gsw3UABYuwdljn+TNU6eRqMU/T1G8mhgvyE/k4bf24e3X+IlUTq8gvNAZoy9gN/z+rpn1/s3YrIgXRS6MMp2fW4vNlsVKDe+1+Qb52GwAF3Kk72t34zMMPcwh/l2rSkyVlnCZ2RLmBXLQw1kydBMp596eDy9PINO3znxCw8iH+9401sbBF/tKYqlojaaHrcRN1VIP3zRUaYyM6C3jM1MrPq0QkBzV24wGKKSxwDsV3H9qf13ZTMCxn+M10izMzYNX0Jmuj17cHGZRM/9/ryH9rn4UWPVPyqAwEjSMWFZTCH6baONe6i/+PVOSL54VV54JpgLCsV1ozWptSIa1VmsPVd5eBFKRPSDDjMlAZWMh3ujDObByai32MWKidB7WW0xylks+JGTtcaqH3N6tn3tnpA== 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)(40470700004)(46966006)(36840700001)(8676002)(86362001)(508600001)(316002)(70206006)(6666004)(36756003)(2616005)(16526019)(4326008)(70586007)(81166007)(8936002)(356005)(5660300002)(6916009)(186003)(26005)(6286002)(36860700001)(54906003)(1076003)(2906002)(82310400005)(47076005)(336012)(426003)(55016003)(83380400001)(40460700003)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 09:15:58.6003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ec21b88-2554-4eca-6e8c-08da4f78d366 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: BN8NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3412 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 The patch separates flex item destruction function implementation. Setups with installed JSON development library can use any value in range [0, FLEX_MAX_PARSERS_NUM - 1] as input flex item ID. In setups without JSON development library flex item destruction function is resolved to empty stub. cc: stable@dpdk.org Fixes: 2d3d84013508 ("app/testpmd: fix flex item flush") Signed-off-by: Gregory Etelson Reviewed-by: Viacheslav Ovsiienko Reviewed-by: Andrew Rybchenko --- v2: fix compilation warning on setups without JSON library. --- app/test-pmd/cmd_flex_item.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmd_flex_item.c b/app/test-pmd/cmd_flex_item.c index 78a89c0f8a..63593fd456 100644 --- a/app/test-pmd/cmd_flex_item.c +++ b/app/test-pmd/cmd_flex_item.c @@ -20,6 +20,8 @@ struct flex_item *flex_items[RTE_MAX_ETHPORTS][FLEX_MAX_PARSERS_NUM]; struct flex_pattern flex_patterns[FLEX_MAX_PATTERNS_NUM]; +#ifdef RTE_HAS_JANSSON + static struct flex_item * flex_parser_fetch(uint16_t port_id, uint16_t flex_id) { @@ -34,7 +36,6 @@ flex_parser_fetch(uint16_t port_id, uint16_t flex_id) return flex_items[port_id][flex_id]; } -#ifdef RTE_HAS_JANSSON static __rte_always_inline bool match_strkey(const char *key, const char *pattern) { @@ -368,23 +369,12 @@ flex_item_create(portid_t port_id, uint16_t flex_id, const char *filename) free(fp); } -#else /* RTE_HAS_JANSSON */ -void flex_item_create(__rte_unused portid_t port_id, - __rte_unused uint16_t flex_id, - __rte_unused const char *filename) -{ - printf("cannot create flex item - no JSON library configured\n"); -} -#endif /* RTE_HAS_JANSSON */ - void flex_item_destroy(portid_t port_id, uint16_t flex_id) { int ret; struct rte_flow_error error; struct flex_item *fp = flex_parser_fetch(port_id, flex_id); - if (!flex_id) - return; if (fp == FLEX_PARSER_ERR) { printf("Bad parameters: port_id=%u flex_id=%u\n", port_id, flex_id); @@ -405,6 +395,22 @@ flex_item_destroy(portid_t port_id, uint16_t flex_id) } } +#else /* RTE_HAS_JANSSON */ +void flex_item_create(__rte_unused portid_t port_id, + __rte_unused uint16_t flex_id, + __rte_unused const char *filename) +{ + printf("cannot create flex item - no JSON library configured\n"); +} + +void +flex_item_destroy(__rte_unused portid_t port_id, __rte_unused uint16_t flex_id) +{ + +} + +#endif /* RTE_HAS_JANSSON */ + void port_flex_item_flush(portid_t port_id) {