#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
-
+#include "hcapi/hcapi_cfa.h"
#include "tf_project.h"
/**
#define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
#define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
+
/*
* Helper Macros
*/
* @ref tf_close_session
*/
-
/**
* Session Version defines
*
} internal;
};
+/**
+ * Session Client Identifier
+ *
+ * Unique identifier for a client within a session. Session Client ID
+ * is constructed from the passed in session and a firmware allocated
+ * fw_session_client_id. Done by TruFlow on tf_open_session().
+ */
+union tf_session_client_id {
+ uint16_t id;
+ struct {
+ uint8_t fw_session_id;
+ uint8_t fw_session_client_id;
+ } internal;
+};
+
/**
* Session Version
*
*/
enum tf_device_type {
TF_DEVICE_TYPE_WH = 0, /**< Whitney+ */
- TF_DEVICE_TYPE_BRD2, /**< TBD */
- TF_DEVICE_TYPE_BRD3, /**< TBD */
- TF_DEVICE_TYPE_BRD4, /**< TBD */
+ TF_DEVICE_TYPE_SR, /**< Stingray */
+ TF_DEVICE_TYPE_THOR, /**< Thor */
+ TF_DEVICE_TYPE_SR2, /**< Stingray2 */
TF_DEVICE_TYPE_MAX /**< Maximum */
};
-/** Identifier resource types
+/**
+ * Identifier resource types
*/
enum tf_identifier_type {
- /** The L2 Context is returned from the L2 Ctxt TCAM lookup
+ /**
+ * The L2 Context is returned from the L2 Ctxt TCAM lookup
+ * and can be used in WC TCAM or EM keys to virtualize further
+ * lookups.
+ */
+ TF_IDENT_TYPE_L2_CTXT_HIGH,
+ /**
+ * The L2 Context is returned from the L2 Ctxt TCAM lookup
* and can be used in WC TCAM or EM keys to virtualize further
* lookups.
*/
- TF_IDENT_TYPE_L2_CTXT,
- /** The WC profile func is returned from the L2 Ctxt TCAM lookup
+ TF_IDENT_TYPE_L2_CTXT_LOW,
+ /**
+ * The WC profile func is returned from the L2 Ctxt TCAM lookup
* to enable virtualization of the profile TCAM.
*/
TF_IDENT_TYPE_PROF_FUNC,
- /** The WC profile ID is included in the WC lookup key
+ /**
+ * The WC profile ID is included in the WC lookup key
* to enable virtualization of the WC TCAM hardware.
*/
TF_IDENT_TYPE_WC_PROF,
- /** The EM profile ID is included in the EM lookup key
+ /**
+ * The EM profile ID is included in the EM lookup key
* to enable virtualization of the EM hardware. (not required for SR2
* as it has table scope)
*/
TF_IDENT_TYPE_EM_PROF,
- /** The L2 func is included in the ILT result and from recycling to
+ /**
+ * The L2 func is included in the ILT result and from recycling to
* enable virtualization of further lookups.
*/
TF_IDENT_TYPE_L2_FUNC,
/** Wh+/SR Action Modify L4 Dest Port */
TF_TBL_TYPE_ACT_MODIFY_DPORT,
/** Wh+/SR Action Modify IPv4 Source */
- TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC,
- /** Wh+/SR Action _Modify L4 Dest Port */
- TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST,
- /** Action Modify IPv6 Source */
- TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC,
- /** Action Modify IPv6 Destination */
- TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST,
+ TF_TBL_TYPE_ACT_MODIFY_IPV4,
/** Meter Profiles */
TF_TBL_TYPE_METER_PROF,
/** Meter Instance */
/* External */
- /** External table type - initially 1 poolsize entries.
+ /**
+ * External table type - initially 1 poolsize entries.
* All External table types are associated with a table
* scope. Internal types are not.
*/
*/
enum tf_tcam_tbl_type {
/** L2 Context TCAM */
- TF_TCAM_TBL_TYPE_L2_CTXT_TCAM,
+ TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
+ /** L2 Context TCAM */
+ TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
/** Profile TCAM */
TF_TCAM_TBL_TYPE_PROF_TCAM,
/** Wildcard TCAM */
TF_EM_TBL_TYPE_MAX
};
-/** TruFlow Session Information
+/**
+ * TruFlow Session Information
*
* Structure defining a TruFlow Session, also known as a Management
* session. This structure is initialized at time of
* tf_open_session(). It is passed to all of the TruFlow APIs as way
* to prescribe and isolate resources between different TruFlow ULP
* Applications.
+ *
+ * Ownership of the elements is split between ULP and TruFlow. Please
+ * see the individual elements.
*/
struct tf_session_info {
/**
uint32_t core_data_sz_bytes;
};
-/** TruFlow handle
+/**
+ * TruFlow handle
*
* Contains a pointer to the session info. Allocated by ULP and passed
* to TruFlow using tf_open_session(). TruFlow will populate the
- * session info at that time. Additional 'opens' can be done using
- * same session_info by using tf_attach_session().
+ * session info at that time. A TruFlow Session can be used by more
+ * than one PF/VF by using the tf_open_session().
*
* It is expected that ULP allocates this memory as shared memory.
*
struct tf_session_info *session;
};
+/**
+ * Identifier resource definition
+ */
+struct tf_identifier_resources {
+ /**
+ * Array of TF Identifiers where each entry is expected to be
+ * set to the requested resource number of that specific type.
+ * The index used is tf_identifier_type.
+ */
+ uint16_t cnt[TF_IDENT_TYPE_MAX];
+};
+
+/**
+ * Table type resource definition
+ */
+struct tf_tbl_resources {
+ /**
+ * Array of TF Table types where each entry is expected to be
+ * set to the requeste resource number of that specific
+ * type. The index used is tf_tbl_type.
+ */
+ uint16_t cnt[TF_TBL_TYPE_MAX];
+};
+
+/**
+ * TCAM type resource definition
+ */
+struct tf_tcam_resources {
+ /**
+ * Array of TF TCAM types where each entry is expected to be
+ * set to the requested resource number of that specific
+ * type. The index used is tf_tcam_tbl_type.
+ */
+ uint16_t cnt[TF_TCAM_TBL_TYPE_MAX];
+};
+
+/**
+ * EM type resource definition
+ */
+struct tf_em_resources {
+ /**
+ * Array of TF EM table types where each entry is expected to
+ * be set to the requested resource number of that specific
+ * type. The index used is tf_em_tbl_type.
+ */
+ uint16_t cnt[TF_EM_TBL_TYPE_MAX];
+};
+
+/**
+ * tf_session_resources parameter definition.
+ */
+struct tf_session_resources {
+ /**
+ * [in] Requested Identifier Resources
+ *
+ * Number of identifier resources requested for the
+ * session.
+ */
+ struct tf_identifier_resources ident_cnt[TF_DIR_MAX];
+ /**
+ * [in] Requested Index Table resource counts
+ *
+ * The number of index table resources requested for the
+ * session.
+ */
+ struct tf_tbl_resources tbl_cnt[TF_DIR_MAX];
+ /**
+ * [in] Requested TCAM Table resource counts
+ *
+ * The number of TCAM table resources requested for the
+ * session.
+ */
+
+ struct tf_tcam_resources tcam_cnt[TF_DIR_MAX];
+ /**
+ * [in] Requested EM resource counts
+ *
+ * The number of internal EM table resources requested for the
+ * session.
+ */
+ struct tf_em_resources em_cnt[TF_DIR_MAX];
+};
/**
* tf_open_session parameters definition.
*/
struct tf_open_session_parms {
- /** [in] ctrl_chan_name
+ /**
+ * [in] ctrl_chan_name
*
* String containing name of control channel interface to be
* used for this session to communicate with firmware.
* shared memory allocation.
*/
char ctrl_chan_name[TF_SESSION_NAME_MAX];
- /** [in] shadow_copy
+ /**
+ * [in] shadow_copy
*
* Boolean controlling the use and availability of shadow
* copy. Shadow copy will allow the TruFlow to keep track of
* control channel.
*/
bool shadow_copy;
- /** [in/out] session_id
+ /**
+ * [in/out] session_id
*
* Session_id is unique per session.
*
* The session_id allows a session to be shared between devices.
*/
union tf_session_id session_id;
- /** [in] device type
+ /**
+ * [in/out] session_client_id
*
- * Device type is passed, one of Wh+, Brd2, Brd3, Brd4
- */
- enum tf_device_type device_type;
- /** [in] Requested Identifier Resources
+ * Session_client_id is unique per client.
*
- * The number of identifier resources requested for the session.
- * The index used is tf_identifier_type.
- */
- uint16_t identifer_cnt[TF_IDENT_TYPE_MAX];
- /** [in] Requested Index Table resource counts
+ * Session_client_id is composed of session_id and the
+ * fw_session_client_id fw_session_id. The construction is
+ * done by parsing the ctrl_chan_name together with allocation
+ * of a fw_session_client_id during tf_open_session().
+ *
+ * A reference count will be incremented in the session on
+ * which a client is created.
*
- * The number of index table resources requested for the session.
- * The index used is tf_tbl_type.
+ * A session can first be closed if there is one Session
+ * Client left. Session Clients should closed using
+ * tf_close_session().
*/
- uint16_t tbl_cnt[TF_TBL_TYPE_MAX];
- /** [in] Requested TCAM Table resource counts
+ union tf_session_client_id session_client_id;
+ /**
+ * [in] device type
*
- * The number of TCAM table resources requested for the session.
- * The index used is tf_tcam_tbl_type.
+ * Device type for the session.
*/
- uint16_t tcam_tbl_cnt[TF_TCAM_TBL_TYPE_MAX];
- /** [in] Requested EM resource counts
+ enum tf_device_type device_type;
+ /**
+ * [in] resources
*
- * The number of internal EM table resources requested for the session
- * The index used is tf_em_tbl_type.
+ * Resource allocation for the session.
*/
- uint16_t em_tbl_cnt[TF_EM_TBL_TYPE_MAX];
+ struct tf_session_resources resources;
};
/**
- * Opens a new TruFlow management session.
+ * Opens a new TruFlow Session or session client.
+ *
+ * What gets created depends on the passed in tfp content. If the tfp
+ * does not have prior session data a new session with associated
+ * session client. If tfp has a session already a session client will
+ * be created. In both cases the session client is created using the
+ * provided ctrl_chan_name.
*
- * TruFlow will allocate session specific memory, shared memory, to
- * hold its session data. This data is private to TruFlow.
+ * In case of session creation TruFlow will allocate session specific
+ * memory, shared memory, to hold its session data. This data is
+ * private to TruFlow.
*
- * Multiple PFs can share the same session. An association, refcount,
- * between session and PFs is maintained within TruFlow. Thus, a PF
- * can attach to an existing session, see tf_attach_session().
+ * No other TruFlow APIs will succeed unless this API is first called
+ * and succeeds.
*
- * No other TruFlow APIs will succeed unless this API is first called and
- * succeeds.
+ * tf_open_session() returns a session id and session client id that
+ * is used on all other TF APIs.
*
- * tf_open_session() returns a session id that can be used on attach.
+ * A Session or session client can be closed using tf_close_session().
*
* [in] tfp
* Pointer to TF handle
+ *
* [in] parms
* Pointer to open parameters
*
int tf_open_session(struct tf *tfp,
struct tf_open_session_parms *parms);
+/**
+ * Experimental
+ *
+ * tf_attach_session parameters definition.
+ */
struct tf_attach_session_parms {
- /** [in] ctrl_chan_name
+ /**
+ * [in] ctrl_chan_name
*
* String containing name of control channel interface to be
* used for this session to communicate with firmware.
*/
char ctrl_chan_name[TF_SESSION_NAME_MAX];
- /** [in] attach_chan_name
+ /**
+ * [in] attach_chan_name
*
* String containing name of attach channel interface to be
* used for this session.
*/
char attach_chan_name[TF_SESSION_NAME_MAX];
- /** [in] session_id
+ /**
+ * [in] session_id
*
* Session_id is unique per session. For Attach the session_id
* should be the session_id that was returned on the first
};
/**
- * Attaches to an existing session. Used when more than one PF wants
- * to share a single session. In that case all TruFlow management
- * traffic will be sent to the TruFlow firmware using the 'PF' that
- * did the attach not the session ctrl channel.
+ * Experimental
+ *
+ * Allows a 2nd application instance to attach to an existing
+ * session. Used when a session is to be shared between two processes.
*
* Attach will increment a ref count as to manage the shared session data.
*
- * [in] tfp, pointer to TF handle
- * [in] parms, pointer to attach parameters
+ * [in] tfp
+ * Pointer to TF handle
+ *
+ * [in] parms
+ * Pointer to attach parameters
*
* Returns
* - (0) if successful.
struct tf_attach_session_parms *parms);
/**
- * Closes an existing session. Cleans up all hardware and firmware
- * state associated with the TruFlow application session when the last
- * PF associated with the session results in refcount to be zero.
+ * Closes an existing session client or the session it self. The
+ * session client is default closed and if the session reference count
+ * is 0 then the session is closed as well.
+ *
+ * On session close all hardware and firmware state associated with
+ * the TruFlow application is cleaned up.
+ *
+ * The session client is extracted from the tfp. Thus tf_close_session()
+ * cannot close a session client on behalf of another function.
*
* Returns success or failure code.
*/
*
* @ref tf_free_identifier
*/
-/** tf_alloc_identifier parameter definition
+/**
+ * tf_alloc_identifier parameter definition
*/
struct tf_alloc_identifier_parms {
/**
*/
enum tf_identifier_type ident_type;
/**
- * [out] Identifier allocated
+ * [out] Allocated identifier
*/
- uint16_t id;
+ uint32_t id;
};
-/** tf_free_identifier parameter definition
+/**
+ * tf_free_identifier parameter definition
*/
struct tf_free_identifier_parms {
/**
/**
* [in] ID to free
*/
- uint16_t id;
+ uint32_t id;
+ /**
+ * (experimental)
+ * [out] Current refcnt after free
+ */
+ uint32_t ref_cnt;
};
-/** allocate identifier resource
+/**
+ * tf_search_identifier parameter definition (experimental)
+ */
+struct tf_search_identifier_parms {
+ /**
+ * [in] receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Identifier type
+ */
+ enum tf_identifier_type ident_type;
+ /**
+ * [in] Identifier data to search for
+ */
+ uint32_t search_id;
+ /**
+ * [out] Set if matching identifier found
+ */
+ bool hit;
+ /**
+ * [out] Current ref count after allocation
+ */
+ uint32_t ref_cnt;
+};
+
+/**
+ * allocate identifier resource
*
* TruFlow core will allocate a free id from the per identifier resource type
* pool reserved for the session during tf_open(). No firmware is involved.
*
+ * If shadow copy is enabled, the internal ref_cnt is set to 1 in the
+ * shadow table for a newly allocated resource.
+ *
* Returns success or failure code.
*/
int tf_alloc_identifier(struct tf *tfp,
struct tf_alloc_identifier_parms *parms);
-/** free identifier resource
+/**
+ * free identifier resource
*
* TruFlow core will return an id back to the per identifier resource type pool
* reserved for the session. No firmware is involved. During tf_close, the
* complete pool is returned to the firmware.
*
+ * additional operation (experimental)
+ * Decrement reference count. Only release resource once refcnt goes to 0 if
+ * shadow copy is enabled.
+ *
* Returns success or failure code.
*/
int tf_free_identifier(struct tf *tfp,
struct tf_free_identifier_parms *parms);
+/**
+ * Search identifier resource (experimental)
+ *
+ * If the shadow copy is enabled search_id is used to search for a matching
+ * entry in the shadow table. The shadow table consists of an array of
+ * reference counts indexed by identifier. If a matching entry is found hit is
+ * set to TRUE, refcnt is increased by 1 and returned. Otherwise, hit is
+ * set to false and refcnt is set to 0.
+ *
+ * TODO: we may need a per table internal shadow copy enable flag to stage
+ * the shadow table implementation. We do not need the shadow table for other
+ * tables at this time so we may only want to enable the identifier shadow.
+ *
+ * TODO: remove this pseudocode below added to show that if search fails
+ * we shouldn't allocate a new entry but return.
+ *
+ * identifier alloc (search_en=1)
+ * if (ident is allocated and ref_cnt >=1)
+ * return ident - hit is set, incr refcnt
+ * else (not found)
+ * return
+ *
+ */
+int tf_search_identifier(struct tf *tfp,
+ struct tf_search_identifier_parms *parms);
+
/**
* @page dram_table DRAM Table Scope Interface
*
*/
-/** tf_alloc_tbl_scope_parms definition
+/**
+ * tf_alloc_tbl_scope_parms definition
*/
struct tf_alloc_tbl_scope_parms {
/**
*/
uint32_t rx_num_flows_in_k;
/**
- * [in] Brd4 only receive table access interface id
+ * [in] SR2 only receive table access interface id
*/
uint32_t rx_tbl_if_id;
/**
*/
uint32_t tx_num_flows_in_k;
/**
- * [in] Brd4 only receive table access interface id
+ * [in] SR2 only receive table access interface id
*/
uint32_t tx_tbl_if_id;
/**
/**
* allocate a table scope
*
- * On Brd4 Firmware will allocate a scope ID. On other devices, the scope
+ * On SR2 Firmware will allocate a scope ID. On other devices, the scope
* is a software construct to identify an EEM table. This function will
* divide the hash memory/buckets and records according to the device
* device constraints based upon calculations using either the number of flows
*
* This API will allocate the table region in
* DRAM, program the PTU page table entries, and program the number of static
- * buckets (if Brd4) in the RX and TX CFAs. Buckets are assumed to start at
+ * buckets (if SR2) in the RX and TX CFAs. Buckets are assumed to start at
* 0 in the EM memory for the scope. Upon successful completion of this API,
* hash tables are fully initialized and ready for entries to be inserted.
*
*
* Firmware checks that the table scope ID is owned by the TruFlow
* session, verifies that no references to this table scope remains
- * (Brd4 ILT) or Profile TCAM entries for either CFA (RX/TX) direction,
+ * (SR2 ILT) or Profile TCAM entries for either CFA (RX/TX) direction,
* then frees the table scope ID.
*
* Returns success or failure code.
int tf_free_tbl_scope(struct tf *tfp,
struct tf_free_tbl_scope_parms *parms);
-
/**
* @page tcam TCAM Access
*
* @ref tf_free_tcam_entry
*/
-/** tf_alloc_tcam_entry parameter definition
+
+/**
+ * tf_alloc_tcam_entry parameter definition
*/
struct tf_alloc_tcam_entry_parms {
/**
uint16_t idx;
};
-/** allocate TCAM entry
+/**
+ * allocate TCAM entry
*
* Allocate a TCAM entry - one of these types:
*
int tf_alloc_tcam_entry(struct tf *tfp,
struct tf_alloc_tcam_entry_parms *parms);
-/** tf_set_tcam_entry parameter definition
+/**
+ * tf_set_tcam_entry parameter definition
*/
struct tf_set_tcam_entry_parms {
/**
uint16_t result_sz_in_bits;
};
-/** set TCAM entry
+/**
+ * set TCAM entry
*
* Program a TCAM table entry for a TruFlow session.
*
int tf_set_tcam_entry(struct tf *tfp,
struct tf_set_tcam_entry_parms *parms);
-/** tf_get_tcam_entry parameter definition
+/**
+ * tf_get_tcam_entry parameter definition
*/
struct tf_get_tcam_entry_parms {
/**
uint16_t result_sz_in_bits;
};
-/*
+/**
* get TCAM entry
*
* Program a TCAM table entry for a TruFlow session.
int tf_get_tcam_entry(struct tf *tfp,
struct tf_get_tcam_entry_parms *parms);
-/*
+/**
* tf_free_tcam_entry parameter definition
*/
struct tf_free_tcam_entry_parms {
uint16_t ref_cnt;
};
-/*
+/**
+ * free TCAM entry
+ *
* Free TCAM entry.
*
* Firmware checks to ensure the TCAM entries are owned by the TruFlow
* @ref tf_set_tbl_entry
*
* @ref tf_get_tbl_entry
+ *
+ * @ref tf_bulk_get_tbl_entry
*/
/**
*/
uint8_t *data;
/**
- * [out] Entry size
+ * [in] Entry size
*/
uint16_t data_sz_in_bytes;
/**
int tf_get_tbl_entry(struct tf *tfp,
struct tf_get_tbl_entry_parms *parms);
+/**
+ * tf_bulk_get_tbl_entry parameter definition
+ */
+struct tf_bulk_get_tbl_entry_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to get
+ */
+ enum tf_tbl_type type;
+ /**
+ * [in] Starting index to read from
+ */
+ uint32_t starting_idx;
+ /**
+ * [in] Number of sequential entries
+ */
+ uint16_t num_entries;
+ /**
+ * [in] Size of the single entry
+ */
+ uint16_t entry_sz_in_bytes;
+ /**
+ * [out] Host physical address, where the data
+ * will be copied to by the firmware.
+ * Use tfp_calloc() API and mem_pa
+ * variable of the tfp_calloc_parms
+ * structure for the physical address.
+ */
+ uint64_t physical_mem_addr;
+};
+
+/**
+ * Bulk get index table entry
+ *
+ * Used to retrieve a set of index table entries.
+ *
+ * Entries within the range may not have been allocated using
+ * tf_alloc_tbl_entry() at the time of access. But the range must
+ * be within the bounds determined from tf_open_session() for the
+ * given table type. Currently, this is only used for collecting statistics.
+ *
+ * Returns success or failure code. Failure will be returned if the
+ * provided data buffer is too small for the data type requested.
+ */
+int tf_bulk_get_tbl_entry(struct tf *tfp,
+ struct tf_bulk_get_tbl_entry_parms *parms);
+
/**
* @page exact_match Exact Match Table
*
*/
uint32_t tbl_scope_id;
/**
- * [in] ID of table interface to use (Brd4 only)
+ * [in] ID of table interface to use (SR2 only)
*/
uint32_t tbl_if_id;
/**
*/
uint32_t tbl_scope_id;
/**
- * [in] ID of table interface to use (Brd4 only)
+ * [in] ID of table interface to use (SR2 only)
*/
uint32_t tbl_if_id;
/**
* [in] epoch group IDs of entry to delete
- * 2 element array with 2 ids. (Brd4 only)
+ * 2 element array with 2 ids. (SR2 only)
*/
uint16_t *epochs;
/**
*/
uint32_t tbl_scope_id;
/**
- * [in] ID of table interface to use (Brd4 only)
+ * [in] ID of table interface to use (SR2 only)
*/
uint32_t tbl_if_id;
/**
uint16_t em_record_sz_in_bits;
/**
* [in] epoch group IDs of entry to lookup
- * 2 element array with 2 ids. (Brd4 only)
+ * 2 element array with 2 ids. (SR2 only)
*/
uint16_t *epochs;
/**
* 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).
+ * need to allocate a dynamic bucket for the entry (SR2 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
*/
int tf_search_em_entry(struct tf *tfp,
struct tf_search_em_entry_parms *parms);
+
+/**
+ * @page global Global Configuration
+ *
+ * @ref tf_set_global_cfg
+ *
+ * @ref tf_get_global_cfg
+ */
+/**
+ * Tunnel Encapsulation Offsets
+ */
+enum tf_tunnel_encap_offsets {
+ TF_TUNNEL_ENCAP_L2,
+ TF_TUNNEL_ENCAP_NAT,
+ TF_TUNNEL_ENCAP_MPLS,
+ TF_TUNNEL_ENCAP_VXLAN,
+ TF_TUNNEL_ENCAP_GENEVE,
+ TF_TUNNEL_ENCAP_NVGRE,
+ TF_TUNNEL_ENCAP_GRE,
+ TF_TUNNEL_ENCAP_FULL_GENERIC
+};
+/**
+ * Global Configuration Table Types
+ */
+enum tf_global_config_type {
+ TF_TUNNEL_ENCAP, /**< Tunnel Encap Config(TECT) */
+ TF_ACTION_BLOCK, /**< Action Block Config(ABCR) */
+ TF_GLOBAL_CFG_TYPE_MAX
+};
+
+/**
+ * tf_global_cfg parameter definition
+ */
+struct tf_global_cfg_parms {
+ /**
+ * [in] receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Global config type
+ */
+ enum tf_global_config_type type;
+ /**
+ * [in] Offset @ the type
+ */
+ uint32_t offset;
+ /**
+ * [in/out] Value of the configuration
+ * set - Read, Modify and Write
+ * get - Read the full configuration
+ */
+ uint8_t *config;
+ /**
+ * [in] struct containing size
+ */
+ uint16_t config_sz_in_bytes;
+};
+
+/**
+ * Get global configuration
+ *
+ * Retrieve the configuration
+ *
+ * Returns success or failure code.
+ */
+int tf_get_global_cfg(struct tf *tfp,
+ struct tf_global_cfg_parms *parms);
+
+/**
+ * Update the global configuration table
+ *
+ * Read, modify write the value.
+ *
+ * Returns success or failure code.
+ */
+int tf_set_global_cfg(struct tf *tfp,
+ struct tf_global_cfg_parms *parms);
+
+/**
+ * @page if_tbl Interface Table Access
+ *
+ * @ref tf_set_if_tbl_entry
+ *
+ * @ref tf_get_if_tbl_entry
+ *
+ * @ref tf_restore_if_tbl_entry
+ */
+/**
+ * Enumeration of TruFlow interface table types.
+ */
+enum tf_if_tbl_type {
+ /** Default Profile L2 Context Entry */
+ TF_IF_TBL_TYPE_PROF_SPIF_DFLT_L2_CTXT,
+ /** Default Profile TCAM/Lookup Action Record Pointer Table */
+ TF_IF_TBL_TYPE_PROF_PARIF_DFLT_ACT_REC_PTR,
+ /** Error Profile TCAM Miss Action Record Pointer Table */
+ TF_IF_TBL_TYPE_PROF_PARIF_ERR_ACT_REC_PTR,
+ /** Default Error Profile TCAM Miss Action Record Pointer Table */
+ TF_IF_TBL_TYPE_LKUP_PARIF_DFLT_ACT_REC_PTR,
+ /** SR2 Ingress lookup table */
+ TF_IF_TBL_TYPE_ILT,
+ /** SR2 VNIC/SVIF Table */
+ TF_IF_TBL_TYPE_VNIC_SVIF,
+ TF_IF_TBL_TYPE_MAX
+};
+
+/**
+ * tf_set_if_tbl_entry parameter definition
+ */
+struct tf_set_if_tbl_entry_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of object to set
+ */
+ enum tf_if_tbl_type type;
+ /**
+ * [in] Entry data
+ */
+ uint8_t *data;
+ /**
+ * [in] Entry size
+ */
+ uint16_t data_sz_in_bytes;
+ /**
+ * [in] Interface to write
+ */
+ uint32_t idx;
+};
+
+/**
+ * set interface table entry
+ *
+ * Used to set an interface table. This API is used for managing tables indexed
+ * by SVIF/SPIF/PARIF interfaces. In current implementation only the value is
+ * set.
+ * Returns success or failure code.
+ */
+int tf_set_if_tbl_entry(struct tf *tfp,
+ struct tf_set_if_tbl_entry_parms *parms);
+
+/**
+ * tf_get_if_tbl_entry parameter definition
+ */
+struct tf_get_if_tbl_entry_parms {
+ /**
+ * [in] Receive or transmit direction
+ */
+ enum tf_dir dir;
+ /**
+ * [in] Type of table to get
+ */
+ enum tf_if_tbl_type type;
+ /**
+ * [out] Entry data
+ */
+ uint8_t *data;
+ /**
+ * [in] Entry size
+ */
+ uint16_t data_sz_in_bytes;
+ /**
+ * [in] Entry index to read
+ */
+ uint32_t idx;
+};
+
+/**
+ * get interface table entry
+ *
+ * Used to retrieve an interface table entry.
+ *
+ * Reads the interface table entry value
+ *
+ * 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_if_tbl_entry(struct tf *tfp,
+ struct tf_get_if_tbl_entry_parms *parms);
+
#endif /* _TF_CORE_H_ */