X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_shadow_tcam.h;h=ea9f38e7c371f996cf3b6f9b892d333d4ec655cc;hp=e2c4e06c00b4d5bc0f3be43c5b414371295afbda;hb=7d5d5b877582ee30e64946ee788d21d50d03ae2e;hpb=54b20f94cd847c713c2c9bca281295f5d1d0663f diff --git a/drivers/net/bnxt/tf_core/tf_shadow_tcam.h b/drivers/net/bnxt/tf_core/tf_shadow_tcam.h index e2c4e06c00..ea9f38e7c3 100644 --- a/drivers/net/bnxt/tf_core/tf_shadow_tcam.h +++ b/drivers/net/bnxt/tf_core/tf_shadow_tcam.h @@ -8,232 +8,188 @@ #include "tf_core.h" -struct tf; - -/** - * The Shadow tcam module provides shadow DB handling for tcam based - * TF types. A shadow DB provides the capability that allows for reuse - * of TF resources. - * - * A Shadow tcam DB is intended to be used by the Tcam module only. - */ - /** - * Shadow DB configuration information for a single tcam type. - * - * During Device initialization the HCAPI device specifics are learned - * and as well as the RM DB creation. From that those initial steps - * this structure can be populated. + * Shadow DB configuration information * - * NOTE: - * If used in an array of tcam types then such array must be ordered - * by the TF type is represents. + * The shadow configuration is for all tcam table types for a direction */ struct tf_shadow_tcam_cfg_parms { /** - * TF tcam type + * [in] The number of elements in the alloc_cnt and base_addr + * For now, it should always be equal to TF_TCAM_TBL_TYPE_MAX */ - enum tf_tcam_tbl_type type; - + int num_entries; /** - * Number of entries the Shadow DB needs to hold + * [in] Resource allocation count array + * This array content originates from the tf_session_resources + * that is passed in on session open + * Array size is TF_TCAM_TBL_TYPE_MAX */ - int num_entries; - + uint16_t *alloc_cnt; /** - * Element width for this table type + * [in] The base index for each tcam table */ - int element_width; + uint16_t base_addr[TF_TCAM_TBL_TYPE_MAX]; }; /** - * Shadow tcam DB creation parameters + * Shadow TCAM DB creation parameters. The shadow db for this direction + * is returned */ struct tf_shadow_tcam_create_db_parms { /** - * [in] Configuration information for the shadow db + * [in] Receive or transmit direction */ - struct tf_shadow_tcam_cfg_parms *cfg; + enum tf_dir dir; /** - * [in] Number of elements in the parms structure + * [in] Configuration information for the shadow db */ - uint16_t num_elements; + struct tf_shadow_tcam_cfg_parms *cfg; /** * [out] Shadow tcam DB handle */ - void *tf_shadow_tcam_db; + void **shadow_db; }; /** - * Shadow tcam DB free parameters + * Create the shadow db for a single direction + * + * The returned shadow db must be free using the free db API when no longer + * needed */ -struct tf_shadow_tcam_free_db_parms { - /** - * Shadow tcam DB handle - */ - void *tf_shadow_tcam_db; -}; +int +tf_shadow_tcam_create_db(struct tf_shadow_tcam_create_db_parms *parms); /** - * Shadow tcam search parameters + * Shadow TCAM free parameters */ -struct tf_shadow_tcam_search_parms { +struct tf_shadow_tcam_free_db_parms { /** * [in] Shadow tcam DB handle */ - void *tf_shadow_tcam_db; - /** - * [in] TCAM tbl type - */ - enum tf_tcam_tbl_type type; - /** - * [in] Pointer to entry blob value in remap table to match - */ - uint8_t *entry; - /** - * [in] Size of the entry blob passed in bytes - */ - uint16_t entry_sz; - /** - * [out] Index of the found element returned if hit - */ - uint16_t *index; - /** - * [out] Reference count incremented if hit - */ - uint16_t *ref_cnt; + void *shadow_db; }; /** - * Shadow tcam insert parameters + * Free all resources associated with the shadow db + */ +int +tf_shadow_tcam_free_db(struct tf_shadow_tcam_free_db_parms *parms); + +/** + * Shadow TCAM bind index parameters */ -struct tf_shadow_tcam_insert_parms { +struct tf_shadow_tcam_bind_index_parms { /** * [in] Shadow tcam DB handle */ - void *tf_shadow_tcam_db; + void *shadow_db; /** - * [in] TCAM tbl type + * [in] receive or transmit direction + */ + enum tf_dir dir; + /** + * [in] TCAM table type */ enum tf_tcam_tbl_type type; /** - * [in] Pointer to entry blob value in remap table to match + * [in] index of the entry to program */ - uint8_t *entry; + uint16_t idx; /** - * [in] Size of the entry blob passed in bytes + * [in] struct containing key */ - uint16_t entry_sz; + uint8_t *key; /** - * [in] Entry to update + * [in] struct containing mask fields */ - uint16_t index; + uint8_t *mask; /** - * [out] Reference count after insert + * [in] key size in bits (if search) */ - uint16_t *ref_cnt; + uint16_t key_size; + /** + * [in] The hash bucket handled returned from the search + */ + uint32_t hb_handle; }; /** - * Shadow tcam remove parameters + * Binds the allocated tcam index with the hash and shadow tables */ -struct tf_shadow_tcam_remove_parms { +int +tf_shadow_tcam_bind_index(struct tf_shadow_tcam_bind_index_parms *parms); + +/** + * Shadow TCAM insert parameters + */ +struct tf_shadow_tcam_insert_parms { /** * [in] Shadow tcam DB handle */ - void *tf_shadow_tcam_db; - /** - * [in] TCAM tbl type - */ - enum tf_tcam_tbl_type type; - /** - * [in] Entry to update - */ - uint16_t index; + void *shadow_db; /** - * [out] Reference count after removal + * [in] The set parms from tf core */ - uint16_t *ref_cnt; + struct tf_tcam_set_parms *sparms; }; /** - * @page shadow_tcam Shadow tcam DB - * - * @ref tf_shadow_tcam_create_db - * - * @ref tf_shadow_tcam_free_db - * - * @reg tf_shadow_tcam_search - * - * @reg tf_shadow_tcam_insert - * - * @reg tf_shadow_tcam_remove - */ - -/** - * Creates and fills a Shadow tcam DB. The DB is indexed per the - * parms structure. - * - * [in] parms - * Pointer to create db parameters + * Set the entry into the tcam manager hash and shadow tables * - * Returns - * - (0) if successful. - * - (-EINVAL) on failure. + * The search must have been used prior to setting the entry so that the + * hash has been calculated and duplicate entries will not be added */ -int tf_shadow_tcam_create_db(struct tf_shadow_tcam_create_db_parms *parms); +int +tf_shadow_tcam_insert(struct tf_shadow_tcam_insert_parms *parms); /** - * Closes the Shadow tcam DB and frees all allocated - * resources per the associated database. - * - * [in] parms - * Pointer to the free DB parameters - * - * Returns - * - (0) if successful. - * - (-EINVAL) on failure. + * Shadow TCAM remove parameters */ -int tf_shadow_tcam_free_db(struct tf_shadow_tcam_free_db_parms *parms); +struct tf_shadow_tcam_remove_parms { + /** + * [in] Shadow tcam DB handle + */ + void *shadow_db; + /** + * [in,out] The set parms from tf core + */ + struct tf_tcam_free_parms *fparms; +}; /** - * Search Shadow tcam db for matching result - * - * [in] parms - * Pointer to the search parameters + * Remove the entry from the tcam hash and shadow tables * - * Returns - * - (0) if successful, element was found. - * - (-EINVAL) on failure. + * The search must have been used prior to setting the entry so that the + * hash has been calculated and duplicate entries will not be added */ -int tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms); +int +tf_shadow_tcam_remove(struct tf_shadow_tcam_remove_parms *parms); /** - * Inserts an element into the Shadow tcam DB. Will fail if the - * elements ref_count is different from 0. Ref_count after insert will - * be incremented. - * - * [in] parms - * Pointer to insert parameters - * - * Returns - * - (0) if successful. - * - (-EINVAL) on failure. + * Shadow TCAM search parameters */ -int tf_shadow_tcam_insert(struct tf_shadow_tcam_insert_parms *parms); +struct tf_shadow_tcam_search_parms { + /** + * [in] Shadow tcam DB handle + */ + void *shadow_db; + /** + * [in,out] The search parameters from tf core + */ + struct tf_tcam_alloc_search_parms *sparms; + /** + * [out] The hash handle to use for the set + */ + uint32_t hb_handle; +}; /** - * Removes an element from the Shadow tcam DB. Will fail if the - * elements ref_count is 0. Ref_count after removal will be - * decremented. + * Search for an entry in the tcam hash/shadow tables * - * [in] parms - * Pointer to remove parameter - * - * Returns - * - (0) if successful. - * - (-EINVAL) on failure. + * If there is a miss, but there is room for insertion, the hb_handle returned + * is used for insertion during the bind index API */ -int tf_shadow_tcam_remove(struct tf_shadow_tcam_remove_parms *parms); - -#endif /* _TF_SHADOW_TCAM_H_ */ +int +tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms); +#endif