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 4BC00A0C43; Mon, 18 Oct 2021 20:04:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F2770410F0; Mon, 18 Oct 2021 20:03:46 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2065.outbound.protection.outlook.com [40.107.95.65]) by mails.dpdk.org (Postfix) with ESMTP id DDF7C40DF5 for ; Mon, 18 Oct 2021 20:03:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikUCvUadOsGK0UpEofLXqv+MDAlDCPlpmPcsytcJtjiC4EB5g0p0jmE4nZz3RLg2vKBSJH3e+Hb4vIQHCrHlA9vrSMgVP7YNdUwCuxGbWPL0JneUiRzpcC6DanW+v6VJISkTaFsN3YGJkigRTk7L54MH39V0QEhPi2CX+/VpegHEnK2lFksEcP3ZELcDwiFOVh8w444NKdqZt3mYaFRiwGPb0YWr4s3euN0HN9XVhE0Q1ZKKpDl1Xrvg7cknyNB6vAwDHrsHX9Le49jFfzcpPRonog7kf2v5tjvyzMQ3at9LPCpHZXdbB4PT3Ao9TdCpH7t9s3o4j4X79XjL0z/KuA== 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=Y6upOZM3rt8wrHWNIuNpCejr1LFc6DDyNt+qWTT5u8Q=; b=mjpaRVURy9Crz/Ku3S1cZejPKGoXEvdN8wWLfB3ljHE8EuDRfi6qoYxVYYxPHR4SZrP1bp+YroEleqEIiqlrnfU6REiTUHTGvuNCohTR2lDAw4eBMmOhhSVBxLhBFM2or187Iix7oLLWpJhleG+dRnO3VvGEEhWSyXaL2j6dU+o4ljVVIKt7UlQji4MI3zRswZA3VfrB/B8cvuF8kTfYR76KGMDskOXxqgUf8cc5WjjRWMr08s89XxfKqo4gusiuYXq7AIt1Xxd1f1YItkh3mz2P2kYq2zNiuiJdl2KwowLuvkH5MgL3zcVe58LY7OHyRwhAOJtXzFkfWYP6nM4unQ== 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=Y6upOZM3rt8wrHWNIuNpCejr1LFc6DDyNt+qWTT5u8Q=; b=kUU3+2hyH8fJ72d8CxPhaPFLjbNJ+R0Z83IqdsUdgNHxmqFW8ip9MW0sqWCe24CzOq64mi4G//Kvg1s5p0VURwjO3Y+4PKZGvsytxjYgX7qTHo9CAh8oYEPVbloUUpulSkobtCts3IbPLGZUS3KfkVrzRWtI451YeIy6FbAJ0lE/ZtyTHot7Ryyi5YQnJNa00NJssnrLFigNMbkhJpzWAOLKDTIoTLZXueaw1Qd9lANBBv0ijsfPBpw2DjDQq+iJeLfhIIbssyTOOxcu/0mKKj3MxzSOqh2WdrwbxsswbRhhpXGZU1BeLI9jyJbp6R7g5yEpExHFnAdBTtlhBdCvvA== Received: from CO2PR04CA0098.namprd04.prod.outlook.com (2603:10b6:104:6::24) by MWHPR1201MB0128.namprd12.prod.outlook.com (2603:10b6:301:56::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Mon, 18 Oct 2021 18:03:43 +0000 Received: from CO1NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:104:6:cafe::14) by CO2PR04CA0098.outlook.office365.com (2603:10b6:104:6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 18:03:43 +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 CO1NAM11FT030.mail.protection.outlook.com (10.13.174.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 18:03:42 +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; Mon, 18 Oct 2021 18:03:35 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Mon, 18 Oct 2021 21:02:51 +0300 Message-ID: <20211018180252.14106-6-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211018180252.14106-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211018180252.14106-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: 40f556c7-1527-4074-ca00-08d992619f4a X-MS-TrafficTypeDiagnostic: MWHPR1201MB0128: 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: hzjGHvUdNPO3hJO7wR4hUMJWPsSZLFzFnt3vqCb8Pnl6KOjtjZA0XvS9J0i3IagewPuaXR9O6kePJooFeNe2fm6+L8fObwwt2zVtmjlWVucTtW0LgTbpl+aFkrpm099gFJJAMcRYbCgWYlJwwcGnvs3pkxsR36jWnHZbMqnhsf/yoQp2FLDS5lw6MGZ6/3zTwy6g3t5a96lslC59/81HtUXcgHAixeWidoqZd71tBdtSYPrUuEEBNLJ3RjKHUdE6WRcktyzLmPQVnqSWhmdd9kt+a2/gsB9LgCaa+VT5RrqCo2fh/kaaJMT9g5S+/jTvup38PMjBrNro57kZyIRivivirW8L68LRHb0ODTrqrwtwEER2eX0zIuL/lS2ExdYVYUMQyCB48x8M3YKo9QLZxpoW3/wcCQdrt/gx/zbUARKHJZzzyyNgU6AnicbRg4VGV+FstrRV0Cd8Dldtr2vvTZzCNRdBTrmabiB1RQCbfv31ibOHfy5d76qu31bh09l+pOLZdGwISG4L4U28BwrRZ3R/M6ZjTuGEqkRqo3+AknN7FmnTdoDQ5utgISJjLGJRIvVY1GSjmx/5BZEgsQcWPTNJMrjCri/W/3apVnyRsCx14M/bd4vNxgyub/31F3NxqN78zH5QaIt3dQifA+lz6N5PCfar/YTaPFsWMUJEJNltYf6ml7YMDQ6wm8vfxsrB251FDirIMLIlUTwFyn64Bg== 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)(36840700001)(46966006)(5660300002)(82310400003)(70206006)(6666004)(54906003)(186003)(316002)(16526019)(8936002)(8676002)(36756003)(70586007)(86362001)(7696005)(36860700001)(6916009)(508600001)(47076005)(2906002)(6286002)(4326008)(26005)(55016002)(336012)(1076003)(2616005)(426003)(7636003)(83380400001)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 18:03:42.6240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40f556c7-1527-4074-ca00-08d992619f4a 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: CO1NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0128 Subject: [dpdk-dev] [PATCH v6 5/6] 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 --- 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 0b5856c7d5..4e8e3e3c29 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -7952,6 +7952,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 fc43bf2763..c580406e99 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1027,6 +1027,11 @@ void add_tx_dynf_callback(portid_t portid); void remove_tx_dynf_callback(portid_t portid); int update_jumbo_frame_offload(portid_t portid); +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