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 15F7044165; Wed, 5 Jun 2024 20:35:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3DF6410E6; Wed, 5 Jun 2024 20:35:43 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.62]) by mails.dpdk.org (Postfix) with ESMTP id 4E4D5410DD for ; Wed, 5 Jun 2024 20:35:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TfW24E6yj3wTbpzbMJ1bI+RKWOSIvWNQop+/2qskN2awA3OmNS9Q270z4ZmMZyGASskOpv6JRQ4bTx7aNyE4/nqdHjlsa0EZfBALLFaQXihMGI9rhqvUQOb78Jg4kCT5yjwDLLYijmsapFwjKsP1BrLzziX9CAMlN4VTz6cCR2snQclYM9S4lst0W0hcjHSWA+nSqfxI1rqyu4wEoamX80XAWaxA11C/cpfrjlmm70oiDEY1xCrbBomdA2JwfKKdQVcZ2reiTv8WTQD7UDroVvdTMxkj6kkJkqhk0IGTvxzn9IjUlZrgvO94Y7p8DbmyBay6+kwg6jCetg/BXgpXFQ== 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=2zqtHnYBlRxNniPT8S3AoO1bLXMhG6IssZLxfopd/P4=; b=NjCshqFfe1rdNqQyW/jj/FhFKKlnCASfWSksdXzBrdfJfplUOT9eJbXNGFDt1E4dmEJwkg8QAsnRjj2Xag5vGOUp49n/AuM/MEzfERkQi9tJEi1SHkaYmHMpzUV0x/fR9ORsldO2mvoMw7oNDYwe80ZGy4yLETMy8BzrHUbyo7CZaXWTXiw5HcPybmzq7LCPb5e9iFK7z2CRJJMki20+M1lwp1+eRmHiAZc/c9YBYg1TVOWWLY4sj3PAByK5OrxY27r0g9M0kYsz36+vhqVi/bceEv//2+HwiO9WitTeTakwWBfPhA4irRZb6IDlZcv+tKwgUBfI+Lg5dPN3Qi4HpA== 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=2zqtHnYBlRxNniPT8S3AoO1bLXMhG6IssZLxfopd/P4=; b=MOlCGFzWI/l2kawyFqhm5CCmCkOBNBZBiwOr+AVQFSjyHz2uC8+yfqiK2/E8/zUS65kikh6gQyb1oJR0ieoan8fZLaiiuJ0wR/oEeNJyuwlB9nldjpaRe3uEU14z5xO+dxKuBX2CtH7kzKvhHjxX3Ia3aNUcfXO/s3soY7unz+UqC7YRAcmgG6runWDQZbCN0fozp4+VZOrLRqA7jtMFsPThmGQ5JYZxWA5ceqQIcdevJICZzWsF/TxMWq+xy/j1X0/ppj8aaivLAFmGBttDfjlziWxnOtjoqUaAlnTi39FBlStu2N7Gas7PEBZ1lqb4wP0Ff6rzfDOPUKP9jlmqDw== Received: from DM6PR17CA0024.namprd17.prod.outlook.com (2603:10b6:5:1b3::37) by DM4PR12MB5841.namprd12.prod.outlook.com (2603:10b6:8:64::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Wed, 5 Jun 2024 18:35:37 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:5:1b3:cafe::e2) by DM6PR17CA0024.outlook.office365.com (2603:10b6:5:1b3::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.16 via Frontend Transport; Wed, 5 Jun 2024 18:35:37 +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 CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Wed, 5 Jun 2024 18:35:37 +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, 5 Jun 2024 11:34:44 -0700 Received: from nvidia.com (10.126.230.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, 5 Jun 2024 11:34:42 -0700 From: Dariusz Sosnowski To: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko CC: Subject: [PATCH 1/9] ethdev: support duplicating only item mask Date: Wed, 5 Jun 2024 20:34:11 +0200 Message-ID: <20240605183419.489323-2-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.230.35] 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: CY4PEPF0000FCC2:EE_|DM4PR12MB5841:EE_ X-MS-Office365-Filtering-Correlation-Id: dd8e3742-57aa-4688-8cb2-08dc858e4b55 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:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rSX7gmKNV1m6ybPCEyQoODC0SpUSs4oB2N+jF39+/NkOnCXxaUWcdMto6HP1?= =?us-ascii?Q?BhZQLOS/FPinCEVtnmB+rKgjOOlQqfe1hiFRQEGBd/ALMNWcHtMchEydLddv?= =?us-ascii?Q?lz2WHRBYknPfNgrGX35cm6v0Em0MwPse1Coesb2dCw2yL2biWdjIuHQM8ncv?= =?us-ascii?Q?RF6Lzmm3rR72qA6Qzm0VoEKxxSKRIBs1ioOfaisGwyjRTv34BfmmT9+0cPwu?= =?us-ascii?Q?S3/XGBS5sEY5PA7YJFfhYLg6CWouhPgplHXF123qTyBwNLNCTQks5/PIadBX?= =?us-ascii?Q?WGwbkLmd5Hvgou15KwppoeK0fCBrUJdAC+SkzK9ByVsDN7aPVZm9kyBRJRkX?= =?us-ascii?Q?Dr6iovQe0Ox/SffdYoJ9UMdrea5t2CvGwxnTIan501MFMyosqnflhNzPoPCq?= =?us-ascii?Q?Qe7qtp5W2Mlwh7ZyK9ae62Gu/5ex2mZRLjS9RAgvIgbGdScdKPAS4LtatF1I?= =?us-ascii?Q?cByGMSTEuJv4ZFrPRcCFpsfBla+fttNHjj0k5xSE4ARisaBZNgopc3YFGp1I?=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v1wOBSPGUgHtL4R70urzyI2OkQgDaaV6tP5chJA=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:(13230031)(36860700004)(376005)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 18:35:37.4422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd8e3742-57aa-4688-8cb2-08dc858e4b55 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5841 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 --- 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 6e8ab1d4c7..35f180e735 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -4409,6 +4409,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