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 5AD92A0C43; Wed, 20 Oct 2021 17:16:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDE7741243; Wed, 20 Oct 2021 17:16:00 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2087.outbound.protection.outlook.com [40.107.236.87]) by mails.dpdk.org (Postfix) with ESMTP id D79C940142 for ; Wed, 20 Oct 2021 17:15:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nd9uS3pcS6eWIa95AcskuUkyA3O7CEQMJ80MMS0rxSifD2kjRpAiPSW2SRTTOMboGKlhm7/Z+sH1UWlu94f0e5CvZXXGJ3b/l5sNvAlAJIrqgHNilrsIwi5tu7g3snOIeRxZFg1FWZSJxqOLjYVTa5gHEKPCz4VHQkFpq+HMtw4hDCsstSsuMcXaGqzmjY5EgvAXvshPdXWVjmKA60mwe8BT8Wy6uxW6OI8DWoLQrBAg8AZflz+zOa/WBqWlwl/L8LmHtXx3ccclmgdcZYoAC/LB91ug4A58nSLfd+JUCt8AoUj4ZWBIlxbbM2w+I7X77YgqCCw6Yxm5zAKnGX2xNQ== 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=OXVXaJ5uMK4leEBgrAsJHCqbHdduFwjdQXsmPmvNWLCb0QH64D0QEYKFpQ2HCip0ncHDMeTNyXavLXIb4Wtnqod8rBd6gU8vayOh+2YiWUq5ERXUv0wXPntju9EuAmuXvT0eQpgFqJFkfN3m1onj+Ba7gxaE+tAuzDSNVU7NW+fdFuUUlH306liSmhJsCBywCe8nJrLKNBTQ/dQuUK390qiGnM+/6T18/P0tCTyP2UbDwWOEU4F/7L9Oc08YKCSP4gFyAEo4l7yEbRsEDUvByFeAMAPKWnhK7NKypEAwEEc70KV0fEzMFrWYNt/6RE1VCS/eiD7X5q63dnvPSHzB0A== 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=H/it6ZWJjZ2Uod7zflUByBtmfNPklcegkPCgKB4CtvdzT/3Ydz4nL0fY6Crj5bWu9yHrFtDOctaV9QxmA3+uDFkwvREtPsop+YsZOjeMpcQ4WBgsXj4t6T2vEYZKqkkwhqaqm7kRQpCqoPuEzkUuuOBAIwQ9RDr0fHaRNmg29/VG+l+Snq3fKPjHSFcJlmRR1PlAhzXCVuY0tOAxz0hRBBO0WsVNwSV8X/0keKQiCjQCWnIBd+g6UZ08RG9aB2J1YKbZvFRSqxuibJ+b8woXgNxeRzlf6Ja5unPKJLycN66yv1/UOgcGRNAiCyCIRwaZQANX1+yXXjh2oGr7b4o/Hw== Received: from BN6PR19CA0054.namprd19.prod.outlook.com (2603:10b6:404:e3::16) by BN6PR12MB1412.namprd12.prod.outlook.com (2603:10b6:404:1b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Wed, 20 Oct 2021 15:15:54 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:404:e3:cafe::ed) by BN6PR19CA0054.outlook.office365.com (2603:10b6:404:e3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Wed, 20 Oct 2021 15:15: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 BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) 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:15: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:15:36 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Wed, 20 Oct 2021 18:14:56 +0300 Message-ID: <20211020151457.17577-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211020151457.17577-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211020151457.17577-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8180d916-24a9-42cb-15b5-08d993dc8299 X-MS-TrafficTypeDiagnostic: BN6PR12MB1412: 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: tfRympsS0BUYKNpuH0TGE0ghdqq0+hJL5ks2ETdwwip2VJF9LqKUV6CKKy20fIoiE8oyDVT08sKPyWTixC5liuap38RmX3VzhWbRwdWd0FSinxlWgVV+0ok/x26QHAhEKmHkMVVJgJoiR89zZ6cYuY+qRf9RNCZhoyAcmvBgNMjGgsSWA/buChLAaK3UQzl7nK8i7Hl/UPRSKmksmfvct+M/IRK9TG6GdpjxnC/zZAhsvxUSwW/INwsV6SPLfLu351iy1D6Oi8EpwnlRkhb92VoXi9CjpfeaIA3w0dBdVfWiG9QlbB5vlAvkzM8USBLSHKy5WHK91MMVfy3LHbVjd+b7P+rxeYa5K6PwR3ReVgtDrufbwiKGqlWGKxuHemrRoTeq9VPkAPY/TTQONMB331btaFDVa4zkZcAUpHi2hakgOcKNFAtBYotWQhXHwYnonE+4od40bhqMZBCk6Baur1f/m1RzRYUG6sw1gBBNBqjc4Oyk2qIBEEz/ScQkvDHlBDe+ioKm3Nhm0YCWHtO58RjgTP75MBp3bYHpEhcGd67F2qfJ5X0OhB+vicJldMl/uZXkVF4LTEHujqDZ85LSByo2RyoGS5fZAbHfOxt+/VhwPbUbvWFmqUjrb8pHmzPODqqszE+nJmha8Xe2rFo4m/4I/1itRYAqPiM6PnDaIONw8NrQ+yg9NFvE+DUWOd9vSSSx4zeITVobDlxawwcR2g== 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)(5660300002)(36906005)(316002)(336012)(186003)(47076005)(16526019)(55016002)(26005)(36860700001)(8676002)(4326008)(36756003)(54906003)(86362001)(6666004)(2906002)(7636003)(70206006)(426003)(508600001)(82310400003)(70586007)(6916009)(6286002)(8936002)(1076003)(83380400001)(7696005)(356005)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2021 15:15:54.1055 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8180d916-24a9-42cb-15b5-08d993dc8299 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: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1412 Subject: [dpdk-dev] [PATCH v8 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