From patchwork Thu Oct 26 07:30:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Etelson X-Patchwork-Id: 133376 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 CDA5343204; Thu, 26 Oct 2023 09:31:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 656E04067C; Thu, 26 Oct 2023 09:31:27 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2081.outbound.protection.outlook.com [40.107.92.81]) by mails.dpdk.org (Postfix) with ESMTP id 66B8B402C5 for ; Thu, 26 Oct 2023 09:31:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnkk2QUPryfo+YjAX4KrVEXxH/xV3zIuiJutOjET+KVifetIazUE6J5hA9eNjU3ZvmZpwT3362ndOAMZAcnxYYYivkkJ8GAFwmpodi4tjfxtrdgItPeajI+w23Nx7ON5q7jElVDHxn2MlYB9UIorgSdNtUdT/ngeS+7I5uDhfxVVxzKGCHMlKg/h/Vm+ZwIee3bUgXRbyboJLItlfNKlI2aL9nxZR/U9GRysoYYHvtnYi4ZfX2bWS66e8TSea4gdOhcMMyHx3WZ2QM1zVQm5dt+SFAYOWy2JbQVV8D7CK4HQCsG8t8+LzMlpxTI3TK10EHsEJZvXYT7iggQ0g+LfYw== 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=6ZJsdtDPCb6dnHJRRgfN2tIiz5hFTvon8g2l83CtzrQ=; b=T1xSFjBKZ/iJQOuDwhteGh+t5JZojPWaPOqy10cWXviDeNGomuLIJ0fy0KqUMz23VgWsF39vW8GFjNP3C0AF0PjPukopCaWEt76NL+XkEwM3NViUxeVR/RNEOWzoUyiWFD6HY5zc7LL2SEhdL3XuaStpORfz3zcQ7Uhq7L0d46xqmgsGQ9JVsSaAI64/riCnSkBI3g3feSn+eb+EliKtiQqKPYvuS22lQ8ebL7SP6fKhyo+Fav9Gn6n7tAWGx1KxanliM8kzOlJFXGVqf6e7KvQpZLzBMRvjneD7KPJ06W9nL+MTgt2xfHmp3xlG2b+vW2lWoGujKJ6uwfm62UixhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 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=6ZJsdtDPCb6dnHJRRgfN2tIiz5hFTvon8g2l83CtzrQ=; b=FuvC/+dwAINY/0ZZkv8jvzA+by2tgbFx3kNP+2E9JAxMninn5+Uq/BQAoztwV12RCyR5534MFg8TwIN+m0PT44O1Ej6UW/bYUGwcsAmQKMSSD4hzN5tqSewWeIPLyHNJWtLxQAtrtfiguWDaPyUg0TuddND+xC5Vvlz+SVI7CY7/PNS9kY5h2t+n0zktc70X7tAsXCKgi+mxfUhKLFBysXgx+1LbZ0ombwMiPhNscoCmvv0B6basRHcwhf+X5T5N9b6xz5mF7bZTLHhQTxJmLGtLSCIdeVWcqrGE6dsn7QSioeATH8qhtad957WC17GKN4OXWTM+L1AVa66mciC4RA== Received: from BL1PR13CA0371.namprd13.prod.outlook.com (2603:10b6:208:2c0::16) by MN2PR12MB4173.namprd12.prod.outlook.com (2603:10b6:208:1d8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Thu, 26 Oct 2023 07:31:23 +0000 Received: from MN1PEPF0000ECDA.namprd02.prod.outlook.com (2603:10b6:208:2c0:cafe::a7) by BL1PR13CA0371.outlook.office365.com (2603:10b6:208:2c0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19 via Frontend Transport; Thu, 26 Oct 2023 07:31:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MN1PEPF0000ECDA.mail.protection.outlook.com (10.167.242.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.15 via Frontend Transport; Thu, 26 Oct 2023 07:31:23 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 26 Oct 2023 00:31:03 -0700 Received: from nvidia.com (10.126.230.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.41; Thu, 26 Oct 2023 00:31:01 -0700 From: Gregory Etelson To: CC: , =?utf-8?b?wqA=?= , Ori Kam , Aman Singh , Yuying Zhang Subject: [PATCH] app/testpmd: add size parameter to raw_encap action Date: Thu, 26 Oct 2023 10:30:47 +0300 Message-ID: <20231026073047.300888-1-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Originating-IP: [10.126.230.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-TrafficTypeDiagnostic: MN1PEPF0000ECDA:EE_|MN2PR12MB4173:EE_ X-MS-Office365-Filtering-Correlation-Id: ef6147e0-546a-4905-b8ef-08dbd5f58e64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lpcL+sHCzPqOyzYBt9P6boqt2gupI/g3RiAMnKWjt4p4DIBZ07jY5qT9E4aDQ8S6u/6mXr399jLRLR8xXPUq35wqkt8f80XnNEiEmTucIWeBnnGAUPhwu36wU7hIlYdphx/XO/FRB2L0q2tpSV9usGFM2UaU/aZXFcnHF7IcN6EyooOvcwubDgXEhKkwBNLqcKWD45UtQwRI1zlWIQLSK5ciZmgXFWToxFCQA3CJgBfr8OE4nmJuECNVnP1KLBz6zlgdeGhWIxpRy0a5YbFFy3fQIejuhszqM/O+I4LplZ50hPIQVT87Ef1iZa1+d2WC8vDRBVtYvzTY7BSbSSY1cQnn2VeyDlwMZ7hG3Ku1uJ4elpl45zNOAggws+JkyHmqZDpywSzr2vCLQh5twKMY2k+sdrDpmjSmIXOKZrSCUcQW79h//WqnOLA/cVtMAhXeNC1w8/ZgoWTngE5hqlnTonYm4aZuRiItd/HqBHxe0wjYixGffO9FI0WdqJN+iToSrEm/U9dHlj1flFFX3EWlDumJjfes5bIo3lhZBFGZVnj8n9im9wiwVJghRNCyoLzxTx5UJtfCzTba/SH1YjfNUD4y6PAu6D1fsKt4raQsQCsL4eHIIlcJibtYK9FUxJCNgLfajpoL8Sh/BUVZEUlg4n9dhYNbo4dY2VJCaJSWCxgvEi2XXGhLcdYD2DRa67cf+1dtGH6iYk/Ig/jZfQQjEpII0dyf7H+gIPz+mk3AqPdyJjbqQkqG5DyD/8g6+W9P X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(346002)(396003)(39860400002)(136003)(230922051799003)(1800799009)(82310400011)(451199024)(64100799003)(186009)(46966006)(40470700004)(36840700001)(7696005)(6666004)(55016003)(40460700003)(6286002)(16526019)(426003)(336012)(26005)(356005)(82740400003)(7636003)(86362001)(36756003)(47076005)(83380400001)(36860700001)(40480700001)(1076003)(2616005)(4326008)(8676002)(5660300002)(70586007)(70206006)(6916009)(316002)(54906003)(8936002)(41300700001)(478600001)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 07:31:23.3382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef6147e0-546a-4905-b8ef-08dbd5f58e64 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECDA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4173 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 Testpmd always provides RAW_ENCAP flow action configuration with encap buffer and the buffer size. That implementation does not allow to create non-masked raw_encap action in the template API actions template. The patch adds the `size` parameter to testpmd `raw_encap` action configuration. Testpmd can create non-masked raw-encap action template and specify encap buffer during flow creation. Example: # total data size is 50 testpmd> set raw_encap 0 \ eth src is 11:22:33:44:55:66 dst is aa:bb:cc:dd:01:aa / \ ipv4 src is 31.31.31.31 dst is 63.63.63.1 / udp src is 1 / \ vxlan vni is 1 / end_set testpmd> flow actions_template 0 create ingress \ actions_template_id 50 \ template raw_encap size 50 / jump / end \ mask raw_encap size 50 / jump / end \ tstpmd> flow queue 0 create 0 template_table 0 \ pattern_template 0 actions_template 0 postpone no \ pattern ... end \ actions raw_encap index 0 / jump group 1 / end The new `size` parameter is mutually exclusive with the existing `index` parameter. Signed-off-by: Gregory Etelson Acked-by: Dariusz Sosnowski --- app/test-pmd/cmdline_flow.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 6c8571154e..b231c3fd03 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -647,6 +647,7 @@ enum index { ACTION_DEC_TCP_ACK_VALUE, ACTION_RAW_ENCAP, ACTION_RAW_DECAP, + ACTION_RAW_ENCAP_SIZE, ACTION_RAW_ENCAP_INDEX, ACTION_RAW_ENCAP_INDEX_VALUE, ACTION_RAW_DECAP_INDEX, @@ -2389,6 +2390,7 @@ static const enum index action_dec_tcp_ack[] = { }; static const enum index action_raw_encap[] = { + ACTION_RAW_ENCAP_SIZE, ACTION_RAW_ENCAP_INDEX, ACTION_NEXT, ZERO, @@ -6761,6 +6763,14 @@ static const struct token token_list[] = { .next = NEXT(action_raw_encap), .call = parse_vc_action_raw_encap, }, + [ACTION_RAW_ENCAP_SIZE] = { + .name = "size", + .help = "raw encap size", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT), + NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_raw_encap, size)), + .call = parse_vc_conf, + }, [ACTION_RAW_ENCAP_INDEX] = { .name = "index", .help = "the index of raw_encap_confs", @@ -9456,8 +9466,6 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token, unsigned int size) { struct buffer *out = buf; - struct rte_flow_action *action; - struct action_raw_encap_data *action_raw_encap_data = NULL; int ret; ret = parse_vc(ctx, token, str, len, buf, size); @@ -9468,16 +9476,9 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token, return ret; if (!out->args.vc.actions_n) return -1; - action = &out->args.vc.actions[out->args.vc.actions_n - 1]; /* Point to selected object. */ ctx->object = out->args.vc.data; ctx->objmask = NULL; - /* Copy the headers to the buffer. */ - action_raw_encap_data = ctx->object; - action_raw_encap_data->conf.data = raw_encap_confs[0].data; - action_raw_encap_data->conf.preserve = NULL; - action_raw_encap_data->conf.size = raw_encap_confs[0].size; - action->conf = &action_raw_encap_data->conf; return ret; }