1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Broadcom
6 #ifndef _TF_EM_COMMON_H_
7 #define _TF_EM_COMMON_H_
10 #include "tf_session.h"
14 * Function to search for table scope control block structure
15 * with specified table scope ID.
18 * Table scope ID to search for
21 * Pointer to the found table scope control block struct or NULL if
22 * table scope control block struct not found
24 struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
27 * Create and initialize a stack to use for action entries
34 * Number of EEM entries
40 * -ENOMEM - Out of memory
43 int tf_create_tbl_pool_external(enum tf_dir dir,
44 struct tf_tbl_scope_cb *tbl_scope_cb,
46 uint32_t entry_sz_bytes);
49 * Delete and cleanup action record allocation stack
57 void tf_destroy_tbl_pool_external(enum tf_dir dir,
58 struct tf_tbl_scope_cb *tbl_scope_cb);
61 * Get hash mask for current EEM table size
64 * Number of EEM entries
66 uint32_t tf_em_get_key_mask(int num_entries);
76 * Completed key record
78 void tf_em_create_key_entry(struct cfa_p4_eem_entry_hdr *result,
80 struct cfa_p4_eem_64b_entry *key_entry);
83 * Find base page address for offset into specified table type
97 * Void pointer to page base address - Success
99 void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb,
102 enum hcapi_cfa_em_table_type table_type);
105 * Validates EM number of entries requested
108 * Pointer to table scope control block to be populated
111 * Pointer to input parameters
115 * -EINVAL - Parameter error
117 int tf_em_validate_num_entries(struct tf_tbl_scope_cb *tbl_scope_cb,
118 struct tf_alloc_tbl_scope_parms *parms);
121 * Size the EM table based on capabilities
128 * - EINVAL - Parameter error
129 * - ENOMEM - Out of memory
131 int tf_em_size_table(struct hcapi_cfa_em_table *tbl,
134 #endif /* _TF_EM_COMMON_H_ */