1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
10 #include "tf_session.h"
12 #define SUPPORT_CFA_HW_P4 1
13 #define SUPPORT_CFA_HW_P58 0
14 #define SUPPORT_CFA_HW_P59 0
15 #define SUPPORT_CFA_HW_ALL 0
17 #include "hcapi/hcapi_cfa_defs.h"
19 #define TF_HW_EM_KEY_MAX_SIZE 52
20 #define TF_EM_KEY_RECORD_SIZE 64
30 * E = Entry (bucket inndex)
32 #define TF_EM_INTERNAL_INDEX_SHIFT 2
33 #define TF_EM_INTERNAL_INDEX_MASK 0xFFFC
34 #define TF_EM_INTERNAL_ENTRY_MASK 0x3
37 * Each EM entry is 512-bit (64-bytes) but ordered differently to
40 struct tf_em_64b_entry {
41 /** Header is 8 bytes long */
42 struct cfa_p4_eem_entry_hdr hdr;
43 /** Key is 448 bits - 56 bytes */
44 uint8_t key[TF_EM_KEY_RECORD_SIZE - sizeof(struct cfa_p4_eem_entry_hdr)];
48 * Allocates EEM Table scope
51 * Pointer to TruFlow handle
54 * Pointer to input parameters
58 * -EINVAL - Parameter error
59 * -ENOMEM - Out of memory
61 int tf_alloc_eem_tbl_scope(struct tf *tfp,
62 struct tf_alloc_tbl_scope_parms *parms);
65 * Free's EEM Table scope control block
68 * Pointer to TruFlow handle
71 * Pointer to input parameters
75 * -EINVAL - Parameter error
77 int tf_free_eem_tbl_scope_cb(struct tf *tfp,
78 struct tf_free_tbl_scope_parms *parms);
81 * Function to search for table scope control block structure
82 * with specified table scope ID.
85 * Session to use for the search of the table scope control block
87 * Table scope ID to search for
90 * Pointer to the found table scope control block struct or NULL if
91 * table scope control block struct not found
93 struct tf_tbl_scope_cb *tbl_scope_cb_find(struct tf_session *session,
94 uint32_t tbl_scope_id);
96 void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb,
99 enum hcapi_cfa_em_table_type table_type);
101 int tf_em_insert_entry(struct tf *tfp,
102 struct tf_insert_em_entry_parms *parms);
104 int tf_em_delete_entry(struct tf *tfp,
105 struct tf_delete_em_entry_parms *parms);
106 #endif /* _TF_EM_H_ */