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 3FEB444060; Wed, 12 Jun 2024 18:19:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D00D2402B4; Wed, 12 Jun 2024 18:19:35 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2084.outbound.protection.outlook.com [40.107.236.84]) by mails.dpdk.org (Postfix) with ESMTP id 91ACD40151 for ; Wed, 12 Jun 2024 18:19:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+ny7751+Ja2mY3tXKT+XUt9m4HaCuUv3uYd1kwZ3HnMfPLNhzCQre1n1Ht/ItnGT7L6753T7ufZzxrKXQESURCPpq9JA3lRgi4ujx3iDcu5JYBuXunNhopBJvzwFb2iIvQr/KdMAc19/VaYHldALGUoBbXDS2GHopJCe1Il/DxafC/mIXARH00i77ul3puQVgkUJIRxU30aQF9dMriTEgW9dUBylsMARy/W4HLM04AM2N9YEj4Uk80MAidAxSRiNtKGKkJ/uDtQp53Udq9OlIlaGKEUUtp4yZ8iAM1wjMsOENncf0/Pkitp/n8Db4N9xU5x4PeJOOmP8T5JQX/0aw== 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=5JN52+B3kWHRy731JYykpqlrJ7TR7VpYx6ZS0gOOzl0=; b=beA1HxDa6ZMG8abEq/L3doMrLOaI95zcG5NqrAE7uz2WqED1QjjVfQNxgMOzEJW3OJHwtuSgnxidzcKA8PCZeTMn3ZthsZ/9Pp7p20AB+Eczq0dKiGd5LeBAHupRCgcad8CQivxbZD8kTLIQUBOvkWhvnPdp+GBoqGJLFSOZ25KzChmaT8xSvzieRPQprFZ1zX3AzLTNrdyM8goIXaDuAj/cChXhgWaaV++PC7fTuH/en8nrKzB/vEgg4FUITkTImpF3ehcnuRrcHCwKhnwaPwQRjFPeSoZpgbUXD92dro+IaRcuvXJRnMIU9KT+nhJ00ILqij/Ef+qc6Tmo/G5yfw== 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 (0) 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=5JN52+B3kWHRy731JYykpqlrJ7TR7VpYx6ZS0gOOzl0=; b=auy4PQ0+SVLJ5YBJuaXUArs7O76s5H47v4CF5m74cYFDMTjzzH5Jtt4oAxUQNY050FFudm7MjM9K1NNg0P1gFRJD2ji1iiog3AKU+1zdZkM7+DCcdfl0+7fmw0HIrb3zZykmg2i6+m6Jpd28eZ9STI6Gvf9mMAfhkYkfS78bJy1VpVtC7uFSZz1uLC5RkZDb1CkJPhqGksoHu8/UuA2cbpanrQxuN4kpvfCNFGaxTE0r5vEcLaXVXuOPGcGgrQ5PGGvVI8DlXcypGnG1Xgti/mDjUokQxECr51yM4HVfUvjLM2GMVtH/kLXn+eEObSkvjSceHXPXsJN+HHR6C0ncZg== Received: from BN8PR03CA0014.namprd03.prod.outlook.com (2603:10b6:408:94::27) by MW4PR12MB7016.namprd12.prod.outlook.com (2603:10b6:303:218::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.37; Wed, 12 Jun 2024 16:19:30 +0000 Received: from BN1PEPF0000468E.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::74) by BN8PR03CA0014.outlook.office365.com (2603:10b6:408:94::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20 via Frontend Transport; Wed, 12 Jun 2024 16:19:30 +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 BN1PEPF0000468E.mail.protection.outlook.com (10.167.243.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 12 Jun 2024 16:19:30 +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.1544.4; Wed, 12 Jun 2024 09:19:11 -0700 Received: from nvidia.com (10.126.231.35) 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.1544.4; Wed, 12 Jun 2024 09:19:09 -0700 From: Dariusz Sosnowski To: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko CC: Subject: [PATCH v2] ethdev: support duplicating only item mask Date: Wed, 12 Jun 2024 18:18:46 +0200 Message-ID: <20240612161846.977980-1-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240605183419.489323-1-dsosnowski@nvidia.com> References: <20240605183419.489323-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] 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: BN1PEPF0000468E:EE_|MW4PR12MB7016:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a1790aa-efea-40c9-de74-08dc8afb702f 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; ARA:13230034|36860700007|376008|1800799018|82310400020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kkn70VINQqh5Fw8N8hah3xRtwbbkVmSuw2IdKhWWkALkxIxMSeVCrJTE+G3P?= =?us-ascii?Q?GOF7UO9MuglDOvZyH8LdK1WX9Ywse09lL45hwt6UEgmGn25HUWZLY1Ztn0y7?= =?us-ascii?Q?rkD7BYeU7aH+rH+bB4BT5afT0oEZ2liAoYpC/hEI4gRPUIppDDLFMwAsK2Kg?= =?us-ascii?Q?tojR4eJlwNPubHbf2vYmqEoNzcYG2DXxwg0+D4IUo2gbgaOEiCzfxJao0hCV?= =?us-ascii?Q?JkSvdmXLOXR1n5iLD3aBSBIg3UU+XPjBIdc+RIex9USi0FCE3A51gKmXFbl9?= =?us-ascii?Q?bKMQ9v708pBK8EiRcKUUb38DrEjGWrzyBO7YhnrYAgrmeoe25Ohxi3R42XSp?= =?us-ascii?Q?HxaIz5VEt4Gl569pCY1BXAsfHyoNFUPZV4FXzlj+zl0AYTQFfKTO6LTQV2RH?= =?us-ascii?Q?JehFFyKiZzBHDJ06aQ1Nbxcrnx6CrS50WkIDYuU9hG+v6wctClDGLMQkK15a?= =?us-ascii?Q?J45/PWcvbwQPZ4D0vVOeX0Fm4x00r5TwDjBpu6smQkSwp9CujBRenBdByz+E?= =?us-ascii?Q?U1pPBydak8nZeUpRy77GpgM9xildk4hOSg5cRcEMGx10zHFjViQmOxtNPhYh?= =?us-ascii?Q?NFmB9cx6bHhmLuzrVsV0QMPApejFO3YXJrZyCYPQz10szRYybbz5pd1Q/ZoS?= =?us-ascii?Q?flNALmHhIoBVJPmbAsE/6L25cwl9wDolNRVUK0rK6/67owT/vTkYoE00XjlI?= =?us-ascii?Q?S/pZU5RL1ENna4nW+aA94krHhJDwxWftaDFCzSpMEi4N2CSZ1zzAF3o2wAcw?= =?us-ascii?Q?3DAWCnn3CNu3REjt0YQ/dZ51ms7nIuB3tesX5Xc7uKx8bPw+751ldOOj8Vgb?= =?us-ascii?Q?HOQx1u8uAiugSJ1a4LSEIuaY13Ha5eJeqivAYBkZUuIalMVPWeoweO987zK3?= =?us-ascii?Q?GP3RtaH37blT0t4SrI1asGQG4V/WoQhF6wIU2GH3OLh+zD7/2/OuJ3fAIS3K?= =?us-ascii?Q?Rl31DiVYOqnUcXa0ep+xG/p9VBI0LJijxyGPuyINRj0gHxec3biOA6xMNJqy?= =?us-ascii?Q?4F5U2FacESr7KaFijgBiwtmT+7uJ9ua0dTaLKcYxv3ZhQGb00/Jw/25CFGDT?= =?us-ascii?Q?oljkhQksjuQL/y//veyUZ5jC64J0iGvED68g1NhiIG+pasU9+0puCtj18icg?= =?us-ascii?Q?W324U4R6U27/ntUUVzL2Ukn9ArkAv36kexRyrvOVamdZHg6B6dQijTAvm/Go?= =?us-ascii?Q?5DpcUvj7sbCN9OMVSLAqbYslSPxxJkCI3Krgg6/AhMy+7ZDmpmC/RQ0pns8f?= =?us-ascii?Q?PrZuSSDol4FYS2BsTk6gjRQMx6wiW4lAqXSWM3TPOY+wATE7IS1KQkJg/BI5?= =?us-ascii?Q?Pnxrq5QAycZde8kuwtLMRiPhs6f1A6uI31FE0B9BKKhz+bwLl6mbdyArL4D5?= =?us-ascii?Q?XadkDE6Msw1+2529DF6NeCohQvLv3ENtXEYxg3pfn/JhuMxkRw=3D=3D?= 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:(13230034)(36860700007)(376008)(1800799018)(82310400020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2024 16:19:30.1190 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a1790aa-efea-40c9-de74-08dc8afb702f 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: BN1PEPF0000468E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7016 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 Extend rte_flow_conv() to support working only on item's mask. This allows drivers to get only the mask's size when working on pattern templates and duplicate items having only the mask in a generic way. Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- v2: - Split series 32095 into separate ethdev and mlx5 series. - Rebased on latest commit in next-net-main. --- lib/ethdev/rte_flow.c | 15 +++++++++++++-- lib/ethdev/rte_flow.h | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7ab1100ea0..ca2f85c3fa 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -60,9 +60,10 @@ rte_flow_conv_copy(void *buf, const void *data, const size_t size, bool rte_type = type >= 0; size_t sz = rte_type ? desc[type].size : sizeof(void *); - if (buf == NULL || data == NULL) + if (data == NULL) return 0; - rte_memcpy(buf, data, (size > sz ? sz : size)); + if (buf != NULL) + rte_memcpy(buf, data, (size > sz ? sz : size)); if (rte_type && desc[type].desc_fn) sz += desc[type].desc_fn(size > 0 ? buf : NULL, data); return sz; @@ -1090,6 +1091,7 @@ rte_flow_conv(enum rte_flow_conv_op op, switch (op) { const struct rte_flow_attr *attr; + const struct rte_flow_item *item; case RTE_FLOW_CONV_OP_NONE: ret = 0; @@ -1104,6 +1106,15 @@ rte_flow_conv(enum rte_flow_conv_op op, case RTE_FLOW_CONV_OP_ITEM: ret = rte_flow_conv_pattern(dst, size, src, 1, error); break; + case RTE_FLOW_CONV_OP_ITEM_MASK: + item = src; + if (item->mask == NULL) { + ret = rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_MASK, + item, "Mask not provided"); + break; + } + ret = rte_flow_conv_item_spec(dst, size, src, RTE_FLOW_CONV_ITEM_MASK); + break; case RTE_FLOW_CONV_OP_ACTION: ret = rte_flow_conv_actions(dst, size, src, 1, error); break; diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index fb84992b61..f864578f80 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -4426,6 +4426,18 @@ enum rte_flow_conv_op { */ RTE_FLOW_CONV_OP_ITEM, + /** + * Convert a single item mask. + * + * Duplicates only @p mask. + * + * - @p src type: + * @code const struct rte_flow_item * @endcode + * - @p dst type: + * @code struct rte_flow_item * @endcode + */ + RTE_FLOW_CONV_OP_ITEM_MASK, + /** * Convert a single action. * -- 2.39.2