net/bnxt: update TruFlow core index table
Update the TruFlow core index table and remove unused shadow table functionality. Signed-off-by: Farah Smith <farah.smith@broadcom.com> Reviewed-by: Peter Spreadborough <peter.spreadborough@broadcom.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
parent
14a4e2844b
commit
c6d273e9ab
@ -1105,71 +1105,6 @@ tf_alloc_tbl_entry(struct tf *tfp,
|
||||
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)
|
||||
|
@ -1622,79 +1622,6 @@ int tf_clear_tcam_shared_entries(struct tf *tfp,
|
||||
* @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
|
||||
*/
|
||||
@ -1711,30 +1638,9 @@ struct tf_alloc_tbl_entry_parms {
|
||||
* [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;
|
||||
};
|
||||
@ -1790,11 +1696,6 @@ struct tf_free_tbl_entry_parms {
|
||||
* [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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -347,28 +347,6 @@ struct tf_dev_ops {
|
||||
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.
|
||||
*
|
||||
|
@ -236,7 +236,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
|
||||
.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,
|
||||
@ -282,7 +281,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
|
||||
.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,
|
||||
|
@ -280,7 +280,6 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
|
||||
.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,
|
||||
@ -326,7 +325,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
|
||||
.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,
|
||||
|
@ -23,6 +23,10 @@
|
||||
|
||||
#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 *))
|
||||
|
||||
|
@ -26,11 +26,6 @@
|
||||
|
||||
struct tf;
|
||||
|
||||
/**
|
||||
* Table Shadow DBs
|
||||
*/
|
||||
static void *shadow_tbl_db[TF_DIR_MAX];
|
||||
|
||||
/**
|
||||
* Shadow init flag, set on bind and cleared on unbind
|
||||
*/
|
||||
@ -327,22 +322,6 @@ tf_tbl_free(struct tf *tfp __rte_unused,
|
||||
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)
|
||||
|
@ -15,8 +15,6 @@ struct tf;
|
||||
* The Table module provides processing of Internal TF table types.
|
||||
*/
|
||||
|
||||
/** Invalid table scope id */
|
||||
#define TF_TBL_SCOPE_INVALID 0xffffffff
|
||||
|
||||
/**
|
||||
* Table configuration parameters
|
||||
@ -86,57 +84,6 @@ struct tf_tbl_free_parms {
|
||||
* [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;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -326,25 +273,6 @@ int tf_tbl_alloc(struct tf *tfp,
|
||||
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.
|
||||
|
@ -189,13 +189,12 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user