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 52038A034C; Wed, 21 Dec 2022 09:41:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFF4D42D2A; Wed, 21 Dec 2022 09:40:56 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2070.outbound.protection.outlook.com [40.107.244.70]) by mails.dpdk.org (Postfix) with ESMTP id 6A8E642D37 for ; Wed, 21 Dec 2022 09:40:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aYEAHXYn59cVeybc5LiELdyzxMG3IwiTGA2f2Aj2C42p3dfGQMNmVcdkh+KKKq1Vqoy59urFMjqV9zAXmsTiCGQ/Qm7XzC7F4b1XyqdnTt02iNp9XatBvKAK+WA4d7fr4/KtkVRyfBMQtzBEcFzm5PWVWl8UBTcFwTw1kV332oNvmM4FKjUa5rQIMQmKPZUg+VW3htb0Ks1N9JsTzHsMoNELBIcrnbM9cf44uQLJHWHaHwJGlDTq4jYiwcTuqHBNg/3jVhRKDVnZngUFodkwR0xDU7MQ75drlCnokspQ99/vJsZoc2OyKBOvPREwtniasw6j+PVPqIuowfN9ye5+AA== 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=ZUTL9KMnBoky5HJ86pLxtyufakUYY/FuLLNV75jJTnY=; b=aSjw222+wjhBdGHFwJlTS998m3lLgNjo7IeEcx+YZgMGz15Qr905x6pBWwdPV2JQVmF3cj55Psrb3LRFywF5Xou2FMwfjpgAcJrG3ZmwEdCJ+pl0C8Gu3pvzIL0SAP+z0qu3Bw2vLB940G6Lyy7uRRrj4CtHBZjVvAKDaER8B4Z44PTH1mfAIpcNwUB4NtEVGHTEvTOQU6Yise5mVUwYs0z/aoZo/yH8Eps3VwhyCEgZJ60yNRCsQNI4SkHojLMVogzHWJfdQ1pAGHH1t1xOgA1FDUGqjehZtAtjMi7mm8THVmQ/kDfpNt+iAZ240Tmdmqa6pQNL2dg5bIOSGIOHLw== 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=ZUTL9KMnBoky5HJ86pLxtyufakUYY/FuLLNV75jJTnY=; b=IAKrBLYX8ePmVdoAqMc0G4npsFYHogiNZ/xiB5FnByVXz9FQ2e6pMVFY9XwxFn0A0xwIkyHWiK0b9MFLIGSNPGX+z6CF5/QzTN/dprE1nstZwIHoceRvO2zPWxFQ1JqZr4xY65oWJdZV9nKfjbpBhP8v+fm2vqo20+i7BxbbM1R0xru/69F0NI63UzXnsXuBvz+aBZaBt2EIDo3dwAArdsS9HfyIKGu4SOvCnWPVgrYUpGBmWIQrwN4vBnYbof7oIt031+cw74F1koK8O2KMSYXWCKF4IAouxXqvNFF4oedU/JmJJFrfelLiXkpWmslcnrUxjGLgpHT6YVRhuvQBQQ== Received: from BN8PR04CA0041.namprd04.prod.outlook.com (2603:10b6:408:d4::15) by DM4PR12MB6662.namprd12.prod.outlook.com (2603:10b6:8:bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 08:40:53 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:408:d4:cafe::25) by BN8PR04CA0041.outlook.office365.com (2603:10b6:408:d4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 08:40: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 BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.8 via Frontend Transport; Wed, 21 Dec 2022 08:40:53 +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; Wed, 21 Dec 2022 00:40:41 -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, 21 Dec 2022 00:40:38 -0800 From: Rongwei Liu To: , , , , Aman Singh , Yuying Zhang CC: , Subject: [RFC 9/9] app/testpmd: raw encap with flex item support Date: Wed, 21 Dec 2022 10:40:00 +0200 Message-ID: <20221221084000.3680015-10-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221221084000.3680015-1-rongweil@nvidia.com> References: <20221221084000.3680015-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: BL02EPF00010208:EE_|DM4PR12MB6662:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e28d778-c51f-4506-e408-08dae32f1260 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: Yh/TmTBIQ9WKMqyzxYJZmOx1vnkHi1V4gMTa2srvgp9Q3+wGeS1GaOSDUQ0wiISqn2RTTafvjQBHau3TNeldJcgwUdnFfKoqULm6R9jIAnMz2iuSA73cl9GxdVPsHZlkk3LwfmedBAXGS6xKRv2TzDwWv4nOI7X6tmxs0BVxcfOPKx296pB1aT7RaLrZQmr/DxRpXIlHOCVIkQiUQiVeDFkLOrwMPdfaKaNschrWRJ+kuBM8krnhf0o2Lb16F7lHqa6vIYNMc+io1Y3kiEv4VN62CsaQCpqRm++mZJKJISLdrOgLgD7kPdHzonayPgc9waul+zVKNrp54wOd4TLV5S5+dDHLCxKppwOu1zXj6XyAZ8y3gikV1OZ+2i//W60d3pwQSfAErTP+lA8APpd2pMPTq4wmJTukDmmOXcq8heIrvIQUZpAESvIRU7jE1LUXndS29+Df/sMUMqusWvyAktl0SxOB6QzJXnXkzSRrLzHQEsyWEtjrhHB5jXjANzx/ueH+n4vJ3wMIVtk2C1uTNTN7Vnxt6iskSe2hzwsBQGPBjkx6pt3tybH7vC8VonqT6syjK9LFmtubDN1OPez0pGYgAoH+ZXrQ27PxMgVehvsmkr0IK1GIJstJWedc8gqHZbtnExrw9C2ku1U/8Xmc0yL4314qlgusML3MqI85owypjYHHqMVsVoD+Euf6HrjQfGOK0hqz9j+U6AuqBkuCfw== 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:(13230022)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199015)(46966006)(40470700004)(36840700001)(54906003)(7696005)(316002)(36860700001)(82740400003)(40460700003)(2616005)(478600001)(86362001)(7636003)(4326008)(8676002)(110136005)(1076003)(356005)(70586007)(82310400005)(70206006)(36756003)(40480700001)(83380400001)(5660300002)(8936002)(107886003)(426003)(6666004)(47076005)(336012)(2906002)(26005)(6286002)(16526019)(186003)(41300700001)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 08:40:53.5622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e28d778-c51f-4506-e408-08dae32f1260 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: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6662 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 --- 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