X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_em.h;h=074c1286517b22581ddad6370384f61ee90180db;hb=f1f6ebc0eaf68a825c6175f5e6a436f7d91660c3;hp=39a216341b33e2aa93aa9c447261c750a3223904;hpb=f000d3dcd57ce07de5f4b11bedd795a5a24bfab7;p=dpdk.git diff --git a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h index 39a216341b..074c128651 100644 --- a/drivers/net/bnxt/tf_core/tf_em.h +++ b/drivers/net/bnxt/tf_core/tf_em.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2019-2020 Broadcom + * Copyright(c) 2019-2021 Broadcom * All rights reserved. */ @@ -9,15 +9,17 @@ #include "tf_core.h" #include "tf_session.h" -#define SUPPORT_CFA_HW_P4 1 -#define SUPPORT_CFA_HW_P58 0 -#define SUPPORT_CFA_HW_P59 0 -#define SUPPORT_CFA_HW_ALL 0 +#include "tf_em_common.h" -#include "hcapi/hcapi_cfa_defs.h" +#include "hcapi_cfa_defs.h" -#define TF_HW_EM_KEY_MAX_SIZE 52 -#define TF_EM_KEY_RECORD_SIZE 64 +#define TF_EM_MIN_ENTRIES (1 << 15) /* 32K */ +#define TF_EM_MAX_ENTRIES (1 << 27) /* 128M */ + +#define TF_P4_HW_EM_KEY_MAX_SIZE 52 +#define TF_P4_EM_KEY_RECORD_SIZE 64 + +#define TF_P58_HW_EM_KEY_MAX_SIZE 80 #define TF_EM_MAX_MASK 0x7FFF #define TF_EM_MAX_ENTRY (128 * 1024 * 1024) @@ -69,6 +71,9 @@ #error "Invalid Page Size specified. Please use a TF_EM_PAGE_SIZE_n define" #endif +/* + * System memory always uses 4K pages + */ #define TF_EM_PAGE_SIZE (1 << TF_EM_PAGE_SHIFT) #define TF_EM_PAGE_ALIGNMENT (1 << TF_EM_PAGE_SHIFT) @@ -80,7 +85,7 @@ * | Index |E | * +--------------+--+ * - * E = Entry (bucket inndex) + * E = Entry (bucket index) */ #define TF_EM_INTERNAL_INDEX_SHIFT 2 #define TF_EM_INTERNAL_INDEX_MASK 0xFFFC @@ -94,7 +99,7 @@ struct tf_em_64b_entry { /** Header is 8 bytes long */ struct cfa_p4_eem_entry_hdr hdr; /** Key is 448 bits - 56 bytes */ - uint8_t key[TF_EM_KEY_RECORD_SIZE - sizeof(struct cfa_p4_eem_entry_hdr)]; + uint8_t key[TF_P4_EM_KEY_RECORD_SIZE - sizeof(struct cfa_p4_eem_entry_hdr)]; }; /** EEM Memory Type @@ -128,6 +133,16 @@ struct tf_em_cfg_parms { enum tf_mem_type mem_type; }; +/** + * EM database + * + * EM rm database + * + */ +struct em_rm_db { + struct rm_db *em_db[TF_DIR_MAX]; +}; + /** * @page em EM * @@ -155,13 +170,9 @@ struct tf_em_cfg_parms { * * @ref tf_em_ext_common_unbind * - * @ref tf_em_ext_host_alloc + * @ref tf_em_ext_alloc * - * @ref tf_em_ext_host_free - * - * @ref tf_em_ext_system_alloc - * - * @ref tf_em_ext_system_free + * @ref tf_em_ext_free * * @ref tf_em_ext_common_free * @@ -169,7 +180,7 @@ struct tf_em_cfg_parms { */ /** - * Allocates EEM Table scope + * Insert record in to internal EM table * * [in] tfp * Pointer to TruFlow handle @@ -180,13 +191,12 @@ struct tf_em_cfg_parms { * Returns: * 0 - Success * -EINVAL - Parameter error - * -ENOMEM - Out of memory */ -int tf_alloc_eem_tbl_scope(struct tf *tfp, - struct tf_alloc_tbl_scope_parms *parms); +int tf_em_insert_int_entry(struct tf *tfp, + struct tf_insert_em_entry_parms *parms); /** - * Free's EEM Table scope control block + * Delete record from internal EM table * * [in] tfp * Pointer to TruFlow handle @@ -198,8 +208,8 @@ int tf_alloc_eem_tbl_scope(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_free_eem_tbl_scope_cb(struct tf *tfp, - struct tf_free_tbl_scope_parms *parms); +int tf_em_delete_int_entry(struct tf *tfp, + struct tf_delete_em_entry_parms *parms); /** * Insert record in to internal EM table @@ -214,8 +224,8 @@ int tf_free_eem_tbl_scope_cb(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_insert_int_entry(struct tf *tfp, - struct tf_insert_em_entry_parms *parms); +int tf_em_hash_insert_int_entry(struct tf *tfp, + struct tf_insert_em_entry_parms *parms); /** * Delete record from internal EM table @@ -230,8 +240,24 @@ int tf_em_insert_int_entry(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_delete_int_entry(struct tf *tfp, - struct tf_delete_em_entry_parms *parms); +int tf_em_hash_delete_int_entry(struct tf *tfp, + struct tf_delete_em_entry_parms *parms); + +/** + * Move record from internal EM table + * + * [in] tfp + * Pointer to TruFlow handle + * + * [in] parms + * Pointer to input parameters + * + * Returns: + * 0 - Success + * -EINVAL - Parameter error + */ +int tf_em_move_int_entry(struct tf *tfp, + struct tf_move_em_entry_parms *parms); /** * Insert record in to external EEM table @@ -374,8 +400,8 @@ int tf_em_ext_common_unbind(struct tf *tfp); * 0 - Success * -EINVAL - Parameter error */ -int tf_em_ext_host_alloc(struct tf *tfp, - struct tf_alloc_tbl_scope_parms *parms); +int tf_em_ext_alloc(struct tf *tfp, + struct tf_alloc_tbl_scope_parms *parms); /** * Free for external EEM using host memory @@ -390,11 +416,11 @@ int tf_em_ext_host_alloc(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_ext_host_free(struct tf *tfp, - struct tf_free_tbl_scope_parms *parms); +int tf_em_ext_free(struct tf *tfp, + struct tf_free_tbl_scope_parms *parms); /** - * Alloc for external EEM using system memory + * Common free table scope for external EEM using host or system memory * * [in] tfp * Pointer to TruFlow handle @@ -406,27 +432,11 @@ int tf_em_ext_host_free(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_ext_system_alloc(struct tf *tfp, - struct tf_alloc_tbl_scope_parms *parms); - -/** - * Free for external EEM using system memory - * - * [in] tfp - * Pointer to TruFlow handle - * - * [in] parms - * Pointer to input parameters - * - * Returns: - * 0 - Success - * -EINVAL - Parameter error - */ -int tf_em_ext_system_free(struct tf *tfp, +int tf_em_ext_common_free(struct tf *tfp, struct tf_free_tbl_scope_parms *parms); /** - * Common free for external EEM using host or system memory + * Common alloc table scope for external EEM using host or system memory * * [in] tfp * Pointer to TruFlow handle @@ -438,11 +448,10 @@ int tf_em_ext_system_free(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_ext_common_free(struct tf *tfp, - struct tf_free_tbl_scope_parms *parms); - +int tf_em_ext_common_alloc(struct tf *tfp, + struct tf_alloc_tbl_scope_parms *parms); /** - * Common alloc for external EEM using host or system memory + * Map a set of parifs to a set of EEM base addresses (table scope) * * [in] tfp * Pointer to TruFlow handle @@ -454,8 +463,8 @@ int tf_em_ext_common_free(struct tf *tfp, * 0 - Success * -EINVAL - Parameter error */ -int tf_em_ext_common_alloc(struct tf *tfp, - struct tf_alloc_tbl_scope_parms *parms); +int tf_em_ext_map_tbl_scope(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms); /** * Allocate External Tbl entry from the scope pool. @@ -510,8 +519,8 @@ tf_tbl_ext_free(struct tf *tfp, * - (0) if successful. * - (-EINVAL) on failure. */ -int tf_tbl_ext_set(struct tf *tfp, - struct tf_tbl_set_parms *parms); +int tf_tbl_ext_common_set(struct tf *tfp, + struct tf_tbl_set_parms *parms); /** * Sets the specified external table type element. @@ -529,26 +538,29 @@ int tf_tbl_ext_set(struct tf *tfp, * - (0) if successful. * - (-EINVAL) on failure. */ -int tf_tbl_ext_host_set(struct tf *tfp, - struct tf_tbl_set_parms *parms); +int tf_tbl_ext_set(struct tf *tfp, + struct tf_tbl_set_parms *parms); + +int +tf_em_ext_system_bind(struct tf *tfp, + struct tf_em_cfg_parms *parms); + +int offload_system_mmap(struct tf_tbl_scope_cb *tbl_scope_cb); /** - * Sets the specified external table type element. - * - * This API sets the specified element data by invoking the - * firmware. + * Retrieves the allocated resource info * * [in] tfp - * Pointer to TF handle + * Pointer to TF handle, used for HCAPI communication * * [in] parms - * Pointer to table set parameters + * Pointer to parameters * * Returns * - (0) if successful. * - (-EINVAL) on failure. */ -int tf_tbl_ext_system_set(struct tf *tfp, - struct tf_tbl_set_parms *parms); - +int +tf_em_get_resc_info(struct tf *tfp, + struct tf_em_resource_info *em); #endif /* _TF_EM_H_ */