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 370E2A0548; Thu, 4 Nov 2021 12:27:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 250B24270F; Thu, 4 Nov 2021 12:27:47 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) by mails.dpdk.org (Postfix) with ESMTP id 0C7054270E for ; Thu, 4 Nov 2021 12:27:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QIFGlgqw79VXicNiNxUH72lfPKtDRQW2a+rm9rsyDaSWwsc8A5adpEOKJ4mcka86711XscMmehz8rqB5HQMqQWf52OTjU8ysKPLTuOEoPQeI1M+UrOd57GLI/r11d7MrONB8JSaI5vytccTSd5F3S5K0HUJyQxT0wt9TrVguE38SAaTpbiZ8TyBlvqqpPxh+YImJE0XXahGEepq6k9vnnt1+mNWIQ33rpxhOSmhintvuvf7O8V7k3dxI+dZO4Qjk25wlE1REp7I9W+faI0PRiFG6styP5qvWpKj0TipPoEsh/I8yJ01+JKdD84TZVo2od/IrXczUnNb/5p+1UW02pA== 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=IrIrkTfb/pL9qdo5/okV1EFuIbLkI4jM0llJhgHpmU4=; b=d95w8og9dXnb95j53wRmmdnizrLMwikKeaTAZEZqB9jJvZUbdHzJNPLq0r1Q7l2WAcJu7jCxzKFqItHT1Tl7r4xIeK111z6gGlbpJaKnxCqWgNKbsM8XKMdYQrCtHY8n9nEEjgGbThR/QR06Fvver2rp4ebskvTD8Vp9hLb8Q9jM6V6n+rxU2+sq9FHZ9/EUXeihTKOjCmXSSmelQcUeBQJmWQb+DbNYhJwrfG7PVxSeC7qVV6lJypQu0Hn2cTAo1pe1DwFcJOlJQ6K4Cqt/ztU3Xe45t8Y48rLB1FplS/Hu2h0aWuCGRZbK4NQxcpMmMpLY/N+jB2s6XJCpmLY6sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=IrIrkTfb/pL9qdo5/okV1EFuIbLkI4jM0llJhgHpmU4=; b=IwtoLTE167c+rZrCeNiTwfJXb4+OhULzK/tAIQyL/h7duuR0xC7NhZgIYfNi9H8cJ6MQNG9WQmtaBSt0YWmBomjcU/skOgQXwQJHmEvIWuALGFn1cGxelQEx05K/nX0EuYaRtFx2Z0bf7V6LON42msoWoSr/iT8BuWb0VfO+PkQXqLzuTtwxkR/FcxiHqU0IQnVroTPfWXRs2dQxBDAs1ZNJFnNQAnKs+x7NtN0DASMFgGLSFiUqI2aBZOVQEzNeyzMiV2G+Mic+d5E2mJv2wEw5QIOOM9iEWSyVoIxDY04dpE6k5wJyT7QkMNhNAC9rWuh4HHgPfYobbOm9PU7F1g== Received: from MWHPR11CA0048.namprd11.prod.outlook.com (2603:10b6:300:115::34) by CH0PR12MB5203.namprd12.prod.outlook.com (2603:10b6:610:ba::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Thu, 4 Nov 2021 11:27:41 +0000 Received: from CO1NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:300:115:cafe::cd) by MWHPR11CA0048.outlook.office365.com (2603:10b6:300:115::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Thu, 4 Nov 2021 11:27:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT058.mail.protection.outlook.com (10.13.174.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Thu, 4 Nov 2021 11:27:40 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 4 Nov 2021 11:27:34 +0000 From: Gregory Etelson To: , , CC: , Ori Kam , Thomas Monjalon , Andrew Rybchenko Date: Thu, 4 Nov 2021 13:27:21 +0200 Message-ID: <20211104112721.4025-1-getelson@nvidia.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211026090554.9128-1-getelson@nvidia.com> References: <20211026090554.9128-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54990287-ccd2-4073-cdba-08d99f861cc9 X-MS-TrafficTypeDiagnostic: CH0PR12MB5203: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HX/ggnhzPdaf2GU9YCZjA2Dn3R6/4tEh5S9L5XmKpTcqdts5iP/5fSn8zwxTSkkSoJJPYFmfSmD9kUAtc6a7zRXqlO7l356c/i7jJQDzSlIlJiffa4A7YBZYqzO/V15WixTU72eTv3zgVJSea770Su+yXjvDLLNJXRbhbsD7AdMzcN8VoIcSzyCUcplf2J/H9Vcwg2ES8kJssDgy4BaxMI453h+iVRupHLhDpoqRY/RDFs8VZ6thHGBim5aORThWQeJGSz2Eaa6rqd5kGzohaf6xED3DlyoSYZh0z0rzf+Lw2O5/EnvKHhjjree2XiSMXfxEZughvJRicB5KSmQ3QOY4zT0F3xAJxT0iPElQ+8mN7uKjqT0U1UI6n6r6GQJrzQueu2tAFXMUAbF91gIrZC/B0wd3w0o2FbpYZuj6hdmGmyzquh5Q2b99hx4K1vBlHwIhbYiTfghjFGH9To+FspqE4EXcxGU38bcrOaWBRpBxTJlEASWSdFT3XvRYINhRkjfvgC7Cbc6YHgvDEGa/e1K8qkuEKngOrL6yHbKc0RUF7JnaFHX0/+i2t4BFs4vcsm5dM57SD1298QKOYpjOIiF2r1UeQiGGXu8E8623VEGS9NVaiYZqpCs+okp1oPXRpM9FVOsp1cfpxTgHy3gLHkzF1y1OPdX8hBiowwhHFQjw5YzjtpF0UyXoZGBXE2apAiX92wHFeI0HbOdbQQt8zw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(426003)(36860700001)(336012)(36756003)(1076003)(55016002)(54906003)(356005)(4326008)(7636003)(2616005)(7696005)(26005)(6286002)(508600001)(47076005)(2906002)(16526019)(186003)(5660300002)(8936002)(70206006)(83380400001)(6666004)(86362001)(8676002)(110136005)(6636002)(70586007)(82310400003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2021 11:27:40.5918 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54990287-ccd2-4073-cdba-08d99f861cc9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5203 Subject: [dpdk-dev] [PATCH v2] ethdev: fix variable length flow elements support 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 Sender: "dev" RTE flow API defines two flow elements types - common and PMD private. Common RTE flow types are defined in rte_flow.h while PMD private types exists inside specific PMD only. Application can create a flow rule with PMD private items or actions. RTE flow API restricts private PMD types to negative values. Current implementation tried to use negative PMD private item type value as index in the rte_flow_desc_item[] array. The patch allows access to rte_flow_desc_item[] and rte_flow_desc_action[] arrays to non-private PMD types only. Fixes: 6cf72047332b ("ethdev: support flow elements with variable length") Signed-off-by: Gregory Etelson --- v2: Update the patch comment. --- lib/ethdev/rte_flow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index d268784532..a93f68abbc 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -54,11 +54,13 @@ rte_flow_conv_copy(void *buf, const void *data, const size_t size, /** * Allow PMD private flow item */ - size_t sz = type >= 0 ? desc[type].size : sizeof(void *); + bool rte_type = type >= 0; + + size_t sz = rte_type ? desc[type].size : sizeof(void *); if (buf == NULL || data == NULL) return 0; rte_memcpy(buf, data, (size > sz ? sz : size)); - if (desc[type].desc_fn) + if (rte_type && desc[type].desc_fn) sz += desc[type].desc_fn(size > 0 ? buf : NULL, data); return sz; } -- 2.33.1