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 E5D3C41B81; Mon, 30 Jan 2023 14:21:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F4D542D2F; Mon, 30 Jan 2023 14:20:57 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) by mails.dpdk.org (Postfix) with ESMTP id ADD1B42D7C for ; Mon, 30 Jan 2023 14:20:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/Cf7OLpb7dDhq80KaZSbbuVaIgVlkKwHPbZOifbx68WUFa5s4YUtxi5qHcb2z+gXYjCqICaMgG2qPHE2g0XjswS67W1DL44qRRb+HvEc+cZz+D9Ei74bb/zHnQ9nhArDJgfVOCCZNw+Wm2ba/SGmPY3pPfj4OIGNjLQQzRImjbB9jfpSOx0Tf7S6ozSUEkPmZnTYuk5DOpOuzeQASqqJGd6dbbIqxo0zGoVpJUh8GXH+KVIV5bQ/fiSt+bIIkSj+guP2M+5dR4NMQkOQ2lESmr98SpAlpxlxquoupmHh9Xa6+LMycoe71kSz8aPzazR0OEv6D626PcykzoFlw9RmQ== 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=8UnuhICc1dx5/OUzGM8OVhCHsUgATrf5Onl9BdruQ0M=; b=az0H54tV1/yyHN0qOdI1mhxN+UVv2bukvTd3Vsx+uHE4ci3RClw6AN8M/pRyhx3nlDerBirPUj7Fcc+tRCzsoxrdC1fl/tdw40iIdQIQbutRyz8ibSSLJW5wbFavQ9ebePeaFEwHG922IYUpOVNHvI+N6kjIgVYJga2W4cEZSPEQB6oInN72csjibGAeBGIcJZHhuVgrHtT7qt4qZc4SSuuPabLsDz6pZMa6j1wV/osT8vptDG/aOIUupU/JXQW3588rcaf/sfhxxNjk9h+0p+zuaDEAkJqNmCfb6uHbhCWUqz2QWX1aBL15FHl/A2eerG2hN2/BGwMmHO/tnbCAgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=8UnuhICc1dx5/OUzGM8OVhCHsUgATrf5Onl9BdruQ0M=; b=Yl18CMtRY/BQ0PZoc/89Zb5Di/wj1vh5E7GkRObDmuQZgJCCBa43nSr+kQQHldvEnHcxTiDv5EIEMNtkqkenBO6T1T3ILCy1b8duZgZELy1hgeanNQHB5wzlv+VpBfD8oN/5oWonUKtBcdyoO7qttxAcjqk5dF/3h1Z9iPrMpkCVCpRdvTLgSph0KZvphkzV/byatQY5qxmk1Foy0nYc+VzBvu6afkWIPU1t9S5pZL98lSFWzJmLo/ZCBR8d8waeBkupeGtbz4hdsOs2lbDUhmhC7kJORjC+/ogMMP++P/ZXGoaBQZUINQH/s095MqwYVQsqk7rKuEMK3vRjf5ei3g== Received: from BN1PR10CA0010.namprd10.prod.outlook.com (2603:10b6:408:e0::15) by IA1PR12MB7710.namprd12.prod.outlook.com (2603:10b6:208:422::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 13:20:53 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e0:cafe::fa) by BN1PR10CA0010.outlook.office365.com (2603:10b6:408:e0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 13:20:53 +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 BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 13:20:52 +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.36; Mon, 30 Jan 2023 05:20:40 -0800 Received: from nvidia.com (10.126.231.37) 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.36; Mon, 30 Jan 2023 05:20:37 -0800 From: Rongwei Liu To: , , , , Aman Singh , Yuying Zhang CC: , Subject: [PATCH v3 09/11] app/testpmd: raw encap with flex item support Date: Mon, 30 Jan 2023 15:19:58 +0200 Message-ID: <20230130132000.1715473-10-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230130132000.1715473-1-rongweil@nvidia.com> References: <3ba49f25-52d0-fe07-02e6-22a71e0fbe13@oktetlabs.ru> <20230130132000.1715473-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] 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: BN8NAM11FT025:EE_|IA1PR12MB7710:EE_ X-MS-Office365-Filtering-Correlation-Id: 85b9411d-17f3-4ea0-0f75-08db02c4d018 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: foZxveKyZ9jNVd0UhYLw8nVyPDa3uD78mHz69ibt4NqdzeRAk9aH50ZPJhOfmKxhzDjiTs1OymsrDLnuFnYcwaChffPWNlgJ5qiWg/W0sszdIPdYdn+6kPqnhcsAqYhxCh4i+jcgsgjOiV9777ymiJShQ9yV+l+yb1elh/Y3ej+Xhow3zSEnxDgZM4//pM82zUBKyg33GMuAMub2wTjR3chbYID3/JVc8/RvOAyB9shvEuZtfyWlZPCgDTbp7LfJFeddHjG45Nyrh1wvZ9Ef/iLzWIzIqlEWtvJlRRbwmKiRGHnRNUzpcn+0QQGcwbKgnAU8rpeACKda0AmiDuTKKErk/JMPp4mapwadNwqEks8hje2rFMQ+uPMnQEVsxI6F46s8Q9fQehUcvNdFhc2+FsJgc4Yp5Eudnpky+XtRy1/gquJ7ftHz4MIgmwTSq3OqiA8MAKlRqixXwL9TEZ+1ExljODDLZBJLeMetNNIw7snu9fK+4rI90M7/6GxsP0oJ9ereeLUX3kKO2IofzjCw7gOkHTDEblvDH71FIzJEVI5j1VbRnKlV6TIQYjLl7RnssW+fY90UtOcF5xQJDwlkjsERTu9FMEQptqDtUnnQAdSkod/PjMHisi2XFg9hdUe5hchtdwNdDDo9QZZHqYN/pTFGld3unIof1R1vFDSTfDnyc96RyTOAl6AtIaqUfWVrsOr1iiCYksBcqXbd2Td7Jw== 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:(13230025)(4636009)(39860400002)(346002)(376002)(396003)(136003)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(2906002)(7696005)(6666004)(107886003)(478600001)(110136005)(54906003)(41300700001)(86362001)(36756003)(356005)(2616005)(336012)(47076005)(426003)(1076003)(8676002)(4326008)(70586007)(70206006)(316002)(55016003)(40460700003)(8936002)(5660300002)(40480700001)(36860700001)(82740400003)(26005)(16526019)(186003)(83380400001)(7636003)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:20:52.9109 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85b9411d-17f3-4ea0-0f75-08db02c4d018 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: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7710 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 Application should retrieve raw_encap buffer from spec->pattern if it is flex item. Signed-off-by: Rongwei Liu Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 9037432cc8..3b2975ee83 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -11193,6 +11193,7 @@ cmd_set_raw_parsed(const struct buffer *in) uint16_t proto = 0; uint16_t idx = in->port; /* We borrow port field as index */ int gtp_psc = -1; /* GTP PSC option index. */ + const void *src_spec; if (in->command == SET_SAMPLE_ACTIONS) return cmd_set_raw_parsed_sample(in); @@ -11216,6 +11217,7 @@ cmd_set_raw_parsed(const struct buffer *in) item = in->args.vc.pattern + i; if (item->spec == NULL) item->spec = flow_item_default_mask(item); + src_spec = item->spec; switch (item->type) { case RTE_FLOW_ITEM_TYPE_ETH: size = sizeof(struct rte_ether_hdr); @@ -11343,9 +11345,13 @@ cmd_set_raw_parsed(const struct buffer *in) size = sizeof(struct rte_flow_item_pfcp); break; case RTE_FLOW_ITEM_TYPE_FLEX: - size = item->spec ? - ((const struct rte_flow_item_flex *) - item->spec)->length : 0; + if (item->spec != NULL) { + size = ((const struct rte_flow_item_flex *)item->spec)->length; + src_spec = ((const struct rte_flow_item_flex *)item->spec)->pattern; + } else { + size = 0; + src_spec = NULL; + } break; case RTE_FLOW_ITEM_TYPE_GRE_OPTION: size = 0; @@ -11378,12 +11384,14 @@ cmd_set_raw_parsed(const struct buffer *in) fprintf(stderr, "Error - Not supported item\n"); goto error; } - *total_size += size; - rte_memcpy(data_tail - (*total_size), item->spec, size); - /* update some fields which cannot be set by cmdline */ - update_fields((data_tail - (*total_size)), item, - upper_layer); - upper_layer = proto; + if (size) { + *total_size += size; + rte_memcpy(data_tail - (*total_size), src_spec, size); + /* update some fields which cannot be set by cmdline */ + update_fields((data_tail - (*total_size)), item, + upper_layer); + upper_layer = proto; + } } if (verbose_level & 0x1) printf("total data size is %zu\n", (*total_size)); -- 2.27.0