From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 90BE1A0350; Thu, 25 Jun 2020 18:04:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0E078F04; Thu, 25 Jun 2020 18:04:04 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10041.outbound.protection.outlook.com [40.107.1.41]) by dpdk.org (Postfix) with ESMTP id 5B2BBA3 for ; Thu, 25 Jun 2020 18:04:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AN7b96L2wGy+58boszVPLiQS0J7hH63XFR2pPJCrmU84cDnOYu6QLKGq+J+p6hNIe6QM8o6PvgIxKafe4/FZGzxSKMhPDqtJYidDM/iskucSfBJf94Hcf8yfEt01Q1iWl9lTOgsKTIsPk2/5EOKeZ4EBgrf9+l7Z2tiJNWcOnuSZkF7aCecq2XaYSheRBQHu0neFH5ZzPlSqFg7rAs3dr7gY9RcB0S2kORVpqLf/SEFCqi8KZ7msrlEIJ7W+K3lhujwcR4Fr7tJjBumHyXWPf7PeFBp3Km5qRob5z5PHMNrjJr+wIqdfjMlAdtjfDf0Klx2cNyLdL/UrQ7hOHyXtlQ== 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-SenderADCheck; bh=U2TAFuaecR+V4LSuI9zfk6vbeELcGWTq125ymv5D25Y=; b=gNFHu8yxAqV+96BqUhUXtDNZg72TpvklDft9xE2ZQw/j1y5FJDY/jEAqyBy58/2aZIxjY7ENTvcrgr6NrHJqo603+zImjmG9dkCP26NKLW1EZGj98efV6Q6xJGc3q8kqtXR/+lbripb5j9ABAxHp/BTUtOZT+iJBL4aW5CecYdI4fyG9zGcHu5wAYM7uUKkZfJhGnorN/TJP/TY0FgSTCkGJQQHbgIbgqbxN3gjSN8+sO7VuRW8qdWq9sYd9a82zMdjZt6aeGJywarrNo8HeEJ94ZpHarHMJIO97znaJIo770RhPz2husTYyj9RPy4NaEPeLf6Fd5hZR64aD6zM50g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U2TAFuaecR+V4LSuI9zfk6vbeELcGWTq125ymv5D25Y=; b=aOIjAYiS8hUu4tOKxeB9x57jb4lbysLteXpG6AkWHx9ItnlCgsVwzSPkRBjfpFeod3AuuX+GEoHDm7GvwQWbNxO8gZeMZSECmCNq0P0SbkJ24DGJwW7399GhIlxY5hviOnQcpBi/spNwa1u7qEZRDN9i93igZ2TRfC4nF7ufnB4= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB8PR05MB6761.eurprd05.prod.outlook.com (2603:10a6:10:139::21) by DB6PR0501MB2552.eurprd05.prod.outlook.com (2603:10a6:4:5f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Thu, 25 Jun 2020 16:04:01 +0000 Received: from DB8PR05MB6761.eurprd05.prod.outlook.com ([fe80::10cf:d50d:bee:a43]) by DB8PR05MB6761.eurprd05.prod.outlook.com ([fe80::10cf:d50d:bee:a43%5]) with mapi id 15.20.3131.023; Thu, 25 Jun 2020 16:04:01 +0000 From: Gregory Etelson To: dev@dpdk.org Cc: getelson@mellanox.com, matan@mellanox.com, rasland@mellanox.com, Ori Kam Date: Thu, 25 Jun 2020 19:03:47 +0300 Message-Id: <20200625160348.26220-2-getelson@mellanox.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200625160348.26220-1-getelson@mellanox.com> References: <20200625160348.26220-1-getelson@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR01CA0124.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::29) To DB8PR05MB6761.eurprd05.prod.outlook.com (2603:10a6:10:139::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (176.230.225.181) by AM0PR01CA0124.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Thu, 25 Jun 2020 16:04:00 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [176.230.225.181] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 64bf657e-249b-441f-4dc5-08d819215fed X-MS-TrafficTypeDiagnostic: DB6PR0501MB2552: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-Forefront-PRVS: 0445A82F82 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VZ4f2plWsRnn07ZkHyhVlhskdve8iZ7YRsuLY7c0d+GTk5DJs9u8mMEX3OwJNebH2WhFZom3Zp8Kf+mTHEaxXmHbRHhBRaZ0mWCASxyr90XOdcM6I585EiwzdzvUZ2ofQPzfXskPNG8kTzKcGM3wF4GQx+G79VrCxI1LfF+UVAhvYhY8K0TjoHY+uitMqLSO/XAc+08p0cTo5kt7MotOoDdylrPWYZhpN9e2UoMfWNS8XSyyl41LMwhRN0ImZtizUM1e45JwafwnncoIAOXsvAS5mcyJbgU3b7OSd7xOtOZhZ/kB0zi/hzJe5s6QfiUPM4embQoWJm7WnOUpJdw1oA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR05MB6761.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(346002)(366004)(396003)(376002)(8886007)(83380400001)(36756003)(316002)(2906002)(26005)(186003)(66946007)(66476007)(66556008)(16526019)(55016002)(86362001)(5660300002)(8676002)(478600001)(8936002)(7696005)(52116002)(6666004)(1076003)(107886003)(4326008)(6916009)(2616005)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mXWjh2ui8+jkTw/cmRP47UfGRgzddoY8VTzYx5GDdQ1pSM+DEwVmH0l8t7MEL5TzrNnmRBSA7mvJ1K5wadtE8Mbut4VvxNaQIXcDrhbArC51C2Eau7UNoEb84ufhXsNW9bxrNqjXgoWwtlBrqBmRNQ/JHAEWXJ8S4zPIxXPciR3T1GDaMVAwN1n0gJV7uss0HWEdh2au1Y1F02PiKQdADU9J1qo+uHnoEbJfFVLxIOw3fKCUcc4+to7SKlmFxl9MgXzCo4UzfaR9eiAsIqM8XmoHfd39NccqII5pd1UyD+8XY6ZEqp+qfEiXqXeCHAKyYuseehZBvj/Iap9oKeN01uuJDWsAWRcPLfpyPbMKa2fwzcFGYu0Xu8cbsnXiGXhKRTtLT4SZZpqwNS+qaeivyWIqqmFYtd3qJiFNPBGCuNu8fuzw0Rtpg239Nycv89hmPIT1XT7RaNQ+j6fZ13lMMorbzcX9sG6hIZnLws1MpZbqVKpgQgLPOExBm3nKciSH X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64bf657e-249b-441f-4dc5-08d819215fed X-MS-Exchange-CrossTenant-AuthSource: DB8PR05MB6761.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2020 16:04:00.8769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cznDzcFqQzugVnqX7cunhwRCHRXxxfaQ9tU9dWdC/3qN7dJI1kAK0FLZ+bD9GEKM41DyxVBBkf99XGqimadgpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2552 Subject: [dpdk-dev] [PATCH 1/2] ethdev: allow negative values in flow rule types X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 items & actions use positive values in item & action type. Negative values are reserved for PMD private types. PMD items & actions usually are not exposed to application and are not used to create RTE flows. The patch allows applications with access to PMD flow items & actions ability to integrate RTE and PMD items & actions and use them to create flow rule. Signed-off-by: Gregory Etelson Acked-by: Ori Kam --- lib/librte_ethdev/rte_flow.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 1685be5f73..c19d25649f 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -563,7 +563,12 @@ rte_flow_conv_item_spec(void *buf, const size_t size, } break; default: - off = rte_flow_desc_item[item->type].size; + /** + * allow PMD private flow item + */ + off = (uint32_t)item->type <= INT_MAX ? + rte_flow_desc_item[item->type].size : + sizeof(void *); rte_memcpy(buf, data, (size > off ? off : size)); break; } @@ -666,7 +671,12 @@ rte_flow_conv_action_conf(void *buf, const size_t size, } break; default: - off = rte_flow_desc_action[action->type].size; + /** + * allow PMD private flow action + */ + off = (uint32_t)action->type <= INT_MAX ? + rte_flow_desc_action[action->type].size : + sizeof(void *); rte_memcpy(buf, action->conf, (size > off ? off : size)); break; } @@ -708,8 +718,12 @@ rte_flow_conv_pattern(struct rte_flow_item *dst, unsigned int i; for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) { - if ((size_t)src->type >= RTE_DIM(rte_flow_desc_item) || - !rte_flow_desc_item[src->type].name) + /** + * allow PMD private flow item + */ + if (((uint32_t)src->type <= INT_MAX) && + ((size_t)src->type >= RTE_DIM(rte_flow_desc_item) || + !rte_flow_desc_item[src->type].name)) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, src, "cannot convert unknown item type"); @@ -797,8 +811,12 @@ rte_flow_conv_actions(struct rte_flow_action *dst, unsigned int i; for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) { - if ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) || - !rte_flow_desc_action[src->type].name) + /** + * allow PMD private flow action + */ + if (((uint32_t)src->type <= INT_MAX) && + ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) || + !rte_flow_desc_action[src->type].name)) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, src, "cannot convert unknown action type"); -- 2.25.1