+
+/**
+ * get index table entry
+ *
+ * Used to retrieve a previous set index table entry.
+ *
+ * Reads and compares with the shadow table copy (if enabled) (only
+ * for internal objects).
+ *
+ * Returns success or failure code. Failure will be returned if the
+ * provided data buffer is too small for the data type requested.
+ */
+int tf_get_tbl_entry(struct tf *tfp,
+ struct tf_get_tbl_entry_parms *parms);
+
+/**
+ * @page exact_match Exact Match Table
+ *
+ * @ref tf_insert_em_entry
+ *
+ * @ref tf_delete_em_entry
+ *
+ * @ref tf_search_em_entry
+ *
+ */
+/**
+ * tf_insert_em_entry parameter definition
+ */
+struct tf_insert_em_entry_parms {
+ /**
+ * [in] receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] internal or external
+ */
+ enum tf_mem mem;
+ /**
+ * [in] ID of table scope to use (external only)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] ID of table interface to use (Brd4 only)
+ */
+ uint32_t tbl_if_id;
+ /**
+ * [in] ptr to structure containing key fields
+ */
+ uint8_t *key;
+ /**
+ * [in] key bit length
+ */
+ uint16_t key_sz_in_bits;
+ /**
+ * [in] ptr to structure containing result field
+ */
+ uint8_t *em_record;
+ /**
+ * [out] result size in bits
+ */
+ uint16_t em_record_sz_in_bits;
+ /**
+ * [in] duplicate check flag
+ */
+ uint8_t dup_check;
+ /**
+ * [out] Flow handle value for the inserted entry. This is encoded
+ * as the entries[4]:bucket[2]:hashId[1]:hash[14]
+ */
+ uint64_t flow_handle;
+ /**
+ * [out] Flow id is returned as null (internal)
+ * Flow id is the GFID value for the inserted entry (external)
+ * This is the value written to the BD and useful information for mark.
+ */
+ uint64_t flow_id;
+};
+/**
+ * tf_delete_em_entry parameter definition
+ */
+struct tf_delete_em_entry_parms {
+ /**
+ * [in] receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] internal or external
+ */
+ enum tf_mem mem;
+ /**
+ * [in] ID of table scope to use (external only)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] ID of table interface to use (Brd4 only)
+ */
+ uint32_t tbl_if_id;
+ /**
+ * [in] epoch group IDs of entry to delete
+ * 2 element array with 2 ids. (Brd4 only)
+ */
+ uint16_t *epochs;
+ /**
+ * [out] The index of the entry
+ */
+ uint16_t index;
+ /**
+ * [in] structure containing flow delete handle information
+ */
+ uint64_t flow_handle;
+};
+/**
+ * tf_search_em_entry parameter definition
+ */
+struct tf_search_em_entry_parms {
+ /**
+ * [in] receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] internal or external
+ */
+ enum tf_mem mem;
+ /**
+ * [in] ID of table scope to use (external only)
+ */
+ uint32_t tbl_scope_id;
+ /**
+ * [in] ID of table interface to use (Brd4 only)
+ */
+ uint32_t tbl_if_id;
+ /**
+ * [in] ptr to structure containing key fields
+ */
+ uint8_t *key;
+ /**
+ * [in] key bit length
+ */
+ uint16_t key_sz_in_bits;
+ /**
+ * [in/out] ptr to structure containing EM record fields
+ */
+ uint8_t *em_record;
+ /**
+ * [out] result size in bits
+ */
+ uint16_t em_record_sz_in_bits;
+ /**
+ * [in] epoch group IDs of entry to lookup
+ * 2 element array with 2 ids. (Brd4 only)
+ */
+ uint16_t *epochs;
+ /**
+ * [in] ptr to structure containing flow delete handle
+ */
+ uint64_t flow_handle;
+};
+
+/**
+ * insert em hash entry in internal table memory
+ *
+ * Internal:
+ *
+ * This API inserts an exact match entry into internal EM table memory
+ * of the specified direction.
+ *
+ * Note: The EM record is managed within the TruFlow core and not the
+ * application.
+ *
+ * Shadow copy of internal record table an association with hash and 1,2, or 4
+ * associated buckets
+ *
+ * External:
+ * This API inserts an exact match entry into DRAM EM table memory of the
+ * specified direction and table scope.
+ *
+ * When inserting an entry into an exact match table, the TruFlow library may
+ * need to allocate a dynamic bucket for the entry (Brd4 only).
+ *
+ * The insertion of duplicate entries in an EM table is not permitted. If a
+ * TruFlow application can guarantee that it will never insert duplicates, it
+ * can disable duplicate checking by passing a zero value in the dup_check
+ * parameter to this API. This will optimize performance. Otherwise, the
+ * TruFlow library will enforce protection against inserting duplicate entries.
+ *
+ * Flow handle is defined in this document:
+ *
+ * https://docs.google.com
+ * /document/d/1NESu7RpTN3jwxbokaPfYORQyChYRmJgs40wMIRe8_-Q/edit
+ *
+ * Returns success or busy code.
+ *
+ */
+int tf_insert_em_entry(struct tf *tfp,
+ struct tf_insert_em_entry_parms *parms);
+
+/**
+ * delete em hash entry table memory
+ *
+ * Internal:
+ *
+ * This API deletes an exact match entry from internal EM table memory of the
+ * specified direction. If a valid flow ptr is passed in then that takes
+ * precedence over the pointer to the complete key passed in.
+ *
+ *
+ * External:
+ *
+ * This API deletes an exact match entry from EM table memory of the specified
+ * direction and table scope. If a valid flow handle is passed in then that
+ * takes precedence over the pointer to the complete key passed in.
+ *
+ * The TruFlow library may release a dynamic bucket when an entry is deleted.
+ *
+ *
+ * Returns success or not found code
+ *
+ *
+ */
+int tf_delete_em_entry(struct tf *tfp,
+ struct tf_delete_em_entry_parms *parms);
+
+/**
+ * search em hash entry table memory
+ *
+ * Internal:
+
+ * This API looks up an EM entry in table memory with the specified EM
+ * key or flow (flow takes precedence) and direction.
+ *
+ * The status will be one of: success or entry not found. If the lookup
+ * succeeds, a pointer to the matching entry and the result record associated
+ * with the matching entry will be provided.
+ *
+ * If flow_handle is set, search shadow copy.
+ *
+ * Otherwise, query the fw with key to get result.
+ *
+ * External:
+ *
+ * This API looks up an EM entry in table memory with the specified EM
+ * key or flow_handle (flow takes precedence), direction and table scope.
+ *
+ * The status will be one of: success or entry not found. If the lookup
+ * succeeds, a pointer to the matching entry and the result record associated
+ * with the matching entry will be provided.
+ *
+ * Returns success or not found code
+ *
+ */
+int tf_search_em_entry(struct tf *tfp,
+ struct tf_search_em_entry_parms *parms);