a6d6128f15e25ce1d4e2fa3e34fdca2576976aba
[dpdk.git] / drivers / net / bnxt / tf_core / tf_core.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_CORE_H_
7 #define _TF_CORE_H_
8
9 #include <stdint.h>
10 #include <stdlib.h>
11 #include <stdbool.h>
12 #include <stdio.h>
13
14 #include "tf_project.h"
15
16 /**
17  * @file
18  *
19  * Truflow Core API Header File
20  */
21
22 /********** BEGIN Truflow Core DEFINITIONS **********/
23
24 /**
25  * direction
26  */
27 enum tf_dir {
28         TF_DIR_RX,  /**< Receive */
29         TF_DIR_TX,  /**< Transmit */
30         TF_DIR_MAX
31 };
32
33 /**
34  * External pool size
35  *
36  * Defines a single pool of external action records of
37  * fixed size.  Currently, this is an index.
38  */
39 #define TF_EXT_POOL_ENTRY_SZ_BYTES 1
40
41 /**
42  *  External pool entry count
43  *
44  *  Defines the number of entries in the external action pool
45  */
46 #define TF_EXT_POOL_ENTRY_CNT (1 * 1024)
47
48 /**
49  * Number of external pools
50  */
51 #define TF_EXT_POOL_CNT_MAX 1
52
53 /**
54  * External pool Id
55  */
56 #define TF_EXT_POOL_0      0 /**< matches TF_TBL_TYPE_EXT   */
57 #define TF_EXT_POOL_1      1 /**< matches TF_TBL_TYPE_EXT_0 */
58
59 /********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
60
61 /**
62  * @page general General
63  *
64  * @ref tf_open_session
65  *
66  * @ref tf_attach_session
67  *
68  * @ref tf_close_session
69  */
70
71
72 /** Session Version defines
73  *
74  * The version controls the format of the tf_session and
75  * tf_session_info structure. This is to assure upgrade between
76  * versions can be supported.
77  */
78 #define TF_SESSION_VER_MAJOR  1   /**< Major Version */
79 #define TF_SESSION_VER_MINOR  0   /**< Minor Version */
80 #define TF_SESSION_VER_UPDATE 0   /**< Update Version */
81
82 /** Session Name
83  *
84  * Name of the TruFlow control channel interface.  Expects
85  * format to be RTE Name specific, i.e. rte_eth_dev_get_name_by_port()
86  */
87 #define TF_SESSION_NAME_MAX       64
88
89 #define TF_FW_SESSION_ID_INVALID  0xFF  /**< Invalid FW Session ID define */
90
91 /** Session Identifier
92  *
93  * Unique session identifier which includes PCIe bus info to
94  * distinguish the PF and session info to identify the associated
95  * TruFlow session. Session ID is constructed from the passed in
96  * ctrl_chan_name in tf_open_session() together with an allocated
97  * fw_session_id. Done by TruFlow on tf_open_session().
98  */
99 union tf_session_id {
100         uint32_t id;
101         struct {
102                 uint8_t domain;
103                 uint8_t bus;
104                 uint8_t device;
105                 uint8_t fw_session_id;
106         } internal;
107 };
108
109 /** Session Version
110  *
111  * The version controls the format of the tf_session and
112  * tf_session_info structure. This is to assure upgrade between
113  * versions can be supported.
114  *
115  * Please see the TF_VER_MAJOR/MINOR and UPDATE defines.
116  */
117 struct tf_session_version {
118         uint8_t major;
119         uint8_t minor;
120         uint8_t update;
121 };
122
123 /** Session supported device types
124  *
125  */
126 enum tf_device_type {
127         TF_DEVICE_TYPE_WH = 0, /**< Whitney+  */
128         TF_DEVICE_TYPE_BRD2,   /**< TBD       */
129         TF_DEVICE_TYPE_BRD3,   /**< TBD       */
130         TF_DEVICE_TYPE_BRD4,   /**< TBD       */
131         TF_DEVICE_TYPE_MAX     /**< Maximum   */
132 };
133
134 /** TruFlow Session Information
135  *
136  * Structure defining a TruFlow Session, also known as a Management
137  * session. This structure is initialized at time of
138  * tf_open_session(). It is passed to all of the TruFlow APIs as way
139  * to prescribe and isolate resources between different TruFlow ULP
140  * Applications.
141  */
142 struct tf_session_info {
143         /**
144          * TrueFlow Version. Used to control the structure layout when
145          * sharing sessions. No guarantee that a secondary process
146          * would come from the same version of an executable.
147          * TruFlow initializes this variable on tf_open_session().
148          *
149          * Owner:  TruFlow
150          * Access: TruFlow
151          */
152         struct tf_session_version ver;
153         /**
154          * will be STAILQ_ENTRY(tf_session_info) next
155          *
156          * Owner:  ULP
157          * Access: ULP
158          */
159         void                 *next;
160         /**
161          * Session ID is a unique identifier for the session. TruFlow
162          * initializes this variable during tf_open_session()
163          * processing.
164          *
165          * Owner:  TruFlow
166          * Access: Truflow & ULP
167          */
168         union tf_session_id   session_id;
169         /**
170          * Protects access to core_data. Lock is initialized and owned
171          * by ULP. TruFlow can access the core_data without checking
172          * the lock.
173          *
174          * Owner:  ULP
175          * Access: ULP
176          */
177         uint8_t               spin_lock;
178         /**
179          * The core_data holds the TruFlow tf_session data
180          * structure. This memory is allocated and owned by TruFlow on
181          * tf_open_session().
182          *
183          * TruFlow uses this memory for session management control
184          * until the session is closed by ULP. Access control is done
185          * by the spin_lock which ULP controls ahead of TruFlow API
186          * calls.
187          *
188          * Please see tf_open_session_parms for specification details
189          * on this variable.
190          *
191          * Owner:  TruFlow
192          * Access: TruFlow
193          */
194         void                 *core_data;
195         /**
196          * The core_data_sz_bytes specifies the size of core_data in
197          * bytes.
198          *
199          * The size is set by TruFlow on tf_open_session().
200          *
201          * Please see tf_open_session_parms for specification details
202          * on this variable.
203          *
204          * Owner:  TruFlow
205          * Access: TruFlow
206          */
207         uint32_t              core_data_sz_bytes;
208 };
209
210 /** TruFlow handle
211  *
212  * Contains a pointer to the session info. Allocated by ULP and passed
213  * to TruFlow using tf_open_session(). TruFlow will populate the
214  * session info at that time. Additional 'opens' can be done using
215  * same session_info by using tf_attach_session().
216  *
217  * It is expected that ULP allocates this memory as shared memory.
218  *
219  * NOTE: This struct must be within the BNXT PMD struct bnxt
220  *       (bp). This allows use of container_of() to get access to the PMD.
221  */
222 struct tf {
223         struct tf_session_info *session;
224 };
225
226
227 /**
228  * tf_open_session parameters definition.
229  */
230 struct tf_open_session_parms {
231         /** [in] ctrl_chan_name
232          *
233          * String containing name of control channel interface to be
234          * used for this session to communicate with firmware.
235          *
236          * The ctrl_chan_name can be looked up by using
237          * rte_eth_dev_get_name_by_port() within the ULP.
238          *
239          * ctrl_chan_name will be used as part of a name for any
240          * shared memory allocation.
241          */
242         char ctrl_chan_name[TF_SESSION_NAME_MAX];
243         /** [in] shadow_copy
244          *
245          * Boolean controlling the use and availability of shadow
246          * copy. Shadow copy will allow the TruFlow to keep track of
247          * resource content on the firmware side without having to
248          * query firmware. Additional private session core_data will
249          * be allocated if this boolean is set to 'true', default
250          * 'false'.
251          *
252          * Size of memory depends on the NVM Resource settings for the
253          * control channel.
254          */
255         bool shadow_copy;
256         /** [in/out] session_id
257          *
258          * Session_id is unique per session.
259          *
260          * Session_id is composed of domain, bus, device and
261          * fw_session_id. The construction is done by parsing the
262          * ctrl_chan_name together with allocation of a fw_session_id.
263          *
264          * The session_id allows a session to be shared between devices.
265          */
266         union tf_session_id session_id;
267         /** [in] device type
268          *
269          * Device type is passed, one of Wh+, Brd2, Brd3, Brd4
270          */
271         enum tf_device_type device_type;
272 };
273
274 /**
275  * Opens a new TruFlow management session.
276  *
277  * TruFlow will allocate session specific memory, shared memory, to
278  * hold its session data. This data is private to TruFlow.
279  *
280  * Multiple PFs can share the same session. An association, refcount,
281  * between session and PFs is maintained within TruFlow. Thus, a PF
282  * can attach to an existing session, see tf_attach_session().
283  *
284  * No other TruFlow APIs will succeed unless this API is first called and
285  * succeeds.
286  *
287  * tf_open_session() returns a session id that can be used on attach.
288  *
289  * [in] tfp
290  *   Pointer to TF handle
291  * [in] parms
292  *   Pointer to open parameters
293  *
294  * Returns
295  *   - (0) if successful.
296  *   - (-EINVAL) on failure.
297  */
298 int tf_open_session(struct tf *tfp,
299                     struct tf_open_session_parms *parms);
300
301 struct tf_attach_session_parms {
302         /** [in] ctrl_chan_name
303          *
304          * String containing name of control channel interface to be
305          * used for this session to communicate with firmware.
306          *
307          * The ctrl_chan_name can be looked up by using
308          * rte_eth_dev_get_name_by_port() within the ULP.
309          *
310          * ctrl_chan_name will be used as part of a name for any
311          * shared memory allocation.
312          */
313         char ctrl_chan_name[TF_SESSION_NAME_MAX];
314
315         /** [in] attach_chan_name
316          *
317          * String containing name of attach channel interface to be
318          * used for this session.
319          *
320          * The attach_chan_name must be given to a 2nd process after
321          * the primary process has been created. This is the
322          * ctrl_chan_name of the primary process and is used to find
323          * the shared memory for the session that the attach is going
324          * to use.
325          */
326         char attach_chan_name[TF_SESSION_NAME_MAX];
327
328         /** [in] session_id
329          *
330          * Session_id is unique per session. For Attach the session_id
331          * should be the session_id that was returned on the first
332          * open.
333          *
334          * Session_id is composed of domain, bus, device and
335          * fw_session_id. The construction is done by parsing the
336          * ctrl_chan_name together with allocation of a fw_session_id
337          * during tf_open_session().
338          *
339          * A reference count will be incremented on attach. A session
340          * is first fully closed when reference count is zero by
341          * calling tf_close_session().
342          */
343         union tf_session_id session_id;
344 };
345
346 /**
347  * Attaches to an existing session. Used when more than one PF wants
348  * to share a single session. In that case all TruFlow management
349  * traffic will be sent to the TruFlow firmware using the 'PF' that
350  * did the attach not the session ctrl channel.
351  *
352  * Attach will increment a ref count as to manage the shared session data.
353  *
354  * [in] tfp, pointer to TF handle
355  * [in] parms, pointer to attach parameters
356  *
357  * Returns
358  *   - (0) if successful.
359  *   - (-EINVAL) on failure.
360  */
361 int tf_attach_session(struct tf *tfp,
362                       struct tf_attach_session_parms *parms);
363
364 /**
365  * Closes an existing session. Cleans up all hardware and firmware
366  * state associated with the TruFlow application session when the last
367  * PF associated with the session results in refcount to be zero.
368  *
369  * Returns success or failure code.
370  */
371 int tf_close_session(struct tf *tfp);
372
373 /**
374  * @page  ident Identity Management
375  *
376  * @ref tf_alloc_identifier
377  *
378  * @ref tf_free_identifier
379  */
380 enum tf_identifier_type {
381         /** The L2 Context is returned from the L2 Ctxt TCAM lookup
382          *  and can be used in WC TCAM or EM keys to virtualize further
383          *  lookups.
384          */
385         TF_IDENT_TYPE_L2_CTXT,
386         /** The WC profile func is returned from the L2 Ctxt TCAM lookup
387          *  to enable virtualization of the profile TCAM.
388          */
389         TF_IDENT_TYPE_PROF_FUNC,
390         /** The WC profile ID is included in the WC lookup key
391          *  to enable virtualization of the WC TCAM hardware.
392          */
393         TF_IDENT_TYPE_WC_PROF,
394         /** The EM profile ID is included in the EM lookup key
395          *  to enable virtualization of the EM hardware. (not required for Brd4
396          *  as it has table scope)
397          */
398         TF_IDENT_TYPE_EM_PROF,
399         /** The L2 func is included in the ILT result and from recycling to
400          *  enable virtualization of further lookups.
401          */
402         TF_IDENT_TYPE_L2_FUNC
403 };
404
405 /** tf_alloc_identifier parameter definition
406  */
407 struct tf_alloc_identifier_parms {
408         /**
409          * [in]  receive or transmit direction
410          */
411         enum tf_dir dir;
412         /**
413          * [in] Identifier type
414          */
415         enum tf_identifier_type ident_type;
416         /**
417          * [out] Identifier allocated
418          */
419         uint16_t id;
420 };
421
422 /** tf_free_identifier parameter definition
423  */
424 struct tf_free_identifier_parms {
425         /**
426          * [in]  receive or transmit direction
427          */
428         enum tf_dir dir;
429         /**
430          * [in] Identifier type
431          */
432         enum tf_identifier_type ident_type;
433         /**
434          * [in] ID to free
435          */
436         uint16_t id;
437 };
438
439 /** allocate identifier resource
440  *
441  * TruFlow core will allocate a free id from the per identifier resource type
442  * pool reserved for the session during tf_open().  No firmware is involved.
443  *
444  * Returns success or failure code.
445  */
446 int tf_alloc_identifier(struct tf *tfp,
447                         struct tf_alloc_identifier_parms *parms);
448
449 /** free identifier resource
450  *
451  * TruFlow core will return an id back to the per identifier resource type pool
452  * reserved for the session.  No firmware is involved.  During tf_close, the
453  * complete pool is returned to the firmware.
454  *
455  * Returns success or failure code.
456  */
457 int tf_free_identifier(struct tf *tfp,
458                        struct tf_free_identifier_parms *parms);
459
460 /**
461  * @page dram_table DRAM Table Scope Interface
462  *
463  * @ref tf_alloc_tbl_scope
464  *
465  * @ref tf_free_tbl_scope
466  *
467  * If we allocate the EEM memory from the core, we need to store it in
468  * the shared session data structure to make sure it can be freed later.
469  * (for example if the PF goes away)
470  *
471  * Current thought is that memory is allocated within core.
472  */
473
474
475 /** tf_alloc_tbl_scope_parms definition
476  */
477 struct tf_alloc_tbl_scope_parms {
478         /**
479          * [in] All Maximum key size required.
480          */
481         uint16_t rx_max_key_sz_in_bits;
482         /**
483          * [in] Maximum Action size required (includes inlined items)
484          */
485         uint16_t rx_max_action_entry_sz_in_bits;
486         /**
487          * [in] Memory size in Megabytes
488          * Total memory size allocated by user to be divided
489          * up for actions, hash, counters.  Only inline external actions.
490          * Use this variable or the number of flows, do not set both.
491          */
492         uint32_t rx_mem_size_in_mb;
493         /**
494          * [in] Number of flows * 1000. If set, rx_mem_size_in_mb must equal 0.
495          */
496         uint32_t rx_num_flows_in_k;
497         /**
498          * [in] SR2 only receive table access interface id
499          */
500         uint32_t rx_tbl_if_id;
501         /**
502          * [in] All Maximum key size required.
503          */
504         uint16_t tx_max_key_sz_in_bits;
505         /**
506          * [in] Maximum Action size required (includes inlined items)
507          */
508         uint16_t tx_max_action_entry_sz_in_bits;
509         /**
510          * [in] Memory size in Megabytes
511          * Total memory size allocated by user to be divided
512          * up for actions, hash, counters.  Only inline external actions.
513          */
514         uint32_t tx_mem_size_in_mb;
515         /**
516          * [in] Number of flows * 1000
517          */
518         uint32_t tx_num_flows_in_k;
519         /**
520          * [in] SR2 only receive table access interface id
521          */
522         uint32_t tx_tbl_if_id;
523         /**
524          * [out] table scope identifier
525          */
526         uint32_t tbl_scope_id;
527 };
528
529 struct tf_free_tbl_scope_parms {
530         /**
531          * [in] table scope identifier
532          */
533         uint32_t tbl_scope_id;
534 };
535
536 /**
537  * allocate a table scope
538  *
539  * On SR2 Firmware will allocate a scope ID.  On other devices, the scope
540  * is a software construct to identify an EEM table.  This function will
541  * divide the hash memory/buckets and records according to the device
542  * device constraints based upon calculations using either the number of flows
543  * requested or the size of memory indicated.  Other parameters passed in
544  * determine the configuration (maximum key size, maximum external action record
545  * size.
546  *
547  * This API will allocate the table region in
548  * DRAM, program the PTU page table entries, and program the number of static
549  * buckets (if SR2) in the RX and TX CFAs.  Buckets are assumed to start at
550  * 0 in the EM memory for the scope.  Upon successful completion of this API,
551  * hash tables are fully initialized and ready for entries to be inserted.
552  *
553  * A single API is used to allocate a common table scope identifier in both
554  * receive and transmit CFA. The scope identifier is common due to nature of
555  * connection tracking sending notifications between RX and TX direction.
556  *
557  * The receive and transmit table access identifiers specify which rings will
558  * be used to initialize table DRAM.  The application must ensure mutual
559  * exclusivity of ring usage for table scope allocation and any table update
560  * operations.
561  *
562  * The hash table buckets, EM keys, and EM lookup results are stored in the
563  * memory allocated based on the rx_em_hash_mb/tx_em_hash_mb parameters.  The
564  * hash table buckets are stored at the beginning of that memory.
565  *
566  * NOTES:  No EM internal setup is done here. On chip EM records are managed
567  * internally by TruFlow core.
568  *
569  * Returns success or failure code.
570  */
571 int tf_alloc_tbl_scope(struct tf *tfp,
572                        struct tf_alloc_tbl_scope_parms *parms);
573
574
575 /**
576  * free a table scope
577  *
578  * Firmware checks that the table scope ID is owned by the TruFlow
579  * session, verifies that no references to this table scope remains
580  * (SR2 ILT) or Profile TCAM entries for either CFA (RX/TX) direction,
581  * then frees the table scope ID.
582  *
583  * Returns success or failure code.
584  */
585 int tf_free_tbl_scope(struct tf *tfp,
586                       struct tf_free_tbl_scope_parms *parms);
587
588 /**
589  * TCAM table type
590  */
591 enum tf_tcam_tbl_type {
592         TF_TCAM_TBL_TYPE_L2_CTXT_TCAM,
593         TF_TCAM_TBL_TYPE_PROF_TCAM,
594         TF_TCAM_TBL_TYPE_WC_TCAM,
595         TF_TCAM_TBL_TYPE_SP_TCAM,
596         TF_TCAM_TBL_TYPE_CT_RULE_TCAM,
597         TF_TCAM_TBL_TYPE_VEB_TCAM,
598         TF_TCAM_TBL_TYPE_MAX
599
600 };
601
602 /**
603  * @page tcam TCAM Access
604  *
605  * @ref tf_alloc_tcam_entry
606  *
607  * @ref tf_set_tcam_entry
608  *
609  * @ref tf_get_tcam_entry
610  *
611  * @ref tf_free_tcam_entry
612  */
613
614 /** tf_alloc_tcam_entry parameter definition
615  */
616 struct tf_alloc_tcam_entry_parms {
617         /**
618          * [in] receive or transmit direction
619          */
620         enum tf_dir dir;
621         /**
622          * [in] TCAM table type
623          */
624         enum tf_tcam_tbl_type tcam_tbl_type;
625         /**
626          * [in] Enable search for matching entry
627          */
628         uint8_t search_enable;
629         /**
630          * [in] Key data to match on (if search)
631          */
632         uint8_t *key;
633         /**
634          * [in] key size in bits (if search)
635          */
636         uint16_t key_sz_in_bits;
637         /**
638          * [in] Mask data to match on (if search)
639          */
640         uint8_t *mask;
641         /**
642          * [in] Priority of entry requested (definition TBD)
643          */
644         uint32_t priority;
645         /**
646          * [out] If search, set if matching entry found
647          */
648         uint8_t hit;
649         /**
650          * [out] Current refcnt after allocation
651          */
652         uint16_t ref_cnt;
653         /**
654          * [out] Idx allocated
655          *
656          */
657         uint16_t idx;
658 };
659
660 /** allocate TCAM entry
661  *
662  * Allocate a TCAM entry - one of these types:
663  *
664  * L2 Context
665  * Profile TCAM
666  * WC TCAM
667  * VEB TCAM
668  *
669  * This function allocates a TCAM table record.  This function
670  * will attempt to allocate a TCAM table entry from the session
671  * owned TCAM entries or search a shadow copy of the TCAM table for a
672  * matching entry if search is enabled.  Key, mask and result must match for
673  * hit to be set.  Only TruFlow core data is accessed.
674  * A hash table to entry mapping is maintained for search purposes.  If
675  * search is not enabled, the first available free entry is returned based
676  * on priority and alloc_cnt is set to 1.  If search is enabled and a matching
677  * entry to entry_data is found, hit is set to TRUE and alloc_cnt is set to 1.
678  * RefCnt is also returned.
679  *
680  * Also returns success or failure code.
681  */
682 int tf_alloc_tcam_entry(struct tf *tfp,
683                         struct tf_alloc_tcam_entry_parms *parms);
684
685 /** tf_set_tcam_entry parameter definition
686  */
687 struct  tf_set_tcam_entry_parms {
688         /**
689          * [in] receive or transmit direction
690          */
691         enum tf_dir dir;
692         /**
693          * [in] TCAM table type
694          */
695         enum tf_tcam_tbl_type tcam_tbl_type;
696         /**
697          * [in] base index of the entry to program
698          */
699         uint16_t idx;
700         /**
701          * [in] struct containing key
702          */
703         uint8_t *key;
704         /**
705          * [in] struct containing mask fields
706          */
707         uint8_t *mask;
708         /**
709          * [in] key size in bits (if search)
710          */
711         uint16_t key_sz_in_bits;
712         /**
713          * [in] struct containing result
714          */
715         uint8_t *result;
716         /**
717          * [in] struct containing result size in bits
718          */
719         uint16_t result_sz_in_bits;
720 };
721
722 /** set TCAM entry
723  *
724  * Program a TCAM table entry for a TruFlow session.
725  *
726  * If the entry has not been allocated, an error will be returned.
727  *
728  * Returns success or failure code.
729  */
730 int tf_set_tcam_entry(struct tf *tfp,
731                       struct tf_set_tcam_entry_parms *parms);
732
733 /** tf_get_tcam_entry parameter definition
734  */
735 struct tf_get_tcam_entry_parms {
736         /**
737          * [in] receive or transmit direction
738          */
739         enum tf_dir dir;
740         /**
741          * [in] TCAM table type
742          */
743         enum tf_tcam_tbl_type  tcam_tbl_type;
744         /**
745          * [in] index of the entry to get
746          */
747         uint16_t idx;
748         /**
749          * [out] struct containing key
750          */
751         uint8_t *key;
752         /**
753          * [out] struct containing mask fields
754          */
755         uint8_t *mask;
756         /**
757          * [out] key size in bits
758          */
759         uint16_t key_sz_in_bits;
760         /**
761          * [out] struct containing result
762          */
763         uint8_t *result;
764         /**
765          * [out] struct containing result size in bits
766          */
767         uint16_t result_sz_in_bits;
768 };
769
770 /** get TCAM entry
771  *
772  * Program a TCAM table entry for a TruFlow session.
773  *
774  * If the entry has not been allocated, an error will be returned.
775  *
776  * Returns success or failure code.
777  */
778 int tf_get_tcam_entry(struct tf *tfp,
779                       struct tf_get_tcam_entry_parms *parms);
780
781 /** tf_free_tcam_entry parameter definition
782  */
783 struct tf_free_tcam_entry_parms {
784         /**
785          * [in] receive or transmit direction
786          */
787         enum tf_dir dir;
788         /**
789          * [in] TCAM table type
790          */
791         enum tf_tcam_tbl_type tcam_tbl_type;
792         /**
793          * [in] Index to free
794          */
795         uint16_t idx;
796         /**
797          * [out] reference count after free
798          */
799         uint16_t ref_cnt;
800 };
801
802 /** free TCAM entry
803  *
804  * Free TCAM entry.
805  *
806  * Firmware checks to ensure the TCAM entries are owned by the TruFlow
807  * session.  TCAM entry will be invalidated.  All-ones mask.
808  * writes to hw.
809  *
810  * WCTCAM profile id of 0 must be used to invalidate an entry.
811  *
812  * Returns success or failure code.
813  */
814 int tf_free_tcam_entry(struct tf *tfp,
815                        struct tf_free_tcam_entry_parms *parms);
816
817 /**
818  * @page table Table Access
819  *
820  * @ref tf_alloc_tbl_entry
821  *
822  * @ref tf_free_tbl_entry
823  *
824  * @ref tf_set_tbl_entry
825  *
826  * @ref tf_get_tbl_entry
827  */
828
829 /**
830  * Enumeration of TruFlow table types. A table type is used to identify a
831  * resource object.
832  *
833  * NOTE: The table type TF_TBL_TYPE_EXT is unique in that it is
834  * the only table type that is connected with a table scope.
835  */
836 enum tf_tbl_type {
837         /** Wh+/Brd2 Action Record */
838         TF_TBL_TYPE_FULL_ACT_RECORD,
839         /** Multicast Groups */
840         TF_TBL_TYPE_MCAST_GROUPS,
841         /** Action Encap 8 Bytes */
842         TF_TBL_TYPE_ACT_ENCAP_8B,
843         /** Action Encap 16 Bytes */
844         TF_TBL_TYPE_ACT_ENCAP_16B,
845         /** Action Encap 64 Bytes */
846         TF_TBL_TYPE_ACT_ENCAP_32B,
847         /** Action Encap 64 Bytes */
848         TF_TBL_TYPE_ACT_ENCAP_64B,
849         /** Action Source Properties SMAC */
850         TF_TBL_TYPE_ACT_SP_SMAC,
851         /** Action Source Properties SMAC IPv4 */
852         TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
853         /** Action Source Properties SMAC IPv6 */
854         TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
855         /** Action Statistics 64 Bits */
856         TF_TBL_TYPE_ACT_STATS_64,
857         /** Action Modify L4 Src Port */
858         TF_TBL_TYPE_ACT_MODIFY_SPORT,
859         /** Action Modify L4 Dest Port */
860         TF_TBL_TYPE_ACT_MODIFY_DPORT,
861         /** Action Modify IPv4 Source */
862         TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC,
863         /** Action _Modify L4 Dest Port */
864         TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST,
865         /** Action Modify IPv6 Source */
866         TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC,
867         /** Action Modify IPv6 Destination */
868         TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST,
869
870         /* HW */
871
872         /** Meter Profiles */
873         TF_TBL_TYPE_METER_PROF,
874         /** Meter Instance */
875         TF_TBL_TYPE_METER_INST,
876         /** Mirror Config */
877         TF_TBL_TYPE_MIRROR_CONFIG,
878         /** UPAR */
879         TF_TBL_TYPE_UPAR,
880         /** Brd4 Epoch 0 table */
881         TF_TBL_TYPE_EPOCH0,
882         /** Brd4 Epoch 1 table  */
883         TF_TBL_TYPE_EPOCH1,
884         /** Brd4 Metadata  */
885         TF_TBL_TYPE_METADATA,
886         /** Brd4 CT State  */
887         TF_TBL_TYPE_CT_STATE,
888         /** Brd4 Range Profile  */
889         TF_TBL_TYPE_RANGE_PROF,
890         /** Brd4 Range Entry  */
891         TF_TBL_TYPE_RANGE_ENTRY,
892         /** Brd4 LAG Entry  */
893         TF_TBL_TYPE_LAG,
894         /** Brd4 only VNIC/SVIF Table */
895         TF_TBL_TYPE_VNIC_SVIF,
896
897         /* External */
898
899         /** External table type - initially 1 poolsize entries.
900          * All External table types are associated with a table
901          * scope. Internal types are not.
902          */
903         TF_TBL_TYPE_EXT,
904         /** Future - external pool of size0 entries */
905         TF_TBL_TYPE_EXT_0,
906         TF_TBL_TYPE_MAX
907 };
908 #endif /* _TF_CORE_H_ */