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 0D6A6424B9; Mon, 30 Jan 2023 05:54:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8742241151; Mon, 30 Jan 2023 05:54:05 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) by mails.dpdk.org (Postfix) with ESMTP id B717C42D29 for ; Mon, 30 Jan 2023 05:54:01 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H9SZ4X8uobT6PD9l3Pp6RNNkMjadBSNHXFll8RldXy/UJFRCqAEyjAxZVklMw861S04jY4EE/C2FRSwvcOL2WLkKX2ZMaRn5SfIkERqwGRndMyqQn9TRAg2bSKf+sdbUiDjJRba+n5mNCrSBnQL4pEkgABcEL29tpNEH+zVZkZMzBi3ftubbB7+XXxcb3wnnaSEMuDG5/NfsZnNNLsyQz5IBZSVLAq4cXMpqD/768Q+Sa9Gzb4j8yOOZGCNZX53/FIvspvpeCSgjHk3aQ6ehPH4Tslb0AZ76fUe/P4O4i4N3gH/wfKBqdhd8Ev50/03hYeoYKuKujNIc8O7oQhu2Xw== 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=p+q+vrNiX6zn3xxx6pBtNu5+Q90OHYv6uY61JVIWMbM=; b=YfCf7bAzRbK8Yon9meNBJj604cfuM5BwsCT7FE/arrDPSfs7qEMYZ9YY86+I6ko8rZqBf3KMZnVrVfHDb5hE2aGn50JlhIwRUuHtWb8y8A4P3DVsg6PF9QPEzWnWFFoIaE35l3PE4rLcfiTQsBZpwQop5cBZ0UIy/X8QybBvgkVDHahMkA0ywj/LGEGtI7V0pyESXiyD29DTGjkjMjieKElBYpjARfK741l/XyOAUKlNnFyBTd/ocEywbRHJxpPH5dRMwg5ew79SmHLseIfC5uPSLscYU6SSJTpbdzsHU5+gcYxMAUql3C63K0SXFGoXNKJjTiu6JNSKIz2PcsvK8A== 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=p+q+vrNiX6zn3xxx6pBtNu5+Q90OHYv6uY61JVIWMbM=; b=U3Y7ONmsbkOU0PxNTGoxNn11PcwB1ve0OxbJFIxvZk2DQteHpcKpTZuVrlcPqF5yNU4NNyAekv4lU8OM/CBdQjXhqigKoTbE9f3bkWLwUu7X9qQPCs0oWk2p9KOJNRHJyZMqdBebkjaQPPV3++O+miciAaJjqu0JQKETaMtmwGpX631y8g/smZPo5rTRA32kGIvfMRUSkzIDUftGA5SR8Jt/4C+J0JaeRuYujaXQ9Yexfwm2VNnhwKdSubIbCsPymXpvipsIR2SAFoZiBOxXEV21Lt4ZEzuFfUKq3ku6VSBst3OLMIDJGY4XAdiOATVoTIFMlhWhnYsKogQlinyh5Q== Received: from MW2PR16CA0061.namprd16.prod.outlook.com (2603:10b6:907:1::38) by SJ0PR12MB8089.namprd12.prod.outlook.com (2603:10b6:a03:4eb::18) 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 04:54:00 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::35) by MW2PR16CA0061.outlook.office365.com (2603:10b6:907:1::38) 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 04:54:00 +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 CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.17 via Frontend Transport; Mon, 30 Jan 2023 04:54:00 +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; Sun, 29 Jan 2023 20:53:46 -0800 Received: from nvidia.com (10.126.230.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; Sun, 29 Jan 2023 20:53:44 -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 06:53:00 +0200 Message-ID: <20230130045302.1560006-10-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230130045302.1560006-1-rongweil@nvidia.com> References: <3ba49f25-52d0-fe07-02e6-22a71e0fbe13@oktetlabs.ru> <20230130045302.1560006-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.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: CO1NAM11FT070:EE_|SJ0PR12MB8089:EE_ X-MS-Office365-Filtering-Correlation-Id: dc7ca2dd-4d61-48ae-81ec-08db027e008e 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: +E8QyYxnos6Ge12FGSc0M97eEPWwepuucItbButR5BWxZLJLJkp6bJe1VilRF00rl4vTcP/A5K6kpIEfuzKEVi7ONwHi7HfCCOl1wGGzZ7+UXXkNC6gy60JtaVA/Vc0duEjpjZJzJyrPnqRo9nC3iV7Uh4NaozoXtxlDMu4ybk9gOv8CDMAdJLNx6sEWMv/SP/F5f/w0NAyo8OJZbvc3eNsso8omu/UwlKxLlmUXhXHRTn1YzO/yiMvFGueD1cuIOHFaCdd9uSpZVN/9GuA+tVkh0X59Hh9IE0xNfxtZm5NeRvAghDzQ3FflV+7PFixXwnG27qk9vX9Y8HceqzV8nKhE6w3G4X5X2NQDLGH9AIN5HOjY6nuTj66axHlTni4ECjjV4SVfLGqHyAjQNReEAJdafOHipFTR3HiKIgG6qzkW7ExVmuqZlPdwIGp/NAeKUbuPyXxWd0u9Q6mpozosBrY074lxxN+PdnMUGw8WoCLvKT4ZQ6dq/VUPjpH1Ycd79Zzg6CxQ+q9KgMNHDC6nllp4+TKZV/2XuqJDtP71hpC3ZanRylhamei3k2L9y2+DQ6Yzw/bv5UimGxDXppleR5V4XYFWMnsuaF4ONBErjmGOWaUyc7jP46nrjiuQ0TIW0tMs1fDilcL6RJBX/sQYgBA/SgIoSuatPzEHn2JZYviAQ4M/Hb6yEdU9vOP9rQRYLGjc08oaWk9T0B+zqQ9ofQ== 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)(376002)(346002)(396003)(136003)(451199018)(40470700004)(36840700001)(46966006)(356005)(86362001)(82310400005)(36756003)(41300700001)(2906002)(54906003)(7696005)(110136005)(6666004)(478600001)(107886003)(2616005)(8936002)(55016003)(40480700001)(5660300002)(316002)(4326008)(70206006)(70586007)(8676002)(83380400001)(7636003)(82740400003)(26005)(36860700001)(6286002)(16526019)(186003)(1076003)(40460700003)(47076005)(426003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 04:54:00.0437 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc7ca2dd-4d61-48ae-81ec-08db027e008e 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: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8089 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 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