- Remove table scope data from session. Added to EEM.
- Complete move to RM of table scope base and range.
- Fix some err messaging strings.
- Fix the tcam logging message.
Signed-off-by: Peter Spreadborough <peter.spreadborough@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
rc = dev->ops->tf_dev_free_tcam(tfp, &fparms);
if (rc) {
TFP_DRV_LOG(ERR,
- "%s: TCAM allocation failed, rc:%s\n",
+ "%s: TCAM free failed, rc:%s\n",
tf_dir_2_str(parms->dir),
strerror(-rc));
return rc;
#include "tf_core.h"
#include "tf_session.h"
-#define TF_HACK_TBL_SCOPE_BASE 68
#define SUPPORT_CFA_HW_P4 1
#define SUPPORT_CFA_HW_P58 0
#define SUPPORT_CFA_HW_P59 0
*/
void *eem_db[TF_DIR_MAX];
+#define TF_EEM_DB_TBL_SCOPE 1
+
/**
* Init flag, set on bind and cleared on unbind
*/
*/
static enum tf_mem_type mem_type;
+/** Table scope array */
+struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
+
/* API defined in tf_em.h */
struct tf_tbl_scope_cb *
-tbl_scope_cb_find(struct tf_session *session,
- uint32_t tbl_scope_id)
+tbl_scope_cb_find(uint32_t tbl_scope_id)
{
int i;
struct tf_rm_is_allocated_parms parms;
/* Check that id is valid */
parms.rm_db = eem_db[TF_DIR_RX];
- parms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/;
- parms.index = tbl_scope_id + TF_HACK_TBL_SCOPE_BASE;
+ parms.db_index = TF_EEM_DB_TBL_SCOPE;
+ parms.index = tbl_scope_id;
parms.allocated = &allocated;
i = tf_rm_is_allocated(&parms);
return NULL;
for (i = 0; i < TF_NUM_TBL_SCOPE; i++) {
- if (session->tbl_scopes[i].tbl_scope_id == tbl_scope_id)
- return &session->tbl_scopes[i];
+ if (tbl_scopes[i].tbl_scope_id == tbl_scope_id)
+ return &tbl_scopes[i];
}
return NULL;
* Function to search for table scope control block structure
* with specified table scope ID.
*
- * [in] session
- * Session to use for the search of the table scope control block
* [in] tbl_scope_id
* Table scope ID to search for
*
* Pointer to the found table scope control block struct or NULL if
* table scope control block struct not found
*/
-struct tf_tbl_scope_cb *tbl_scope_cb_find(struct tf_session *session,
- uint32_t tbl_scope_id);
+struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
/**
* Create and initialize a stack to use for action entries
* EM DBs.
*/
extern void *eem_db[TF_DIR_MAX];
+#define TF_EEM_DB_TBL_SCOPE 1
+
+extern struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
/**
* Function to free a page table
* -EINVAL - Error
*/
int
-tf_em_insert_ext_entry(struct tf *tfp,
+tf_em_insert_ext_entry(struct tf *tfp __rte_unused,
struct tf_insert_em_entry_parms *parms)
{
struct tf_tbl_scope_cb *tbl_scope_cb;
- tbl_scope_cb =
- tbl_scope_cb_find((struct tf_session *)(tfp->session->core_data),
- parms->tbl_scope_id);
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
if (tbl_scope_cb == NULL) {
TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n");
return -EINVAL;
* -EINVAL - Error
*/
int
-tf_em_delete_ext_entry(struct tf *tfp,
+tf_em_delete_ext_entry(struct tf *tfp __rte_unused,
struct tf_delete_em_entry_parms *parms)
{
struct tf_tbl_scope_cb *tbl_scope_cb;
- tbl_scope_cb =
- tbl_scope_cb_find((struct tf_session *)(tfp->session->core_data),
- parms->tbl_scope_id);
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
if (tbl_scope_cb == NULL) {
TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n");
return -EINVAL;
enum tf_dir dir;
struct tf_tbl_scope_cb *tbl_scope_cb;
struct hcapi_cfa_em_table *em_tables;
- struct tf_session *session;
struct tf_free_tbl_scope_parms free_parms;
struct tf_rm_allocate_parms aparms = { 0 };
struct tf_rm_free_parms fparms = { 0 };
- session = (struct tf_session *)tfp->session->core_data;
-
/* Get Table Scope control block from the session pool */
aparms.rm_db = eem_db[TF_DIR_RX];
- aparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/;
+ aparms.db_index = TF_EEM_DB_TBL_SCOPE;
aparms.index = (uint32_t *)&parms->tbl_scope_id;
rc = tf_rm_allocate(&aparms);
if (rc) {
return rc;
}
- parms->tbl_scope_id -= TF_HACK_TBL_SCOPE_BASE;
- tbl_scope_cb = &session->tbl_scopes[parms->tbl_scope_id];
+ tbl_scope_cb = &tbl_scopes[parms->tbl_scope_id];
tbl_scope_cb->index = parms->tbl_scope_id;
tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
cleanup:
/* Free Table control block */
fparms.rm_db = eem_db[TF_DIR_RX];
- fparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/;
- fparms.index = parms->tbl_scope_id + TF_HACK_TBL_SCOPE_BASE;
+ fparms.db_index = TF_EEM_DB_TBL_SCOPE;
+ fparms.index = parms->tbl_scope_id;
tf_rm_free(&fparms);
return -EINVAL;
}
int rc = 0;
enum tf_dir dir;
struct tf_tbl_scope_cb *tbl_scope_cb;
- struct tf_session *session;
struct tf_rm_free_parms aparms = { 0 };
- session = (struct tf_session *)(tfp->session->core_data);
-
- tbl_scope_cb = tbl_scope_cb_find(session,
- parms->tbl_scope_id);
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
if (tbl_scope_cb == NULL) {
TFP_DRV_LOG(ERR, "Table scope error\n");
/* Free Table control block */
aparms.rm_db = eem_db[TF_DIR_RX];
- aparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/;
- aparms.index = parms->tbl_scope_id + TF_HACK_TBL_SCOPE_BASE;
+ aparms.db_index = TF_EEM_DB_TBL_SCOPE;
+ aparms.index = parms->tbl_scope_id;
rc = tf_rm_free(&aparms);
if (rc) {
TFP_DRV_LOG(ERR,
tf_em_ctx_unreg(tfp, tbl_scope_cb, dir);
}
+ tbl_scopes[parms->tbl_scope_id].tbl_scope_id = -1;
return rc;
}
* -EINVAL - Error
*/
int
-tf_em_insert_ext_sys_entry(struct tf *tfp,
+tf_em_insert_ext_sys_entry(struct tf *tfp __rte_unused,
struct tf_insert_em_entry_parms *parms)
{
struct tf_tbl_scope_cb *tbl_scope_cb;
- tbl_scope_cb = tbl_scope_cb_find
- ((struct tf_session *)(tfp->session->core_data),
- parms->tbl_scope_id);
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
if (tbl_scope_cb == NULL) {
TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n");
return -EINVAL;
* -EINVAL - Error
*/
int
-tf_em_delete_ext_sys_entry(struct tf *tfp,
+tf_em_delete_ext_sys_entry(struct tf *tfp __rte_unused,
struct tf_delete_em_entry_parms *parms)
{
struct tf_tbl_scope_cb *tbl_scope_cb;
- tbl_scope_cb = tbl_scope_cb_find
- ((struct tf_session *)(tfp->session->core_data),
- parms->tbl_scope_id);
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
if (tbl_scope_cb == NULL) {
TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n");
return -EINVAL;
/** Device handle */
struct tf_dev_info dev;
-
- /** Table scope array */
- struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
};
/**
rc = tf_msg_tcam_entry_free(tfp, parms);
if (rc) {
/* Log error */
- TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s",
+ TFP_DRV_LOG(ERR,
+ "%s: %s: Entry %d free failed, rc:%s\n",
tf_dir_2_str(parms->dir),
tf_tcam_tbl_2_str(parms->type),
parms->idx,
rc = tf_msg_tcam_entry_set(tfp, parms);
if (rc) {
/* Log error */
- TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s",
+ TFP_DRV_LOG(ERR,
+ "%s: %s: Entry %d set failed, rc:%s",
tf_dir_2_str(parms->dir),
tf_tcam_tbl_2_str(parms->type),
parms->idx,