From patchwork Thu Oct 6 15:03:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Vesker X-Patchwork-Id: 117472 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12CEAA00C2; Thu, 6 Oct 2022 17:05:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1865542CCB; Thu, 6 Oct 2022 17:04:38 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 7432C42CCB for ; Thu, 6 Oct 2022 17:04:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aCKdz6BilUDMtwSSjhSRuNfFhq8fBQA9swJKKivvGiNKW+ADjshHXTlAnWqdorQV2mWdQxw8xnleaekzyXXaPBDcXfcmhoIkfTn+o7i2RhfkOi4X2efSklo4S/pFKkvKZ1XWifc9Dc/w4PxOm+9UcYew/Qq1zRllgPhAnAz0wi5fFLetmIiFhIP/EgA8Xx5LrGYJtqFWU6w811V8XPeq7l4H2RB3KvzCyT8GXJkZy7Uc69Gy6mXj/tM0v2u3h+XCRvFs5mNEC2S+ZFgtMnYJFeAirLlGpRdpV1T5RJYpLgU5BdLX0jpSC1EQ0GmE9VJToKq0TWne4Qpsmo2bHsCFGA== 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=P/gQUecjmUIXcFxGyiQCISSL3PpZkXQ3e1+ugN/Zmdg=; b=LiynMpRPETIu8unDhnEbUlYWCi0tObFex04Q8gFsFqEwmv4H3m1+EhsHmBIda/2SqgZjusHdkU4Korwlzjyrr7KuGvAgMSs0clFrHG4fzJ+KPkNfISRXkUqihyFFhpqdwt4d+9Qzgo+XxyHbafF8mxUThc1FXOny0NtNppi0EoOZJU0OHSwKR12hszaNITp+NUpB1x0l5brLRXc4c7KQA+Xl7f9JCZH+n06oHZfWy2PmzyvZ6p3xwWrmpR2oODGhqG14h+ciFkN9bm6bqvhb8fuJxc7PuA1KwUebHNkvTmVWlkrA6mreDLPXKNFw8b8TcbfuvvnyKy3Aya4Uf83Exw== 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 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=P/gQUecjmUIXcFxGyiQCISSL3PpZkXQ3e1+ugN/Zmdg=; b=pdHjsMPCAlspwQ92YLcDeVPD0mzApvPgHYWFrClBvsdeySwIYg2qpvDS4y/N+a+Cmk5phmXP7+yejaFKGgHLFyDZlOFoqUSw+XS32Y+SnrzH8JzFk6gpJhwVMAHP6AlNCiUYEbyxDq7c8cDFWwm6xkJlMiT31DdcGP9u255vI1c7OtJTffI3pMkwhgnoXKnNpfTsfTWbFYfvOyu75sBpIISNq9bGH0KokcUrnv8cM3yUGGhmGUzbdqU2iQGtzRazSh+wMZrMK5iMjrubLKSgGvzddm7zSbxHtlgaZOsz9KFt85XKNjyC1dQXPTYTnZGNMZ3FS4kayp9hs1m6zRNYoQ== Received: from BN8PR03CA0033.namprd03.prod.outlook.com (2603:10b6:408:94::46) by DS7PR12MB5813.namprd12.prod.outlook.com (2603:10b6:8:75::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Thu, 6 Oct 2022 15:04:33 +0000 Received: from BN8NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::86) by BN8PR03CA0033.outlook.office365.com (2603:10b6:408:94::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.26 via Frontend Transport; Thu, 6 Oct 2022 15:04:33 +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 BN8NAM11FT005.mail.protection.outlook.com (10.13.176.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10 via Frontend Transport; Thu, 6 Oct 2022 15:04:32 +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.986.26; Thu, 6 Oct 2022 08:04:06 -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.986.29; Thu, 6 Oct 2022 08:04:02 -0700 From: Alex Vesker To: , , , , Matan Azrad CC: , Subject: [v2 08/19] net/mlx5: Remove stub HWS support Date: Thu, 6 Oct 2022 18:03:14 +0300 Message-ID: <20221006150325.660-9-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20221006150325.660-1-valex@nvidia.com> References: <20220922190345.394-1-valex@nvidia.com> <20221006150325.660-1-valex@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT005:EE_|DS7PR12MB5813:EE_ X-MS-Office365-Filtering-Correlation-Id: 54008cfb-75f3-4253-234c-08daa7ac139f 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: kZKwP81spDyDS5Siu5FNw9hgri//QiDpqz5aaxKy0+4PLlHntCQpu9ThOMChwYUvxQV5zs76uJZZrHoZzze07/+TbgVsur7KIfJJbedy4gSXwLaV7BCv4sAK2HolznyEypdmmkyv+Hl0VfouHKfa3/j0FuNhc4yMufGF+6Dh6enpWqp413ARY1d4ynYl8KTJvkKZMSe8NhkIyJlmgodGZg9jxXMz5u6dxCgWPvdL2+dttvCTHfy9OkPfjSQbTLJqZcQY+HhbMsW3u2xNI2puCURNIQ0A4lMHtkYYwaqgSnz5AkA+Gv6Rr4hn6bxInD3PsM1pNhvM7DvwbAUtFJatjId/CsFfaNOHcb4eHv5FTtmMU7AbyB9se4njIdHdSTEIyrRLcq/Ax3fyd3j4MGskZj/W9PyB0HRBXQy7N+xKjYmW43i7fCKhBAqnjlXp+PcPbZkw6fX8CwVvspE/cm+I8XE9xMlAaozK4cfrzJ8l8nBtd/wceEjFf/dlHtAyLC13Gs6TMcWw2W0zwBcJ1DnlNUhv1IFNBdH9sKx83jfK+8TYVBezm5Zqzu3uSXR/ooJciVF6FtEPKu30p0D8EHfESSlM8HQoZjeA23aotnIaidYcpMs5YNFUb68BiojWtmss4TGuAFKqEiHFf/oUrGEefuAxOyf3BvZ39pNywAvR1gzFIN9trmInUUwO8MVKQS69FzDVPyiZjdokM2KiEdkA6ndMqtLtS6nNyi2lpBC4DtEgi+d8g1CkTyg2+8YuQyqTHYH465dC7plfIMSBLLqE3Q== 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:(13230022)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199015)(40470700004)(36840700001)(46966006)(2906002)(70206006)(70586007)(82310400005)(41300700001)(54906003)(5660300002)(36756003)(316002)(478600001)(8676002)(110136005)(4326008)(40480700001)(86362001)(6636002)(356005)(6666004)(7696005)(82740400003)(26005)(107886003)(6286002)(55016003)(16526019)(8936002)(336012)(47076005)(426003)(1076003)(2616005)(40460700003)(30864003)(186003)(83380400001)(36860700001)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2022 15:04:32.9725 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54008cfb-75f3-4253-234c-08daa7ac139f 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: BN8NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5813 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 This change brakes compilation, which is bad, but it will be fixed for the final submission. Signed-off-by: Alex Vesker --- drivers/net/mlx5/meson.build | 1 - drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_dr.c | 383 ----------------------------- drivers/net/mlx5/mlx5_dr.h | 456 ----------------------------------- 4 files changed, 841 deletions(-) delete mode 100644 drivers/net/mlx5/mlx5_dr.c delete mode 100644 drivers/net/mlx5/mlx5_dr.h diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 6a84d96380..c7ddd4b65c 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -14,7 +14,6 @@ sources = files( 'mlx5.c', 'mlx5_ethdev.c', 'mlx5_flow.c', - 'mlx5_dr.c', 'mlx5_flow_meter.c', 'mlx5_flow_dv.c', 'mlx5_flow_hw.c', diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index ea63c29bf9..29657ab273 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -34,7 +34,6 @@ #include "mlx5_os.h" #include "mlx5_autoconf.h" #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) -#include "mlx5_dr.h" #endif #define MLX5_SH(dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh) diff --git a/drivers/net/mlx5/mlx5_dr.c b/drivers/net/mlx5/mlx5_dr.c deleted file mode 100644 index 7218708986..0000000000 --- a/drivers/net/mlx5/mlx5_dr.c +++ /dev/null @@ -1,383 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. - */ -#include - -#include "mlx5_defs.h" -#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) -#include "mlx5_dr.h" - -/* - * The following null stubs are prepared in order not to break the linkage - * before the HW steering low-level implementation is added. - */ - -/* Open a context used for direct rule insertion using hardware steering. - * Each context can contain multiple tables of different types. - * - * @param[in] ibv_ctx - * The ibv context to used for HWS. - * @param[in] attr - * Attributes used for context open. - * @return pointer to mlx5dr_context on success NULL otherwise. - */ -__rte_weak struct mlx5dr_context * -mlx5dr_context_open(void *ibv_ctx, - struct mlx5dr_context_attr *attr) -{ - (void)ibv_ctx; - (void)attr; - return NULL; -} - -/* Close a context used for direct hardware steering. - * - * @param[in] ctx - * mlx5dr context to close. - * @return zero on success non zero otherwise. - */ -__rte_weak int -mlx5dr_context_close(struct mlx5dr_context *ctx) -{ - (void)ctx; - return 0; -} - -/* Create a new direct rule table. Each table can contain multiple matchers. - * - * @param[in] ctx - * The context in which the new table will be opened. - * @param[in] attr - * Attributes used for table creation. - * @return pointer to mlx5dr_table on success NULL otherwise. - */ -__rte_weak struct mlx5dr_table * -mlx5dr_table_create(struct mlx5dr_context *ctx, - struct mlx5dr_table_attr *attr) -{ - (void)ctx; - (void)attr; - return NULL; -} - -/* Destroy direct rule table. - * - * @param[in] tbl - * mlx5dr table to destroy. - * @return zero on success non zero otherwise. - */ -__rte_weak int mlx5dr_table_destroy(struct mlx5dr_table *tbl) -{ - (void)tbl; - return 0; -} - -/* Create new match template based on items mask, the match template - * will be used for matcher creation. - * - * @param[in] items - * Describe the mask for template creation - * @param[in] flags - * Template creation flags - * @return pointer to mlx5dr_match_template on success NULL otherwise - */ -__rte_weak struct mlx5dr_match_template * -mlx5dr_match_template_create(const struct rte_flow_item items[], - enum mlx5dr_match_template_flags flags) -{ - (void)items; - (void)flags; - return NULL; -} - -/* Destroy match template. - * - * @param[in] mt - * Match template to destroy. - * @return zero on success non zero otherwise. - */ -__rte_weak int -mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt) -{ - (void)mt; - return 0; -} - -/* Create a new direct rule matcher. Each matcher can contain multiple rules. - * Matchers on the table will be processed by priority. Matching fields and - * mask are described by the match template. In some cases multiple match - * templates can be used on the same matcher. - * - * @param[in] table - * The table in which the new matcher will be opened. - * @param[in] mt - * Array of match templates to be used on matcher. - * @param[in] num_of_mt - * Number of match templates in mt array. - * @param[in] attr - * Attributes used for matcher creation. - * @return pointer to mlx5dr_matcher on success NULL otherwise. - */ -__rte_weak struct mlx5dr_matcher * -mlx5dr_matcher_create(struct mlx5dr_table *table __rte_unused, - struct mlx5dr_match_template *mt[] __rte_unused, - uint8_t num_of_mt __rte_unused, - struct mlx5dr_matcher_attr *attr __rte_unused) -{ - return NULL; -} - -/* Destroy direct rule matcher. - * - * @param[in] matcher - * Matcher to destroy. - * @return zero on success non zero otherwise. - */ -__rte_weak int -mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher __rte_unused) -{ - return 0; -} - -/* Enqueue create rule operation. - * - * @param[in] matcher - * The matcher in which the new rule will be created. - * @param[in] mt_idx - * Match template index to create the rule with. - * @param[in] items - * The items used for the value matching. - * @param[in] rule_actions - * Rule action to be executed on match. - * @param[in] num_of_actions - * Number of rule actions. - * @param[in] attr - * Rule creation attributes. - * @param[in, out] rule_handle - * A valid rule handle. The handle doesn't require any initialization. - * @return zero on successful enqueue non zero otherwise. - */ -__rte_weak int -mlx5dr_rule_create(struct mlx5dr_matcher *matcher __rte_unused, - uint8_t mt_idx __rte_unused, - const struct rte_flow_item items[] __rte_unused, - struct mlx5dr_rule_action rule_actions[] __rte_unused, - uint8_t num_of_actions __rte_unused, - struct mlx5dr_rule_attr *attr __rte_unused, - struct mlx5dr_rule *rule_handle __rte_unused) -{ - return 0; -} - -/* Enqueue destroy rule operation. - * - * @param[in] rule - * The rule destruction to enqueue. - * @param[in] attr - * Rule destruction attributes. - * @return zero on successful enqueue non zero otherwise. - */ -__rte_weak int -mlx5dr_rule_destroy(struct mlx5dr_rule *rule __rte_unused, - struct mlx5dr_rule_attr *attr __rte_unused) -{ - return 0; -} - -/* Create direct rule drop action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_dest_drop(struct mlx5dr_context *ctx __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule default miss action. - * Defaults are RX: Drop TX: Wire. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_default_miss(struct mlx5dr_context *ctx __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule goto table action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] tbl - * Destination table. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx __rte_unused, - struct mlx5dr_table *tbl __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule goto TIR action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] obj - * Direct rule TIR devx object. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx __rte_unused, - struct mlx5dr_devx_obj *obj __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule TAG action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_tag(struct mlx5dr_context *ctx __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule counter action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] obj - * Direct rule counter devx object. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_counter(struct mlx5dr_context *ctx, - struct mlx5dr_devx_obj *obj, - uint32_t flags); - -/* Create direct rule reformat action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] reformat_type - * Type of reformat. - * @param[in] data_sz - * Size in bytes of data. - * @param[in] inline_data - * Header data array in case of inline action. - * @param[in] log_bulk_size - * Number of unique values used with this pattern. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_reformat(struct mlx5dr_context *ctx __rte_unused, - enum mlx5dr_action_reformat_type reformat_type __rte_unused, - size_t data_sz __rte_unused, - void *inline_data __rte_unused, - uint32_t log_bulk_size __rte_unused, - uint32_t flags __rte_unused) -{ - return NULL; -} - -/* Create direct rule modify header action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] pattern_sz - * Byte size of the pattern array. - * @param[in] pattern - * PRM format modify pattern action array. - * @param[in] log_bulk_size - * Number of unique values used with this pattern. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -__rte_weak struct mlx5dr_action * -mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx, - size_t pattern_sz, - rte_be64_t pattern[], - uint32_t log_bulk_size, - uint32_t flags); - -/* Destroy direct rule action. - * - * @param[in] action - * The action to destroy. - * @return zero on success non zero otherwise. - */ -__rte_weak int -mlx5dr_action_destroy(struct mlx5dr_action *action __rte_unused) -{ - return 0; -} - -/* Poll queue for rule creation and deletions completions. - * - * @param[in] ctx - * The context to which the queue belong to. - * @param[in] queue_id - * The id of the queue to poll. - * @param[in, out] res - * Completion array. - * @param[in] res_nb - * Maximum number of results to return. - * @return negative number on failure, the number of completions otherwise. - */ -__rte_weak int -mlx5dr_send_queue_poll(struct mlx5dr_context *ctx __rte_unused, - uint16_t queue_id __rte_unused, - struct rte_flow_op_result res[] __rte_unused, - uint32_t res_nb __rte_unused) -{ - return 0; -} - -/* Perform an action on the queue - * - * @param[in] ctx - * The context to which the queue belong to. - * @param[in] queue_id - * The id of the queue to perform the action on. - * @param[in] actions - * Actions to perform on the queue. (enum mlx5dr_send_queue_actions) - * @return zero on success non zero otherwise. - */ -__rte_weak int -mlx5dr_send_queue_action(struct mlx5dr_context *ctx __rte_unused, - uint16_t queue_id __rte_unused, - uint32_t actions __rte_unused) -{ - return 0; -} - -#endif diff --git a/drivers/net/mlx5/mlx5_dr.h b/drivers/net/mlx5/mlx5_dr.h deleted file mode 100644 index d0b2c15652..0000000000 --- a/drivers/net/mlx5/mlx5_dr.h +++ /dev/null @@ -1,456 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. - */ - -#ifndef MLX5_DR_H_ -#define MLX5_DR_H_ - -#include - -struct mlx5dr_context; -struct mlx5dr_table; -struct mlx5dr_matcher; -struct mlx5dr_rule; - -enum mlx5dr_table_type { - MLX5DR_TABLE_TYPE_NIC_RX, - MLX5DR_TABLE_TYPE_NIC_TX, - MLX5DR_TABLE_TYPE_FDB, - MLX5DR_TABLE_TYPE_MAX, -}; - -enum mlx5dr_matcher_resource_mode { - /* Allocate resources based on number of rules with minimal failure probability */ - MLX5DR_MATCHER_RESOURCE_MODE_RULE, - /* Allocate fixed size hash table based on given column and rows */ - MLX5DR_MATCHER_RESOURCE_MODE_HTABLE, -}; - -enum mlx5dr_action_flags { - MLX5DR_ACTION_FLAG_ROOT_RX = 1 << 0, - MLX5DR_ACTION_FLAG_ROOT_TX = 1 << 1, - MLX5DR_ACTION_FLAG_ROOT_FDB = 1 << 2, - MLX5DR_ACTION_FLAG_HWS_RX = 1 << 3, - MLX5DR_ACTION_FLAG_HWS_TX = 1 << 4, - MLX5DR_ACTION_FLAG_HWS_FDB = 1 << 5, - MLX5DR_ACTION_FLAG_INLINE = 1 << 6, -}; - -enum mlx5dr_action_reformat_type { - MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2, - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2, - MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2, - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3, -}; - -enum mlx5dr_match_template_flags { - /* Allow relaxed matching by skipping derived dependent match fields. */ - MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH = 1, -}; - -enum mlx5dr_send_queue_actions { - /* Start executing all pending queued rules and write to HW */ - MLX5DR_SEND_QUEUE_ACTION_DRAIN = 1 << 0, -}; - -struct mlx5dr_context_attr { - uint16_t queues; - uint16_t queue_size; - size_t initial_log_ste_memory; - /* Optional PD used for allocating res ources */ - struct ibv_pd *pd; -}; - -struct mlx5dr_table_attr { - enum mlx5dr_table_type type; - uint32_t level; -}; - -struct mlx5dr_matcher_attr { - uint32_t priority; - enum mlx5dr_matcher_resource_mode mode; - union { - struct { - uint8_t sz_row_log; - uint8_t sz_col_log; - } table; - - struct { - uint8_t num_log; - } rule; - }; -}; - -struct mlx5dr_rule_attr { - uint16_t queue_id; - void *user_data; - uint32_t burst:1; -}; - -struct mlx5dr_devx_obj { - struct mlx5dv_devx_obj *obj; - uint32_t id; -}; - -struct mlx5dr_rule_action { - struct mlx5dr_action *action; - union { - struct { - uint32_t value; - } tag; - - struct { - uint32_t offset; - } counter; - - struct { - uint32_t offset; - uint8_t *data; - } modify_header; - - struct { - uint32_t offset; - uint8_t *data; - } reformat; - - struct { - rte_be32_t vlan_hdr; - } push_vlan; - }; -}; - -enum { - MLX5DR_MATCH_TAG_SZ = 32, - MLX5DR_JAMBO_TAG_SZ = 44, -}; - -enum mlx5dr_rule_status { - MLX5DR_RULE_STATUS_UNKNOWN, - MLX5DR_RULE_STATUS_CREATING, - MLX5DR_RULE_STATUS_CREATED, - MLX5DR_RULE_STATUS_DELETING, - MLX5DR_RULE_STATUS_DELETED, - MLX5DR_RULE_STATUS_FAILED, -}; - -struct mlx5dr_rule { - struct mlx5dr_matcher *matcher; - union { - uint8_t match_tag[MLX5DR_MATCH_TAG_SZ]; - struct ibv_flow *flow; - }; - enum mlx5dr_rule_status status; - uint32_t rtc_used; /* The RTC into which the STE was inserted */ -}; - -/* Open a context used for direct rule insertion using hardware steering. - * Each context can contain multiple tables of different types. - * - * @param[in] ibv_ctx - * The ibv context to used for HWS. - * @param[in] attr - * Attributes used for context open. - * @return pointer to mlx5dr_context on success NULL otherwise. - */ -struct mlx5dr_context * -mlx5dr_context_open(void *ibv_ctx, - struct mlx5dr_context_attr *attr); - -/* Close a context used for direct hardware steering. - * - * @param[in] ctx - * mlx5dr context to close. - * @return zero on success non zero otherwise. - */ -int mlx5dr_context_close(struct mlx5dr_context *ctx); - -/* Create a new direct rule table. Each table can contain multiple matchers. - * - * @param[in] ctx - * The context in which the new table will be opened. - * @param[in] attr - * Attributes used for table creation. - * @return pointer to mlx5dr_table on success NULL otherwise. - */ -struct mlx5dr_table * -mlx5dr_table_create(struct mlx5dr_context *ctx, - struct mlx5dr_table_attr *attr); - -/* Destroy direct rule table. - * - * @param[in] tbl - * mlx5dr table to destroy. - * @return zero on success non zero otherwise. - */ -int mlx5dr_table_destroy(struct mlx5dr_table *tbl); - -/* Create new match template based on items mask, the match template - * will be used for matcher creation. - * - * @param[in] items - * Describe the mask for template creation - * @param[in] flags - * Template creation flags - * @return pointer to mlx5dr_match_template on success NULL otherwise - */ -struct mlx5dr_match_template * -mlx5dr_match_template_create(const struct rte_flow_item items[], - enum mlx5dr_match_template_flags flags); - -/* Destroy match template. - * - * @param[in] mt - * Match template to destroy. - * @return zero on success non zero otherwise. - */ -int mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt); - -/* Create a new direct rule matcher. Each matcher can contain multiple rules. - * Matchers on the table will be processed by priority. Matching fields and - * mask are described by the match template. In some cases multiple match - * templates can be used on the same matcher. - * - * @param[in] table - * The table in which the new matcher will be opened. - * @param[in] mt - * Array of match templates to be used on matcher. - * @param[in] num_of_mt - * Number of match templates in mt array. - * @param[in] attr - * Attributes used for matcher creation. - * @return pointer to mlx5dr_matcher on success NULL otherwise. - */ -struct mlx5dr_matcher * -mlx5dr_matcher_create(struct mlx5dr_table *table, - struct mlx5dr_match_template *mt[], - uint8_t num_of_mt, - struct mlx5dr_matcher_attr *attr); - -/* Destroy direct rule matcher. - * - * @param[in] matcher - * Matcher to destroy. - * @return zero on success non zero otherwise. - */ -int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher); - -/* Get the size of the rule handle (mlx5dr_rule) to be used on rule creation. - * - * @return size in bytes of rule handle struct. - */ -size_t mlx5dr_rule_get_handle_size(void); - -/* Enqueue create rule operation. - * - * @param[in] matcher - * The matcher in which the new rule will be created. - * @param[in] mt_idx - * Match template index to create the rule with. - * @param[in] items - * The items used for the value matching. - * @param[in] rule_actions - * Rule action to be executed on match. - * @param[in] num_of_actions - * Number of rule actions. - * @param[in] attr - * Rule creation attributes. - * @param[in, out] rule_handle - * A valid rule handle. The handle doesn't require any initialization. - * @return zero on successful enqueue non zero otherwise. - */ -int mlx5dr_rule_create(struct mlx5dr_matcher *matcher, - uint8_t mt_idx, - const struct rte_flow_item items[], - struct mlx5dr_rule_action rule_actions[], - uint8_t num_of_actions, - struct mlx5dr_rule_attr *attr, - struct mlx5dr_rule *rule_handle); - -/* Enqueue destroy rule operation. - * - * @param[in] rule - * The rule destruction to enqueue. - * @param[in] attr - * Rule destruction attributes. - * @return zero on successful enqueue non zero otherwise. - */ -int mlx5dr_rule_destroy(struct mlx5dr_rule *rule, - struct mlx5dr_rule_attr *attr); - -/* Create direct rule drop action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_dest_drop(struct mlx5dr_context *ctx, - uint32_t flags); - -/* Create direct rule default miss action. - * Defaults are RX: Drop TX: Wire. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_default_miss(struct mlx5dr_context *ctx, - uint32_t flags); - -/* Create direct rule goto table action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] tbl - * Destination table. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, - struct mlx5dr_table *tbl, - uint32_t flags); - -/* Create direct rule goto TIR action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] obj - * Direct rule TIR devx object. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, - struct mlx5dr_devx_obj *obj, - uint32_t flags); - -/* Create direct rule TAG action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_tag(struct mlx5dr_context *ctx, - uint32_t flags); - -/* Create direct rule counter action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] obj - * Direct rule counter devx object. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_counter(struct mlx5dr_context *ctx, - struct mlx5dr_devx_obj *obj, - uint32_t flags); - -/* Create direct rule reformat action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] reformat_type - * Type of reformat. - * @param[in] data_sz - * Size in bytes of data. - * @param[in] inline_data - * Header data array in case of inline action. - * @param[in] log_bulk_size - * Number of unique values used with this pattern. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_reformat(struct mlx5dr_context *ctx, - enum mlx5dr_action_reformat_type reformat_type, - size_t data_sz, - void *inline_data, - uint32_t log_bulk_size, - uint32_t flags); - -/* Create direct rule modify header action. - * - * @param[in] ctx - * The context in which the new action will be created. - * @param[in] pattern_sz - * Byte size of the pattern array. - * @param[in] pattern - * PRM format modify pattern action array. - * @param[in] log_bulk_size - * Number of unique values used with this pattern. - * @param[in] flags - * Action creation flags. (enum mlx5dr_action_flags) - * @return pointer to mlx5dr_action on success NULL otherwise. - */ -struct mlx5dr_action * -mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx, - size_t pattern_sz, - rte_be64_t pattern[], - uint32_t log_bulk_size, - uint32_t flags); - -/* Destroy direct rule action. - * - * @param[in] action - * The action to destroy. - * @return zero on success non zero otherwise. - */ -int mlx5dr_action_destroy(struct mlx5dr_action *action); - -/* Poll queue for rule creation and deletions completions. - * - * @param[in] ctx - * The context to which the queue belong to. - * @param[in] queue_id - * The id of the queue to poll. - * @param[in, out] res - * Completion array. - * @param[in] res_nb - * Maximum number of results to return. - * @return negative number on failure, the number of completions otherwise. - */ -int mlx5dr_send_queue_poll(struct mlx5dr_context *ctx, - uint16_t queue_id, - struct rte_flow_op_result res[], - uint32_t res_nb); - -/* Perform an action on the queue - * - * @param[in] ctx - * The context to which the queue belong to. - * @param[in] queue_id - * The id of the queue to perform the action on. - * @param[in] actions - * Actions to perform on the queue. (enum mlx5dr_send_queue_actions) - * @return zero on success non zero otherwise. - */ -int mlx5dr_send_queue_action(struct mlx5dr_context *ctx, - uint16_t queue_id, - uint32_t actions); - -/* Dump HWS info - * - * @param[in] ctx - * The context which to dump the info from. - * @param[in] f - * The file to write the dump to. - * @return zero on success non zero otherwise. - */ -int mlx5dr_debug_dump(struct mlx5dr_context *ctx, FILE *f); - -#endif