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 114E842413; Thu, 19 Jan 2023 06:00:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30B2F42DA0; Thu, 19 Jan 2023 05:59:25 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2064.outbound.protection.outlook.com [40.107.93.64]) by mails.dpdk.org (Postfix) with ESMTP id C488A42DA0 for ; Thu, 19 Jan 2023 05:59:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CyCmwwR2XliBivni0b4ekSI8jNM5cctQbpoDF+rhqc2gS+P2XA3LbeG+GWlmJGCDDOYwYbN6EdGX3ueJgl97lTIYgUB2DYTAHe4vfYh2xpSay/eIhX2vqlRBeVLaThuOkqtMLChdj2ae1db0L+I/rjYQzut4YA0NN1cD890s8MZzo6aCdasj3v9oKtaa1KEO9dQOBNp9aE4O4IQpBCzF+gjC4xCpUZJ3E9vrY50+n3CMtKRS1bj9mKY9pomO+MfIuK15JWF3j4fo+jU+cfECbp96AWiiib0BHmXfvRW0gO/tFvQ2cqSXKli3kkYHVSWVgqpJw2ldBGsFSfrQCZ3Ejg== 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=JexVsaSgu/22qoV30sz62/ycgRbfmwXUDeWQHk+bkWs=; b=Umax9Q9J0Ed2QL3QETYZz4adnCdzJ4i/spfs06mmUU5yGzmIz97CMLN0kQvUYTIER87kBfMM1b33nHLmAEsmi8Ojyay1Lr6TYSZcXhiC9rw4WFHM9uo7yGw1rCnvUonewzzOy1cmG4msBh6MfWD2CXXfGAxqfzo2BqzqWM8GRBYUzmczw+1pC1wcWpWv+lJM92Gp9gGxucJLLzigAalfWWiM7ibCiUrUet9jz3dCVi1xTEMApSUNM3FgMk+IW8EsYcI54ysrIpZsIuRfdc9envjPW7epxM95tdUkmbUsbpshedRSqjg8gVOUgva0T8SXEp0vGEMU8UCZLw0DR01KPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=JexVsaSgu/22qoV30sz62/ycgRbfmwXUDeWQHk+bkWs=; b=RCf9dMXuRzdGeJnudMJPf9pVApYVCADOpRY+7z2kqGmGDayXqCcYw/nC6/BYtEvCaN4Ijusp5ITgfZM9iwBUL0r1zTNeZn9W0pEW4ts9cgGg7TsM9L/X3LJI0H//mRtAvA8QpHFMKzWiUUpt+A0NYeRGARfpLYnXWtCLifKieTDBVzkUGr47dgbRtWFgw6UFbp7BKIRjtN2pYFoWQd0dKOYcPgxUGB/1RVXUqfn5HbOJvfz/qziT9fLvvzK0cfnvQ4xFoMIW1GUr+mHFRV/OYj1JOPvVDK0r6Bz6/91B6hLoG4BtWy+dV9cZvFrQLjAooa4WNED0AAzGgS/t3CjjxA== Received: from MW4PR04CA0163.namprd04.prod.outlook.com (2603:10b6:303:85::18) by BL1PR12MB5850.namprd12.prod.outlook.com (2603:10b6:208:395::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 04:59:22 +0000 Received: from CO1NAM11FT076.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::96) by MW4PR04CA0163.outlook.office365.com (2603:10b6:303:85::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25 via Frontend Transport; Thu, 19 Jan 2023 04:59:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT076.mail.protection.outlook.com (10.13.174.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Thu, 19 Jan 2023 04:59:21 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 18 Jan 2023 20:59:02 -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; Wed, 18 Jan 2023 20:59:00 -0800 From: Rongwei Liu To: , , , , Aman Singh , Yuying Zhang CC: , Subject: [PATCH v2 09/11] app/testpmd: raw encap with flex item support Date: Thu, 19 Jan 2023 06:58:22 +0200 Message-ID: <20230119045824.665663-10-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230119045824.665663-1-rongweil@nvidia.com> References: <20221221084000.3680015-2-rongweil@nvidia.com> <20230119045824.665663-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: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT076:EE_|BL1PR12MB5850:EE_ X-MS-Office365-Filtering-Correlation-Id: e877bcda-f896-42d9-88af-08daf9d9ed95 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: UBEgN/K45KkDuZl9dXt3yPGEMb5Phn023lcNO87i/DcIFP7du8iH0w3W9PbFA5Rq22YBqVmBAPftCZdsL6hjVBCdLobz5YwZ6pr8xaqBXlbPr7nJ5PalR+S7H03DZBYrBeadfro/K0elR6hlR0A6a1dJHpr1VUlYrrOwXv4OpMqFhRL03jvJgXH0eMtreVIP9lwZQdQzWqJJH1GwRel/wqdcI58kkQP/ltKdUmoxQe1xVjAqlPI6wbp+JDGF0e4ql/sIiuFWDy8uG/jjP75SOEUUjb4eL6c/8099mu0Szf/MscCiWYPI0gu587Mrkq+z9iKip0/9kujg5aN4HmyPVlypB62h5O1CyMipZl6gyo8Dv/6LPB2BYXRcgtriUgrcPEEBZf5ewPhnXQ268VcFopCv3xcpVhW/fpcfZr7ut/8TEJw6mh0q2QsMbScG+PIQKL0A+tHNQ2YsytjjfxFQBikfM++58znjVf1uBGUQ1zNQZSQLXV19Y7KS5yoMv/3goOhkYVnwvGJQrt7YaA7WqiBg7UCJC68dc6htqRfx64ss7TxUOuUkXspvnboz+xeDY+qkl2AHpPkbU1BZgKuPF4fCfvbM/NAFZfr5K/8bc0CZ7ggNiVZgjKGE0xrcsTZSB3VKLPvHhzzavjMuNxGS5+Je9cebdSF8DXArUdzWf/ppOumWHQ38lScMm9M/czp3pytUy8nBucHxtoLu3i6CpA== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(2906002)(478600001)(336012)(1076003)(36860700001)(7696005)(86362001)(41300700001)(5660300002)(8936002)(36756003)(70586007)(4326008)(70206006)(8676002)(83380400001)(426003)(82310400005)(6666004)(107886003)(186003)(26005)(55016003)(6286002)(16526019)(7636003)(2616005)(82740400003)(356005)(40460700003)(316002)(47076005)(54906003)(110136005)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 04:59:21.3534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e877bcda-f896-42d9-88af-08daf9d9ed95 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT076.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5850 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: Viacheslav Ovsiienko --- 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 f5d7a67def..50c8ec5594 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