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 B3436A0C43; Wed, 20 Oct 2021 17:07:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F337641241; Wed, 20 Oct 2021 17:06:59 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2082.outbound.protection.outlook.com [40.107.95.82]) by mails.dpdk.org (Postfix) with ESMTP id 53E8941238 for ; Wed, 20 Oct 2021 17:06:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZzLoIJOtlB0cWvCRR9ynERqcFz9SmbWO0XFeM1RybGmqV+DaonpWfH0hZ9+tvmZO6Wl3og08fLFNWrWxsaqn4gKGMsHGNPrtk7FR76fl9UY06FiyGTE6cBwT6uqTgqsUm/FDxAjaTWBZgaXrusGoBbgbNzCu0V++ifPQTJLfanw8h6aNcQ4Rx/JebWeXkelTU9ZYUVNwnu9ZlXruOVwfIzSJIQIEjzOwkvzfbXDuFdO7Q9MzdfUV3Lo314ssiBFG0eoKNl+AXTnvGw142DMhna5UhLaC6W73OVv06dd+4Mx9gQbfnxV9Ss/31biLzyxU3YHeONflp1gh0HDCi3Wm2g== 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=dzdm+SzJrkRRbgucP6z28Q9dfz/1X3Bl1FB7P9UMI00=; b=KRbChhmRSL9lA801YTfMvTrj3N9IzQqE8IEKLwCYt46IpgbMfvVdqqYlnE7Qdor29gj23iRwbLk47U2bjppcuWL3T77h6Ziq/ub0RtPN0XRaNa6qFJqeJOp3gj2YK1dmKRF0njVXqlWdWql8GLg1ti0ef4JqDfxx8oyMQckHad2jP7ZYMfEfb9QxVUGcw5I3GZ/4Anm6qv+RHlxH18XXCH9/KORMDbSX5lSnJNsRIEHl0tclSdQve91JBdg6RdCqF90UzY/XI0+3OHK/vroUhGOXqkh+plUY7SxwZWjPX855ASB3CYsFbUSs4t6+QqdTPjGrcIjRkGQmrLGWBCLang== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=dzdm+SzJrkRRbgucP6z28Q9dfz/1X3Bl1FB7P9UMI00=; b=qmwdRfIEzEZXfZ3pCPLruv1rCNhWGH33Q52BoNlX/71X8Jcw/el/uNqiuYZP6fley6Out5rntucs1Wp0mbaqd5ls4Zs/JqukIzaaYXG2oavYSVKWPvInKL82AHxT/99zHR8kwipb1lQpkd15sGdIlgG7iSmMWJCTxRIAIKJumkMlM6yNzNw4+Ux0WUu0fW9LFLF8xPUmue9DZpml1KUwHzdvMzdb8pcyGoXoR+g7WdY002nqCc8l99YZGNgO/A/Ljl0PibOxeamdOVpQ8B3Uk1/AbzwSIzpvJqXMZlIazy9N22BYrMMrq+52htrLNOYkDjA5hZnQKrlP2d8imuodNg== Received: from MW4PR04CA0044.namprd04.prod.outlook.com (2603:10b6:303:6a::19) by DM6PR12MB4796.namprd12.prod.outlook.com (2603:10b6:5:16a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Wed, 20 Oct 2021 15:06:54 +0000 Received: from CO1NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6a:cafe::79) by MW4PR04CA0044.outlook.office365.com (2603:10b6:303:6a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Wed, 20 Oct 2021 15:06:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT037.mail.protection.outlook.com (10.13.174.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Wed, 20 Oct 2021 15:06:54 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 20 Oct 2021 15:06:49 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Wed, 20 Oct 2021 18:06:20 +0300 Message-ID: <20211020150621.16517-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211020150621.16517-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211020150621.16517-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 398a83ce-6006-4862-edbe-08d993db40d5 X-MS-TrafficTypeDiagnostic: DM6PR12MB4796: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jq110/i89hFes1XEBE3k6aYwX0JMpTd6nMYoDZbgdOXJpUs29tW+8HMTO/9jrLzr+fJ3WAj3J9h0MLiUsGCSpgr5loxtVqoWrvMj8FnlDM/tVehBly/pki9LYhgAhM1m78sg3CGCDeJvneJXeXsB1hxo22+Xt7EwcLt+c4XDaRkRRHUk63L2E2lRGtjHIO0NHlVKvvy50qGzE4pEKOnNq8XBBTwrGA9AIsG9YTQvUoAVhTrYEf2nMTwcsWdLkmhjWYSW9C/pZnl6d7utX5tHFHPasXxVP8nfkelBq4DAuARjFBqTvB3PBfVYAlz0KtDkCLV4bi89pPWnWdVYjSZeGyU0R/4XwYqPJSiX7ozcgSHKLnJDPbj2f6uTQSJMFuuQAVbwKYFajljrk0v4DKrN/j2hB6pB9Wco5a6Llq7t35r9FEqxQPHPua0mc1V1hDI6BU9gR3RUQqPMeP/ktLjwj/aGkteHaJua8Djjb7NFjWbhIFrJGqB/64YugT7ACB0E6WPuYmuARIc5zrqGjBznOMp1K9wE/b+NMVh+KHibubE/gH3hb53+UDHxTLbr2qFw+lT5o2PvjFjex+tzMcLuH9uuM7ANUyldFBHYl67ppLL/IonAm1W/+rzboa2SSVumSCGphmYu5YhfclaMm0vu/NJhsxKq+jba+c1IOfv2lhuEbzki/ZJpirnheR2PozbjTDhtxEGxKtgspy+Q2OUUFw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(83380400001)(2616005)(426003)(7696005)(2906002)(4326008)(55016002)(5660300002)(6286002)(316002)(36860700001)(16526019)(36906005)(7636003)(508600001)(356005)(6666004)(6916009)(36756003)(54906003)(70586007)(70206006)(82310400003)(26005)(8936002)(47076005)(86362001)(8676002)(186003)(1076003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2021 15:06:54.3729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 398a83ce-6006-4862-edbe-08d993db40d5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4796 Subject: [dpdk-dev] [PATCH v7 3/4] app/testpmd: add dedicated flow command parsing routine 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 Sender: "dev" From: Gregory Etelson testpmd flow creation is constructed from these procedures: 1. receive string with flow rule description; 2. parse input string and build flow parameters: port_id value, flow attributes, items array, actions array; 3. create a flow rule from flow rule parameters. Flow rule creation procedures are built as a pipeline. A new procedure starts immediately after successful predecessor completion. Due to this we have no dedicated routines providing intermediate results for step 1-3 above. The patch adds `flow_parse()` function call. It parses input string and provides a caller with parsed data. This is a preparation step for introducing flex item command processing. Signed-off-by: Gregory Etelson Reviewed-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 24 ++++++++++++++++++++++++ app/test-pmd/testpmd.h | 5 +++++ 2 files changed, 29 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index a90822b660..cd640b9b7a 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -8076,6 +8076,30 @@ cmd_flow_parse(cmdline_parse_token_hdr_t *hdr, const char *src, void *result, return len; } +int +flow_parse(const char *src, void *result, unsigned int size, + struct rte_flow_attr **attr, + struct rte_flow_item **pattern, struct rte_flow_action **actions) +{ + int ret; + struct context saved_flow_ctx = cmd_flow_context; + + cmd_flow_context_init(&cmd_flow_context); + do { + ret = cmd_flow_parse(NULL, src, result, size); + if (ret > 0) { + src += ret; + while (isspace(*src)) + src++; + } + } while (ret > 0 && strlen(src)); + cmd_flow_context = saved_flow_ctx; + *attr = &((struct buffer *)result)->args.vc.attr; + *pattern = ((struct buffer *)result)->args.vc.pattern; + *actions = ((struct buffer *)result)->args.vc.actions; + return (ret >= 0 && !strlen(src)) ? 0 : -1; +} + /** Return number of completion entries (cmdline API). */ static int cmd_flow_complete_get_nb(cmdline_parse_token_hdr_t *hdr) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index dd8f27a296..81be754605 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1047,6 +1047,11 @@ void add_tx_dynf_callback(portid_t portid); void remove_tx_dynf_callback(portid_t portid); int update_mtu_from_frame_size(portid_t portid, uint32_t max_rx_pktlen); +extern int flow_parse(const char *src, void *result, unsigned int size, + struct rte_flow_attr **attr, + struct rte_flow_item **pattern, + struct rte_flow_action **actions); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.18.1