@@ -617,25 +617,48 @@ tf_alloc_tbl_entry(struct tf *tfp,
return rc;
}
- if (dev->ops->tf_dev_alloc_tbl == NULL) {
- rc = -EOPNOTSUPP;
- TFP_DRV_LOG(ERR,
- "%s: Operation not supported, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return -EOPNOTSUPP;
- }
-
aparms.dir = parms->dir;
aparms.type = parms->type;
aparms.idx = &idx;
- rc = dev->ops->tf_dev_alloc_tbl(tfp, &aparms);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Table allocation failed, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
+ aparms.tbl_scope_id = parms->tbl_scope_id;
+
+ if (parms->type == TF_TBL_TYPE_EXT) {
+ if (dev->ops->tf_dev_alloc_ext_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_alloc_ext_tbl(tfp, &aparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: External table allocation failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+
+ } else {
+ if (dev->ops->tf_dev_alloc_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_alloc_tbl(tfp, &aparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Table allocation failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
}
parms->idx = idx;
@@ -677,25 +700,47 @@ tf_free_tbl_entry(struct tf *tfp,
return rc;
}
- if (dev->ops->tf_dev_free_tbl == NULL) {
- rc = -EOPNOTSUPP;
- TFP_DRV_LOG(ERR,
- "%s: Operation not supported, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return -EOPNOTSUPP;
- }
-
fparms.dir = parms->dir;
fparms.type = parms->type;
fparms.idx = parms->idx;
- rc = dev->ops->tf_dev_free_tbl(tfp, &fparms);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Table free failed, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
+ fparms.tbl_scope_id = parms->tbl_scope_id;
+
+ if (parms->type == TF_TBL_TYPE_EXT) {
+ if (dev->ops->tf_dev_free_ext_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_free_ext_tbl(tfp, &fparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Table free failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+ } else {
+ if (dev->ops->tf_dev_free_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_free_tbl(tfp, &fparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Table free failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
}
return 0;
@@ -735,27 +780,49 @@ tf_set_tbl_entry(struct tf *tfp,
return rc;
}
- if (dev->ops->tf_dev_set_tbl == NULL) {
- rc = -EOPNOTSUPP;
- TFP_DRV_LOG(ERR,
- "%s: Operation not supported, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return -EOPNOTSUPP;
- }
-
sparms.dir = parms->dir;
sparms.type = parms->type;
sparms.data = parms->data;
sparms.data_sz_in_bytes = parms->data_sz_in_bytes;
sparms.idx = parms->idx;
- rc = dev->ops->tf_dev_set_tbl(tfp, &sparms);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Table set failed, rc:%s\n",
- tf_dir_2_str(parms->dir),
- strerror(-rc));
- return rc;
+ sparms.tbl_scope_id = parms->tbl_scope_id;
+
+ if (parms->type == TF_TBL_TYPE_EXT) {
+ if (dev->ops->tf_dev_set_ext_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_set_ext_tbl(tfp, &sparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Table set failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
+ } else {
+ if (dev->ops->tf_dev_set_tbl == NULL) {
+ rc = -EOPNOTSUPP;
+ TFP_DRV_LOG(ERR,
+ "%s: Operation not supported, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return -EOPNOTSUPP;
+ }
+
+ rc = dev->ops->tf_dev_set_tbl(tfp, &sparms);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "%s: Table set failed, rc:%s\n",
+ tf_dir_2_str(parms->dir),
+ strerror(-rc));
+ return rc;
+ }
}
return rc;
@@ -211,10 +211,6 @@ enum tf_tbl_type {
TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC,
/** Wh+/SR Action _Modify L4 Dest Port */
TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST,
- /** Action Modify IPv6 Source */
- TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC,
- /** Action Modify IPv6 Destination */
- TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST,
/** Meter Profiles */
TF_TBL_TYPE_METER_PROF,
/** Meter Instance */
@@ -216,6 +216,26 @@ struct tf_dev_ops {
int (*tf_dev_alloc_tbl)(struct tf *tfp,
struct tf_tbl_alloc_parms *parms);
+ /**
+ * Allocation of a external table type element.
+ *
+ * This API allocates the specified table type element from a
+ * device specific table type DB. The allocated element is
+ * returned.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table allocation parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+ int (*tf_dev_alloc_ext_tbl)(struct tf *tfp,
+ struct tf_tbl_alloc_parms *parms);
+
/**
* Free of a table type element.
*
@@ -235,6 +255,25 @@ struct tf_dev_ops {
int (*tf_dev_free_tbl)(struct tf *tfp,
struct tf_tbl_free_parms *parms);
+ /**
+ * Free of a external table type element.
+ *
+ * This API free's a previous allocated table type element from a
+ * device specific table type DB.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table free parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+ 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.
*
@@ -276,6 +315,25 @@ struct tf_dev_ops {
int (*tf_dev_set_tbl)(struct tf *tfp,
struct tf_tbl_set_parms *parms);
+ /**
+ * Sets the specified external table type element.
+ *
+ * This API sets the specified element data by invoking the
+ * firmware.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table set parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+ int (*tf_dev_set_ext_tbl)(struct tf *tfp,
+ struct tf_tbl_set_parms *parms);
+
/**
* Retrieves the specified table type element.
*
@@ -85,10 +85,13 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
.tf_dev_get_tcam_slice_info = tf_dev_p4_get_tcam_slice_info,
.tf_dev_alloc_ident = NULL,
.tf_dev_free_ident = NULL,
+ .tf_dev_alloc_ext_tbl = NULL,
.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_get_bulk_tbl = NULL,
.tf_dev_alloc_tcam = NULL,
@@ -113,9 +116,12 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
.tf_dev_alloc_ident = tf_ident_alloc,
.tf_dev_free_ident = tf_ident_free,
.tf_dev_alloc_tbl = tf_tbl_alloc,
+ .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 = NULL,
.tf_dev_set_tbl = tf_tbl_set,
+ .tf_dev_set_ext_tbl = tf_tbl_ext_set,
.tf_dev_get_tbl = tf_tbl_get,
.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
.tf_dev_alloc_tcam = tf_tcam_alloc,
@@ -47,8 +47,6 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = {
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_DPORT },
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 },
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_D_IPV4 },
- { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_S_IPV6 },
- { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_D_IPV6 },
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER_PROF },
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER },
{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MIRROR },
@@ -456,4 +456,99 @@ int tf_em_ext_common_free(struct tf *tfp,
*/
int tf_em_ext_common_alloc(struct tf *tfp,
struct tf_alloc_tbl_scope_parms *parms);
+
+/**
+ * Allocate External Tbl entry from the scope pool.
+ *
+ * [in] tfp
+ * Pointer to Truflow Handle
+ * [in] parms
+ * Allocation parameters
+ *
+ * Return:
+ * 0 - Success, entry allocated - no search support
+ * -ENOMEM -EINVAL -EOPNOTSUPP
+ * - Failure, entry not allocated, out of resources
+ */
+int
+tf_tbl_ext_alloc(struct tf *tfp,
+ struct tf_tbl_alloc_parms *parms);
+
+/**
+ * Free External Tbl entry to the scope pool.
+ *
+ * [in] tfp
+ * Pointer to Truflow Handle
+ * [in] parms
+ * Allocation parameters
+ *
+ * Return:
+ * 0 - Success, entry freed
+ *
+ * - Failure, entry not successfully freed for these reasons
+ * -ENOMEM
+ * -EOPNOTSUPP
+ * -EINVAL
+ */
+int
+tf_tbl_ext_free(struct tf *tfp,
+ struct tf_tbl_free_parms *parms);
+
+/**
+ * Sets the specified external table type element.
+ *
+ * This API sets the specified element data by invoking the
+ * firmware.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table set parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+int tf_tbl_ext_set(struct tf *tfp,
+ struct tf_tbl_set_parms *parms);
+
+/**
+ * Sets the specified external table type element.
+ *
+ * This API sets the specified element data by invoking the
+ * firmware.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table set parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+int tf_tbl_ext_host_set(struct tf *tfp,
+ struct tf_tbl_set_parms *parms);
+
+/**
+ * Sets the specified external table type element.
+ *
+ * This API sets the specified element data by invoking the
+ * firmware.
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table set parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+int tf_tbl_ext_system_set(struct tf *tfp,
+ struct tf_tbl_set_parms *parms);
+
#endif /* _TF_EM_H_ */
@@ -29,8 +29,6 @@
*/
void *eem_db[TF_DIR_MAX];
-#define TF_EEM_DB_TBL_SCOPE 1
-
/**
* Init flag, set on bind and cleared on unbind
*/
@@ -54,13 +52,13 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)
/* Check that id is valid */
parms.rm_db = eem_db[TF_DIR_RX];
- parms.db_index = TF_EEM_DB_TBL_SCOPE;
+ parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
parms.index = tbl_scope_id;
parms.allocated = &allocated;
i = tf_rm_is_allocated(&parms);
- if (i < 0 || !allocated)
+ if (i < 0 || allocated != TF_RM_ALLOCATED_ENTRY_IN_USE)
return NULL;
for (i = 0; i < TF_NUM_TBL_SCOPE; i++) {
@@ -158,6 +156,111 @@ tf_destroy_tbl_pool_external(enum tf_dir dir,
tfp_free(ext_act_pool_mem);
}
+/**
+ * Allocate External Tbl entry from the scope pool.
+ *
+ * [in] tfp
+ * Pointer to Truflow Handle
+ * [in] parms
+ * Allocation parameters
+ *
+ * Return:
+ * 0 - Success, entry allocated - no search support
+ * -ENOMEM -EINVAL -EOPNOTSUPP
+ * - Failure, entry not allocated, out of resources
+ */
+int
+tf_tbl_ext_alloc(struct tf *tfp,
+ struct tf_tbl_alloc_parms *parms)
+{
+ int rc;
+ uint32_t index;
+ struct tf_tbl_scope_cb *tbl_scope_cb;
+ struct stack *pool;
+
+ TF_CHECK_PARMS2(tfp, parms);
+
+ /* Get the pool info from the table scope
+ */
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
+
+ if (tbl_scope_cb == NULL) {
+ TFP_DRV_LOG(ERR,
+ "%s, table scope not allocated\n",
+ tf_dir_2_str(parms->dir));
+ return -EINVAL;
+ }
+ pool = &tbl_scope_cb->ext_act_pool[parms->dir];
+
+ /* Allocate an element
+ */
+ rc = stack_pop(pool, &index);
+
+ if (rc != 0) {
+ TFP_DRV_LOG(ERR,
+ "%s, Allocation failed, type:%d\n",
+ tf_dir_2_str(parms->dir),
+ parms->type);
+ return rc;
+ }
+
+ *parms->idx = index;
+ return rc;
+}
+
+/**
+ * Free External Tbl entry to the scope pool.
+ *
+ * [in] tfp
+ * Pointer to Truflow Handle
+ * [in] parms
+ * Allocation parameters
+ *
+ * Return:
+ * 0 - Success, entry freed
+ *
+ * - Failure, entry not successfully freed for these reasons
+ * -ENOMEM
+ * -EOPNOTSUPP
+ * -EINVAL
+ */
+int
+tf_tbl_ext_free(struct tf *tfp,
+ struct tf_tbl_free_parms *parms)
+{
+ int rc = 0;
+ uint32_t index;
+ struct tf_tbl_scope_cb *tbl_scope_cb;
+ struct stack *pool;
+
+ TF_CHECK_PARMS2(tfp, parms);
+
+ /* Get the pool info from the table scope
+ */
+ tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
+
+ if (tbl_scope_cb == NULL) {
+ TFP_DRV_LOG(ERR,
+ "%s, table scope error\n",
+ tf_dir_2_str(parms->dir));
+ return -EINVAL;
+ }
+ pool = &tbl_scope_cb->ext_act_pool[parms->dir];
+
+ index = parms->idx;
+
+ rc = stack_push(pool, index);
+
+ if (rc != 0) {
+ TFP_DRV_LOG(ERR,
+ "%s, consistency error, stack full, type:%d, idx:%d\n",
+ tf_dir_2_str(parms->dir),
+ parms->type,
+ index);
+ }
+ return rc;
+}
+
uint32_t
tf_em_get_key_mask(int num_entries)
{
@@ -273,6 +376,15 @@ tf_em_ext_common_unbind(struct tf *tfp)
return 0;
}
+int tf_tbl_ext_set(struct tf *tfp,
+ struct tf_tbl_set_parms *parms)
+{
+ if (mem_type == TF_EEM_MEM_TYPE_HOST)
+ return tf_tbl_ext_host_set(tfp, parms);
+ else
+ return tf_tbl_ext_system_set(tfp, parms);
+}
+
int
tf_em_ext_common_alloc(struct tf *tfp,
struct tf_alloc_tbl_scope_parms *parms)
@@ -48,7 +48,6 @@
* 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];
@@ -986,7 +985,7 @@ tf_em_ext_host_alloc(struct tf *tfp,
/* Get Table Scope control block from the session pool */
aparms.rm_db = eem_db[TF_DIR_RX];
- aparms.db_index = TF_EEM_DB_TBL_SCOPE;
+ aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
aparms.index = (uint32_t *)&parms->tbl_scope_id;
rc = tf_rm_allocate(&aparms);
if (rc) {
@@ -1087,7 +1086,7 @@ tf_em_ext_host_alloc(struct tf *tfp,
cleanup:
/* Free Table control block */
fparms.rm_db = eem_db[TF_DIR_RX];
- fparms.db_index = TF_EEM_DB_TBL_SCOPE;
+ fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
fparms.index = parms->tbl_scope_id;
tf_rm_free(&fparms);
return -EINVAL;
@@ -1111,7 +1110,7 @@ tf_em_ext_host_free(struct tf *tfp,
/* Free Table control block */
aparms.rm_db = eem_db[TF_DIR_RX];
- aparms.db_index = TF_EEM_DB_TBL_SCOPE;
+ aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
aparms.index = parms->tbl_scope_id;
rc = tf_rm_free(&aparms);
if (rc) {
@@ -1133,6 +1132,77 @@ tf_em_ext_host_free(struct tf *tfp,
tf_em_ctx_unreg(tfp, tbl_scope_cb, dir);
}
- tbl_scopes[parms->tbl_scope_id].tbl_scope_id = -1;
+ tbl_scopes[parms->tbl_scope_id].tbl_scope_id = TF_TBL_SCOPE_INVALID;
+ return rc;
+}
+
+/**
+ * Sets the specified external table type element.
+ *
+ * This API sets the specified element data
+ *
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to table set parameters
+ *
+ * Returns
+ * - (0) if successful.
+ * - (-EINVAL) on failure.
+ */
+int tf_tbl_ext_host_set(struct tf *tfp,
+ struct tf_tbl_set_parms *parms)
+{
+ int rc = 0;
+ struct tf_tbl_scope_cb *tbl_scope_cb;
+ uint32_t tbl_scope_id;
+ struct hcapi_cfa_hwop op;
+ struct hcapi_cfa_key_tbl key_tbl;
+ struct hcapi_cfa_key_data key_obj;
+ struct hcapi_cfa_key_loc key_loc;
+
+ TF_CHECK_PARMS2(tfp, parms);
+
+ if (parms->data == NULL) {
+ TFP_DRV_LOG(ERR,
+ "%s, invalid parms->data\n",
+ tf_dir_2_str(parms->dir));
+ return -EINVAL;
+ }
+
+ tbl_scope_id = parms->tbl_scope_id;
+
+ if (tbl_scope_id == TF_TBL_SCOPE_INVALID) {
+ TFP_DRV_LOG(ERR,
+ "%s, Table scope not allocated\n",
+ tf_dir_2_str(parms->dir));
+ return -EINVAL;
+ }
+
+ /* Get the table scope control block associated with the
+ * external pool
+ */
+ tbl_scope_cb = tbl_scope_cb_find(tbl_scope_id);
+
+ if (tbl_scope_cb == NULL) {
+ TFP_DRV_LOG(ERR,
+ "%s, table scope error\n",
+ tf_dir_2_str(parms->dir));
+ return -EINVAL;
+ }
+
+ op.opcode = HCAPI_CFA_HWOPS_PUT;
+ key_tbl.base0 =
+ (uint8_t *)&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_RECORD_TABLE];
+ key_obj.offset = parms->idx % TF_EM_PAGE_SIZE;
+ key_obj.data = parms->data;
+ key_obj.size = parms->data_sz_in_bytes;
+
+ rc = hcapi_cfa_key_hw_op(&op,
+ &key_tbl,
+ &key_obj,
+ &key_loc);
+
return rc;
}
@@ -112,3 +112,9 @@ tf_em_ext_system_free(struct tf *tfp __rte_unused,
{
return 0;
}
+
+int tf_tbl_ext_system_set(struct tf *tfp __rte_unused,
+ struct tf_tbl_set_parms *parms __rte_unused)
+{
+ return 0;
+}
@@ -159,13 +159,13 @@ tf_ident_free(struct tf *tfp __rte_unused,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s: Entry already free, type:%d, index:%d\n",
tf_dir_2_str(parms->dir),
parms->type,
parms->id);
- return rc;
+ return -EINVAL;
}
/* Free requested element */
@@ -12,6 +12,11 @@
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
@@ -172,13 +172,13 @@ tf_tbl_free(struct tf *tfp __rte_unused,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s: Entry already free, type:%d, index:%d\n",
tf_dir_2_str(parms->dir),
parms->type,
parms->idx);
- return rc;
+ return -EINVAL;
}
/* Free requested element */
@@ -233,7 +233,7 @@ tf_tbl_set(struct tf *tfp,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s, Invalid or not allocated index, type:%d, idx:%d\n",
tf_dir_2_str(parms->dir),
@@ -301,7 +301,7 @@ tf_tbl_get(struct tf *tfp,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s, Invalid or not allocated index, type:%d, idx:%d\n",
tf_dir_2_str(parms->dir),
@@ -374,7 +374,7 @@ tf_tbl_bulk_get(struct tf *tfp,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s, Invalid or not allocated index, type:%d, idx:%d\n",
tf_dir_2_str(parms->dir),
@@ -83,6 +83,10 @@ struct tf_tbl_alloc_parms {
* [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;
/**
* [out] Idx of allocated entry or found entry (if search_enable)
*/
@@ -101,6 +105,10 @@ struct tf_tbl_free_parms {
* [in] Type of the allocation type
*/
enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
/**
* [in] Index to free
*/
@@ -168,6 +176,10 @@ struct tf_tbl_set_parms {
* [in] Type of object to set
*/
enum tf_tbl_type type;
+ /**
+ * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+ */
+ uint32_t tbl_scope_id;
/**
* [in] Entry data
*/
@@ -252,13 +252,13 @@ tf_tcam_free(struct tf *tfp,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s: Entry already free, type:%d, index:%d\n",
tf_dir_2_str(parms->dir),
parms->type,
parms->idx);
- return rc;
+ return -EINVAL;
}
/* Free requested element */
@@ -362,13 +362,13 @@ tf_tcam_set(struct tf *tfp __rte_unused,
if (rc)
return rc;
- if (!allocated) {
+ if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) {
TFP_DRV_LOG(ERR,
"%s: Entry is not allocated, type:%d, index:%d\n",
tf_dir_2_str(parms->dir),
parms->type,
parms->idx);
- return rc;
+ return -EINVAL;
}
/* Convert TF type to HCAPI RM type */
@@ -92,10 +92,6 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
return "NAT IPv4 Source";
case TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST:
return "NAT IPv4 Destination";
- case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC:
- return "NAT IPv6 Source";
- case TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST:
- return "NAT IPv6 Destination";
case TF_TBL_TYPE_METER_PROF:
return "Meter Profile";
case TF_TBL_TYPE_METER_INST: