return 0;
}
-int
-tf_search_tbl_entry(struct tf *tfp,
- struct tf_search_tbl_entry_parms *parms)
-{
- int rc;
- struct tf_session *tfs;
- struct tf_dev_info *dev;
- struct tf_tbl_alloc_search_parms sparms;
-
- TF_CHECK_PARMS2(tfp, parms);
-
- /* Retrieve the session information */
- rc = tf_session_get_session(tfp, &tfs);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Failed to lookup session, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
- }
-
- /* Retrieve the device information */
- rc = tf_session_get_device(tfs, &dev);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Failed to lookup device, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
- }
-
- if (dev->ops->tf_dev_alloc_search_tbl == NULL) {
- rc = -EOPNOTSUPP;
- TFP_DRV_LOG(ERR,
- "%s: Operation not supported, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
- }
-
- memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms));
- sparms.dir = parms->dir;
- sparms.type = parms->type;
- sparms.result = parms->result;
- sparms.result_sz_in_bytes = parms->result_sz_in_bytes;
- sparms.alloc = parms->alloc;
- sparms.tbl_scope_id = parms->tbl_scope_id;
- rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: TBL allocation failed, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
- }
-
- /* Return the outputs from the search */
- parms->hit = sparms.hit;
- parms->search_status = sparms.search_status;
- parms->ref_cnt = sparms.ref_cnt;
- parms->idx = sparms.idx;
-
- return 0;
-}
-
int
tf_free_tbl_entry(struct tf *tfp,
struct tf_free_tbl_entry_parms *parms)
* @ref tf_get_shared_tbl_increment
*/
-/**
- * tf_alloc_tbl_entry parameter definition
- */
-struct tf_search_tbl_entry_parms {
- /**
- * [in] Receive or transmit direction
- */
- enum tf_dir dir;
- /**
- * [in] Type of the allocation
- */
- enum tf_tbl_type type;
- /**
- * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
- */
- uint32_t tbl_scope_id;
- /**
- * [in] Result data to search for
- */
- uint8_t *result;
- /**
- * [in] Result data size in bytes
- */
- uint16_t result_sz_in_bytes;
- /**
- * [in] Allocate on miss.
- */
- uint8_t alloc;
- /**
- * [out] Set if matching entry found
- */
- uint8_t hit;
- /**
- * [out] Search result status (hit, miss, reject)
- */
- enum tf_search_status search_status;
- /**
- * [out] Current ref count after allocation
- */
- uint16_t ref_cnt;
- /**
- * [out] Idx of allocated entry or found entry
- */
- uint32_t idx;
-};
-
-/**
- * search Table Entry (experimental)
- *
- * This function searches the shadow copy of an index table for a matching
- * entry. The result data must match for hit to be set. Only TruFlow core
- * data is accessed. If shadow_copy is not enabled, an error is returned.
- *
- * Implementation:
- *
- * A hash is performed on the result data and mapped to a shadow copy entry
- * where the result is populated. If the result matches the entry, hit is set,
- * ref_cnt is incremented (if alloc), and the search status indicates what
- * action the caller can take regarding setting the entry.
- *
- * search status should be used as follows:
- * - On MISS, the caller should set the result into the returned index.
- *
- * - On REJECT, the caller should reject the flow since there are no resources.
- *
- * - On Hit, the matching index is returned to the caller. Additionally, the
- * ref_cnt is updated.
- *
- * Also returns success or failure code.
- */
-int tf_search_tbl_entry(struct tf *tfp,
- struct tf_search_tbl_entry_parms *parms);
-
/**
* tf_alloc_tbl_entry parameter definition
*/
* [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
*/
uint32_t tbl_scope_id;
+
/**
- * [in] Enable search for matching entry. If the table type is
- * internal the shadow copy will be searched before
- * alloc. Session must be configured with shadow copy enabled.
- */
- uint8_t search_enable;
- /**
- * [in] Result data to search for (if search_enable)
- */
- uint8_t *result;
- /**
- * [in] Result data size in bytes (if search_enable)
- */
- uint16_t result_sz_in_bytes;
- /**
- * [out] If search_enable, set if matching entry found
- */
- uint8_t hit;
- /**
- * [out] Current ref count after allocation (if search_enable)
- */
- uint16_t ref_cnt;
- /**
- * [out] Idx of allocated entry or found entry (if search_enable)
+ * [out] Idx of allocated entry
*/
uint32_t idx;
};
* [in] Index to free
*/
uint32_t idx;
- /**
- * [out] Reference count after free, only valid if session has been
- * created with shadow_copy.
- */
- uint16_t ref_cnt;
};
/**
int (*tf_dev_free_ext_tbl)(struct tf *tfp,
struct tf_tbl_free_parms *parms);
- /**
- * Searches for the specified table type element in a shadow DB.
- *
- * This API searches for the specified table type element in a
- * device specific shadow DB. If the element is found the
- * reference count for the element is updated. If the element
- * is not found a new element is allocated from the table type
- * DB and then inserted into the shadow DB.
- *
- * [in] tfp
- * Pointer to TF handle
- *
- * [in] parms
- * Pointer to table allocation and search parameters
- *
- * Returns
- * - (0) if successful.
- * - (-EINVAL) on failure.
- */
- int (*tf_dev_alloc_search_tbl)(struct tf *tfp,
- struct tf_tbl_alloc_search_parms *parms);
-
/**
* Sets the specified table type element.
*
.tf_dev_alloc_tbl = NULL,
.tf_dev_free_ext_tbl = NULL,
.tf_dev_free_tbl = NULL,
- .tf_dev_alloc_search_tbl = NULL,
.tf_dev_set_tbl = NULL,
.tf_dev_set_ext_tbl = NULL,
.tf_dev_get_tbl = NULL,
.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
.tf_dev_free_tbl = tf_tbl_free,
.tf_dev_free_ext_tbl = tf_tbl_ext_free,
- .tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
.tf_dev_set_tbl = tf_tbl_set,
.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
.tf_dev_get_tbl = tf_tbl_get,
.tf_dev_alloc_tbl = NULL,
.tf_dev_free_ext_tbl = NULL,
.tf_dev_free_tbl = NULL,
- .tf_dev_alloc_search_tbl = NULL,
.tf_dev_set_tbl = NULL,
.tf_dev_set_ext_tbl = NULL,
.tf_dev_get_tbl = NULL,
.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
.tf_dev_free_tbl = tf_tbl_free,
.tf_dev_free_ext_tbl = tf_tbl_ext_free,
- .tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
.tf_dev_set_tbl = tf_tbl_set,
.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
.tf_dev_get_tbl = tf_tbl_get,
#include "bnxt.h"
+
+/** Invalid table scope id */
+#define TF_TBL_SCOPE_INVALID 0xffffffff
+
/* Number of pointers per page_size */
#define MAX_PAGE_PTRS(page_size) ((page_size) / sizeof(void *))
struct tf;
-/**
- * Table Shadow DBs
- */
-static void *shadow_tbl_db[TF_DIR_MAX];
-
/**
* Shadow init flag, set on bind and cleared on unbind
*/
return 0;
}
-int
-tf_tbl_alloc_search(struct tf *tfp,
- struct tf_tbl_alloc_search_parms *parms)
-{
- int rc = 0;
- TF_CHECK_PARMS2(tfp, parms);
-
- if (!shadow_init || !shadow_tbl_db[parms->dir]) {
- TFP_DRV_LOG(ERR, "%s: Shadow TBL not initialized.\n",
- tf_dir_2_str(parms->dir));
- return -EINVAL;
- }
-
- return rc;
-}
-
int
tf_tbl_set(struct tf *tfp,
struct tf_tbl_set_parms *parms)
* The Table module provides processing of Internal TF table types.
*/
-/** Invalid table scope id */
-#define TF_TBL_SCOPE_INVALID 0xffffffff
/**
* Table configuration parameters
* [in] Index to free
*/
uint32_t idx;
- /**
- * [out] Reference count after free, only valid if session has been
- * created with shadow_copy.
- */
- uint16_t ref_cnt;
-};
-
-/**
- * Table allocate search parameters
- */
-struct tf_tbl_alloc_search_parms {
- /**
- * [in] Receive or transmit direction
- */
- enum tf_dir dir;
- /**
- * [in] Type of the allocation
- */
- enum tf_tbl_type type;
- /**
- * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
- */
- uint32_t tbl_scope_id;
- /**
- * [in] Result data to search for
- */
- uint8_t *result;
- /**
- * [in] Result data size in bytes
- */
- uint16_t result_sz_in_bytes;
- /**
- * [in] Whether or not to allocate on MISS, 1 is allocate.
- */
- uint8_t alloc;
- /**
- * [out] If search_enable, set if matching entry found
- */
- uint8_t hit;
- /**
- * [out] The status of the search (REJECT, MISS, HIT)
- */
- enum tf_search_status search_status;
- /**
- * [out] Current ref count after allocation
- */
- uint16_t ref_cnt;
- /**
- * [out] Idx of allocated entry or found entry
- */
- uint32_t idx;
};
/**
int tf_tbl_free(struct tf *tfp,
struct tf_tbl_free_parms *parms);
-/**
- * Supported if Shadow DB is configured. Searches the Shadow DB for
- * any matching element. If found the refcount in the shadow DB is
- * updated accordingly. If not found a new element is allocated and
- * installed into the shadow DB.
- *
- * [in] tfp
- * Pointer to TF handle, used for HCAPI communication
- *
- * [in] parms
- * Pointer to parameters
- *
- * Returns
- * - (0) if successful.
- * - (-EINVAL) on failure.
- */
-int tf_tbl_alloc_search(struct tf *tfp,
- struct tf_tbl_alloc_search_parms *parms);
-
/**
* Configures the requested element by sending a firmware request which
* then installs it into the device internal structures.
aparms.type = glb_res->resource_type;
aparms.dir = glb_res->direction;
- aparms.search_enable = 0;
aparms.tbl_scope_id = tbl_scope_id;
/* Allocate the index tbl using tf api */
rc = tf_alloc_tbl_entry(tfp, &aparms);
if (rc) {
- BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+ BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
tf_dir_2_str(aparms.dir), aparms.type);
return rc;
}