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 **********/
24 #define TF_KILOBYTE 1024
25 #define TF_MEGABYTE (1024 * 1024)
31 TF_DIR_RX, /**< Receive */
32 TF_DIR_TX, /**< Transmit */
40 TF_MEM_INTERNAL, /**< Internal */
41 TF_MEM_EXTERNAL, /**< External */
46 * External memory control channel type
48 enum tf_ext_mem_chan_type {
50 * Direct memory write(Wh+/SR)
52 TF_EXT_MEM_CHAN_TYPE_DIRECT = 0,
56 TF_EXT_MEM_CHAN_TYPE_RING_IF,
58 * Use HWRM message to firmware
60 TF_EXT_MEM_CHAN_TYPE_FW,
62 * Use ring_if message to firmware
64 TF_EXT_MEM_CHAN_TYPE_RING_IF_FW,
65 TF_EXT_MEM_CHAN_TYPE_MAX
69 * WC TCAM number of slice per row that devices supported
71 enum tf_wc_num_slice {
72 TF_WC_TCAM_1_SLICE_PER_ROW = 1,
73 TF_WC_TCAM_2_SLICE_PER_ROW = 2,
74 TF_WC_TCAM_4_SLICE_PER_ROW = 4,
75 TF_WC_TCAM_8_SLICE_PER_ROW = 8,
79 * EEM record AR helper
81 * Helper to handle the Action Record Pointer in the EEM Record Entry.
83 * Convert absolute offset to action record pointer in EEM record entry
84 * Convert action record pointer in EEM record entry to absolute offset
86 #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
87 #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
92 #define TF_BITS_2_BYTES(num_bits) (((num_bits) + 7) / 8)
94 /********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
97 * @page general General
99 * @ref tf_open_session
101 * @ref tf_attach_session
103 * @ref tf_close_session
107 * Session Version defines
109 * The version controls the format of the tf_session and
110 * tf_session_info structure. This is to assure upgrade between
111 * versions can be supported.
113 #define TF_SESSION_VER_MAJOR 1 /**< Major Version */
114 #define TF_SESSION_VER_MINOR 0 /**< Minor Version */
115 #define TF_SESSION_VER_UPDATE 0 /**< Update Version */
120 * Name of the TruFlow control channel interface. Expects
121 * format to be RTE Name specific, i.e. rte_eth_dev_get_name_by_port()
123 #define TF_SESSION_NAME_MAX 64
125 #define TF_FW_SESSION_ID_INVALID 0xFF /**< Invalid FW Session ID define */
130 * Unique session identifier which includes PCIe bus info to
131 * distinguish the PF and session info to identify the associated
132 * TruFlow session. Session ID is constructed from the passed in
133 * ctrl_chan_name in tf_open_session() together with an allocated
134 * fw_session_id. Done by TruFlow on tf_open_session().
136 union tf_session_id {
142 uint8_t fw_session_id;
147 * Session Client Identifier
149 * Unique identifier for a client within a session. Session Client ID
150 * is constructed from the passed in session and a firmware allocated
151 * fw_session_client_id. Done by TruFlow on tf_open_session().
153 union tf_session_client_id {
156 uint8_t fw_session_id;
157 uint8_t fw_session_client_id;
164 * The version controls the format of the tf_session and
165 * tf_session_info structure. This is to assure upgrade between
166 * versions can be supported.
168 * Please see the TF_VER_MAJOR/MINOR and UPDATE defines.
170 struct tf_session_version {
177 * Session supported device types
179 enum tf_device_type {
180 TF_DEVICE_TYPE_WH = 0, /**< Whitney+ */
181 TF_DEVICE_TYPE_SR, /**< Stingray */
182 TF_DEVICE_TYPE_THOR, /**< Thor */
183 TF_DEVICE_TYPE_MAX /**< Maximum */
189 enum tf_module_type {
193 TF_MODULE_TYPE_IDENTIFIER,
197 TF_MODULE_TYPE_TABLE,
210 * Identifier resource types
212 enum tf_identifier_type {
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_HIGH,
222 * The L2 Context is returned from the L2 Ctxt TCAM lookup
223 * and can be used in WC TCAM or EM keys to virtualize further
226 TF_IDENT_TYPE_L2_CTXT_LOW,
229 * The WC profile func is returned from the L2 Ctxt TCAM lookup
230 * to enable virtualization of the profile TCAM.
232 TF_IDENT_TYPE_PROF_FUNC,
235 * The WC profile ID is included in the WC lookup key
236 * to enable virtualization of the WC TCAM hardware.
238 TF_IDENT_TYPE_WC_PROF,
241 * The EM profile ID is included in the EM lookup key
242 * to enable virtualization of the EM hardware.
244 TF_IDENT_TYPE_EM_PROF,
247 * The L2 func is included in the ILT result and from recycling to
248 * enable virtualization of further lookups.
250 TF_IDENT_TYPE_L2_FUNC,
255 * Enumeration of TruFlow table types. A table type is used to identify a
258 * NOTE: The table type TF_TBL_TYPE_EXT is unique in that it is
259 * the only table type that is connected with a table scope.
264 /** Wh+/SR/TH Action Record */
265 TF_TBL_TYPE_FULL_ACT_RECORD,
266 /** TH Compact Action Record */
267 TF_TBL_TYPE_COMPACT_ACT_RECORD,
268 /** (Future) Multicast Groups */
269 TF_TBL_TYPE_MCAST_GROUPS,
270 /** Wh+/SR/TH Action Encap 8 Bytes */
271 TF_TBL_TYPE_ACT_ENCAP_8B,
272 /** Wh+/SR/TH Action Encap 16 Bytes */
273 TF_TBL_TYPE_ACT_ENCAP_16B,
274 /** WH+/SR/TH Action Encap 32 Bytes */
275 TF_TBL_TYPE_ACT_ENCAP_32B,
276 /** Wh+/SR/TH Action Encap 64 Bytes */
277 TF_TBL_TYPE_ACT_ENCAP_64B,
278 /** WH+/SR/TH Action Source Properties SMAC */
279 TF_TBL_TYPE_ACT_SP_SMAC,
280 /** Wh+/SR/TH Action Source Properties SMAC IPv4 */
281 TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
282 /** WH+/SR/TH Action Source Properties SMAC IPv6 */
283 TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
284 /** Wh+/SR/TH Action Statistics 64 Bits */
285 TF_TBL_TYPE_ACT_STATS_64,
286 /** Wh+/SR Action Modify IPv4 Source */
287 TF_TBL_TYPE_ACT_MODIFY_IPV4,
288 /** TH 8B Modify Record */
289 TF_TBL_TYPE_ACT_MODIFY_8B,
290 /** TH 16B Modify Record */
291 TF_TBL_TYPE_ACT_MODIFY_16B,
292 /** TH 32B Modify Record */
293 TF_TBL_TYPE_ACT_MODIFY_32B,
294 /** TH 64B Modify Record */
295 TF_TBL_TYPE_ACT_MODIFY_64B,
296 /** Meter Profiles */
297 TF_TBL_TYPE_METER_PROF,
298 /** Meter Instance */
299 TF_TBL_TYPE_METER_INST,
300 /** Wh+/SR/Th Mirror Config */
301 TF_TBL_TYPE_MIRROR_CONFIG,
304 /** (Future) TH Metadata */
305 TF_TBL_TYPE_METADATA,
306 /** (Future) TH CT State */
307 TF_TBL_TYPE_CT_STATE,
308 /** (Future) TH Range Profile */
309 TF_TBL_TYPE_RANGE_PROF,
310 /** TH EM Flexible Key builder */
312 /** TH WC Flexible Key builder */
314 /** Meter Drop Counter */
315 TF_TBL_TYPE_METER_DROP_CNT,
320 * External table type - initially 1 poolsize entries.
321 * All External table types are associated with a table
322 * scope. Internal types are not. Currently this is
323 * a pool of 64B entries.
329 /** Enable Shared TCAM Management
331 * This feature allows for management of high and low pools within
332 * the WC TCAM. These pools are only valid when this feature is enabled.
334 * For normal OVS-DPDK operation, this feature is not required and can
335 * be disabled by commenting out TF_TCAM_SHARED in this header file.
339 * When a shared session is created with WC TCAM entries allocated during
340 * tf_open_session(), the TF_TCAM_TBL_TYPE_WC_TCAM pool entries will be divided
341 * into 2 equal pools - TF_TCAM_TBL_TYPE_WC_TCAM_HIGH and
342 * TF_TCAM_TBL_TYPE_WC_TCAM_LOW.
344 * The user will allocate and free entries from either of these pools to obtain
345 * WC_TCAM entry offsets. For the WC_TCAM_HI/LO management, alloc/free is done
346 * using the tf_alloc_tcam_entry()/tf_free_tcam_entry() APIs for the shared
349 * The use case for this feature is so that applications can have a shared
350 * session and use the TF core to allocate/set/free entries within a given
351 * region of the WC_TCAM within the shared session. Application A only writes
352 * to the LOW region for example and Application B only writes to the HIGH
353 * region during normal operation. After Application A goes down, Application
354 * B may decide to overwrite the LOW region with the HIGH region's entries
355 * and switch to the low region.
357 * For other TCAM types in the shared session, no alloc/free operations are
358 * permitted. Only set should be used for other TCAM table types after getting
359 * the range as provided by the tf_get_resource_info() API.
362 #define TF_TCAM_SHARED 1
367 enum tf_tcam_tbl_type {
368 /** L2 Context TCAM */
369 TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
370 /** L2 Context TCAM */
371 TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
373 TF_TCAM_TBL_TYPE_PROF_TCAM,
375 TF_TCAM_TBL_TYPE_WC_TCAM,
376 /** Source Properties TCAM */
377 TF_TCAM_TBL_TYPE_SP_TCAM,
378 /** Connection Tracking Rule TCAM */
379 TF_TCAM_TBL_TYPE_CT_RULE_TCAM,
380 /** Virtual Edge Bridge TCAM */
381 TF_TCAM_TBL_TYPE_VEB_TCAM,
382 #ifdef TF_TCAM_SHARED
383 /** Wildcard TCAM HI Priority */
384 TF_TCAM_TBL_TYPE_WC_TCAM_HIGH,
385 /** Wildcard TCAM Low Priority */
386 TF_TCAM_TBL_TYPE_WC_TCAM_LOW,
387 #endif /* TF_TCAM_SHARED */
394 enum tf_search_status {
395 /** The entry was not found, but an idx was allocated if requested. */
397 /** The entry was found, and the result/idx are valid */
399 /** The entry was not found and the table is full */
405 * These defines are provisioned during
408 enum tf_em_tbl_type {
409 /** The number of internal EM records for the session */
410 TF_EM_TBL_TYPE_EM_RECORD,
411 /** The number of table scopes requested */
412 TF_EM_TBL_TYPE_TBL_SCOPE,
417 * TruFlow Session Information
419 * Structure defining a TruFlow Session, also known as a Management
420 * session. This structure is initialized at time of
421 * tf_open_session(). It is passed to all of the TruFlow APIs as way
422 * to prescribe and isolate resources between different TruFlow ULP
425 * Ownership of the elements is split between ULP and TruFlow. Please
426 * see the individual elements.
428 struct tf_session_info {
430 * TruFlow Version. Used to control the structure layout when
431 * sharing sessions. No guarantee that a secondary process
432 * would come from the same version of an executable.
433 * TruFlow initializes this variable on tf_open_session().
438 struct tf_session_version ver;
440 * will be STAILQ_ENTRY(tf_session_info) next
447 * Session ID is a unique identifier for the session. TruFlow
448 * initializes this variable during tf_open_session()
452 * Access: Truflow & ULP
454 union tf_session_id session_id;
456 * Protects access to core_data. Lock is initialized and owned
457 * by ULP. TruFlow can access the core_data without checking
465 * The core_data holds the TruFlow tf_session data
466 * structure. This memory is allocated and owned by TruFlow on
469 * TruFlow uses this memory for session management control
470 * until the session is closed by ULP. Access control is done
471 * by the spin_lock which ULP controls ahead of TruFlow API
474 * Please see tf_open_session_parms for specification details
482 * The core_data_sz_bytes specifies the size of core_data in
485 * The size is set by TruFlow on tf_open_session().
487 * Please see tf_open_session_parms for specification details
493 uint32_t core_data_sz_bytes;
499 * Contains a pointer to the session info. Allocated by ULP and passed
500 * to TruFlow using tf_open_session(). TruFlow will populate the
501 * session info at that time. A TruFlow Session can be used by more
502 * than one PF/VF by using the tf_open_session().
504 * It is expected that ULP allocates this memory as shared memory.
506 * NOTE: This struct must be within the BNXT PMD struct bnxt
507 * (bp). This allows use of container_of() to get access to the PMD.
510 struct tf_session_info *session;
512 * the pointer to the parent bp struct
518 * Identifier resource definition
520 struct tf_identifier_resources {
522 * Array of TF Identifiers where each entry is expected to be
523 * set to the requested resource number of that specific type.
524 * The index used is tf_identifier_type.
526 uint16_t cnt[TF_IDENT_TYPE_MAX];
530 * Table type resource definition
532 struct tf_tbl_resources {
534 * Array of TF Table types where each entry is expected to be
535 * set to the requested resource number of that specific
536 * type. The index used is tf_tbl_type.
538 uint16_t cnt[TF_TBL_TYPE_MAX];
542 * TCAM type resource definition
544 struct tf_tcam_resources {
546 * Array of TF TCAM types where each entry is expected to be
547 * set to the requested resource number of that specific
548 * type. The index used is tf_tcam_tbl_type.
550 uint16_t cnt[TF_TCAM_TBL_TYPE_MAX];
554 * EM type resource definition
556 struct tf_em_resources {
558 * Array of TF EM table types where each entry is expected to
559 * be set to the requested resource number of that specific
560 * type. The index used is tf_em_tbl_type.
562 uint16_t cnt[TF_EM_TBL_TYPE_MAX];
566 * tf_session_resources parameter definition.
568 struct tf_session_resources {
570 * [in] Requested Identifier Resources
572 * Number of identifier resources requested for the
575 struct tf_identifier_resources ident_cnt[TF_DIR_MAX];
577 * [in] Requested Index Table resource counts
579 * The number of index table resources requested for the
582 struct tf_tbl_resources tbl_cnt[TF_DIR_MAX];
584 * [in] Requested TCAM Table resource counts
586 * The number of TCAM table resources requested for the
590 struct tf_tcam_resources tcam_cnt[TF_DIR_MAX];
592 * [in] Requested EM resource counts
594 * The number of internal EM table resources requested for the
597 struct tf_em_resources em_cnt[TF_DIR_MAX];
601 * tf_open_session parameters definition.
603 struct tf_open_session_parms {
605 * [in] ctrl_chan_name
607 * String containing name of control channel interface to be
608 * used for this session to communicate with firmware.
610 * The ctrl_chan_name can be looked up by using
611 * rte_eth_dev_get_name_by_port() within the ULP.
613 * ctrl_chan_name will be used as part of a name for any
614 * shared memory allocation. The ctrl_chan_name is usually in format
615 * 0000:02:00.0. The name for shared session is 0000:02:00.0-tf_shared.
617 char ctrl_chan_name[TF_SESSION_NAME_MAX];
621 * Boolean controlling the use and availability of shadow
622 * copy. Shadow copy will allow the TruFlow to keep track of
623 * resource content on the firmware side without having to
624 * query firmware. Additional private session core_data will
625 * be allocated if this boolean is set to 'true', default
628 * Size of memory depends on the NVM Resource settings for the
633 * [in/out] session_id
635 * Session_id is unique per session.
637 * Session_id is composed of domain, bus, device and
638 * fw_session_id. The construction is done by parsing the
639 * ctrl_chan_name together with allocation of a fw_session_id.
641 * The session_id allows a session to be shared between devices.
643 union tf_session_id session_id;
645 * [in/out] session_client_id
647 * Session_client_id is unique per client.
649 * Session_client_id is composed of session_id and the
650 * fw_session_client_id fw_session_id. The construction is
651 * done by parsing the ctrl_chan_name together with allocation
652 * of a fw_session_client_id during tf_open_session().
654 * A reference count will be incremented in the session on
655 * which a client is created.
657 * A session can first be closed if there is one Session
658 * Client left. Session Clients should closed using
659 * tf_close_session().
661 union tf_session_client_id session_client_id;
665 * Device type for the session.
667 enum tf_device_type device_type;
671 * Resource allocation for the session.
673 struct tf_session_resources resources;
677 * The pointer to the parent bp struct. This is only used for HWRM
678 * message passing within the portability layer. The type is struct
686 * The number of slices per row for WC TCAM entry.
688 enum tf_wc_num_slice wc_num_slices;
691 * [out] shared_session_creator
693 * Indicates whether the application created the session if set.
694 * Otherwise the shared session already existed. Just for information
697 int shared_session_creator;
701 * Opens a new TruFlow Session or session client.
703 * What gets created depends on the passed in tfp content. If the tfp does not
704 * have prior session data a new session with associated session client. If tfp
705 * has a session already a session client will be created. In both cases the
706 * session client is created using the provided ctrl_chan_name.
708 * In case of session creation TruFlow will allocate session specific memory to
709 * hold its session data. This data is private to TruFlow.
711 * No other TruFlow APIs will succeed unless this API is first called
714 * tf_open_session() returns a session id and session client id. These are
715 * also stored within the tfp structure passed in to all other APIs.
717 * A Session or session client can be closed using tf_close_session().
719 * There are 2 types of sessions - shared and not. For non-shared all
720 * the allocated resources are owned and managed by a single session instance.
721 * No other applications have access to the resources owned by the non-shared
722 * session. For a shared session, resources are shared between 2 applications.
724 * When the caller of tf_open_session() sets the ctrl_chan_name[] to a name
725 * like "0000:02:00.0-tf_shared", it is a request to create a new "shared"
726 * session in the firmware or access the existing shared session. There is
727 * only 1 shared session that can be created. If the shared session has
728 * already been created in the firmware, this API will return this indication
729 * by clearing the shared_session_creator flag. Only the first shared session
730 * create will have the shared_session_creator flag set.
732 * The shared session should always be the first session to be created by
733 * application and the last session closed due to RM management preference.
735 * Sessions remain open in the firmware until the last client of the session
736 * closes the session (tf_close_session()).
739 * Pointer to TF handle
742 * Pointer to open parameters
745 * - (0) if successful.
746 * - (-EINVAL) on failure.
748 int tf_open_session(struct tf *tfp,
749 struct tf_open_session_parms *parms);
752 * General internal resource info
755 struct tf_resource_info {
761 * Identifier resource definition
763 struct tf_identifier_resource_info {
765 * Array of TF Identifiers. The index used is tf_identifier_type.
767 struct tf_resource_info info[TF_IDENT_TYPE_MAX];
771 * Table type resource info definition
773 struct tf_tbl_resource_info {
775 * Array of TF Table types. The index used is tf_tbl_type.
777 struct tf_resource_info info[TF_TBL_TYPE_MAX];
781 * TCAM type resource definition
783 struct tf_tcam_resource_info {
785 * Array of TF TCAM types. The index used is tf_tcam_tbl_type.
787 struct tf_resource_info info[TF_TCAM_TBL_TYPE_MAX];
791 * EM type resource definition
793 struct tf_em_resource_info {
795 * Array of TF EM table types. The index used is tf_em_tbl_type.
797 struct tf_resource_info info[TF_EM_TBL_TYPE_MAX];
801 * tf_session_resources parameter definition.
803 struct tf_session_resource_info {
805 * [in] Requested Identifier Resources
807 * Number of identifier resources requested for the
810 struct tf_identifier_resource_info ident[TF_DIR_MAX];
812 * [in] Requested Index Table resource counts
814 * The number of index table resources requested for the
817 struct tf_tbl_resource_info tbl[TF_DIR_MAX];
819 * [in] Requested TCAM Table resource counts
821 * The number of TCAM table resources requested for the
825 struct tf_tcam_resource_info tcam[TF_DIR_MAX];
827 * [in] Requested EM resource counts
829 * The number of internal EM table resources requested for the
832 struct tf_em_resource_info em[TF_DIR_MAX];
836 * tf_get_session_resources parameter definition.
838 struct tf_get_session_info_parms {
840 * [out] the structure is used to return the information of
841 * allocated resources.
844 struct tf_session_resource_info session_info;
848 * Gets info about a TruFlow Session
850 * Get info about the session which has been created. Whether it exists and
851 * what resource start and stride offsets are in use. This API is primarily
852 * intended to be used by an application which has created a shared session
853 * This application needs to obtain the resources which have already been
854 * allocated for the shared session.
857 * Pointer to TF handle
860 * Pointer to get parameters
863 * - (0) if successful.
864 * - (-EINVAL) on failure.
866 int tf_get_session_info(struct tf *tfp,
867 struct tf_get_session_info_parms *parms);
871 * tf_attach_session parameters definition.
873 struct tf_attach_session_parms {
875 * [in] ctrl_chan_name
877 * String containing name of control channel interface to be
878 * used for this session to communicate with firmware.
880 * The ctrl_chan_name can be looked up by using
881 * rte_eth_dev_get_name_by_port() within the ULP.
883 * ctrl_chan_name will be used as part of a name for any
884 * shared memory allocation.
886 char ctrl_chan_name[TF_SESSION_NAME_MAX];
889 * [in] attach_chan_name
891 * String containing name of attach channel interface to be
892 * used for this session.
894 * The attach_chan_name must be given to a 2nd process after
895 * the primary process has been created. This is the
896 * ctrl_chan_name of the primary process and is used to find
897 * the shared memory for the session that the attach is going
900 char attach_chan_name[TF_SESSION_NAME_MAX];
905 * Session_id is unique per session. For Attach the session_id
906 * should be the session_id that was returned on the first
909 * Session_id is composed of domain, bus, device and
910 * fw_session_id. The construction is done by parsing the
911 * ctrl_chan_name together with allocation of a fw_session_id
912 * during tf_open_session().
914 * A reference count will be incremented on attach. A session
915 * is first fully closed when reference count is zero by
916 * calling tf_close_session().
918 union tf_session_id session_id;
924 * Allows a 2nd application instance to attach to an existing
925 * session. Used when a session is to be shared between two processes.
927 * Attach will increment a ref count as to manage the shared session data.
930 * Pointer to TF handle
933 * Pointer to attach parameters
936 * - (0) if successful.
937 * - (-EINVAL) on failure.
939 int tf_attach_session(struct tf *tfp,
940 struct tf_attach_session_parms *parms);
943 * Closes an existing session client or the session it self. The
944 * session client is default closed and if the session reference count
945 * is 0 then the session is closed as well.
947 * On session close all hardware and firmware state associated with
948 * the TruFlow application is cleaned up.
950 * The session client is extracted from the tfp. Thus tf_close_session()
951 * cannot close a session client on behalf of another function.
953 * Returns success or failure code.
955 int tf_close_session(struct tf *tfp);
958 * @page ident Identity Management
960 * @ref tf_alloc_identifier
962 * @ref tf_free_identifier
965 * tf_alloc_identifier parameter definition
967 struct tf_alloc_identifier_parms {
969 * [in] receive or transmit direction
973 * [in] Identifier type
975 enum tf_identifier_type ident_type;
977 * [out] Allocated identifier
983 * tf_free_identifier parameter definition
985 struct tf_free_identifier_parms {
987 * [in] receive or transmit direction
991 * [in] Identifier type
993 enum tf_identifier_type ident_type;
1000 * [out] Current refcnt after free
1006 * tf_search_identifier parameter definition (experimental)
1008 struct tf_search_identifier_parms {
1010 * [in] receive or transmit direction
1014 * [in] Identifier type
1016 enum tf_identifier_type ident_type;
1018 * [in] Identifier data to search for
1022 * [out] Set if matching identifier found
1026 * [out] Current ref count after allocation
1032 * allocate identifier resource
1034 * TruFlow core will allocate a free id from the per identifier resource type
1035 * pool reserved for the session during tf_open(). No firmware is involved.
1037 * If shadow copy is enabled, the internal ref_cnt is set to 1 in the
1038 * shadow table for a newly allocated resource.
1040 * Returns success or failure code.
1042 int tf_alloc_identifier(struct tf *tfp,
1043 struct tf_alloc_identifier_parms *parms);
1046 * free identifier resource
1048 * TruFlow core will return an id back to the per identifier resource type pool
1049 * reserved for the session. No firmware is involved. During tf_close, the
1050 * complete pool is returned to the firmware.
1052 * additional operation (experimental)
1053 * Decrement reference count. Only release resource once refcnt goes to 0 if
1054 * shadow copy is enabled.
1056 * Returns success or failure code.
1058 int tf_free_identifier(struct tf *tfp,
1059 struct tf_free_identifier_parms *parms);
1062 * Search identifier resource (experimental)
1064 * If the shadow copy is enabled search_id is used to search for a matching
1065 * entry in the shadow table. The shadow table consists of an array of
1066 * reference counts indexed by identifier. If a matching entry is found hit is
1067 * set to TRUE, refcnt is increased by 1 and returned. Otherwise, hit is
1068 * set to false and refcnt is set to 0.
1070 * TODO: we may need a per table internal shadow copy enable flag to stage
1071 * the shadow table implementation. We do not need the shadow table for other
1072 * tables at this time so we may only want to enable the identifier shadow.
1074 * TODO: remove this pseudocode below added to show that if search fails
1075 * we shouldn't allocate a new entry but return.
1077 * identifier alloc (search_en=1)
1078 * if (ident is allocated and ref_cnt >=1)
1079 * return ident - hit is set, incr refcnt
1084 int tf_search_identifier(struct tf *tfp,
1085 struct tf_search_identifier_parms *parms);
1088 * @page dram_table DRAM Table Scope Interface
1090 * @ref tf_alloc_tbl_scope
1092 * @ref tf_free_tbl_scope
1094 * If we allocate the EEM memory from the core, we need to store it in
1095 * the shared session data structure to make sure it can be freed later.
1096 * (for example if the PF goes away)
1098 * Current thought is that memory is allocated within core.
1102 * tf_alloc_tbl_scope_parms definition
1104 struct tf_alloc_tbl_scope_parms {
1106 * [in] All Maximum key size required.
1108 uint16_t rx_max_key_sz_in_bits;
1110 * [in] Maximum Action size required (includes inlined items)
1112 uint16_t rx_max_action_entry_sz_in_bits;
1114 * [in] Memory size in Megabytes
1115 * Total memory size allocated by user to be divided
1116 * up for actions, hash, counters. Only inline external actions.
1117 * Use this variable or the number of flows, do not set both.
1119 uint32_t rx_mem_size_in_mb;
1121 * [in] Number of flows * 1000. If set, rx_mem_size_in_mb must equal 0.
1123 uint32_t rx_num_flows_in_k;
1125 * [in] All Maximum key size required.
1127 uint16_t tx_max_key_sz_in_bits;
1129 * [in] Maximum Action size required (includes inlined items)
1131 uint16_t tx_max_action_entry_sz_in_bits;
1133 * [in] Memory size in Megabytes
1134 * Total memory size allocated by user to be divided
1135 * up for actions, hash, counters. Only inline external actions.
1137 uint32_t tx_mem_size_in_mb;
1139 * [in] Number of flows * 1000
1141 uint32_t tx_num_flows_in_k;
1143 * [in] Flush pending HW cached flows every 1/10th of value
1144 * set in seconds, both idle and active flows are flushed
1145 * from the HW cache. If set to 0, this feature will be disabled.
1147 uint8_t hw_flow_cache_flush_timer;
1149 * [out] table scope identifier
1151 uint32_t tbl_scope_id;
1154 * tf_free_tbl_scope_parms definition
1156 struct tf_free_tbl_scope_parms {
1158 * [in] table scope identifier
1160 uint32_t tbl_scope_id;
1164 * tf_map_tbl_scope_parms definition
1166 struct tf_map_tbl_scope_parms {
1168 * [in] table scope identifier
1170 uint32_t tbl_scope_id;
1172 * [in] Which parifs are associated with this table scope. Bit 0
1173 * indicates parif 0.
1175 uint16_t parif_bitmask;
1179 * allocate a table scope
1181 * The scope is a software construct to identify an EEM table. This function will
1182 * divide the hash memory/buckets and records according to the device
1183 * device constraints based upon calculations using either the number of flows
1184 * requested or the size of memory indicated. Other parameters passed in
1185 * determine the configuration (maximum key size, maximum external action record
1188 * A single API is used to allocate a common table scope identifier in both
1189 * receive and transmit CFA. The scope identifier is common due to nature of
1190 * connection tracking sending notifications between RX and TX direction.
1192 * The receive and transmit table access identifiers specify which rings will
1193 * be used to initialize table DRAM. The application must ensure mutual
1194 * exclusivity of ring usage for table scope allocation and any table update
1197 * The hash table buckets, EM keys, and EM lookup results are stored in the
1198 * memory allocated based on the rx_em_hash_mb/tx_em_hash_mb parameters. The
1199 * hash table buckets are stored at the beginning of that memory.
1201 * NOTE: No EM internal setup is done here. On chip EM records are managed
1202 * internally by TruFlow core.
1204 * Returns success or failure code.
1206 int tf_alloc_tbl_scope(struct tf *tfp,
1207 struct tf_alloc_tbl_scope_parms *parms);
1210 * map a table scope (legacy device only Wh+/SR)
1212 * Map a table scope to one or more partition interfaces (parifs).
1213 * The parif can be remapped in the L2 context lookup for legacy devices. This
1214 * API allows a number of parifs to be mapped to the same table scope. On
1215 * legacy devices a table scope identifies one of 16 sets of EEM table base
1216 * addresses and is associated with a PF communication channel. The associated
1217 * PF must be configured for the table scope to operate.
1219 * An L2 context TCAM lookup returns a remapped parif value used to
1220 * index into the set of 16 parif_to_pf registers which are used to map to one
1221 * of the 16 table scopes. This API allows the user to map the parifs in the
1222 * mask to the previously allocated table scope (EEM table).
1224 * Returns success or failure code.
1226 int tf_map_tbl_scope(struct tf *tfp,
1227 struct tf_map_tbl_scope_parms *parms);
1229 * free a table scope
1231 * Firmware checks that the table scope ID is owned by the TruFlow
1232 * session, verifies that no references to this table scope remains
1233 * or Profile TCAM entries for either CFA (RX/TX) direction,
1234 * then frees the table scope ID.
1236 * Returns success or failure code.
1238 int tf_free_tbl_scope(struct tf *tfp,
1239 struct tf_free_tbl_scope_parms *parms);
1242 * @page tcam TCAM Access
1244 * @ref tf_search_tcam_entry
1246 * @ref tf_alloc_tcam_entry
1248 * @ref tf_set_tcam_entry
1250 * @ref tf_get_tcam_entry
1252 * @ref tf_free_tcam_entry
1254 #ifdef TF_TCAM_SHARED
1255 * @ref tf_move_tcam_shared_entries
1257 * @ref tf_clear_tcam_shared_entries
1262 * tf_search_tcam_entry parameter definition (experimental)
1264 struct tf_search_tcam_entry_parms {
1266 * [in] receive or transmit direction
1270 * [in] TCAM table type
1272 enum tf_tcam_tbl_type tcam_tbl_type;
1274 * [in] Key data to match on
1278 * [in] key size in bits
1280 uint16_t key_sz_in_bits;
1282 * [in] Mask data to match on
1286 * [in] Priority of entry requested (definition TBD)
1290 * [in] Allocate on miss.
1294 * [out] Set if matching entry found
1298 * [out] Search result status (hit, miss, reject)
1300 enum tf_search_status search_status;
1302 * [out] Current refcnt after allocation
1306 * [in out] The result data from the search is copied here
1310 * [in out] result size in bits for the result data
1312 uint16_t result_sz_in_bits;
1320 * search TCAM entry (experimental)
1322 * Search for a TCAM entry
1324 * This function searches the shadow copy of the TCAM table for a matching
1325 * entry. Key and mask must match for hit to be set. Only TruFlow core data
1326 * is accessed. If shadow_copy is not enabled, an error is returned.
1330 * A hash is performed on the key/mask data and mapped to a shadow copy entry
1331 * where the full key/mask is populated. If the full key/mask matches the
1332 * entry, hit is set, ref_cnt is incremented, and search_status indicates what
1333 * action the caller can take regarding setting the entry.
1335 * search_status should be used as follows:
1336 * - On Miss, the caller should create a result and call tf_set_tcam_entry with
1339 * - On Reject, the hash table is full and the entry cannot be added.
1341 * - On Hit, the result data is returned to the caller. Additionally, the
1342 * ref_cnt is updated.
1344 * Also returns success or failure code.
1346 int tf_search_tcam_entry(struct tf *tfp,
1347 struct tf_search_tcam_entry_parms *parms);
1350 * tf_alloc_tcam_entry parameter definition
1352 struct tf_alloc_tcam_entry_parms {
1354 * [in] receive or transmit direction
1358 * [in] TCAM table type
1360 enum tf_tcam_tbl_type tcam_tbl_type;
1362 * [in] Enable search for matching entry
1364 uint8_t search_enable;
1366 * [in] Key data to match on (if search)
1370 * [in] key size in bits (if search)
1372 uint16_t key_sz_in_bits;
1374 * [in] Mask data to match on (if search)
1378 * [in] Priority of entry requested (definition TBD)
1382 * [out] If search, set if matching entry found
1386 * [out] Current refcnt after allocation
1390 * [out] Idx allocated
1397 * allocate TCAM entry
1399 * Allocate a TCAM entry - one of these types:
1406 * This function allocates a TCAM table record. This function
1407 * will attempt to allocate a TCAM table entry from the session
1408 * owned TCAM entries or search a shadow copy of the TCAM table for a
1409 * matching entry if search is enabled. Key, mask and result must match for
1410 * hit to be set. Only TruFlow core data is accessed.
1411 * A hash table to entry mapping is maintained for search purposes. If
1412 * search is not enabled, the first available free entry is returned based
1413 * on priority and alloc_cnt is set to 1. If search is enabled and a matching
1414 * entry to entry_data is found, hit is set to TRUE and alloc_cnt is set to 1.
1415 * RefCnt is also returned.
1417 * Also returns success or failure code.
1419 int tf_alloc_tcam_entry(struct tf *tfp,
1420 struct tf_alloc_tcam_entry_parms *parms);
1423 * tf_set_tcam_entry parameter definition
1425 struct tf_set_tcam_entry_parms {
1427 * [in] receive or transmit direction
1431 * [in] TCAM table type
1433 enum tf_tcam_tbl_type tcam_tbl_type;
1435 * [in] base index of the entry to program
1439 * [in] struct containing key
1443 * [in] struct containing mask fields
1447 * [in] key size in bits (if search)
1449 uint16_t key_sz_in_bits;
1451 * [in] struct containing result
1455 * [in] struct containing result size in bits
1457 uint16_t result_sz_in_bits;
1463 * Program a TCAM table entry for a TruFlow session.
1465 * If the entry has not been allocated, an error will be returned.
1467 * Returns success or failure code.
1469 int tf_set_tcam_entry(struct tf *tfp,
1470 struct tf_set_tcam_entry_parms *parms);
1473 * tf_get_tcam_entry parameter definition
1475 struct tf_get_tcam_entry_parms {
1477 * [in] receive or transmit direction
1481 * [in] TCAM table type
1483 enum tf_tcam_tbl_type tcam_tbl_type;
1485 * [in] index of the entry to get
1489 * [out] struct containing key
1493 * [out] struct containing mask fields
1497 * [in/out] key size in bits
1499 uint16_t key_sz_in_bits;
1501 * [out] struct containing result
1505 * [in/out] struct containing result size in bits
1507 uint16_t result_sz_in_bits;
1513 * Program a TCAM table entry for a TruFlow session.
1515 * If the entry has not been allocated, an error will be returned.
1517 * Returns success or failure code.
1519 int tf_get_tcam_entry(struct tf *tfp,
1520 struct tf_get_tcam_entry_parms *parms);
1523 * tf_free_tcam_entry parameter definition
1525 struct tf_free_tcam_entry_parms {
1527 * [in] receive or transmit direction
1531 * [in] TCAM table type
1533 enum tf_tcam_tbl_type tcam_tbl_type;
1535 * [in] Index to free
1539 * [out] reference count after free
1549 * Firmware checks to ensure the TCAM entries are owned by the TruFlow
1550 * session. TCAM entry will be invalidated. All-ones mask.
1553 * WCTCAM profile id of 0 must be used to invalidate an entry.
1555 * Returns success or failure code.
1557 int tf_free_tcam_entry(struct tf *tfp,
1558 struct tf_free_tcam_entry_parms *parms);
1560 #ifdef TF_TCAM_SHARED
1562 * tf_move_tcam_shared_entries parameter definition
1564 struct tf_move_tcam_shared_entries_parms {
1566 * [in] receive or transmit direction
1570 * [in] TCAM table type
1572 enum tf_tcam_tbl_type tcam_tbl_type;
1578 * This API only affects the following TCAM pools within a shared session:
1580 * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
1581 * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
1583 * When called, all allocated entries from the high pool will be moved to
1584 * the low pool. Then the allocated entries in the high pool will be
1585 * cleared and freed.
1587 * This API is not supported on a non-shared session.
1589 * Returns success or failure code.
1591 int tf_move_tcam_shared_entries(struct tf *tfp,
1592 struct tf_move_tcam_shared_entries_parms *parms);
1595 * tf_clear_tcam_shared_entries parameter definition
1597 struct tf_clear_tcam_shared_entries_parms {
1599 * [in] receive or transmit direction
1603 * [in] TCAM table type
1605 enum tf_tcam_tbl_type tcam_tbl_type;
1609 * Clear TCAM shared entries pool
1611 * This API only affects the following TCAM pools within a shared session:
1613 * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
1614 * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
1616 * When called, the indicated WC TCAM high or low pool will be cleared.
1618 * This API is not supported on a non-shared session.
1620 * Returns success or failure code.
1622 int tf_clear_tcam_shared_entries(struct tf *tfp,
1623 struct tf_clear_tcam_shared_entries_parms *parms);
1625 #endif /* TF_TCAM_SHARED */
1627 * @page table Table Access
1629 * @ref tf_alloc_tbl_entry
1631 * @ref tf_free_tbl_entry
1633 * @ref tf_set_tbl_entry
1635 * @ref tf_get_tbl_entry
1637 * @ref tf_bulk_get_tbl_entry
1639 * @ref tf_get_shared_tbl_increment
1643 * tf_alloc_tbl_entry parameter definition
1645 struct tf_alloc_tbl_entry_parms {
1647 * [in] Receive or transmit direction
1651 * [in] Type of the allocation
1653 enum tf_tbl_type type;
1655 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1657 uint32_t tbl_scope_id;
1660 * [out] Idx of allocated entry
1666 * allocate index table entries
1670 * Allocate an on chip index table entry or search for a matching
1671 * entry of the indicated type for this TruFlow session.
1673 * Allocates an index table record. This function will attempt to
1674 * allocate an index table entry.
1678 * These are used to allocate inlined action record memory.
1680 * Allocates an external index table action record.
1683 * Implementation of the internals of the external function will be a stack with
1686 * Returns success or failure code.
1688 int tf_alloc_tbl_entry(struct tf *tfp,
1689 struct tf_alloc_tbl_entry_parms *parms);
1692 * tf_free_tbl_entry parameter definition
1694 struct tf_free_tbl_entry_parms {
1696 * [in] Receive or transmit direction
1700 * [in] Type of the allocation type
1702 enum tf_tbl_type type;
1704 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1706 uint32_t tbl_scope_id;
1708 * [in] Index to free
1714 * free index table entry
1716 * Used to free a previously allocated table entry.
1720 * The element is freed and given back to the session pool.
1724 * Frees an external index table action record.
1727 * Implementation of the internals of the external table will be a stack with
1730 * Returns success or failure code.
1732 int tf_free_tbl_entry(struct tf *tfp,
1733 struct tf_free_tbl_entry_parms *parms);
1736 * tf_set_tbl_entry parameter definition
1738 struct tf_set_tbl_entry_parms {
1740 * [in] Table scope identifier
1742 uint32_t tbl_scope_id;
1744 * [in] Receive or transmit direction
1748 * [in] Type of object to set
1750 enum tf_tbl_type type;
1758 uint16_t data_sz_in_bytes;
1760 * [in] External memory channel type to use
1762 enum tf_ext_mem_chan_type chan_type;
1764 * [in] Entry index to write to
1770 * set index table entry
1772 * Used to set an application programmed index table entry into a
1773 * previous allocated table location.
1775 * Returns success or failure code.
1777 int tf_set_tbl_entry(struct tf *tfp,
1778 struct tf_set_tbl_entry_parms *parms);
1781 * tf_get_shared_tbl_increment parameter definition
1783 struct tf_get_shared_tbl_increment_parms {
1785 * [in] Receive or transmit direction
1789 * [in] Type of object to set
1791 enum tf_tbl_type type;
1793 * [out] Value to increment by for resource type
1795 uint32_t increment_cnt;
1799 * tf_get_shared_tbl_increment
1801 * This API is currently only required for use in the shared
1802 * session for Thor (p58) actions. An increment count is returned per
1803 * type to indicate how much to increment the start by for each
1804 * entry (see tf_resource_info)
1806 * Returns success or failure code.
1808 int tf_get_shared_tbl_increment(struct tf *tfp,
1809 struct tf_get_shared_tbl_increment_parms *parms);
1812 * tf_get_tbl_entry parameter definition
1814 struct tf_get_tbl_entry_parms {
1816 * [in] Receive or transmit direction
1820 * [in] Type of object to get
1822 enum tf_tbl_type type;
1830 uint16_t data_sz_in_bytes;
1832 * [in] External memory channel type to use
1834 enum tf_ext_mem_chan_type chan_type;
1836 * [in] Entry index to read
1842 * get index table entry
1844 * Used to retrieve a previous set index table entry.
1846 * Reads and compares with the shadow table copy (if enabled) (only
1847 * for internal objects).
1849 * Returns success or failure code. Failure will be returned if the
1850 * provided data buffer is too small for the data type requested.
1852 int tf_get_tbl_entry(struct tf *tfp,
1853 struct tf_get_tbl_entry_parms *parms);
1856 * tf_bulk_get_tbl_entry parameter definition
1858 struct tf_bulk_get_tbl_entry_parms {
1860 * [in] Receive or transmit direction
1864 * [in] Type of object to get
1866 enum tf_tbl_type type;
1868 * [in] Starting index to read from
1870 uint32_t starting_idx;
1872 * [in] Number of sequential entries
1874 uint16_t num_entries;
1876 * [in] Size of the single entry
1878 uint16_t entry_sz_in_bytes;
1880 * [out] Host physical address, where the data
1881 * will be copied to by the firmware.
1882 * Use tfp_calloc() API and mem_pa
1883 * variable of the tfp_calloc_parms
1884 * structure for the physical address.
1886 uint64_t physical_mem_addr;
1888 * [in] External memory channel type to use
1890 enum tf_ext_mem_chan_type chan_type;
1894 * Bulk get index table entry
1896 * Used to retrieve a set of index table entries.
1898 * Entries within the range may not have been allocated using
1899 * tf_alloc_tbl_entry() at the time of access. But the range must
1900 * be within the bounds determined from tf_open_session() for the
1901 * given table type. Currently, this is only used for collecting statistics.
1903 * Returns success or failure code. Failure will be returned if the
1904 * provided data buffer is too small for the data type requested.
1906 int tf_bulk_get_tbl_entry(struct tf *tfp,
1907 struct tf_bulk_get_tbl_entry_parms *parms);
1910 * @page exact_match Exact Match Table
1912 * @ref tf_insert_em_entry
1914 * @ref tf_delete_em_entry
1916 * @ref tf_search_em_entry
1920 * tf_insert_em_entry parameter definition
1922 struct tf_insert_em_entry_parms {
1924 * [in] receive or transmit direction
1928 * [in] internal or external
1932 * [in] ID of table scope to use (external only)
1934 uint32_t tbl_scope_id;
1936 * [in] ptr to structure containing key fields
1940 * [in] key bit length
1942 uint16_t key_sz_in_bits;
1944 * [in] ptr to structure containing result field
1948 * [out] result size in bits
1950 uint16_t em_record_sz_in_bits;
1952 * [in] duplicate check flag
1956 * [in] External memory channel type to use
1958 enum tf_ext_mem_chan_type chan_type;
1960 * [out] Flow handle value for the inserted entry. This is encoded
1961 * as the entries[4]:bucket[2]:hashId[1]:hash[14]
1963 uint64_t flow_handle;
1965 * [out] Flow id is returned as null (internal)
1966 * Flow id is the GFID value for the inserted entry (external)
1967 * This is the value written to the BD and useful information for mark.
1972 * tf_delete_em_entry parameter definition
1974 struct tf_delete_em_entry_parms {
1976 * [in] receive or transmit direction
1980 * [in] internal or external
1984 * [in] ID of table scope to use (external only)
1986 uint32_t tbl_scope_id;
1988 * [out] The index of the entry
1992 * [in] External memory channel type to use
1994 enum tf_ext_mem_chan_type chan_type;
1996 * [in] structure containing flow delete handle information
1998 uint64_t flow_handle;
2001 * tf_move_em_entry parameter definition
2003 struct tf_move_em_entry_parms {
2005 * [in] receive or transmit direction
2009 * [in] internal or external
2013 * [in] ID of table scope to use (external only)
2015 uint32_t tbl_scope_id;
2017 * [in] ID of table interface to use (SR2 only)
2021 * [in] epoch group IDs of entry to delete
2022 * 2 element array with 2 ids. (SR2 only)
2026 * [out] The index of the entry
2030 * [in] External memory channel type to use
2032 enum tf_ext_mem_chan_type chan_type;
2034 * [in] The index of the new EM record
2038 * [in] structure containing flow delete handle information
2040 uint64_t flow_handle;
2043 * tf_search_em_entry parameter definition (Future)
2045 struct tf_search_em_entry_parms {
2047 * [in] receive or transmit direction
2051 * [in] internal or external
2055 * [in] ID of table scope to use (external only)
2057 uint32_t tbl_scope_id;
2059 * [in] ptr to structure containing key fields
2063 * [in] key bit length
2065 uint16_t key_sz_in_bits;
2067 * [in/out] ptr to structure containing EM record fields
2071 * [out] result size in bits
2073 uint16_t em_record_sz_in_bits;
2075 * [in] External memory channel type to use
2077 enum tf_ext_mem_chan_type chan_type;
2079 * [in] ptr to structure containing flow delete handle
2081 uint64_t flow_handle;
2085 * insert em hash entry in internal table memory
2089 * This API inserts an exact match entry into internal EM table memory
2090 * of the specified direction.
2092 * Note: The EM record is managed within the TruFlow core and not the
2095 * Shadow copy of internal record table an association with hash and 1,2, or 4
2096 * associated buckets
2099 * This API inserts an exact match entry into DRAM EM table memory of the
2100 * specified direction and table scope.
2102 * The insertion of duplicate entries in an EM table is not permitted. If a
2103 * TruFlow application can guarantee that it will never insert duplicates, it
2104 * can disable duplicate checking by passing a zero value in the dup_check
2105 * parameter to this API. This will optimize performance. Otherwise, the
2106 * TruFlow library will enforce protection against inserting duplicate entries.
2108 * Flow handle is defined in this document:
2110 * https://docs.google.com
2111 * /document/d/1NESu7RpTN3jwxbokaPfYORQyChYRmJgs40wMIRe8_-Q/edit
2113 * Returns success or busy code.
2116 int tf_insert_em_entry(struct tf *tfp,
2117 struct tf_insert_em_entry_parms *parms);
2120 * delete em hash entry table memory
2124 * This API deletes an exact match entry from internal EM table memory of the
2125 * specified direction. If a valid flow ptr is passed in then that takes
2126 * precedence over the pointer to the complete key passed in.
2131 * This API deletes an exact match entry from EM table memory of the specified
2132 * direction and table scope. If a valid flow handle is passed in then that
2133 * takes precedence over the pointer to the complete key passed in.
2135 * The TruFlow library may release a dynamic bucket when an entry is deleted.
2138 * Returns success or not found code
2142 int tf_delete_em_entry(struct tf *tfp,
2143 struct tf_delete_em_entry_parms *parms);
2146 * search em hash entry table memory (Future)
2150 * This API looks up an EM entry in table memory with the specified EM
2151 * key or flow (flow takes precedence) and direction.
2153 * The status will be one of: success or entry not found. If the lookup
2154 * succeeds, a pointer to the matching entry and the result record associated
2155 * with the matching entry will be provided.
2157 * If flow_handle is set, search shadow copy.
2159 * Otherwise, query the fw with key to get result.
2163 * This API looks up an EM entry in table memory with the specified EM
2164 * key or flow_handle (flow takes precedence), direction and table scope.
2166 * The status will be one of: success or entry not found. If the lookup
2167 * succeeds, a pointer to the matching entry and the result record associated
2168 * with the matching entry will be provided.
2170 * Returns success or not found code
2173 int tf_search_em_entry(struct tf *tfp,
2174 struct tf_search_em_entry_parms *parms);
2177 * @page global Global Configuration
2179 * @ref tf_set_global_cfg
2181 * @ref tf_get_global_cfg
2184 * Tunnel Encapsulation Offsets
2186 enum tf_tunnel_encap_offsets {
2188 TF_TUNNEL_ENCAP_NAT,
2189 TF_TUNNEL_ENCAP_MPLS,
2190 TF_TUNNEL_ENCAP_VXLAN,
2191 TF_TUNNEL_ENCAP_GENEVE,
2192 TF_TUNNEL_ENCAP_NVGRE,
2193 TF_TUNNEL_ENCAP_GRE,
2194 TF_TUNNEL_ENCAP_FULL_GENERIC
2197 * Global Configuration Table Types
2199 enum tf_global_config_type {
2200 TF_TUNNEL_ENCAP, /**< Tunnel Encap Config(TECT) */
2201 TF_ACTION_BLOCK, /**< Action Block Config(ABCR) */
2202 TF_COUNTER_CFG, /**< Counter Configuration (CNTRS_CTRL) */
2203 TF_METER_CFG, /**< Meter Config(ACTP4_FMTCR) */
2204 TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL) */
2205 TF_GLOBAL_CFG_TYPE_MAX
2209 * tf_global_cfg parameter definition
2211 struct tf_global_cfg_parms {
2213 * [in] receive or transmit direction
2217 * [in] Global config type
2219 enum tf_global_config_type type;
2221 * [in] Offset @ the type
2225 * [in/out] Value of the configuration
2226 * set - Read, Modify and Write
2227 * get - Read the full configuration
2231 * [in] Configuration mask
2232 * set - Read, Modify with mask and Write
2235 uint8_t *config_mask;
2237 * [in] struct containing size
2239 uint16_t config_sz_in_bytes;
2243 * Get global configuration
2245 * Retrieve the configuration
2247 * Returns success or failure code.
2249 int tf_get_global_cfg(struct tf *tfp,
2250 struct tf_global_cfg_parms *parms);
2253 * Update the global configuration table
2255 * Read, modify write the value.
2257 * Returns success or failure code.
2259 int tf_set_global_cfg(struct tf *tfp,
2260 struct tf_global_cfg_parms *parms);
2263 * @page if_tbl Interface Table Access
2265 * @ref tf_set_if_tbl_entry
2267 * @ref tf_get_if_tbl_entry
2269 * @ref tf_restore_if_tbl_entry
2272 * Enumeration of TruFlow interface table types.
2274 enum tf_if_tbl_type {
2275 /** Default Profile L2 Context Entry */
2276 TF_IF_TBL_TYPE_PROF_SPIF_DFLT_L2_CTXT,
2277 /** Default Profile TCAM/Lookup Action Record Pointer Table */
2278 TF_IF_TBL_TYPE_PROF_PARIF_DFLT_ACT_REC_PTR,
2279 /** Error Profile TCAM Miss Action Record Pointer Table */
2280 TF_IF_TBL_TYPE_PROF_PARIF_ERR_ACT_REC_PTR,
2281 /** Default Error Profile TCAM Miss Action Record Pointer Table */
2282 TF_IF_TBL_TYPE_LKUP_PARIF_DFLT_ACT_REC_PTR,
2283 /** Ingress lookup table */
2285 /** VNIC/SVIF Properties Table */
2286 TF_IF_TBL_TYPE_VSPT,
2291 * tf_set_if_tbl_entry parameter definition
2293 struct tf_set_if_tbl_entry_parms {
2295 * [in] Receive or transmit direction
2299 * [in] Type of object to set
2301 enum tf_if_tbl_type type;
2309 uint16_t data_sz_in_bytes;
2311 * [in] Interface to write
2317 * set interface table entry
2319 * Used to set an interface table. This API is used for managing tables indexed
2320 * by SVIF/SPIF/PARIF interfaces. In current implementation only the value is
2322 * Returns success or failure code.
2324 int tf_set_if_tbl_entry(struct tf *tfp,
2325 struct tf_set_if_tbl_entry_parms *parms);
2328 * tf_get_if_tbl_entry parameter definition
2330 struct tf_get_if_tbl_entry_parms {
2332 * [in] Receive or transmit direction
2336 * [in] Type of table to get
2338 enum tf_if_tbl_type type;
2346 uint16_t data_sz_in_bytes;
2348 * [in] Entry index to read
2354 * get interface table entry
2356 * Used to retrieve an interface table entry.
2358 * Reads the interface table entry value
2360 * Returns success or failure code. Failure will be returned if the
2361 * provided data buffer is too small for the data type requested.
2363 int tf_get_if_tbl_entry(struct tf *tfp,
2364 struct tf_get_if_tbl_entry_parms *parms);
2366 #endif /* _TF_CORE_H_ */