net/bnxt: support EM with FKB
[dpdk.git] / drivers / net / bnxt / tf_core / tf_rm.h
index 3b818f2..291086c 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
+ * Copyright(c) 2019-2021 Broadcom
  * All rights reserved.
  */
 
 
 struct tf;
 
+/** RM return codes */
+#define TF_RM_ALLOCATED_ENTRY_FREE        0
+#define TF_RM_ALLOCATED_ENTRY_IN_USE      1
+#define TF_RM_ALLOCATED_NO_ENTRY_FOUND   -1
+
 /**
  * The Resource Manager (RM) module provides basic DB handling for
  * internal resources. These resources exists within the actual device
@@ -56,12 +61,18 @@ struct tf_rm_new_entry {
  * ULP layer that is not controlled by HCAPI within the Firmware.
  */
 enum tf_rm_elem_cfg_type {
-       /** No configuration */
+       /**
+        * No configuration
+        */
        TF_RM_ELEM_CFG_NULL,
-       /** HCAPI 'controlled', uses a Pool for internal storage */
+       /** HCAPI 'controlled', no RM storage thus the Device Module
+        *  using the RM can chose to handle storage locally.
+        */
        TF_RM_ELEM_CFG_HCAPI,
-       /** Private thus not HCAPI 'controlled', creates a Pool for storage */
-       TF_RM_ELEM_CFG_PRIVATE,
+       /** HCAPI 'controlled', uses a Bit Allocator Pool for internal
+        *  storage in the RM.
+        */
+       TF_RM_ELEM_CFG_HCAPI_BA,
        /**
         * Shared element thus it belongs to a shared FW Session and
         * is not controlled by the Host.
@@ -193,6 +204,10 @@ struct tf_rm_allocate_parms {
         *              available index)
         */
        uint32_t priority;
+       /**
+        * [in] Pointer to the allocated index before adjusted.
+        */
+       uint32_t *base_index;
 };
 
 /**
@@ -235,6 +250,10 @@ struct tf_rm_is_allocated_parms {
         * [in] Pointer to flag that indicates the state of the query
         */
        int *allocated;
+       /**
+        * [in] Pointer to the allocated index before adjusted.
+        */
+       uint32_t *base_index;
 };
 
 /**
@@ -295,6 +314,29 @@ struct tf_rm_get_inuse_count_parms {
        uint16_t *count;
 };
 
+/**
+ * Check if the indexes are in the range of reserved resource
+ */
+struct tf_rm_check_indexes_in_range_parms {
+       /**
+        * [in] RM DB Handle
+        */
+       void *rm_db;
+       /**
+        * [in] DB Index, indicates which DB entry to perform the
+        * action on.
+        */
+       uint16_t db_index;
+       /**
+        * [in] Starting index
+        */
+       uint16_t starting_index;
+       /**
+        * [in] number of entries
+        */
+       uint16_t num_entries;
+};
+
 /**
  * @page rm Resource Manager
  *
@@ -443,4 +485,18 @@ int tf_rm_get_hcapi_type(struct tf_rm_get_hcapi_parms *parms);
  */
 int tf_rm_get_inuse_count(struct tf_rm_get_inuse_count_parms *parms);
 
+/**
+ * Check if the requested indexes are in the range of reserved resource.
+ *
+ * [in] parms
+ *   Pointer to get inuse parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_rm_check_indexes_in_range(struct tf_rm_check_indexes_in_range_parms *parms);
+
+
 #endif /* TF_RM_NEW_H_ */