1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Broadcom
13 #include "hcapi_cfa_defs.h"
14 #include "tf_project.h"
19 * Truflow Core API Header File
22 /********** BEGIN Truflow Core DEFINITIONS **********/
25 #define TF_KILOBYTE 1024
26 #define TF_MEGABYTE (1024 * 1024)
32 TF_DIR_RX, /**< Receive */
33 TF_DIR_TX, /**< Transmit */
41 TF_MEM_INTERNAL, /**< Internal */
42 TF_MEM_EXTERNAL, /**< External */
47 * External memory control channel type
49 enum tf_ext_mem_chan_type {
51 * Direct memory write(Wh+/SR)
53 TF_EXT_MEM_CHAN_TYPE_DIRECT = 0,
57 TF_EXT_MEM_CHAN_TYPE_RING_IF,
59 * Use HWRM message to firmware
61 TF_EXT_MEM_CHAN_TYPE_FW,
63 * Use ring_if message to firmware
65 TF_EXT_MEM_CHAN_TYPE_RING_IF_FW,
66 TF_EXT_MEM_CHAN_TYPE_MAX
70 * EEM record AR helper
72 * Helper to handle the Action Record Pointer in the EEM Record Entry.
74 * Convert absolute offset to action record pointer in EEM record entry
75 * Convert action record pointer in EEM record entry to absolute offset
77 #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
78 #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
84 #define TF_BITS_2_BYTES(num_bits) (((num_bits) + 7) / 8)
86 /********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
89 * @page general General
91 * @ref tf_open_session
93 * @ref tf_attach_session
95 * @ref tf_close_session
99 * Session Version defines
101 * The version controls the format of the tf_session and
102 * tf_session_info structure. This is to assure upgrade between
103 * versions can be supported.
105 #define TF_SESSION_VER_MAJOR 1 /**< Major Version */
106 #define TF_SESSION_VER_MINOR 0 /**< Minor Version */
107 #define TF_SESSION_VER_UPDATE 0 /**< Update Version */
112 * Name of the TruFlow control channel interface. Expects
113 * format to be RTE Name specific, i.e. rte_eth_dev_get_name_by_port()
115 #define TF_SESSION_NAME_MAX 64
117 #define TF_FW_SESSION_ID_INVALID 0xFF /**< Invalid FW Session ID define */
122 * Unique session identifier which includes PCIe bus info to
123 * distinguish the PF and session info to identify the associated
124 * TruFlow session. Session ID is constructed from the passed in
125 * ctrl_chan_name in tf_open_session() together with an allocated
126 * fw_session_id. Done by TruFlow on tf_open_session().
128 union tf_session_id {
134 uint8_t fw_session_id;
139 * Session Client Identifier
141 * Unique identifier for a client within a session. Session Client ID
142 * is constructed from the passed in session and a firmware allocated
143 * fw_session_client_id. Done by TruFlow on tf_open_session().
145 union tf_session_client_id {
148 uint8_t fw_session_id;
149 uint8_t fw_session_client_id;
156 * The version controls the format of the tf_session and
157 * tf_session_info structure. This is to assure upgrade between
158 * versions can be supported.
160 * Please see the TF_VER_MAJOR/MINOR and UPDATE defines.
162 struct tf_session_version {
169 * Session supported device types
171 enum tf_device_type {
172 TF_DEVICE_TYPE_WH = 0, /**< Whitney+ */
173 TF_DEVICE_TYPE_SR, /**< Stingray */
174 TF_DEVICE_TYPE_THOR, /**< Thor */
175 TF_DEVICE_TYPE_MAX /**< Maximum */
181 enum tf_module_type {
185 TF_MODULE_TYPE_IDENTIFIER,
189 TF_MODULE_TYPE_TABLE,
203 * Identifier resource types
205 enum tf_identifier_type {
208 * The L2 Context is returned from the L2 Ctxt TCAM lookup
209 * and can be used in WC TCAM or EM keys to virtualize further
212 TF_IDENT_TYPE_L2_CTXT_HIGH,
215 * The L2 Context is returned from the L2 Ctxt TCAM lookup
216 * and can be used in WC TCAM or EM keys to virtualize further
219 TF_IDENT_TYPE_L2_CTXT_LOW,
222 * The WC profile func is returned from the L2 Ctxt TCAM lookup
223 * to enable virtualization of the profile TCAM.
225 TF_IDENT_TYPE_PROF_FUNC,
228 * The WC profile ID is included in the WC lookup key
229 * to enable virtualization of the WC TCAM hardware.
231 TF_IDENT_TYPE_WC_PROF,
234 * The EM profile ID is included in the EM lookup key
235 * to enable virtualization of the EM hardware.
237 TF_IDENT_TYPE_EM_PROF,
240 * The L2 func is included in the ILT result and from recycling to
241 * enable virtualization of further lookups.
243 TF_IDENT_TYPE_L2_FUNC,
248 * Enumeration of TruFlow table types. A table type is used to identify a
251 * NOTE: The table type TF_TBL_TYPE_EXT is unique in that it is
252 * the only table type that is connected with a table scope.
257 /** Wh+/SR/TH Action Record */
258 TF_TBL_TYPE_FULL_ACT_RECORD,
259 /** TH Compact Action Record */
260 TF_TBL_TYPE_COMPACT_ACT_RECORD,
261 /** (Future) Multicast Groups */
262 TF_TBL_TYPE_MCAST_GROUPS,
263 /** Wh+/SR/TH Action Encap 8 Bytes */
264 TF_TBL_TYPE_ACT_ENCAP_8B,
265 /** Wh+/SR/TH Action Encap 16 Bytes */
266 TF_TBL_TYPE_ACT_ENCAP_16B,
267 /** WH+/SR/TH Action Encap 32 Bytes */
268 TF_TBL_TYPE_ACT_ENCAP_32B,
269 /** Wh+/SR/TH Action Encap 64 Bytes */
270 TF_TBL_TYPE_ACT_ENCAP_64B,
271 /** WH+/SR/TH Action Source Properties SMAC */
272 TF_TBL_TYPE_ACT_SP_SMAC,
273 /** Wh+/SR/TH Action Source Properties SMAC IPv4 */
274 TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
275 /** WH+/SR/TH Action Source Properties SMAC IPv6 */
276 TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
277 /** Wh+/SR/TH Action Statistics 64 Bits */
278 TF_TBL_TYPE_ACT_STATS_64,
279 /** Wh+/SR Action Modify IPv4 Source */
280 TF_TBL_TYPE_ACT_MODIFY_IPV4,
281 /** TH 8B Modify Record */
282 TF_TBL_TYPE_ACT_MODIFY_8B,
283 /** TH 16B Modify Record */
284 TF_TBL_TYPE_ACT_MODIFY_16B,
285 /** TH 32B Modify Record */
286 TF_TBL_TYPE_ACT_MODIFY_32B,
287 /** TH 64B Modify Record */
288 TF_TBL_TYPE_ACT_MODIFY_64B,
289 /** (Future) Meter Profiles */
290 TF_TBL_TYPE_METER_PROF,
291 /** (Future) Meter Instance */
292 TF_TBL_TYPE_METER_INST,
293 /** Wh+/SR/Th Mirror Config */
294 TF_TBL_TYPE_MIRROR_CONFIG,
297 /** (Future) TH Metadata */
298 TF_TBL_TYPE_METADATA,
299 /** (Future) TH CT State */
300 TF_TBL_TYPE_CT_STATE,
301 /** (Future) TH Range Profile */
302 TF_TBL_TYPE_RANGE_PROF,
303 /** TH EM Flexible Key builder */
305 /** TH WC Flexible Key builder */
311 * External table type - initially 1 poolsize entries.
312 * All External table types are associated with a table
313 * scope. Internal types are not. Currently this is
314 * a pool of 64B entries.
323 enum tf_tcam_tbl_type {
324 /** L2 Context TCAM */
325 TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
326 /** L2 Context TCAM */
327 TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
329 TF_TCAM_TBL_TYPE_PROF_TCAM,
331 TF_TCAM_TBL_TYPE_WC_TCAM,
332 /** Source Properties TCAM */
333 TF_TCAM_TBL_TYPE_SP_TCAM,
334 /** Connection Tracking Rule TCAM */
335 TF_TCAM_TBL_TYPE_CT_RULE_TCAM,
336 /** Virtual Edge Bridge TCAM */
337 TF_TCAM_TBL_TYPE_VEB_TCAM,
344 enum tf_search_status {
345 /** The entry was not found, but an idx was allocated if requested. */
347 /** The entry was found, and the result/idx are valid */
349 /** The entry was not found and the table is full */
355 * These defines are provisioned during
358 enum tf_em_tbl_type {
359 /** The number of internal EM records for the session */
360 TF_EM_TBL_TYPE_EM_RECORD,
361 /** The number of table scopes reequested */
362 TF_EM_TBL_TYPE_TBL_SCOPE,
367 * TruFlow Session Information
369 * Structure defining a TruFlow Session, also known as a Management
370 * session. This structure is initialized at time of
371 * tf_open_session(). It is passed to all of the TruFlow APIs as way
372 * to prescribe and isolate resources between different TruFlow ULP
375 * Ownership of the elements is split between ULP and TruFlow. Please
376 * see the individual elements.
378 struct tf_session_info {
380 * TrueFlow Version. Used to control the structure layout when
381 * sharing sessions. No guarantee that a secondary process
382 * would come from the same version of an executable.
383 * TruFlow initializes this variable on tf_open_session().
388 struct tf_session_version ver;
390 * will be STAILQ_ENTRY(tf_session_info) next
397 * Session ID is a unique identifier for the session. TruFlow
398 * initializes this variable during tf_open_session()
402 * Access: Truflow & ULP
404 union tf_session_id session_id;
406 * Protects access to core_data. Lock is initialized and owned
407 * by ULP. TruFlow can access the core_data without checking
415 * The core_data holds the TruFlow tf_session data
416 * structure. This memory is allocated and owned by TruFlow on
419 * TruFlow uses this memory for session management control
420 * until the session is closed by ULP. Access control is done
421 * by the spin_lock which ULP controls ahead of TruFlow API
424 * Please see tf_open_session_parms for specification details
432 * The core_data_sz_bytes specifies the size of core_data in
435 * The size is set by TruFlow on tf_open_session().
437 * Please see tf_open_session_parms for specification details
443 uint32_t core_data_sz_bytes;
449 * Contains a pointer to the session info. Allocated by ULP and passed
450 * to TruFlow using tf_open_session(). TruFlow will populate the
451 * session info at that time. A TruFlow Session can be used by more
452 * than one PF/VF by using the tf_open_session().
454 * It is expected that ULP allocates this memory as shared memory.
456 * NOTE: This struct must be within the BNXT PMD struct bnxt
457 * (bp). This allows use of container_of() to get access to the PMD.
460 struct tf_session_info *session;
462 * the pointer to the parent bp struct
468 * Identifier resource definition
470 struct tf_identifier_resources {
472 * Array of TF Identifiers where each entry is expected to be
473 * set to the requested resource number of that specific type.
474 * The index used is tf_identifier_type.
476 uint16_t cnt[TF_IDENT_TYPE_MAX];
480 * Table type resource definition
482 struct tf_tbl_resources {
484 * Array of TF Table types where each entry is expected to be
485 * set to the requeste resource number of that specific
486 * type. The index used is tf_tbl_type.
488 uint16_t cnt[TF_TBL_TYPE_MAX];
492 * TCAM type resource definition
494 struct tf_tcam_resources {
496 * Array of TF TCAM types where each entry is expected to be
497 * set to the requested resource number of that specific
498 * type. The index used is tf_tcam_tbl_type.
500 uint16_t cnt[TF_TCAM_TBL_TYPE_MAX];
504 * EM type resource definition
506 struct tf_em_resources {
508 * Array of TF EM table types where each entry is expected to
509 * be set to the requested resource number of that specific
510 * type. The index used is tf_em_tbl_type.
512 uint16_t cnt[TF_EM_TBL_TYPE_MAX];
516 * tf_session_resources parameter definition.
518 struct tf_session_resources {
520 * [in] Requested Identifier Resources
522 * Number of identifier resources requested for the
525 struct tf_identifier_resources ident_cnt[TF_DIR_MAX];
527 * [in] Requested Index Table resource counts
529 * The number of index table resources requested for the
532 struct tf_tbl_resources tbl_cnt[TF_DIR_MAX];
534 * [in] Requested TCAM Table resource counts
536 * The number of TCAM table resources requested for the
540 struct tf_tcam_resources tcam_cnt[TF_DIR_MAX];
542 * [in] Requested EM resource counts
544 * The number of internal EM table resources requested for the
547 struct tf_em_resources em_cnt[TF_DIR_MAX];
551 * tf_open_session parameters definition.
553 struct tf_open_session_parms {
555 * [in] ctrl_chan_name
557 * String containing name of control channel interface to be
558 * used for this session to communicate with firmware.
560 * The ctrl_chan_name can be looked up by using
561 * rte_eth_dev_get_name_by_port() within the ULP.
563 * ctrl_chan_name will be used as part of a name for any
564 * shared memory allocation. The ctrl_chan_name is usually in format
565 * 0000:02:00.0. The name for shared session is 0000:02:00.0-tf_shared.
567 char ctrl_chan_name[TF_SESSION_NAME_MAX];
571 * Boolean controlling the use and availability of shadow
572 * copy. Shadow copy will allow the TruFlow to keep track of
573 * resource content on the firmware side without having to
574 * query firmware. Additional private session core_data will
575 * be allocated if this boolean is set to 'true', default
578 * Size of memory depends on the NVM Resource settings for the
583 * [in/out] session_id
585 * Session_id is unique per session.
587 * Session_id is composed of domain, bus, device and
588 * fw_session_id. The construction is done by parsing the
589 * ctrl_chan_name together with allocation of a fw_session_id.
591 * The session_id allows a session to be shared between devices.
593 union tf_session_id session_id;
595 * [in/out] session_client_id
597 * Session_client_id is unique per client.
599 * Session_client_id is composed of session_id and the
600 * fw_session_client_id fw_session_id. The construction is
601 * done by parsing the ctrl_chan_name together with allocation
602 * of a fw_session_client_id during tf_open_session().
604 * A reference count will be incremented in the session on
605 * which a client is created.
607 * A session can first be closed if there is one Session
608 * Client left. Session Clients should closed using
609 * tf_close_session().
611 union tf_session_client_id session_client_id;
615 * Device type for the session.
617 enum tf_device_type device_type;
621 * Resource allocation for the session.
623 struct tf_session_resources resources;
627 * The pointer to the parent bp struct. This is only used for HWRM
628 * message passing within the portability layer. The type is struct
634 * [out] shared_session_creator
636 * Indicates whether the application created the session if set.
637 * Otherwise the shared session already existed. Just for information
640 int shared_session_creator;
644 * Opens a new TruFlow Session or session client.
646 * What gets created depends on the passed in tfp content. If the tfp does not
647 * have prior session data a new session with associated session client. If tfp
648 * has a session already a session client will be created. In both cases the
649 * session client is created using the provided ctrl_chan_name.
651 * In case of session creation TruFlow will allocate session specific memory to
652 * hold its session data. This data is private to TruFlow.
654 * No other TruFlow APIs will succeed unless this API is first called
657 * tf_open_session() returns a session id and session client id. These are
658 * also stored within the tfp structure passed in to all other APIs.
660 * A Session or session client can be closed using tf_close_session().
662 * There are 2 types of sessions - shared and not. For non-shared all
663 * the allocated resources are owned and managed by a single session instance.
664 * No other applications have access to the resources owned by the non-shared
665 * session. For a shared session, resources are shared between 2 applications.
667 * When the caller of tf_open_session() sets the ctrl_chan_name[] to a name
668 * like "0000:02:00.0-tf_shared", it is a request to create a new "shared"
669 * session in the firmware or access the existing shared session. There is
670 * only 1 shared session that can be created. If the shared session has
671 * already been created in the firmware, this API will return this indication
672 * by clearing the shared_session_creator flag. Only the first shared session
673 * create will have the shared_session_creator flag set.
675 * The shared session should always be the first session to be created by
676 * application and the last session closed due to RM management preference.
678 * Sessions remain open in the firmware until the last client of the session
679 * closes the session (tf_close_session()).
682 * Pointer to TF handle
685 * Pointer to open parameters
688 * - (0) if successful.
689 * - (-EINVAL) on failure.
691 int tf_open_session(struct tf *tfp,
692 struct tf_open_session_parms *parms);
695 * General internal resource info
697 * TODO: remove tf_rm_new_entry structure and use this structure
700 struct tf_resource_info {
706 * Identifier resource definition
708 struct tf_identifier_resource_info {
710 * Array of TF Identifiers. The index used is tf_identifier_type.
712 struct tf_resource_info info[TF_IDENT_TYPE_MAX];
716 * Table type resource info definition
718 struct tf_tbl_resource_info {
720 * Array of TF Table types. The index used is tf_tbl_type.
722 struct tf_resource_info info[TF_TBL_TYPE_MAX];
726 * TCAM type resource definition
728 struct tf_tcam_resource_info {
730 * Array of TF TCAM types. The index used is tf_tcam_tbl_type.
732 struct tf_resource_info info[TF_TCAM_TBL_TYPE_MAX];
736 * EM type resource definition
738 struct tf_em_resource_info {
740 * Array of TF EM table types. The index used is tf_em_tbl_type.
742 struct tf_resource_info info[TF_EM_TBL_TYPE_MAX];
746 * tf_session_resources parameter definition.
748 struct tf_session_resource_info {
750 * [in] Requested Identifier Resources
752 * Number of identifier resources requested for the
755 struct tf_identifier_resource_info ident[TF_DIR_MAX];
757 * [in] Requested Index Table resource counts
759 * The number of index table resources requested for the
762 struct tf_tbl_resource_info tbl[TF_DIR_MAX];
764 * [in] Requested TCAM Table resource counts
766 * The number of TCAM table resources requested for the
770 struct tf_tcam_resource_info tcam[TF_DIR_MAX];
772 * [in] Requested EM resource counts
774 * The number of internal EM table resources requested for the
777 struct tf_em_resource_info em[TF_DIR_MAX];
781 * tf_get_session_resources parameter definition.
783 struct tf_get_session_info_parms {
785 * [out] the structure is used to return the information of
786 * allocated resources.
789 struct tf_session_resource_info session_info;
793 * Gets info about a TruFlow Session
795 * Get info about the session which has been created. Whether it exists and
796 * what resource start and stride offsets are in use. This API is primarily
797 * intended to be used by an application which has created a shared session
798 * This application needs to obtain the resources which have already been
799 * allocated for the shared session.
802 * Pointer to TF handle
805 * Pointer to get parameters
808 * - (0) if successful.
809 * - (-EINVAL) on failure.
811 int tf_get_session_info(struct tf *tfp,
812 struct tf_get_session_info_parms *parms);
817 * tf_attach_session parameters definition.
819 struct tf_attach_session_parms {
821 * [in] ctrl_chan_name
823 * String containing name of control channel interface to be
824 * used for this session to communicate with firmware.
826 * The ctrl_chan_name can be looked up by using
827 * rte_eth_dev_get_name_by_port() within the ULP.
829 * ctrl_chan_name will be used as part of a name for any
830 * shared memory allocation.
832 char ctrl_chan_name[TF_SESSION_NAME_MAX];
835 * [in] attach_chan_name
837 * String containing name of attach channel interface to be
838 * used for this session.
840 * The attach_chan_name must be given to a 2nd process after
841 * the primary process has been created. This is the
842 * ctrl_chan_name of the primary process and is used to find
843 * the shared memory for the session that the attach is going
846 char attach_chan_name[TF_SESSION_NAME_MAX];
851 * Session_id is unique per session. For Attach the session_id
852 * should be the session_id that was returned on the first
855 * Session_id is composed of domain, bus, device and
856 * fw_session_id. The construction is done by parsing the
857 * ctrl_chan_name together with allocation of a fw_session_id
858 * during tf_open_session().
860 * A reference count will be incremented on attach. A session
861 * is first fully closed when reference count is zero by
862 * calling tf_close_session().
864 union tf_session_id session_id;
870 * Allows a 2nd application instance to attach to an existing
871 * session. Used when a session is to be shared between two processes.
873 * Attach will increment a ref count as to manage the shared session data.
876 * Pointer to TF handle
879 * Pointer to attach parameters
882 * - (0) if successful.
883 * - (-EINVAL) on failure.
885 int tf_attach_session(struct tf *tfp,
886 struct tf_attach_session_parms *parms);
889 * Closes an existing session client or the session it self. The
890 * session client is default closed and if the session reference count
891 * is 0 then the session is closed as well.
893 * On session close all hardware and firmware state associated with
894 * the TruFlow application is cleaned up.
896 * The session client is extracted from the tfp. Thus tf_close_session()
897 * cannot close a session client on behalf of another function.
899 * Returns success or failure code.
901 int tf_close_session(struct tf *tfp);
904 * @page ident Identity Management
906 * @ref tf_alloc_identifier
908 * @ref tf_free_identifier
911 * tf_alloc_identifier parameter definition
913 struct tf_alloc_identifier_parms {
915 * [in] receive or transmit direction
919 * [in] Identifier type
921 enum tf_identifier_type ident_type;
923 * [out] Allocated identifier
929 * tf_free_identifier parameter definition
931 struct tf_free_identifier_parms {
933 * [in] receive or transmit direction
937 * [in] Identifier type
939 enum tf_identifier_type ident_type;
946 * [out] Current refcnt after free
952 * tf_search_identifier parameter definition (experimental)
954 struct tf_search_identifier_parms {
956 * [in] receive or transmit direction
960 * [in] Identifier type
962 enum tf_identifier_type ident_type;
964 * [in] Identifier data to search for
968 * [out] Set if matching identifier found
972 * [out] Current ref count after allocation
978 * allocate identifier resource
980 * TruFlow core will allocate a free id from the per identifier resource type
981 * pool reserved for the session during tf_open(). No firmware is involved.
983 * If shadow copy is enabled, the internal ref_cnt is set to 1 in the
984 * shadow table for a newly allocated resource.
986 * Returns success or failure code.
988 int tf_alloc_identifier(struct tf *tfp,
989 struct tf_alloc_identifier_parms *parms);
992 * free identifier resource
994 * TruFlow core will return an id back to the per identifier resource type pool
995 * reserved for the session. No firmware is involved. During tf_close, the
996 * complete pool is returned to the firmware.
998 * additional operation (experimental)
999 * Decrement reference count. Only release resource once refcnt goes to 0 if
1000 * shadow copy is enabled.
1002 * Returns success or failure code.
1004 int tf_free_identifier(struct tf *tfp,
1005 struct tf_free_identifier_parms *parms);
1008 * Search identifier resource (experimental)
1010 * If the shadow copy is enabled search_id is used to search for a matching
1011 * entry in the shadow table. The shadow table consists of an array of
1012 * reference counts indexed by identifier. If a matching entry is found hit is
1013 * set to TRUE, refcnt is increased by 1 and returned. Otherwise, hit is
1014 * set to false and refcnt is set to 0.
1016 * TODO: we may need a per table internal shadow copy enable flag to stage
1017 * the shadow table implementation. We do not need the shadow table for other
1018 * tables at this time so we may only want to enable the identifier shadow.
1020 * TODO: remove this pseudocode below added to show that if search fails
1021 * we shouldn't allocate a new entry but return.
1023 * identifier alloc (search_en=1)
1024 * if (ident is allocated and ref_cnt >=1)
1025 * return ident - hit is set, incr refcnt
1030 int tf_search_identifier(struct tf *tfp,
1031 struct tf_search_identifier_parms *parms);
1034 * @page dram_table DRAM Table Scope Interface
1036 * @ref tf_alloc_tbl_scope
1038 * @ref tf_free_tbl_scope
1040 * If we allocate the EEM memory from the core, we need to store it in
1041 * the shared session data structure to make sure it can be freed later.
1042 * (for example if the PF goes away)
1044 * Current thought is that memory is allocated within core.
1049 * tf_alloc_tbl_scope_parms definition
1051 struct tf_alloc_tbl_scope_parms {
1053 * [in] All Maximum key size required.
1055 uint16_t rx_max_key_sz_in_bits;
1057 * [in] Maximum Action size required (includes inlined items)
1059 uint16_t rx_max_action_entry_sz_in_bits;
1061 * [in] Memory size in Megabytes
1062 * Total memory size allocated by user to be divided
1063 * up for actions, hash, counters. Only inline external actions.
1064 * Use this variable or the number of flows, do not set both.
1066 uint32_t rx_mem_size_in_mb;
1068 * [in] Number of flows * 1000. If set, rx_mem_size_in_mb must equal 0.
1070 uint32_t rx_num_flows_in_k;
1072 * [in] SR2 only receive table access interface id
1074 uint32_t rx_tbl_if_id;
1076 * [in] All Maximum key size required.
1078 uint16_t tx_max_key_sz_in_bits;
1080 * [in] Maximum Action size required (includes inlined items)
1082 uint16_t tx_max_action_entry_sz_in_bits;
1084 * [in] Memory size in Megabytes
1085 * Total memory size allocated by user to be divided
1086 * up for actions, hash, counters. Only inline external actions.
1088 uint32_t tx_mem_size_in_mb;
1090 * [in] Number of flows * 1000
1092 uint32_t tx_num_flows_in_k;
1094 * [in] SR2 only receive table access interface id
1096 uint32_t tx_tbl_if_id;
1098 * [in] Flush pending HW cached flows every 1/10th of value
1099 * set in seconds, both idle and active flows are flushed
1100 * from the HW cache. If set to 0, this feature will be disabled.
1102 uint8_t hw_flow_cache_flush_timer;
1104 * [out] table scope identifier
1106 uint32_t tbl_scope_id;
1109 * tf_free_tbl_scope_parms definition
1111 struct tf_free_tbl_scope_parms {
1113 * [in] table scope identifier
1115 uint32_t tbl_scope_id;
1119 * tf_map_tbl_scope_parms definition
1121 struct tf_map_tbl_scope_parms {
1123 * [in] table scope identifier
1125 uint32_t tbl_scope_id;
1127 * [in] Which parifs are associated with this table scope. Bit 0
1128 * indicates parif 0.
1130 uint16_t parif_bitmask;
1134 * allocate a table scope
1136 * The scope is a software construct to identify an EEM table. This function will
1137 * divide the hash memory/buckets and records according to the device
1138 * device constraints based upon calculations using either the number of flows
1139 * requested or the size of memory indicated. Other parameters passed in
1140 * determine the configuration (maximum key size, maximum external action record
1143 * A single API is used to allocate a common table scope identifier in both
1144 * receive and transmit CFA. The scope identifier is common due to nature of
1145 * connection tracking sending notifications between RX and TX direction.
1147 * The receive and transmit table access identifiers specify which rings will
1148 * be used to initialize table DRAM. The application must ensure mutual
1149 * exclusivity of ring usage for table scope allocation and any table update
1152 * The hash table buckets, EM keys, and EM lookup results are stored in the
1153 * memory allocated based on the rx_em_hash_mb/tx_em_hash_mb parameters. The
1154 * hash table buckets are stored at the beginning of that memory.
1156 * NOTE: No EM internal setup is done here. On chip EM records are managed
1157 * internally by TruFlow core.
1159 * Returns success or failure code.
1161 int tf_alloc_tbl_scope(struct tf *tfp,
1162 struct tf_alloc_tbl_scope_parms *parms);
1165 * map a table scope (legacy device only Wh+/SR)
1167 * Map a table scope to one or more partition interfaces (parifs).
1168 * The parif can be remapped in the L2 context lookup for legacy devices. This
1169 * API allows a number of parifs to be mapped to the same table scope. On
1170 * legacy devices a table scope identifies one of 16 sets of EEM table base
1171 * addresses and is associated with a PF communication channel. The associated
1172 * PF must be configured for the table scope to operate.
1174 * An L2 context TCAM lookup returns a remapped parif value used to
1175 * index into the set of 16 parif_to_pf registers which are used to map to one
1176 * of the 16 table scopes. This API allows the user to map the parifs in the
1177 * mask to the previously allocated table scope (EEM table).
1179 * Returns success or failure code.
1181 int tf_map_tbl_scope(struct tf *tfp,
1182 struct tf_map_tbl_scope_parms *parms);
1184 * free a table scope
1186 * Firmware checks that the table scope ID is owned by the TruFlow
1187 * session, verifies that no references to this table scope remains
1188 * or Profile TCAM entries for either CFA (RX/TX) direction,
1189 * then frees the table scope ID.
1191 * Returns success or failure code.
1193 int tf_free_tbl_scope(struct tf *tfp,
1194 struct tf_free_tbl_scope_parms *parms);
1197 * @page tcam TCAM Access
1199 * @ref tf_search_tcam_entry
1201 * @ref tf_alloc_tcam_entry
1203 * @ref tf_set_tcam_entry
1205 * @ref tf_get_tcam_entry
1207 * @ref tf_free_tcam_entry
1211 * tf_search_tcam_entry parameter definition (experimental)
1213 struct tf_search_tcam_entry_parms {
1215 * [in] receive or transmit direction
1219 * [in] TCAM table type
1221 enum tf_tcam_tbl_type tcam_tbl_type;
1223 * [in] Key data to match on
1227 * [in] key size in bits
1229 uint16_t key_sz_in_bits;
1231 * [in] Mask data to match on
1235 * [in] Priority of entry requested (definition TBD)
1239 * [in] Allocate on miss.
1243 * [out] Set if matching entry found
1247 * [out] Search result status (hit, miss, reject)
1249 enum tf_search_status search_status;
1251 * [out] Current refcnt after allocation
1255 * [in out] The result data from the search is copied here
1259 * [in out] result size in bits for the result data
1261 uint16_t result_sz_in_bits;
1269 * search TCAM entry (experimental)
1271 * Search for a TCAM entry
1273 * This function searches the shadow copy of the TCAM table for a matching
1274 * entry. Key and mask must match for hit to be set. Only TruFlow core data
1275 * is accessed. If shadow_copy is not enabled, an error is returned.
1279 * A hash is performed on the key/mask data and mapped to a shadow copy entry
1280 * where the full key/mask is populated. If the full key/mask matches the
1281 * entry, hit is set, ref_cnt is incremented, and search_status indicates what
1282 * action the caller can take regarding setting the entry.
1284 * search_status should be used as follows:
1285 * - On Miss, the caller should create a result and call tf_set_tcam_entry with
1288 * - On Reject, the hash table is full and the entry cannot be added.
1290 * - On Hit, the result data is returned to the caller. Additionally, the
1291 * ref_cnt is updated.
1293 * Also returns success or failure code.
1295 int tf_search_tcam_entry(struct tf *tfp,
1296 struct tf_search_tcam_entry_parms *parms);
1299 * tf_alloc_tcam_entry parameter definition
1301 struct tf_alloc_tcam_entry_parms {
1303 * [in] receive or transmit direction
1307 * [in] TCAM table type
1309 enum tf_tcam_tbl_type tcam_tbl_type;
1311 * [in] Enable search for matching entry
1313 uint8_t search_enable;
1315 * [in] Key data to match on (if search)
1319 * [in] key size in bits (if search)
1321 uint16_t key_sz_in_bits;
1323 * [in] Mask data to match on (if search)
1327 * [in] Priority of entry requested (definition TBD)
1331 * [out] If search, set if matching entry found
1335 * [out] Current refcnt after allocation
1339 * [out] Idx allocated
1346 * allocate TCAM entry
1348 * Allocate a TCAM entry - one of these types:
1355 * This function allocates a TCAM table record. This function
1356 * will attempt to allocate a TCAM table entry from the session
1357 * owned TCAM entries or search a shadow copy of the TCAM table for a
1358 * matching entry if search is enabled. Key, mask and result must match for
1359 * hit to be set. Only TruFlow core data is accessed.
1360 * A hash table to entry mapping is maintained for search purposes. If
1361 * search is not enabled, the first available free entry is returned based
1362 * on priority and alloc_cnt is set to 1. If search is enabled and a matching
1363 * entry to entry_data is found, hit is set to TRUE and alloc_cnt is set to 1.
1364 * RefCnt is also returned.
1366 * Also returns success or failure code.
1368 int tf_alloc_tcam_entry(struct tf *tfp,
1369 struct tf_alloc_tcam_entry_parms *parms);
1372 * tf_set_tcam_entry parameter definition
1374 struct tf_set_tcam_entry_parms {
1376 * [in] receive or transmit direction
1380 * [in] TCAM table type
1382 enum tf_tcam_tbl_type tcam_tbl_type;
1384 * [in] base index of the entry to program
1388 * [in] struct containing key
1392 * [in] struct containing mask fields
1396 * [in] key size in bits (if search)
1398 uint16_t key_sz_in_bits;
1400 * [in] struct containing result
1404 * [in] struct containing result size in bits
1406 uint16_t result_sz_in_bits;
1412 * Program a TCAM table entry for a TruFlow session.
1414 * If the entry has not been allocated, an error will be returned.
1416 * Returns success or failure code.
1418 int tf_set_tcam_entry(struct tf *tfp,
1419 struct tf_set_tcam_entry_parms *parms);
1422 * tf_get_tcam_entry parameter definition
1424 struct tf_get_tcam_entry_parms {
1426 * [in] receive or transmit direction
1430 * [in] TCAM table type
1432 enum tf_tcam_tbl_type tcam_tbl_type;
1434 * [in] index of the entry to get
1438 * [out] struct containing key
1442 * [out] struct containing mask fields
1446 * [in/out] key size in bits
1448 uint16_t key_sz_in_bits;
1450 * [out] struct containing result
1454 * [in/out] struct containing result size in bits
1456 uint16_t result_sz_in_bits;
1462 * Program a TCAM table entry for a TruFlow session.
1464 * If the entry has not been allocated, an error will be returned.
1466 * Returns success or failure code.
1468 int tf_get_tcam_entry(struct tf *tfp,
1469 struct tf_get_tcam_entry_parms *parms);
1472 * tf_free_tcam_entry parameter definition
1474 struct tf_free_tcam_entry_parms {
1476 * [in] receive or transmit direction
1480 * [in] TCAM table type
1482 enum tf_tcam_tbl_type tcam_tbl_type;
1484 * [in] Index to free
1488 * [out] reference count after free
1498 * Firmware checks to ensure the TCAM entries are owned by the TruFlow
1499 * session. TCAM entry will be invalidated. All-ones mask.
1502 * WCTCAM profile id of 0 must be used to invalidate an entry.
1504 * Returns success or failure code.
1506 int tf_free_tcam_entry(struct tf *tfp,
1507 struct tf_free_tcam_entry_parms *parms);
1510 * @page table Table Access
1512 * @ref tf_alloc_tbl_entry
1514 * @ref tf_free_tbl_entry
1516 * @ref tf_set_tbl_entry
1518 * @ref tf_get_tbl_entry
1520 * @ref tf_bulk_get_tbl_entry
1524 * tf_alloc_tbl_entry parameter definition
1526 struct tf_search_tbl_entry_parms {
1528 * [in] Receive or transmit direction
1532 * [in] Type of the allocation
1534 enum tf_tbl_type type;
1536 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1538 uint32_t tbl_scope_id;
1540 * [in] Result data to search for
1544 * [in] Result data size in bytes
1546 uint16_t result_sz_in_bytes;
1548 * [in] Allocate on miss.
1552 * [out] Set if matching entry found
1556 * [out] Search result status (hit, miss, reject)
1558 enum tf_search_status search_status;
1560 * [out] Current ref count after allocation
1564 * [out] Idx of allocated entry or found entry
1570 * search Table Entry (experimental)
1572 * This function searches the shadow copy of an index table for a matching
1573 * entry. The result data must match for hit to be set. Only TruFlow core
1574 * data is accessed. If shadow_copy is not enabled, an error is returned.
1578 * A hash is performed on the result data and mappe3d to a shadow copy entry
1579 * where the result is populated. If the result matches the entry, hit is set,
1580 * ref_cnt is incremented (if alloc), and the search status indicates what
1581 * action the caller can take regarding setting the entry.
1583 * search status should be used as follows:
1584 * - On MISS, the caller should set the result into the returned index.
1586 * - On REJECT, the caller should reject the flow since there are no resources.
1588 * - On Hit, the matching index is returned to the caller. Additionally, the
1589 * ref_cnt is updated.
1591 * Also returns success or failure code.
1593 int tf_search_tbl_entry(struct tf *tfp,
1594 struct tf_search_tbl_entry_parms *parms);
1597 * tf_alloc_tbl_entry parameter definition
1599 struct tf_alloc_tbl_entry_parms {
1601 * [in] Receive or transmit direction
1605 * [in] Type of the allocation
1607 enum tf_tbl_type type;
1609 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1611 uint32_t tbl_scope_id;
1613 * [in] Enable search for matching entry. If the table type is
1614 * internal the shadow copy will be searched before
1615 * alloc. Session must be configured with shadow copy enabled.
1617 uint8_t search_enable;
1619 * [in] Result data to search for (if search_enable)
1623 * [in] Result data size in bytes (if search_enable)
1625 uint16_t result_sz_in_bytes;
1627 * [out] If search_enable, set if matching entry found
1631 * [out] Current ref count after allocation (if search_enable)
1635 * [out] Idx of allocated entry or found entry (if search_enable)
1641 * allocate index table entries
1645 * Allocate an on chip index table entry or search for a matching
1646 * entry of the indicated type for this TruFlow session.
1648 * Allocates an index table record. This function will attempt to
1649 * allocate an entry or search an index table for a matching entry if
1650 * search is enabled (only the shadow copy of the table is accessed).
1652 * If search is not enabled, the first available free entry is
1653 * returned. If search is enabled and a matching entry to entry_data
1654 * is found hit is set to TRUE and success is returned.
1658 * These are used to allocate inlined action record memory.
1660 * Allocates an external index table action record.
1663 * Implementation of the internals of this function will be a stack with push
1666 * Returns success or failure code.
1668 int tf_alloc_tbl_entry(struct tf *tfp,
1669 struct tf_alloc_tbl_entry_parms *parms);
1672 * tf_free_tbl_entry parameter definition
1674 struct tf_free_tbl_entry_parms {
1676 * [in] Receive or transmit direction
1680 * [in] Type of the allocation type
1682 enum tf_tbl_type type;
1684 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1686 uint32_t tbl_scope_id;
1688 * [in] Index to free
1692 * [out] Reference count after free, only valid if session has been
1693 * created with shadow_copy.
1699 * free index table entry
1701 * Used to free a previously allocated table entry.
1705 * If session has shadow_copy enabled the shadow DB is searched and if
1706 * found the element ref_cnt is decremented. If ref_cnt goes to
1707 * zero then the element is returned to the session pool.
1709 * If the session does not have a shadow DB the element is free'ed and
1710 * given back to the session pool.
1714 * Free's an external index table action record.
1717 * Implementation of the internals of this function will be a stack with push
1720 * Returns success or failure code.
1722 int tf_free_tbl_entry(struct tf *tfp,
1723 struct tf_free_tbl_entry_parms *parms);
1726 * tf_set_tbl_entry parameter definition
1728 struct tf_set_tbl_entry_parms {
1730 * [in] Table scope identifier
1732 uint32_t tbl_scope_id;
1734 * [in] Receive or transmit direction
1738 * [in] Type of object to set
1740 enum tf_tbl_type type;
1748 uint16_t data_sz_in_bytes;
1750 * [in] External memory channel type to use
1752 enum tf_ext_mem_chan_type chan_type;
1754 * [in] Entry index to write to
1760 * set index table entry
1762 * Used to insert an application programmed index table entry into a
1763 * previous allocated table location. A shadow copy of the table
1764 * is maintained (if enabled) (only for internal objects)
1766 * Returns success or failure code.
1768 int tf_set_tbl_entry(struct tf *tfp,
1769 struct tf_set_tbl_entry_parms *parms);
1772 * tf_get_tbl_entry parameter definition
1774 struct tf_get_tbl_entry_parms {
1776 * [in] Receive or transmit direction
1780 * [in] Type of object to get
1782 enum tf_tbl_type type;
1790 uint16_t data_sz_in_bytes;
1792 * [in] External memory channel type to use
1794 enum tf_ext_mem_chan_type chan_type;
1796 * [in] Entry index to read
1802 * get index table entry
1804 * Used to retrieve a previous set index table entry.
1806 * Reads and compares with the shadow table copy (if enabled) (only
1807 * for internal objects).
1809 * Returns success or failure code. Failure will be returned if the
1810 * provided data buffer is too small for the data type requested.
1812 int tf_get_tbl_entry(struct tf *tfp,
1813 struct tf_get_tbl_entry_parms *parms);
1816 * tf_bulk_get_tbl_entry parameter definition
1818 struct tf_bulk_get_tbl_entry_parms {
1820 * [in] Receive or transmit direction
1824 * [in] Type of object to get
1826 enum tf_tbl_type type;
1828 * [in] Starting index to read from
1830 uint32_t starting_idx;
1832 * [in] Number of sequential entries
1834 uint16_t num_entries;
1836 * [in] Size of the single entry
1838 uint16_t entry_sz_in_bytes;
1840 * [out] Host physical address, where the data
1841 * will be copied to by the firmware.
1842 * Use tfp_calloc() API and mem_pa
1843 * variable of the tfp_calloc_parms
1844 * structure for the physical address.
1846 uint64_t physical_mem_addr;
1848 * [in] External memory channel type to use
1850 enum tf_ext_mem_chan_type chan_type;
1854 * Bulk get index table entry
1856 * Used to retrieve a set of index table entries.
1858 * Entries within the range may not have been allocated using
1859 * tf_alloc_tbl_entry() at the time of access. But the range must
1860 * be within the bounds determined from tf_open_session() for the
1861 * given table type. Currently, this is only used for collecting statistics.
1863 * Returns success or failure code. Failure will be returned if the
1864 * provided data buffer is too small for the data type requested.
1866 int tf_bulk_get_tbl_entry(struct tf *tfp,
1867 struct tf_bulk_get_tbl_entry_parms *parms);
1870 * @page exact_match Exact Match Table
1872 * @ref tf_insert_em_entry
1874 * @ref tf_delete_em_entry
1876 * @ref tf_search_em_entry
1880 * tf_insert_em_entry parameter definition
1882 struct tf_insert_em_entry_parms {
1884 * [in] receive or transmit direction
1888 * [in] internal or external
1892 * [in] ID of table scope to use (external only)
1894 uint32_t tbl_scope_id;
1896 * [in] ptr to structure containing key fields
1900 * [in] key bit length
1902 uint16_t key_sz_in_bits;
1904 * [in] ptr to structure containing result field
1908 * [out] result size in bits
1910 uint16_t em_record_sz_in_bits;
1912 * [in] duplicate check flag
1916 * [in] External memory channel type to use
1918 enum tf_ext_mem_chan_type chan_type;
1920 * [out] Flow handle value for the inserted entry. This is encoded
1921 * as the entries[4]:bucket[2]:hashId[1]:hash[14]
1923 uint64_t flow_handle;
1925 * [out] Flow id is returned as null (internal)
1926 * Flow id is the GFID value for the inserted entry (external)
1927 * This is the value written to the BD and useful information for mark.
1932 * tf_delete_em_entry parameter definition
1934 struct tf_delete_em_entry_parms {
1936 * [in] receive or transmit direction
1940 * [in] internal or external
1944 * [in] ID of table scope to use (external only)
1946 uint32_t tbl_scope_id;
1948 * [out] The index of the entry
1952 * [in] External memory channel type to use
1954 enum tf_ext_mem_chan_type chan_type;
1956 * [in] structure containing flow delete handle information
1958 uint64_t flow_handle;
1961 * tf_move_em_entry parameter definition
1963 struct tf_move_em_entry_parms {
1965 * [in] receive or transmit direction
1969 * [in] internal or external
1973 * [in] ID of table scope to use (external only)
1975 uint32_t tbl_scope_id;
1977 * [in] ID of table interface to use (SR2 only)
1981 * [in] epoch group IDs of entry to delete
1982 * 2 element array with 2 ids. (SR2 only)
1986 * [out] The index of the entry
1990 * [in] External memory channel type to use
1992 enum tf_ext_mem_chan_type chan_type;
1994 * [in] The index of the new EM record
1998 * [in] structure containing flow delete handle information
2000 uint64_t flow_handle;
2003 * tf_search_em_entry parameter definition
2005 struct tf_search_em_entry_parms {
2007 * [in] receive or transmit direction
2011 * [in] internal or external
2015 * [in] ID of table scope to use (external only)
2017 uint32_t tbl_scope_id;
2019 * [in] ptr to structure containing key fields
2023 * [in] key bit length
2025 uint16_t key_sz_in_bits;
2027 * [in/out] ptr to structure containing EM record fields
2031 * [out] result size in bits
2033 uint16_t em_record_sz_in_bits;
2035 * [in] External memory channel type to use
2037 enum tf_ext_mem_chan_type chan_type;
2039 * [in] ptr to structure containing flow delete handle
2041 uint64_t flow_handle;
2045 * insert em hash entry in internal table memory
2049 * This API inserts an exact match entry into internal EM table memory
2050 * of the specified direction.
2052 * Note: The EM record is managed within the TruFlow core and not the
2055 * Shadow copy of internal record table an association with hash and 1,2, or 4
2056 * associated buckets
2059 * This API inserts an exact match entry into DRAM EM table memory of the
2060 * specified direction and table scope.
2062 * The insertion of duplicate entries in an EM table is not permitted. If a
2063 * TruFlow application can guarantee that it will never insert duplicates, it
2064 * can disable duplicate checking by passing a zero value in the dup_check
2065 * parameter to this API. This will optimize performance. Otherwise, the
2066 * TruFlow library will enforce protection against inserting duplicate entries.
2068 * Flow handle is defined in this document:
2070 * https://docs.google.com
2071 * /document/d/1NESu7RpTN3jwxbokaPfYORQyChYRmJgs40wMIRe8_-Q/edit
2073 * Returns success or busy code.
2076 int tf_insert_em_entry(struct tf *tfp,
2077 struct tf_insert_em_entry_parms *parms);
2080 * delete em hash entry table memory
2084 * This API deletes an exact match entry from internal EM table memory of the
2085 * specified direction. If a valid flow ptr is passed in then that takes
2086 * precedence over the pointer to the complete key passed in.
2091 * This API deletes an exact match entry from EM table memory of the specified
2092 * direction and table scope. If a valid flow handle is passed in then that
2093 * takes precedence over the pointer to the complete key passed in.
2095 * The TruFlow library may release a dynamic bucket when an entry is deleted.
2098 * Returns success or not found code
2102 int tf_delete_em_entry(struct tf *tfp,
2103 struct tf_delete_em_entry_parms *parms);
2106 * search em hash entry table memory
2110 * This API looks up an EM entry in table memory with the specified EM
2111 * key or flow (flow takes precedence) and direction.
2113 * The status will be one of: success or entry not found. If the lookup
2114 * succeeds, a pointer to the matching entry and the result record associated
2115 * with the matching entry will be provided.
2117 * If flow_handle is set, search shadow copy.
2119 * Otherwise, query the fw with key to get result.
2123 * This API looks up an EM entry in table memory with the specified EM
2124 * key or flow_handle (flow takes precedence), direction and table scope.
2126 * The status will be one of: success or entry not found. If the lookup
2127 * succeeds, a pointer to the matching entry and the result record associated
2128 * with the matching entry will be provided.
2130 * Returns success or not found code
2133 int tf_search_em_entry(struct tf *tfp,
2134 struct tf_search_em_entry_parms *parms);
2137 * @page global Global Configuration
2139 * @ref tf_set_global_cfg
2141 * @ref tf_get_global_cfg
2144 * Tunnel Encapsulation Offsets
2146 enum tf_tunnel_encap_offsets {
2148 TF_TUNNEL_ENCAP_NAT,
2149 TF_TUNNEL_ENCAP_MPLS,
2150 TF_TUNNEL_ENCAP_VXLAN,
2151 TF_TUNNEL_ENCAP_GENEVE,
2152 TF_TUNNEL_ENCAP_NVGRE,
2153 TF_TUNNEL_ENCAP_GRE,
2154 TF_TUNNEL_ENCAP_FULL_GENERIC
2157 * Global Configuration Table Types
2159 enum tf_global_config_type {
2160 TF_TUNNEL_ENCAP, /**< Tunnel Encap Config(TECT) */
2161 TF_ACTION_BLOCK, /**< Action Block Config(ABCR) */
2162 TF_COUNTER_CFG, /**< Counter Configuration (CNTRS_CTRL) */
2163 TF_GLOBAL_CFG_TYPE_MAX
2167 * tf_global_cfg parameter definition
2169 struct tf_global_cfg_parms {
2171 * [in] receive or transmit direction
2175 * [in] Global config type
2177 enum tf_global_config_type type;
2179 * [in] Offset @ the type
2183 * [in/out] Value of the configuration
2184 * set - Read, Modify and Write
2185 * get - Read the full configuration
2189 * [in] Configuration mask
2190 * set - Read, Modify with mask and Write
2193 uint8_t *config_mask;
2195 * [in] struct containing size
2197 uint16_t config_sz_in_bytes;
2201 * Get global configuration
2203 * Retrieve the configuration
2205 * Returns success or failure code.
2207 int tf_get_global_cfg(struct tf *tfp,
2208 struct tf_global_cfg_parms *parms);
2211 * Update the global configuration table
2213 * Read, modify write the value.
2215 * Returns success or failure code.
2217 int tf_set_global_cfg(struct tf *tfp,
2218 struct tf_global_cfg_parms *parms);
2221 * @page if_tbl Interface Table Access
2223 * @ref tf_set_if_tbl_entry
2225 * @ref tf_get_if_tbl_entry
2227 * @ref tf_restore_if_tbl_entry
2230 * Enumeration of TruFlow interface table types.
2232 enum tf_if_tbl_type {
2233 /** Default Profile L2 Context Entry */
2234 TF_IF_TBL_TYPE_PROF_SPIF_DFLT_L2_CTXT,
2235 /** Default Profile TCAM/Lookup Action Record Pointer Table */
2236 TF_IF_TBL_TYPE_PROF_PARIF_DFLT_ACT_REC_PTR,
2237 /** Error Profile TCAM Miss Action Record Pointer Table */
2238 TF_IF_TBL_TYPE_PROF_PARIF_ERR_ACT_REC_PTR,
2239 /** Default Error Profile TCAM Miss Action Record Pointer Table */
2240 TF_IF_TBL_TYPE_LKUP_PARIF_DFLT_ACT_REC_PTR,
2241 /** Ingress lookup table */
2243 /** VNIC/SVIF Properties Table */
2244 TF_IF_TBL_TYPE_VSPT,
2249 * tf_set_if_tbl_entry parameter definition
2251 struct tf_set_if_tbl_entry_parms {
2253 * [in] Receive or transmit direction
2257 * [in] Type of object to set
2259 enum tf_if_tbl_type type;
2267 uint16_t data_sz_in_bytes;
2269 * [in] Interface to write
2275 * set interface table entry
2277 * Used to set an interface table. This API is used for managing tables indexed
2278 * by SVIF/SPIF/PARIF interfaces. In current implementation only the value is
2280 * Returns success or failure code.
2282 int tf_set_if_tbl_entry(struct tf *tfp,
2283 struct tf_set_if_tbl_entry_parms *parms);
2286 * tf_get_if_tbl_entry parameter definition
2288 struct tf_get_if_tbl_entry_parms {
2290 * [in] Receive or transmit direction
2294 * [in] Type of table to get
2296 enum tf_if_tbl_type type;
2304 uint16_t data_sz_in_bytes;
2306 * [in] Entry index to read
2312 * get interface table entry
2314 * Used to retrieve an interface table entry.
2316 * Reads the interface table entry value
2318 * Returns success or failure code. Failure will be returned if the
2319 * provided data buffer is too small for the data type requested.
2321 int tf_get_if_tbl_entry(struct tf *tfp,
2322 struct tf_get_if_tbl_entry_parms *parms);
2324 #endif /* _TF_CORE_H_ */