net/bnxt: update TruFlow core index table
authorFarah Smith <farah.smith@broadcom.com>
Mon, 20 Sep 2021 07:42:02 +0000 (13:12 +0530)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Tue, 21 Sep 2021 02:40:22 +0000 (04:40 +0200)
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>
drivers/net/bnxt/tf_core/tf_core.c
drivers/net/bnxt/tf_core/tf_core.h
drivers/net/bnxt/tf_core/tf_device.h
drivers/net/bnxt/tf_core/tf_device_p4.c
drivers/net/bnxt/tf_core/tf_device_p58.c
drivers/net/bnxt/tf_core/tf_em_common.c
drivers/net/bnxt/tf_core/tf_tbl.c
drivers/net/bnxt/tf_core/tf_tbl.h
drivers/net/bnxt/tf_ulp/ulp_mapper.c

index 97e6165..5458f76 100644 (file)
@@ -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)
index 84b234f..7e0cdf7 100644 (file)
@@ -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;
 };
 
 /**
index da3f541..b43cfc6 100644 (file)
@@ -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.
         *
index 971fab7..2e7ccec 100644 (file)
@@ -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,
index 6bbc5e2..ce4d8c6 100644 (file)
@@ -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,
index 812ccb0..3bdfc14 100644 (file)
 
 #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 *))
 
index ced5913..e77399c 100644 (file)
 
 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)
index aba46fd..7e1107f 100644 (file)
@@ -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.
index 871dbad..f3a60cc 100644 (file)
@@ -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;
        }