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 192E241BE4; Mon, 6 Feb 2023 04:39:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 121AF42D32; Mon, 6 Feb 2023 04:39:44 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2041.outbound.protection.outlook.com [40.107.95.41]) by mails.dpdk.org (Postfix) with ESMTP id 0171D42D32 for ; Mon, 6 Feb 2023 04:39:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=byFTc3jjET07nChBXJ49p/rvr8f+C4b41X5YKzMjZ+KnZJ6D35YiDmJwAnPCMjGADd33/CjH41LwMlbLTyEyuejhAGPvxY6uVjvQyL5hsFSLFnP5pNrnYOTRSZqKuY5sT5q990qrQDHnB+9kdqSfQJj5M7ZkeEQ2NwentQx0nrRoWL0IgUlZ6Fo6LT0J4dEKav9iyyr1oNM+6TihOYqgaznfgL5mwQH5j13xOb+Az/g4zLy8JQfoWLSDzsd+Sq2LwnrEGCnkiF2EJt0htWHQ9yxRQsafBWnbbJ877oj20E4BCNJFiT+cw4FDsXLfzA5J6p9tjrKt/XeIbmMwo+GwPw== 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=JD+xgzs2+DzsaIt1VbycChgbm8k6eeerteM76lUnHIgmoCCsjEy3g4kBu16s1KgZx5XVq6rIEIi6L4SzOTDrZn/sf6r7TVrdbBSRu23mHRSyvJb2U3FBKghuAs4Vu2kwviJat/4Uz9oJI10dzdsvRVa2BBQgA6t3TtE3ZRFDePg1XaaDwBztW12f14h17w/yPE2XczwJbOq0IX/3z2q9E4D+K2fiCJX9xX2Clg+T8ictojeeSEZ9WTYbc0bTQnBmv0SNAnKIMkIEsrjHwcxeb21etjqsKuxQJngWAfA81r3drc0Fi2Z7zig5kF3OYH/fXRLtGsu0CRRLdUK2xiFMzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=8UnuhICc1dx5/OUzGM8OVhCHsUgATrf5Onl9BdruQ0M=; b=Q8YR9iY33NLY4uAzRjvA37dBDEX766W75zmQdtxu4jbmgiExzh0sulcaTP2P3ipP6WbrALc9ce8E/Y3ZBBVjPbR0njYfRVdc1Rq1F7KrnODtNSyPTOQY9wbw0Lc2udisDLm0xFyw95RWFOi90RIiSe0VhyH6NgIy/lECGeUb6mv1T1fDtHEBaIH/QmZxb9R50TRw0QOHkZQt1HLqSOGvBy35qfWX+0GetGbYbyt53Yp7/XbH20c2z+9fwRI15YH5cRJjwJ6DauxvhgmFQ4eIna2+cQqN6iziklWY4kThp8BQ99B0xh65fM4jzLoQhA1k+xPdhr1ENXwZFWowOtdlfw== Received: from MW2PR16CA0022.namprd16.prod.outlook.com (2603:10b6:907::35) by CY5PR12MB6276.namprd12.prod.outlook.com (2603:10b6:930:f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 03:39:40 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:907:0:cafe::b9) by MW2PR16CA0022.outlook.office365.com (2603:10b6:907::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 03:39:40 +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 CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 03:39:40 +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; Sun, 5 Feb 2023 19:39:34 -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, 5 Feb 2023 19:39:31 -0800 From: Rongwei Liu To: , , , , CC: , Aman Singh , Yuying Zhang Subject: [PATCH v4 3/4] app/testpmd: raw encap with flex item support Date: Mon, 6 Feb 2023 05:39:07 +0200 Message-ID: <20230206033908.2770135-4-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230206033908.2770135-1-rongweil@nvidia.com> References: <20230130132000.1715473-2-rongweil@nvidia.com> <20230206033908.2770135-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: 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: CO1NAM11FT005:EE_|CY5PR12MB6276:EE_ X-MS-Office365-Filtering-Correlation-Id: 533a30c3-0645-4cca-7d6a-08db07f3c726 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: Ys49OMPDZauEnjLop9LF/JXKGNm0Q3gyba1F8vUYvbBj7iRtzVUC54m9Eo0SLOWNUiipFWL2FBREUd4sjmx4f6O9quzOQ8d55Og6kUj1JJqYbOfnSguwoogrNFR14vQiRxJUa+mMOixMihpWa3Qk3fHxMsuuideARHDysFte6zygB2wDMPxhhb4BZ2TKaZJXRD0gbwdjEWO9qBVZ6COOa3PSdXRaBWIGOLtNNpILeaBRosvWHPfulYxZbIzHFOFwTNPktK/TwUjQid/GdYgqGcdCjmIIO3FMA+suTK5psZobaUJ27pQ3t4SnDpwMVtbkYb0ypPutqbgeo2tGHt7FNTDZoBjvTSIRjqcofFjImorrMJkcYn34fTAuCwH0r3bjgIz7jkYFNR23nhpi1VmzonVtiPcFgHpgzGWC1eIGt+pS11k+DjxR6pUOVMoDhdcnGsH3KRi1P9OKF9Wx/tC5kfI65uhytv0ol+GE4sxsWmXUbaofWRdtTv0fzpM91JvnD79Ti78MV+W1kivnXhMLEp3IkT2d01Yq/CyRR1oOTM+x7McolVVvCEqNqXW7WkfHITfwqc4AlqBgpvc059ZBHW4lyKkARvJC0j0ZZ5JB6eMOGSTQ/iwnfLKgr8+NiNYQTKDzbNkffbG8u8VBCrels49bNk3dTY4ZIOcsifK8lwVVcnJrEuzfzVnIWaIbLg2hN47x4HFzS/l8kQ+DGHXcpg== 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:(13230025)(4636009)(396003)(376002)(136003)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(8936002)(41300700001)(5660300002)(4326008)(8676002)(70586007)(70206006)(2906002)(7636003)(54906003)(316002)(110136005)(86362001)(36756003)(7696005)(1076003)(6666004)(356005)(478600001)(82740400003)(26005)(40460700003)(47076005)(426003)(336012)(2616005)(16526019)(6286002)(186003)(55016003)(40480700001)(83380400001)(36860700001)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 03:39:40.1130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 533a30c3-0645-4cca-7d6a-08db07f3c726 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: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6276 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