[dpdk-dev] [PATCH v3 01/13] net/bnxt: tf core index table updates
Venkat Duvvuru
venkatkumar.duvvuru at broadcom.com
Sat Sep 11 17:30:29 CEST 2021
From: Farah Smith <farah.smith at broadcom.com>
Remove unused shadow table functionality.
Signed-off-by: Farah Smith <farah.smith at broadcom.com>
Reviewed-by: Peter Spreadborough <peter.spreadborough at broadcom.com>
---
drivers/net/bnxt/tf_core/tf_core.c | 65 --------------
drivers/net/bnxt/tf_core/tf_core.h | 103 +----------------------
drivers/net/bnxt/tf_core/tf_device.h | 22 -----
drivers/net/bnxt/tf_core/tf_device_p4.c | 2 -
drivers/net/bnxt/tf_core/tf_device_p58.c | 2 -
drivers/net/bnxt/tf_core/tf_em_common.c | 4 +
drivers/net/bnxt/tf_core/tf_tbl.c | 21 -----
drivers/net/bnxt/tf_core/tf_tbl.h | 72 ----------------
drivers/net/bnxt/tf_ulp/ulp_mapper.c | 3 +-
9 files changed, 7 insertions(+), 287 deletions(-)
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 97e6165e92..5458f76e2d 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -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)
diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h
index 84b234f0e3..7e0cdf7e0d 100644
--- a/drivers/net/bnxt/tf_core/tf_core.h
+++ b/drivers/net/bnxt/tf_core/tf_core.h
@@ -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;
};
/**
diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h
index da3f541685..b43cfc6925 100644
--- a/drivers/net/bnxt/tf_core/tf_device.h
+++ b/drivers/net/bnxt/tf_core/tf_device.h
@@ -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.
*
diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c
index 971fab7bda..2e7ccec123 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p4.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c
@@ -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,
diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c
index 6bbc5e21e9..ce4d8c661f 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p58.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c
@@ -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,
diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
index 812ccb0d29..3bdfc14e05 100644
--- a/drivers/net/bnxt/tf_core/tf_em_common.c
+++ b/drivers/net/bnxt/tf_core/tf_em_common.c
@@ -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 *))
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index ced59130b2..e77399c6bd 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -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)
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.h b/drivers/net/bnxt/tf_core/tf_tbl.h
index aba46fd161..7e1107ffe7 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.h
+++ b/drivers/net/bnxt/tf_core/tf_tbl.h
@@ -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.
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 871dbad0fe..f3a60cc880 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -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;
}
--
2.17.1
More information about the dev
mailing list