net/bnxt: support flow meter drop counter
[dpdk.git] / drivers / net / bnxt / tf_core / tf_core.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2021 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 #include "hcapi_cfa_defs.h"
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 #define TF_KILOBYTE  1024
25 #define TF_MEGABYTE  (1024 * 1024)
26
27 /**
28  * direction
29  */
30 enum tf_dir {
31         TF_DIR_RX,  /**< Receive */
32         TF_DIR_TX,  /**< Transmit */
33         TF_DIR_MAX
34 };
35
36 /**
37  * memory choice
38  */
39 enum tf_mem {
40         TF_MEM_INTERNAL, /**< Internal */
41         TF_MEM_EXTERNAL, /**< External */
42         TF_MEM_MAX
43 };
44
45 /**
46  * External memory control channel type
47  */
48 enum tf_ext_mem_chan_type {
49         /**
50          * Direct memory write(Wh+/SR)
51          */
52         TF_EXT_MEM_CHAN_TYPE_DIRECT = 0,
53         /**
54          * Ring interface MPC
55          */
56         TF_EXT_MEM_CHAN_TYPE_RING_IF,
57         /**
58          * Use HWRM message to firmware
59          */
60         TF_EXT_MEM_CHAN_TYPE_FW,
61         /**
62          * Use ring_if message to firmware
63          */
64         TF_EXT_MEM_CHAN_TYPE_RING_IF_FW,
65         TF_EXT_MEM_CHAN_TYPE_MAX
66 };
67
68 /**
69  * EEM record AR helper
70  *
71  * Helper to handle the Action Record Pointer in the EEM Record Entry.
72  *
73  * Convert absolute offset to action record pointer in EEM record entry
74  * Convert action record pointer in EEM record entry to absolute offset
75  */
76 #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
77 #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
78
79 /*
80  * Helper Macros
81  */
82 #define TF_BITS_2_BYTES(num_bits) (((num_bits) + 7) / 8)
83
84 /********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
85
86 /**
87  * @page general General
88  *
89  * @ref tf_open_session
90  *
91  * @ref tf_attach_session
92  *
93  * @ref tf_close_session
94  */
95
96 /**
97  * Session Version defines
98  *
99  * The version controls the format of the tf_session and
100  * tf_session_info structure. This is to assure upgrade between
101  * versions can be supported.
102  */
103 #define TF_SESSION_VER_MAJOR  1   /**< Major Version */
104 #define TF_SESSION_VER_MINOR  0   /**< Minor Version */
105 #define TF_SESSION_VER_UPDATE 0   /**< Update Version */
106
107 /**
108  * Session Name
109  *
110  * Name of the TruFlow control channel interface.  Expects
111  * format to be RTE Name specific, i.e. rte_eth_dev_get_name_by_port()
112  */
113 #define TF_SESSION_NAME_MAX       64
114
115 #define TF_FW_SESSION_ID_INVALID  0xFF  /**< Invalid FW Session ID define */
116
117 /**
118  * Session Identifier
119  *
120  * Unique session identifier which includes PCIe bus info to
121  * distinguish the PF and session info to identify the associated
122  * TruFlow session. Session ID is constructed from the passed in
123  * ctrl_chan_name in tf_open_session() together with an allocated
124  * fw_session_id. Done by TruFlow on tf_open_session().
125  */
126 union tf_session_id {
127         uint32_t id;
128         struct {
129                 uint8_t domain;
130                 uint8_t bus;
131                 uint8_t device;
132                 uint8_t fw_session_id;
133         } internal;
134 };
135
136 /**
137  * Session Client Identifier
138  *
139  * Unique identifier for a client within a session. Session Client ID
140  * is constructed from the passed in session and a firmware allocated
141  * fw_session_client_id. Done by TruFlow on tf_open_session().
142  */
143 union tf_session_client_id {
144         uint16_t id;
145         struct {
146                 uint8_t fw_session_id;
147                 uint8_t fw_session_client_id;
148         } internal;
149 };
150
151 /**
152  * Session Version
153  *
154  * The version controls the format of the tf_session and
155  * tf_session_info structure. This is to assure upgrade between
156  * versions can be supported.
157  *
158  * Please see the TF_VER_MAJOR/MINOR and UPDATE defines.
159  */
160 struct tf_session_version {
161         uint8_t major;
162         uint8_t minor;
163         uint8_t update;
164 };
165
166 /**
167  * Session supported device types
168  */
169 enum tf_device_type {
170         TF_DEVICE_TYPE_WH = 0, /**< Whitney+  */
171         TF_DEVICE_TYPE_SR,     /**< Stingray  */
172         TF_DEVICE_TYPE_THOR,   /**< Thor      */
173         TF_DEVICE_TYPE_MAX     /**< Maximum   */
174 };
175
176 /**
177  * Module types
178  */
179 enum tf_module_type {
180         /**
181          * Identifier module
182          */
183         TF_MODULE_TYPE_IDENTIFIER,
184         /**
185          * Table type module
186          */
187         TF_MODULE_TYPE_TABLE,
188         /**
189          * TCAM module
190          */
191         TF_MODULE_TYPE_TCAM,
192         /**
193          * EM module
194          */
195         TF_MODULE_TYPE_EM,
196         TF_MODULE_TYPE_MAX
197 };
198
199 /**
200  * Identifier resource types
201  */
202 enum tf_identifier_type {
203         /**
204          *  WH/SR/TH
205          *  The L2 Context is returned from the L2 Ctxt TCAM lookup
206          *  and can be used in WC TCAM or EM keys to virtualize further
207          *  lookups.
208          */
209         TF_IDENT_TYPE_L2_CTXT_HIGH,
210         /**
211          *  WH/SR/TH
212          *  The L2 Context is returned from the L2 Ctxt TCAM lookup
213          *  and can be used in WC TCAM or EM keys to virtualize further
214          *  lookups.
215          */
216         TF_IDENT_TYPE_L2_CTXT_LOW,
217         /**
218          *  WH/SR/TH
219          *  The WC profile func is returned from the L2 Ctxt TCAM lookup
220          *  to enable virtualization of the profile TCAM.
221          */
222         TF_IDENT_TYPE_PROF_FUNC,
223         /**
224          *  WH/SR/TH
225          *  The WC profile ID is included in the WC lookup key
226          *  to enable virtualization of the WC TCAM hardware.
227          */
228         TF_IDENT_TYPE_WC_PROF,
229         /**
230          *  WH/SR/TH
231          *  The EM profile ID is included in the EM lookup key
232          *  to enable virtualization of the EM hardware.
233          */
234         TF_IDENT_TYPE_EM_PROF,
235         /**
236          *  (Future)
237          *  The L2 func is included in the ILT result and from recycling to
238          *  enable virtualization of further lookups.
239          */
240         TF_IDENT_TYPE_L2_FUNC,
241         TF_IDENT_TYPE_MAX
242 };
243
244 /**
245  * Enumeration of TruFlow table types. A table type is used to identify a
246  * resource object.
247  *
248  * NOTE: The table type TF_TBL_TYPE_EXT is unique in that it is
249  * the only table type that is connected with a table scope.
250  */
251 enum tf_tbl_type {
252         /* Internal */
253
254         /** Wh+/SR/TH Action Record */
255         TF_TBL_TYPE_FULL_ACT_RECORD,
256         /** TH Compact Action Record */
257         TF_TBL_TYPE_COMPACT_ACT_RECORD,
258         /** (Future) Multicast Groups */
259         TF_TBL_TYPE_MCAST_GROUPS,
260         /** Wh+/SR/TH Action Encap 8 Bytes */
261         TF_TBL_TYPE_ACT_ENCAP_8B,
262         /** Wh+/SR/TH Action Encap 16 Bytes */
263         TF_TBL_TYPE_ACT_ENCAP_16B,
264         /** WH+/SR/TH Action Encap 32 Bytes */
265         TF_TBL_TYPE_ACT_ENCAP_32B,
266         /** Wh+/SR/TH Action Encap 64 Bytes */
267         TF_TBL_TYPE_ACT_ENCAP_64B,
268         /** WH+/SR/TH Action Source Properties SMAC */
269         TF_TBL_TYPE_ACT_SP_SMAC,
270         /** Wh+/SR/TH Action Source Properties SMAC IPv4 */
271         TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
272         /** WH+/SR/TH Action Source Properties SMAC IPv6 */
273         TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
274         /** Wh+/SR/TH Action Statistics 64 Bits */
275         TF_TBL_TYPE_ACT_STATS_64,
276         /** Wh+/SR Action Modify IPv4 Source */
277         TF_TBL_TYPE_ACT_MODIFY_IPV4,
278         /** TH 8B Modify Record */
279         TF_TBL_TYPE_ACT_MODIFY_8B,
280         /** TH 16B Modify Record */
281         TF_TBL_TYPE_ACT_MODIFY_16B,
282         /** TH 32B Modify Record */
283         TF_TBL_TYPE_ACT_MODIFY_32B,
284         /** TH 64B Modify Record */
285         TF_TBL_TYPE_ACT_MODIFY_64B,
286         /** Meter Profiles */
287         TF_TBL_TYPE_METER_PROF,
288         /** Meter Instance */
289         TF_TBL_TYPE_METER_INST,
290         /** Wh+/SR/Th Mirror Config */
291         TF_TBL_TYPE_MIRROR_CONFIG,
292         /** (Future) UPAR */
293         TF_TBL_TYPE_UPAR,
294         /** (Future) TH Metadata  */
295         TF_TBL_TYPE_METADATA,
296         /** (Future) TH CT State  */
297         TF_TBL_TYPE_CT_STATE,
298         /** (Future) TH Range Profile  */
299         TF_TBL_TYPE_RANGE_PROF,
300         /** TH EM Flexible Key builder */
301         TF_TBL_TYPE_EM_FKB,
302         /** TH WC Flexible Key builder */
303         TF_TBL_TYPE_WC_FKB,
304         /** Meter Drop Counter */
305         TF_TBL_TYPE_METER_DROP_CNT,
306
307         /* External */
308
309         /**
310          * External table type - initially 1 poolsize entries.
311          * All External table types are associated with a table
312          * scope. Internal types are not.  Currently this is
313          * a pool of 64B entries.
314          */
315         TF_TBL_TYPE_EXT,
316         TF_TBL_TYPE_MAX
317 };
318
319 /** Enable Shared TCAM Management
320  *
321  *  This feature allows for management of high and low pools within
322  *  the WC TCAM.  These pools are only valid when this feature is enabled.
323  *
324  *  For normal OVS-DPDK operation, this feature is not required and can
325  *  be disabled by commenting out TF_TCAM_SHARED in this header file.
326  *
327  *  Operation:
328  *
329  *  When a shared session is created with WC TCAM entries allocated during
330  *  tf_open_session(), the TF_TCAM_TBL_TYPE_WC_TCAM pool entries will be divided
331  *  into 2 equal pools - TF_TCAM_TBL_TYPE_WC_TCAM_HIGH and
332  *  TF_TCAM_TBL_TYPE_WC_TCAM_LOW.
333  *
334  *  The user will allocate and free entries from either of these pools to obtain
335  *  WC_TCAM entry offsets.  For the WC_TCAM_HI/LO management, alloc/free is done
336  *  using the tf_alloc_tcam_entry()/tf_free_tcam_entry() APIs for the shared
337  *  session.
338  *
339  *  The use case for this feature is so that applications can have a shared
340  *  session and use the TF core to allocate/set/free entries within a given
341  *  region of the WC_TCAM within the shared session.  Application A only writes
342  *  to the LOW region for example and Application B only writes to the HIGH
343  *  region during normal operation.  After Application A goes down, Application
344  *  B may decide to overwrite the LOW region with the HIGH region's entries
345  *  and switch to the low region.
346  *
347  *  For other TCAM types in the  shared session, no alloc/free operations are
348  *  permitted. Only set should be used for other TCAM table types after getting
349  *  the range as provided by the tf_get_resource_info() API.
350  *
351  */
352 #define TF_TCAM_SHARED 1
353
354 /**
355  * TCAM table type
356  */
357 enum tf_tcam_tbl_type {
358         /** L2 Context TCAM */
359         TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
360         /** L2 Context TCAM */
361         TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
362         /** Profile TCAM */
363         TF_TCAM_TBL_TYPE_PROF_TCAM,
364         /** Wildcard TCAM */
365         TF_TCAM_TBL_TYPE_WC_TCAM,
366         /** Source Properties TCAM */
367         TF_TCAM_TBL_TYPE_SP_TCAM,
368         /** Connection Tracking Rule TCAM */
369         TF_TCAM_TBL_TYPE_CT_RULE_TCAM,
370         /** Virtual Edge Bridge TCAM */
371         TF_TCAM_TBL_TYPE_VEB_TCAM,
372 #ifdef TF_TCAM_SHARED
373         /** Wildcard TCAM HI Priority */
374         TF_TCAM_TBL_TYPE_WC_TCAM_HIGH,
375         /** Wildcard TCAM Low Priority */
376         TF_TCAM_TBL_TYPE_WC_TCAM_LOW,
377 #endif /* TF_TCAM_SHARED */
378         TF_TCAM_TBL_TYPE_MAX
379 };
380
381 /**
382  * SEARCH STATUS
383  */
384 enum tf_search_status {
385         /** The entry was not found, but an idx was allocated if requested. */
386         MISS,
387         /** The entry was found, and the result/idx are valid */
388         HIT,
389         /** The entry was not found and the table is full */
390         REJECT
391 };
392
393 /**
394  * EM Resources
395  * These defines are provisioned during
396  * tf_open_session()
397  */
398 enum tf_em_tbl_type {
399         /** The number of internal EM records for the session */
400         TF_EM_TBL_TYPE_EM_RECORD,
401         /** The number of table scopes requested */
402         TF_EM_TBL_TYPE_TBL_SCOPE,
403         TF_EM_TBL_TYPE_MAX
404 };
405
406 /**
407  * TruFlow Session Information
408  *
409  * Structure defining a TruFlow Session, also known as a Management
410  * session. This structure is initialized at time of
411  * tf_open_session(). It is passed to all of the TruFlow APIs as way
412  * to prescribe and isolate resources between different TruFlow ULP
413  * Applications.
414  *
415  * Ownership of the elements is split between ULP and TruFlow. Please
416  * see the individual elements.
417  */
418 struct tf_session_info {
419         /**
420          * TruFlow Version. Used to control the structure layout when
421          * sharing sessions. No guarantee that a secondary process
422          * would come from the same version of an executable.
423          * TruFlow initializes this variable on tf_open_session().
424          *
425          * Owner:  TruFlow
426          * Access: TruFlow
427          */
428         struct tf_session_version ver;
429         /**
430          * will be STAILQ_ENTRY(tf_session_info) next
431          *
432          * Owner:  ULP
433          * Access: ULP
434          */
435         void                 *next;
436         /**
437          * Session ID is a unique identifier for the session. TruFlow
438          * initializes this variable during tf_open_session()
439          * processing.
440          *
441          * Owner:  TruFlow
442          * Access: Truflow & ULP
443          */
444         union tf_session_id   session_id;
445         /**
446          * Protects access to core_data. Lock is initialized and owned
447          * by ULP. TruFlow can access the core_data without checking
448          * the lock.
449          *
450          * Owner:  ULP
451          * Access: ULP
452          */
453         uint8_t               spin_lock;
454         /**
455          * The core_data holds the TruFlow tf_session data
456          * structure. This memory is allocated and owned by TruFlow on
457          * tf_open_session().
458          *
459          * TruFlow uses this memory for session management control
460          * until the session is closed by ULP. Access control is done
461          * by the spin_lock which ULP controls ahead of TruFlow API
462          * calls.
463          *
464          * Please see tf_open_session_parms for specification details
465          * on this variable.
466          *
467          * Owner:  TruFlow
468          * Access: TruFlow
469          */
470         void                 *core_data;
471         /**
472          * The core_data_sz_bytes specifies the size of core_data in
473          * bytes.
474          *
475          * The size is set by TruFlow on tf_open_session().
476          *
477          * Please see tf_open_session_parms for specification details
478          * on this variable.
479          *
480          * Owner:  TruFlow
481          * Access: TruFlow
482          */
483         uint32_t              core_data_sz_bytes;
484 };
485
486 /**
487  * TruFlow handle
488  *
489  * Contains a pointer to the session info. Allocated by ULP and passed
490  * to TruFlow using tf_open_session(). TruFlow will populate the
491  * session info at that time. A TruFlow Session can be used by more
492  * than one PF/VF by using the tf_open_session().
493  *
494  * It is expected that ULP allocates this memory as shared memory.
495  *
496  * NOTE: This struct must be within the BNXT PMD struct bnxt
497  *       (bp). This allows use of container_of() to get access to the PMD.
498  */
499 struct tf {
500         struct tf_session_info *session;
501         /**
502          * the pointer to the parent bp struct
503          */
504         void *bp;
505 };
506
507 /**
508  * Identifier resource definition
509  */
510 struct tf_identifier_resources {
511         /**
512          * Array of TF Identifiers where each entry is expected to be
513          * set to the requested resource number of that specific type.
514          * The index used is tf_identifier_type.
515          */
516         uint16_t cnt[TF_IDENT_TYPE_MAX];
517 };
518
519 /**
520  * Table type resource definition
521  */
522 struct tf_tbl_resources {
523         /**
524          * Array of TF Table types where each entry is expected to be
525          * set to the requested resource number of that specific
526          * type. The index used is tf_tbl_type.
527          */
528         uint16_t cnt[TF_TBL_TYPE_MAX];
529 };
530
531 /**
532  * TCAM type resource definition
533  */
534 struct tf_tcam_resources {
535         /**
536          * Array of TF TCAM types where each entry is expected to be
537          * set to the requested resource number of that specific
538          * type. The index used is tf_tcam_tbl_type.
539          */
540         uint16_t cnt[TF_TCAM_TBL_TYPE_MAX];
541 };
542
543 /**
544  * EM type resource definition
545  */
546 struct tf_em_resources {
547         /**
548          * Array of TF EM table types where each entry is expected to
549          * be set to the requested resource number of that specific
550          * type. The index used is tf_em_tbl_type.
551          */
552         uint16_t cnt[TF_EM_TBL_TYPE_MAX];
553 };
554
555 /**
556  * tf_session_resources parameter definition.
557  */
558 struct tf_session_resources {
559         /**
560          * [in] Requested Identifier Resources
561          *
562          * Number of identifier resources requested for the
563          * session.
564          */
565         struct tf_identifier_resources ident_cnt[TF_DIR_MAX];
566         /**
567          * [in] Requested Index Table resource counts
568          *
569          * The number of index table resources requested for the
570          * session.
571          */
572         struct tf_tbl_resources tbl_cnt[TF_DIR_MAX];
573         /**
574          * [in] Requested TCAM Table resource counts
575          *
576          * The number of TCAM table resources requested for the
577          * session.
578          */
579
580         struct tf_tcam_resources tcam_cnt[TF_DIR_MAX];
581         /**
582          * [in] Requested EM resource counts
583          *
584          * The number of internal EM table resources requested for the
585          * session.
586          */
587         struct tf_em_resources em_cnt[TF_DIR_MAX];
588 };
589
590 /**
591  * tf_open_session parameters definition.
592  */
593 struct tf_open_session_parms {
594         /**
595          * [in] ctrl_chan_name
596          *
597          * String containing name of control channel interface to be
598          * used for this session to communicate with firmware.
599          *
600          * The ctrl_chan_name can be looked up by using
601          * rte_eth_dev_get_name_by_port() within the ULP.
602          *
603          * ctrl_chan_name will be used as part of a name for any
604          * shared memory allocation. The ctrl_chan_name is usually in format
605          * 0000:02:00.0. The name for shared session is 0000:02:00.0-tf_shared.
606          */
607         char ctrl_chan_name[TF_SESSION_NAME_MAX];
608         /**
609          * [in] shadow_copy
610          *
611          * Boolean controlling the use and availability of shadow
612          * copy. Shadow copy will allow the TruFlow to keep track of
613          * resource content on the firmware side without having to
614          * query firmware. Additional private session core_data will
615          * be allocated if this boolean is set to 'true', default
616          * 'false'.
617          *
618          * Size of memory depends on the NVM Resource settings for the
619          * control channel.
620          */
621         bool shadow_copy;
622         /**
623          * [in/out] session_id
624          *
625          * Session_id is unique per session.
626          *
627          * Session_id is composed of domain, bus, device and
628          * fw_session_id. The construction is done by parsing the
629          * ctrl_chan_name together with allocation of a fw_session_id.
630          *
631          * The session_id allows a session to be shared between devices.
632          */
633         union tf_session_id session_id;
634         /**
635          * [in/out] session_client_id
636          *
637          * Session_client_id is unique per client.
638          *
639          * Session_client_id is composed of session_id and the
640          * fw_session_client_id fw_session_id. The construction is
641          * done by parsing the ctrl_chan_name together with allocation
642          * of a fw_session_client_id during tf_open_session().
643          *
644          * A reference count will be incremented in the session on
645          * which a client is created.
646          *
647          * A session can first be closed if there is one Session
648          * Client left. Session Clients should closed using
649          * tf_close_session().
650          */
651         union tf_session_client_id session_client_id;
652         /**
653          * [in] device type
654          *
655          * Device type for the session.
656          */
657         enum tf_device_type device_type;
658         /**
659          * [in] resources
660          *
661          * Resource allocation for the session.
662          */
663         struct tf_session_resources resources;
664
665         /**
666          * [in] bp
667          * The pointer to the parent bp struct. This is only used for HWRM
668          * message passing within the portability layer. The type is struct
669          * bnxt.
670          */
671         void *bp;
672
673         /**
674          * [out] shared_session_creator
675          *
676          * Indicates whether the application created the session if set.
677          * Otherwise the shared session already existed.  Just for information
678          * purposes.
679          */
680         int shared_session_creator;
681 };
682
683 /**
684  * Opens a new TruFlow Session or session client.
685  *
686  * What gets created depends on the passed in tfp content. If the tfp does not
687  * have prior session data a new session with associated session client. If tfp
688  * has a session already a session client will be created. In both cases the
689  * session client is created using the provided ctrl_chan_name.
690  *
691  * In case of session creation TruFlow will allocate session specific memory to
692  * hold its session data. This data is private to TruFlow.
693  *
694  * No other TruFlow APIs will succeed unless this API is first called
695  * and succeeds.
696  *
697  * tf_open_session() returns a session id and session client id.  These are
698  * also stored within the tfp structure passed in to all other APIs.
699  *
700  * A Session or session client can be closed using tf_close_session().
701  *
702  * There are 2 types of sessions - shared and not.  For non-shared all
703  * the allocated resources are owned and managed by a single session instance.
704  * No other applications have access to the resources owned by the non-shared
705  * session.  For a shared session, resources are shared between 2 applications.
706  *
707  * When the caller of tf_open_session() sets the ctrl_chan_name[] to a name
708  * like "0000:02:00.0-tf_shared", it is a request to create a new "shared"
709  * session in the firmware or access the existing shared session. There is
710  * only 1 shared session that can be created. If the shared session has
711  * already been created in the firmware, this API will return this indication
712  * by clearing the shared_session_creator flag. Only the first shared session
713  * create will have the shared_session_creator flag set.
714  *
715  * The shared session should always be the first session to be created by
716  * application and the last session closed due to RM management preference.
717  *
718  * Sessions remain open in the firmware until the last client of the session
719  * closes the session (tf_close_session()).
720  *
721  * [in] tfp
722  *   Pointer to TF handle
723  *
724  * [in] parms
725  *   Pointer to open parameters
726  *
727  * Returns
728  *   - (0) if successful.
729  *   - (-EINVAL) on failure.
730  */
731 int tf_open_session(struct tf *tfp,
732                     struct tf_open_session_parms *parms);
733
734 /**
735  * General internal resource info
736  *
737  * TODO: remove tf_rm_new_entry structure and use this structure
738  * internally.
739  */
740 struct tf_resource_info {
741         uint16_t start;
742         uint16_t stride;
743 };
744
745 /**
746  * Identifier resource definition
747  */
748 struct tf_identifier_resource_info {
749         /**
750          * Array of TF Identifiers. The index used is tf_identifier_type.
751          */
752         struct tf_resource_info info[TF_IDENT_TYPE_MAX];
753 };
754
755 /**
756  * Table type resource info definition
757  */
758 struct tf_tbl_resource_info {
759         /**
760          * Array of TF Table types. The index used is tf_tbl_type.
761          */
762         struct tf_resource_info info[TF_TBL_TYPE_MAX];
763 };
764
765 /**
766  * TCAM type resource definition
767  */
768 struct tf_tcam_resource_info {
769         /**
770          * Array of TF TCAM types. The index used is tf_tcam_tbl_type.
771          */
772         struct tf_resource_info info[TF_TCAM_TBL_TYPE_MAX];
773 };
774
775 /**
776  * EM type resource definition
777  */
778 struct tf_em_resource_info {
779         /**
780          * Array of TF EM table types. The index used is tf_em_tbl_type.
781          */
782         struct tf_resource_info info[TF_EM_TBL_TYPE_MAX];
783 };
784
785 /**
786  * tf_session_resources parameter definition.
787  */
788 struct tf_session_resource_info {
789         /**
790          * [in] Requested Identifier Resources
791          *
792          * Number of identifier resources requested for the
793          * session.
794          */
795         struct tf_identifier_resource_info ident[TF_DIR_MAX];
796         /**
797          * [in] Requested Index Table resource counts
798          *
799          * The number of index table resources requested for the
800          * session.
801          */
802         struct tf_tbl_resource_info tbl[TF_DIR_MAX];
803         /**
804          * [in] Requested TCAM Table resource counts
805          *
806          * The number of TCAM table resources requested for the
807          * session.
808          */
809
810         struct tf_tcam_resource_info tcam[TF_DIR_MAX];
811         /**
812          * [in] Requested EM resource counts
813          *
814          * The number of internal EM table resources requested for the
815          * session.
816          */
817         struct tf_em_resource_info em[TF_DIR_MAX];
818 };
819
820 /**
821  * tf_get_session_resources parameter definition.
822  */
823 struct tf_get_session_info_parms {
824         /**
825          * [out] the structure is used to return the information of
826          * allocated resources.
827          *
828          */
829         struct tf_session_resource_info session_info;
830 };
831
832 /** (experimental)
833  * Gets info about a TruFlow Session
834  *
835  * Get info about the session which has been created.  Whether it exists and
836  * what resource start and stride offsets are in use.  This API is primarily
837  * intended to be used by an application which has created a shared session
838  * This application needs to obtain the resources which have already been
839  * allocated for the shared session.
840  *
841  * [in] tfp
842  *   Pointer to TF handle
843  *
844  * [in] parms
845  *   Pointer to get parameters
846  *
847  * Returns
848  *   - (0) if successful.
849  *   - (-EINVAL) on failure.
850  */
851 int tf_get_session_info(struct tf *tfp,
852                         struct tf_get_session_info_parms *parms);
853 /**
854  * Experimental
855  *
856  * tf_attach_session parameters definition.
857  */
858 struct tf_attach_session_parms {
859         /**
860          * [in] ctrl_chan_name
861          *
862          * String containing name of control channel interface to be
863          * used for this session to communicate with firmware.
864          *
865          * The ctrl_chan_name can be looked up by using
866          * rte_eth_dev_get_name_by_port() within the ULP.
867          *
868          * ctrl_chan_name will be used as part of a name for any
869          * shared memory allocation.
870          */
871         char ctrl_chan_name[TF_SESSION_NAME_MAX];
872
873         /**
874          * [in] attach_chan_name
875          *
876          * String containing name of attach channel interface to be
877          * used for this session.
878          *
879          * The attach_chan_name must be given to a 2nd process after
880          * the primary process has been created. This is the
881          * ctrl_chan_name of the primary process and is used to find
882          * the shared memory for the session that the attach is going
883          * to use.
884          */
885         char attach_chan_name[TF_SESSION_NAME_MAX];
886
887         /**
888          * [in] session_id
889          *
890          * Session_id is unique per session. For Attach the session_id
891          * should be the session_id that was returned on the first
892          * open.
893          *
894          * Session_id is composed of domain, bus, device and
895          * fw_session_id. The construction is done by parsing the
896          * ctrl_chan_name together with allocation of a fw_session_id
897          * during tf_open_session().
898          *
899          * A reference count will be incremented on attach. A session
900          * is first fully closed when reference count is zero by
901          * calling tf_close_session().
902          */
903         union tf_session_id session_id;
904 };
905
906 /**
907  * Experimental
908  *
909  * Allows a 2nd application instance to attach to an existing
910  * session. Used when a session is to be shared between two processes.
911  *
912  * Attach will increment a ref count as to manage the shared session data.
913  *
914  * [in] tfp
915  *   Pointer to TF handle
916  *
917  * [in] parms
918  *   Pointer to attach parameters
919  *
920  * Returns
921  *   - (0) if successful.
922  *   - (-EINVAL) on failure.
923  */
924 int tf_attach_session(struct tf *tfp,
925                       struct tf_attach_session_parms *parms);
926
927 /**
928  * Closes an existing session client or the session it self. The
929  * session client is default closed and if the session reference count
930  * is 0 then the session is closed as well.
931  *
932  * On session close all hardware and firmware state associated with
933  * the TruFlow application is cleaned up.
934  *
935  * The session client is extracted from the tfp. Thus tf_close_session()
936  * cannot close a session client on behalf of another function.
937  *
938  * Returns success or failure code.
939  */
940 int tf_close_session(struct tf *tfp);
941
942 /**
943  * @page  ident Identity Management
944  *
945  * @ref tf_alloc_identifier
946  *
947  * @ref tf_free_identifier
948  */
949 /**
950  * tf_alloc_identifier parameter definition
951  */
952 struct tf_alloc_identifier_parms {
953         /**
954          * [in]  receive or transmit direction
955          */
956         enum tf_dir dir;
957         /**
958          * [in] Identifier type
959          */
960         enum tf_identifier_type ident_type;
961         /**
962          * [out] Allocated identifier
963          */
964         uint32_t id;
965 };
966
967 /**
968  * tf_free_identifier parameter definition
969  */
970 struct tf_free_identifier_parms {
971         /**
972          * [in]  receive or transmit direction
973          */
974         enum tf_dir dir;
975         /**
976          * [in] Identifier type
977          */
978         enum tf_identifier_type ident_type;
979         /**
980          * [in] ID to free
981          */
982         uint32_t id;
983         /**
984          * (experimental)
985          * [out] Current refcnt after free
986          */
987         uint32_t ref_cnt;
988 };
989
990 /**
991  * tf_search_identifier parameter definition (experimental)
992  */
993 struct tf_search_identifier_parms {
994         /**
995          * [in]  receive or transmit direction
996          */
997         enum tf_dir dir;
998         /**
999          * [in] Identifier type
1000          */
1001         enum tf_identifier_type ident_type;
1002         /**
1003          * [in] Identifier data to search for
1004          */
1005         uint32_t search_id;
1006         /**
1007          * [out] Set if matching identifier found
1008          */
1009         bool hit;
1010         /**
1011          * [out] Current ref count after allocation
1012          */
1013         uint32_t ref_cnt;
1014 };
1015
1016 /**
1017  * allocate identifier resource
1018  *
1019  * TruFlow core will allocate a free id from the per identifier resource type
1020  * pool reserved for the session during tf_open().  No firmware is involved.
1021  *
1022  * If shadow copy is enabled, the internal ref_cnt is set to 1 in the
1023  * shadow table for a newly allocated resource.
1024  *
1025  * Returns success or failure code.
1026  */
1027 int tf_alloc_identifier(struct tf *tfp,
1028                         struct tf_alloc_identifier_parms *parms);
1029
1030 /**
1031  * free identifier resource
1032  *
1033  * TruFlow core will return an id back to the per identifier resource type pool
1034  * reserved for the session.  No firmware is involved.  During tf_close, the
1035  * complete pool is returned to the firmware.
1036  *
1037  * additional operation (experimental)
1038  * Decrement reference count.  Only release resource once refcnt goes to 0 if
1039  * shadow copy is enabled.
1040  *
1041  * Returns success or failure code.
1042  */
1043 int tf_free_identifier(struct tf *tfp,
1044                        struct tf_free_identifier_parms *parms);
1045
1046 /**
1047  * Search identifier resource (experimental)
1048  *
1049  * If the shadow copy is enabled search_id is used to search for a matching
1050  * entry in the shadow table.  The shadow table consists of an array of
1051  * reference counts indexed by identifier.  If a matching entry is found hit is
1052  * set to TRUE, refcnt is increased by 1 and returned.  Otherwise, hit is
1053  * set to false and refcnt is set to 0.
1054  *
1055  * TODO: we may need a per table internal shadow copy enable flag to stage
1056  * the shadow table implementation.  We do not need the shadow table for other
1057  * tables at this time so we may only want to enable the identifier shadow.
1058  *
1059  * TODO: remove this pseudocode below added to show that if search fails
1060  * we shouldn't allocate a new entry but return.
1061  *
1062  * identifier alloc (search_en=1)
1063  * if (ident is allocated and ref_cnt >=1)
1064  *      return ident - hit is set, incr refcnt
1065  * else (not found)
1066  *      return
1067  *
1068  */
1069 int tf_search_identifier(struct tf *tfp,
1070                          struct tf_search_identifier_parms *parms);
1071
1072 /**
1073  * @page dram_table DRAM Table Scope Interface
1074  *
1075  * @ref tf_alloc_tbl_scope
1076  *
1077  * @ref tf_free_tbl_scope
1078  *
1079  * If we allocate the EEM memory from the core, we need to store it in
1080  * the shared session data structure to make sure it can be freed later.
1081  * (for example if the PF goes away)
1082  *
1083  * Current thought is that memory is allocated within core.
1084  */
1085
1086 /**
1087  * tf_alloc_tbl_scope_parms definition
1088  */
1089 struct tf_alloc_tbl_scope_parms {
1090         /**
1091          * [in] All Maximum key size required.
1092          */
1093         uint16_t rx_max_key_sz_in_bits;
1094         /**
1095          * [in] Maximum Action size required (includes inlined items)
1096          */
1097         uint16_t rx_max_action_entry_sz_in_bits;
1098         /**
1099          * [in] Memory size in Megabytes
1100          * Total memory size allocated by user to be divided
1101          * up for actions, hash, counters.  Only inline external actions.
1102          * Use this variable or the number of flows, do not set both.
1103          */
1104         uint32_t rx_mem_size_in_mb;
1105         /**
1106          * [in] Number of flows * 1000. If set, rx_mem_size_in_mb must equal 0.
1107          */
1108         uint32_t rx_num_flows_in_k;
1109         /**
1110          * [in] All Maximum key size required.
1111          */
1112         uint16_t tx_max_key_sz_in_bits;
1113         /**
1114          * [in] Maximum Action size required (includes inlined items)
1115          */
1116         uint16_t tx_max_action_entry_sz_in_bits;
1117         /**
1118          * [in] Memory size in Megabytes
1119          * Total memory size allocated by user to be divided
1120          * up for actions, hash, counters.  Only inline external actions.
1121          */
1122         uint32_t tx_mem_size_in_mb;
1123         /**
1124          * [in] Number of flows * 1000
1125          */
1126         uint32_t tx_num_flows_in_k;
1127         /**
1128          * [in] Flush pending HW cached flows every 1/10th of value
1129          * set in seconds, both idle and active flows are flushed
1130          * from the HW cache. If set to 0, this feature will be disabled.
1131          */
1132         uint8_t hw_flow_cache_flush_timer;
1133         /**
1134          * [out] table scope identifier
1135          */
1136         uint32_t tbl_scope_id;
1137 };
1138 /**
1139  * tf_free_tbl_scope_parms definition
1140  */
1141 struct tf_free_tbl_scope_parms {
1142         /**
1143          * [in] table scope identifier
1144          */
1145         uint32_t tbl_scope_id;
1146 };
1147
1148 /**
1149  * tf_map_tbl_scope_parms definition
1150  */
1151 struct tf_map_tbl_scope_parms {
1152         /**
1153          * [in] table scope identifier
1154          */
1155         uint32_t tbl_scope_id;
1156         /**
1157          * [in] Which parifs are associated with this table scope.  Bit 0
1158          *      indicates parif 0.
1159          */
1160         uint16_t parif_bitmask;
1161 };
1162
1163 /**
1164  * allocate a table scope
1165  *
1166  * The scope is a software construct to identify an EEM table.  This function will
1167  * divide the hash memory/buckets and records according to the device
1168  * device constraints based upon calculations using either the number of flows
1169  * requested or the size of memory indicated.  Other parameters passed in
1170  * determine the configuration (maximum key size, maximum external action record
1171  * size).
1172  *
1173  * A single API is used to allocate a common table scope identifier in both
1174  * receive and transmit CFA. The scope identifier is common due to nature of
1175  * connection tracking sending notifications between RX and TX direction.
1176  *
1177  * The receive and transmit table access identifiers specify which rings will
1178  * be used to initialize table DRAM.  The application must ensure mutual
1179  * exclusivity of ring usage for table scope allocation and any table update
1180  * operations.
1181  *
1182  * The hash table buckets, EM keys, and EM lookup results are stored in the
1183  * memory allocated based on the rx_em_hash_mb/tx_em_hash_mb parameters.  The
1184  * hash table buckets are stored at the beginning of that memory.
1185  *
1186  * NOTE:  No EM internal setup is done here. On chip EM records are managed
1187  * internally by TruFlow core.
1188  *
1189  * Returns success or failure code.
1190  */
1191 int tf_alloc_tbl_scope(struct tf *tfp,
1192                        struct tf_alloc_tbl_scope_parms *parms);
1193
1194 /**
1195  * map a table scope (legacy device only Wh+/SR)
1196  *
1197  * Map a table scope to one or more partition interfaces (parifs).
1198  * The parif can be remapped in the L2 context lookup for legacy devices.  This
1199  * API allows a number of parifs to be mapped to the same table scope.  On
1200  * legacy devices a table scope identifies one of 16 sets of EEM table base
1201  * addresses and is associated with a PF communication channel.  The associated
1202  * PF must be configured for the table scope to operate.
1203  *
1204  * An L2 context TCAM lookup returns a remapped parif value used to
1205  * index into the set of 16 parif_to_pf registers which are used to map to one
1206  * of the 16 table scopes.  This API allows the user to map the parifs in the
1207  * mask to the previously allocated table scope (EEM table).
1208
1209  * Returns success or failure code.
1210  */
1211 int tf_map_tbl_scope(struct tf *tfp,
1212                       struct tf_map_tbl_scope_parms *parms);
1213 /**
1214  * free a table scope
1215  *
1216  * Firmware checks that the table scope ID is owned by the TruFlow
1217  * session, verifies that no references to this table scope remains
1218  * or Profile TCAM entries for either CFA (RX/TX) direction,
1219  * then frees the table scope ID.
1220  *
1221  * Returns success or failure code.
1222  */
1223 int tf_free_tbl_scope(struct tf *tfp,
1224                       struct tf_free_tbl_scope_parms *parms);
1225
1226 /**
1227  * @page tcam TCAM Access
1228  *
1229  * @ref tf_search_tcam_entry
1230  *
1231  * @ref tf_alloc_tcam_entry
1232  *
1233  * @ref tf_set_tcam_entry
1234  *
1235  * @ref tf_get_tcam_entry
1236  *
1237  * @ref tf_free_tcam_entry
1238  *
1239 #ifdef TF_TCAM_SHARED
1240  * @ref tf_move_tcam_shared_entries
1241  *
1242  * @ref tf_clear_tcam_shared_entries
1243 #endif
1244  */
1245
1246 /**
1247  * tf_search_tcam_entry parameter definition (experimental)
1248  */
1249 struct tf_search_tcam_entry_parms {
1250         /**
1251          * [in] receive or transmit direction
1252          */
1253         enum tf_dir dir;
1254         /**
1255          * [in] TCAM table type
1256          */
1257         enum tf_tcam_tbl_type tcam_tbl_type;
1258         /**
1259          * [in] Key data to match on
1260          */
1261         uint8_t *key;
1262         /**
1263          * [in] key size in bits
1264          */
1265         uint16_t key_sz_in_bits;
1266         /**
1267          * [in] Mask data to match on
1268          */
1269         uint8_t *mask;
1270         /**
1271          * [in] Priority of entry requested (definition TBD)
1272          */
1273         uint32_t priority;
1274         /**
1275          * [in] Allocate on miss.
1276          */
1277         uint8_t alloc;
1278         /**
1279          * [out] Set if matching entry found
1280          */
1281         uint8_t hit;
1282         /**
1283          * [out] Search result status (hit, miss, reject)
1284          */
1285         enum tf_search_status search_status;
1286         /**
1287          * [out] Current refcnt after allocation
1288          */
1289         uint16_t ref_cnt;
1290         /**
1291          * [in out] The result data from the search is copied here
1292          */
1293         uint8_t *result;
1294         /**
1295          * [in out] result size in bits for the result data
1296          */
1297         uint16_t result_sz_in_bits;
1298         /**
1299          * [out] Index found
1300          */
1301         uint16_t idx;
1302 };
1303
1304 /**
1305  * search TCAM entry (experimental)
1306  *
1307  * Search for a TCAM entry
1308  *
1309  * This function searches the shadow copy of the TCAM table for a matching
1310  * entry.  Key and mask must match for hit to be set.  Only TruFlow core data
1311  * is accessed.  If shadow_copy is not enabled, an error is returned.
1312  *
1313  * Implementation:
1314  *
1315  * A hash is performed on the key/mask data and mapped to a shadow copy entry
1316  * where the full key/mask is populated.  If the full key/mask matches the
1317  * entry, hit is set, ref_cnt is incremented, and search_status indicates what
1318  * action the caller can take regarding setting the entry.
1319  *
1320  * search_status should be used as follows:
1321  * - On Miss, the caller should create a result and call tf_set_tcam_entry with
1322  * returned index.
1323  *
1324  * - On Reject, the hash table is full and the entry cannot be added.
1325  *
1326  * - On Hit, the result data is returned to the caller.  Additionally, the
1327  * ref_cnt is updated.
1328  *
1329  * Also returns success or failure code.
1330  */
1331 int tf_search_tcam_entry(struct tf *tfp,
1332                          struct tf_search_tcam_entry_parms *parms);
1333
1334 /**
1335  * tf_alloc_tcam_entry parameter definition
1336  */
1337 struct tf_alloc_tcam_entry_parms {
1338         /**
1339          * [in] receive or transmit direction
1340          */
1341         enum tf_dir dir;
1342         /**
1343          * [in] TCAM table type
1344          */
1345         enum tf_tcam_tbl_type tcam_tbl_type;
1346         /**
1347          * [in] Enable search for matching entry
1348          */
1349         uint8_t search_enable;
1350         /**
1351          * [in] Key data to match on (if search)
1352          */
1353         uint8_t *key;
1354         /**
1355          * [in] key size in bits (if search)
1356          */
1357         uint16_t key_sz_in_bits;
1358         /**
1359          * [in] Mask data to match on (if search)
1360          */
1361         uint8_t *mask;
1362         /**
1363          * [in] Priority of entry requested (definition TBD)
1364          */
1365         uint32_t priority;
1366         /**
1367          * [out] If search, set if matching entry found
1368          */
1369         uint8_t hit;
1370         /**
1371          * [out] Current refcnt after allocation
1372          */
1373         uint16_t ref_cnt;
1374         /**
1375          * [out] Idx allocated
1376          *
1377          */
1378         uint16_t idx;
1379 };
1380
1381 /**
1382  * allocate TCAM entry
1383  *
1384  * Allocate a TCAM entry - one of these types:
1385  *
1386  * L2 Context
1387  * Profile TCAM
1388  * WC TCAM
1389  * VEB TCAM
1390  *
1391  * This function allocates a TCAM table record.  This function
1392  * will attempt to allocate a TCAM table entry from the session
1393  * owned TCAM entries or search a shadow copy of the TCAM table for a
1394  * matching entry if search is enabled.  Key, mask and result must match for
1395  * hit to be set.  Only TruFlow core data is accessed.
1396  * A hash table to entry mapping is maintained for search purposes.  If
1397  * search is not enabled, the first available free entry is returned based
1398  * on priority and alloc_cnt is set to 1.  If search is enabled and a matching
1399  * entry to entry_data is found, hit is set to TRUE and alloc_cnt is set to 1.
1400  * RefCnt is also returned.
1401  *
1402  * Also returns success or failure code.
1403  */
1404 int tf_alloc_tcam_entry(struct tf *tfp,
1405                         struct tf_alloc_tcam_entry_parms *parms);
1406
1407 /**
1408  * tf_set_tcam_entry parameter definition
1409  */
1410 struct  tf_set_tcam_entry_parms {
1411         /**
1412          * [in] receive or transmit direction
1413          */
1414         enum tf_dir dir;
1415         /**
1416          * [in] TCAM table type
1417          */
1418         enum tf_tcam_tbl_type tcam_tbl_type;
1419         /**
1420          * [in] base index of the entry to program
1421          */
1422         uint16_t idx;
1423         /**
1424          * [in] struct containing key
1425          */
1426         uint8_t *key;
1427         /**
1428          * [in] struct containing mask fields
1429          */
1430         uint8_t *mask;
1431         /**
1432          * [in] key size in bits (if search)
1433          */
1434         uint16_t key_sz_in_bits;
1435         /**
1436          * [in] struct containing result
1437          */
1438         uint8_t *result;
1439         /**
1440          * [in] struct containing result size in bits
1441          */
1442         uint16_t result_sz_in_bits;
1443 };
1444
1445 /**
1446  * set TCAM entry
1447  *
1448  * Program a TCAM table entry for a TruFlow session.
1449  *
1450  * If the entry has not been allocated, an error will be returned.
1451  *
1452  * Returns success or failure code.
1453  */
1454 int tf_set_tcam_entry(struct tf *tfp,
1455                       struct tf_set_tcam_entry_parms *parms);
1456
1457 /**
1458  * tf_get_tcam_entry parameter definition
1459  */
1460 struct tf_get_tcam_entry_parms {
1461         /**
1462          * [in] receive or transmit direction
1463          */
1464         enum tf_dir dir;
1465         /**
1466          * [in] TCAM table type
1467          */
1468         enum tf_tcam_tbl_type  tcam_tbl_type;
1469         /**
1470          * [in] index of the entry to get
1471          */
1472         uint16_t idx;
1473         /**
1474          * [out] struct containing key
1475          */
1476         uint8_t *key;
1477         /**
1478          * [out] struct containing mask fields
1479          */
1480         uint8_t *mask;
1481         /**
1482          * [in/out] key size in bits
1483          */
1484         uint16_t key_sz_in_bits;
1485         /**
1486          * [out] struct containing result
1487          */
1488         uint8_t *result;
1489         /**
1490          * [in/out] struct containing result size in bits
1491          */
1492         uint16_t result_sz_in_bits;
1493 };
1494
1495 /**
1496  * get TCAM entry
1497  *
1498  * Program a TCAM table entry for a TruFlow session.
1499  *
1500  * If the entry has not been allocated, an error will be returned.
1501  *
1502  * Returns success or failure code.
1503  */
1504 int tf_get_tcam_entry(struct tf *tfp,
1505                       struct tf_get_tcam_entry_parms *parms);
1506
1507 /**
1508  * tf_free_tcam_entry parameter definition
1509  */
1510 struct tf_free_tcam_entry_parms {
1511         /**
1512          * [in] receive or transmit direction
1513          */
1514         enum tf_dir dir;
1515         /**
1516          * [in] TCAM table type
1517          */
1518         enum tf_tcam_tbl_type tcam_tbl_type;
1519         /**
1520          * [in] Index to free
1521          */
1522         uint16_t idx;
1523         /**
1524          * [out] reference count after free
1525          */
1526         uint16_t ref_cnt;
1527 };
1528
1529 /**
1530  * free TCAM entry
1531  *
1532  * Free TCAM entry.
1533  *
1534  * Firmware checks to ensure the TCAM entries are owned by the TruFlow
1535  * session.  TCAM entry will be invalidated.  All-ones mask.
1536  * writes to hw.
1537  *
1538  * WCTCAM profile id of 0 must be used to invalidate an entry.
1539  *
1540  * Returns success or failure code.
1541  */
1542 int tf_free_tcam_entry(struct tf *tfp,
1543                        struct tf_free_tcam_entry_parms *parms);
1544
1545 #ifdef TF_TCAM_SHARED
1546 /**
1547  * tf_move_tcam_shared_entries parameter definition
1548  */
1549 struct tf_move_tcam_shared_entries_parms {
1550         /**
1551          * [in] receive or transmit direction
1552          */
1553         enum tf_dir dir;
1554         /**
1555          * [in] TCAM table type
1556          */
1557         enum tf_tcam_tbl_type tcam_tbl_type;
1558 };
1559
1560 /**
1561  * Move TCAM entries
1562  *
1563  * This API only affects the following TCAM pools within a shared session:
1564  *
1565  * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
1566  * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
1567  *
1568  * When called, all allocated entries from the high pool will be moved to
1569  * the low pool.  Then the allocated entries in the high pool will be
1570  * cleared and freed.
1571  *
1572  * This API is not supported on a non-shared session.
1573  *
1574  * Returns success or failure code.
1575  */
1576 int tf_move_tcam_shared_entries(struct tf *tfp,
1577                                 struct tf_move_tcam_shared_entries_parms *parms);
1578
1579 /**
1580  * tf_clear_tcam_shared_entries parameter definition
1581  */
1582 struct tf_clear_tcam_shared_entries_parms {
1583         /**
1584          * [in] receive or transmit direction
1585          */
1586         enum tf_dir dir;
1587         /**
1588          * [in] TCAM table type
1589          */
1590         enum tf_tcam_tbl_type tcam_tbl_type;
1591 };
1592
1593 /**
1594  * Clear TCAM shared entries pool
1595  *
1596  * This API only affects the following TCAM pools within a shared session:
1597  *
1598  * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
1599  * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
1600  *
1601  * When called, the indicated WC TCAM high or low pool will be cleared.
1602  *
1603  * This API is not supported on a non-shared session.
1604  *
1605  * Returns success or failure code.
1606  */
1607 int tf_clear_tcam_shared_entries(struct tf *tfp,
1608                               struct tf_clear_tcam_shared_entries_parms *parms);
1609
1610 #endif /* TF_TCAM_SHARED */
1611 /**
1612  * @page table Table Access
1613  *
1614  * @ref tf_alloc_tbl_entry
1615  *
1616  * @ref tf_free_tbl_entry
1617  *
1618  * @ref tf_set_tbl_entry
1619  *
1620  * @ref tf_get_tbl_entry
1621  *
1622  * @ref tf_bulk_get_tbl_entry
1623  *
1624  * @ref tf_get_shared_tbl_increment
1625  */
1626
1627 /**
1628  * tf_alloc_tbl_entry parameter definition
1629  */
1630 struct tf_alloc_tbl_entry_parms {
1631         /**
1632          * [in] Receive or transmit direction
1633          */
1634         enum tf_dir dir;
1635         /**
1636          * [in] Type of the allocation
1637          */
1638         enum tf_tbl_type type;
1639         /**
1640          * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1641          */
1642         uint32_t tbl_scope_id;
1643
1644         /**
1645          * [out] Idx of allocated entry
1646          */
1647         uint32_t idx;
1648 };
1649
1650 /**
1651  * allocate index table entries
1652  *
1653  * Internal types:
1654  *
1655  * Allocate an on chip index table entry or search for a matching
1656  * entry of the indicated type for this TruFlow session.
1657  *
1658  * Allocates an index table record. This function will attempt to
1659  * allocate an entry or search an index table for a matching entry if
1660  * search is enabled (only the shadow copy of the table is accessed).
1661  *
1662  * If search is not enabled, the first available free entry is
1663  * returned. If search is enabled and a matching entry to entry_data
1664  * is found hit is set to TRUE and success is returned.
1665  *
1666  * External types:
1667  *
1668  * These are used to allocate inlined action record memory.
1669  *
1670  * Allocates an external index table action record.
1671  *
1672  * NOTE:
1673  * Implementation of the internals of this function will be a stack with push
1674  * and pop.
1675  *
1676  * Returns success or failure code.
1677  */
1678 int tf_alloc_tbl_entry(struct tf *tfp,
1679                        struct tf_alloc_tbl_entry_parms *parms);
1680
1681 /**
1682  * tf_free_tbl_entry parameter definition
1683  */
1684 struct tf_free_tbl_entry_parms {
1685         /**
1686          * [in] Receive or transmit direction
1687          */
1688         enum tf_dir dir;
1689         /**
1690          * [in] Type of the allocation type
1691          */
1692         enum tf_tbl_type type;
1693         /**
1694          * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
1695          */
1696         uint32_t tbl_scope_id;
1697         /**
1698          * [in] Index to free
1699          */
1700         uint32_t idx;
1701 };
1702
1703 /**
1704  * free index table entry
1705  *
1706  * Used to free a previously allocated table entry.
1707  *
1708  * Internal types:
1709  *
1710  * If session has shadow_copy enabled the shadow DB is searched and if
1711  * found the element ref_cnt is decremented. If ref_cnt goes to
1712  * zero then the element is returned to the session pool.
1713  *
1714  * If the session does not have a shadow DB the element is free'ed and
1715  * given back to the session pool.
1716  *
1717  * External types:
1718  *
1719  * Free's an external index table action record.
1720  *
1721  * NOTE:
1722  * Implementation of the internals of this function will be a stack with push
1723  * and pop.
1724  *
1725  * Returns success or failure code.
1726  */
1727 int tf_free_tbl_entry(struct tf *tfp,
1728                       struct tf_free_tbl_entry_parms *parms);
1729
1730 /**
1731  * tf_set_tbl_entry parameter definition
1732  */
1733 struct tf_set_tbl_entry_parms {
1734         /**
1735          * [in] Table scope identifier
1736          */
1737         uint32_t tbl_scope_id;
1738         /**
1739          * [in] Receive or transmit direction
1740          */
1741         enum tf_dir dir;
1742         /**
1743          * [in] Type of object to set
1744          */
1745         enum tf_tbl_type type;
1746         /**
1747          * [in] Entry data
1748          */
1749         uint8_t *data;
1750         /**
1751          * [in] Entry size
1752          */
1753         uint16_t data_sz_in_bytes;
1754         /**
1755          * [in] External memory channel type to use
1756          */
1757         enum tf_ext_mem_chan_type chan_type;
1758         /**
1759          * [in] Entry index to write to
1760          */
1761         uint32_t idx;
1762 };
1763
1764 /**
1765  * set index table entry
1766  *
1767  * Used to insert an application programmed index table entry into a
1768  * previous allocated table location.  A shadow copy of the table
1769  * is maintained (if enabled) (only for internal objects)
1770  *
1771  * Returns success or failure code.
1772  */
1773 int tf_set_tbl_entry(struct tf *tfp,
1774                      struct tf_set_tbl_entry_parms *parms);
1775
1776 /**
1777  * tf_get_shared_tbl_increment parameter definition
1778  */
1779 struct tf_get_shared_tbl_increment_parms {
1780         /**
1781          * [in] Receive or transmit direction
1782          */
1783         enum tf_dir dir;
1784         /**
1785          * [in] Type of object to set
1786          */
1787         enum tf_tbl_type type;
1788         /**
1789          * [out] Value to increment by for resource type
1790          */
1791         uint32_t increment_cnt;
1792 };
1793
1794 /**
1795  * tf_get_shared_tbl_increment
1796  *
1797  * This API is currently only required for use in the shared
1798  * session for Thor (p58) actions.  An increment count is returned per
1799  * type to indicate how much to increment the start by for each
1800  * entry (see tf_resource_info)
1801  *
1802  * Returns success or failure code.
1803  */
1804 int tf_get_shared_tbl_increment(struct tf *tfp,
1805                                 struct tf_get_shared_tbl_increment_parms *parms);
1806
1807 /**
1808  * tf_get_tbl_entry parameter definition
1809  */
1810 struct tf_get_tbl_entry_parms {
1811         /**
1812          * [in] Receive or transmit direction
1813          */
1814         enum tf_dir dir;
1815         /**
1816          * [in] Type of object to get
1817          */
1818         enum tf_tbl_type type;
1819         /**
1820          * [out] Entry data
1821          */
1822         uint8_t *data;
1823         /**
1824          * [in] Entry size
1825          */
1826         uint16_t data_sz_in_bytes;
1827         /**
1828          * [in] External memory channel type to use
1829          */
1830         enum tf_ext_mem_chan_type chan_type;
1831         /**
1832          * [in] Entry index to read
1833          */
1834         uint32_t idx;
1835 };
1836
1837 /**
1838  * get index table entry
1839  *
1840  * Used to retrieve a previous set index table entry.
1841  *
1842  * Reads and compares with the shadow table copy (if enabled) (only
1843  * for internal objects).
1844  *
1845  * Returns success or failure code. Failure will be returned if the
1846  * provided data buffer is too small for the data type requested.
1847  */
1848 int tf_get_tbl_entry(struct tf *tfp,
1849                      struct tf_get_tbl_entry_parms *parms);
1850
1851 /**
1852  * tf_bulk_get_tbl_entry parameter definition
1853  */
1854 struct tf_bulk_get_tbl_entry_parms {
1855         /**
1856          * [in] Receive or transmit direction
1857          */
1858         enum tf_dir dir;
1859         /**
1860          * [in] Type of object to get
1861          */
1862         enum tf_tbl_type type;
1863         /**
1864          * [in] Starting index to read from
1865          */
1866         uint32_t starting_idx;
1867         /**
1868          * [in] Number of sequential entries
1869          */
1870         uint16_t num_entries;
1871         /**
1872          * [in] Size of the single entry
1873          */
1874         uint16_t entry_sz_in_bytes;
1875         /**
1876          * [out] Host physical address, where the data
1877          * will be copied to by the firmware.
1878          * Use tfp_calloc() API and mem_pa
1879          * variable of the tfp_calloc_parms
1880          * structure for the physical address.
1881          */
1882         uint64_t physical_mem_addr;
1883         /**
1884          * [in] External memory channel type to use
1885          */
1886         enum tf_ext_mem_chan_type chan_type;
1887 };
1888
1889 /**
1890  * Bulk get index table entry
1891  *
1892  * Used to retrieve a set of index table entries.
1893  *
1894  * Entries within the range may not have been allocated using
1895  * tf_alloc_tbl_entry() at the time of access. But the range must
1896  * be within the bounds determined from tf_open_session() for the
1897  * given table type.  Currently, this is only used for collecting statistics.
1898  *
1899  * Returns success or failure code. Failure will be returned if the
1900  * provided data buffer is too small for the data type requested.
1901  */
1902 int tf_bulk_get_tbl_entry(struct tf *tfp,
1903                           struct tf_bulk_get_tbl_entry_parms *parms);
1904
1905 /**
1906  * @page exact_match Exact Match Table
1907  *
1908  * @ref tf_insert_em_entry
1909  *
1910  * @ref tf_delete_em_entry
1911  *
1912  * @ref tf_search_em_entry
1913  *
1914  */
1915 /**
1916  * tf_insert_em_entry parameter definition
1917  */
1918 struct tf_insert_em_entry_parms {
1919         /**
1920          * [in] receive or transmit direction
1921          */
1922         enum tf_dir dir;
1923         /**
1924          * [in] internal or external
1925          */
1926         enum tf_mem mem;
1927         /**
1928          * [in] ID of table scope to use (external only)
1929          */
1930         uint32_t tbl_scope_id;
1931         /**
1932          * [in] ptr to structure containing key fields
1933          */
1934         uint8_t *key;
1935         /**
1936          * [in] key bit length
1937          */
1938         uint16_t key_sz_in_bits;
1939         /**
1940          * [in] ptr to structure containing result field
1941          */
1942         uint8_t *em_record;
1943         /**
1944          * [out] result size in bits
1945          */
1946         uint16_t em_record_sz_in_bits;
1947         /**
1948          * [in] duplicate check flag
1949          */
1950         uint8_t dup_check;
1951         /**
1952          * [in] External memory channel type to use
1953          */
1954         enum tf_ext_mem_chan_type chan_type;
1955         /**
1956          * [out] Flow handle value for the inserted entry.  This is encoded
1957          * as the entries[4]:bucket[2]:hashId[1]:hash[14]
1958          */
1959         uint64_t flow_handle;
1960         /**
1961          * [out] Flow id is returned as null (internal)
1962          * Flow id is the GFID value for the inserted entry (external)
1963          * This is the value written to the BD and useful information for mark.
1964          */
1965         uint64_t flow_id;
1966 };
1967 /**
1968  * tf_delete_em_entry parameter definition
1969  */
1970 struct tf_delete_em_entry_parms {
1971         /**
1972          * [in] receive or transmit direction
1973          */
1974         enum tf_dir dir;
1975         /**
1976          * [in] internal or external
1977          */
1978         enum tf_mem mem;
1979         /**
1980          * [in] ID of table scope to use (external only)
1981          */
1982         uint32_t tbl_scope_id;
1983         /**
1984          * [out] The index of the entry
1985          */
1986         uint16_t index;
1987         /**
1988          * [in] External memory channel type to use
1989          */
1990         enum tf_ext_mem_chan_type chan_type;
1991         /**
1992          * [in] structure containing flow delete handle information
1993          */
1994         uint64_t flow_handle;
1995 };
1996 /**
1997  * tf_move_em_entry parameter definition
1998  */
1999 struct tf_move_em_entry_parms {
2000         /**
2001          * [in] receive or transmit direction
2002          */
2003         enum tf_dir dir;
2004         /**
2005          * [in] internal or external
2006          */
2007         enum tf_mem mem;
2008         /**
2009          * [in] ID of table scope to use (external only)
2010          */
2011         uint32_t tbl_scope_id;
2012         /**
2013          * [in] ID of table interface to use (SR2 only)
2014          */
2015         uint32_t tbl_if_id;
2016         /**
2017          * [in] epoch group IDs of entry to delete
2018          * 2 element array with 2 ids. (SR2 only)
2019          */
2020         uint16_t *epochs;
2021         /**
2022          * [out] The index of the entry
2023          */
2024         uint16_t index;
2025         /**
2026          * [in] External memory channel type to use
2027          */
2028         enum tf_ext_mem_chan_type chan_type;
2029         /**
2030          * [in] The index of the new EM record
2031          */
2032         uint32_t new_index;
2033         /**
2034          * [in] structure containing flow delete handle information
2035          */
2036         uint64_t flow_handle;
2037 };
2038 /**
2039  * tf_search_em_entry parameter definition (Future)
2040  */
2041 struct tf_search_em_entry_parms {
2042         /**
2043          * [in] receive or transmit direction
2044          */
2045         enum tf_dir dir;
2046         /**
2047          * [in] internal or external
2048          */
2049         enum tf_mem mem;
2050         /**
2051          * [in] ID of table scope to use (external only)
2052          */
2053         uint32_t tbl_scope_id;
2054         /**
2055          * [in] ptr to structure containing key fields
2056          */
2057         uint8_t *key;
2058         /**
2059          * [in] key bit length
2060          */
2061         uint16_t key_sz_in_bits;
2062         /**
2063          * [in/out] ptr to structure containing EM record fields
2064          */
2065         uint8_t *em_record;
2066         /**
2067          * [out] result size in bits
2068          */
2069         uint16_t em_record_sz_in_bits;
2070         /**
2071          * [in] External memory channel type to use
2072          */
2073         enum tf_ext_mem_chan_type chan_type;
2074         /**
2075          * [in] ptr to structure containing flow delete handle
2076          */
2077         uint64_t flow_handle;
2078 };
2079
2080 /**
2081  * insert em hash entry in internal table memory
2082  *
2083  * Internal:
2084  *
2085  * This API inserts an exact match entry into internal EM table memory
2086  * of the specified direction.
2087  *
2088  * Note: The EM record is managed within the TruFlow core and not the
2089  * application.
2090  *
2091  * Shadow copy of internal record table an association with hash and 1,2, or 4
2092  * associated buckets
2093  *
2094  * External:
2095  * This API inserts an exact match entry into DRAM EM table memory of the
2096  * specified direction and table scope.
2097  *
2098  * The insertion of duplicate entries in an EM table is not permitted.  If a
2099  * TruFlow application can guarantee that it will never insert duplicates, it
2100  * can disable duplicate checking by passing a zero value in the  dup_check
2101  * parameter to this API.  This will optimize performance. Otherwise, the
2102  * TruFlow library will enforce protection against inserting duplicate entries.
2103  *
2104  * Flow handle is defined in this document:
2105  *
2106  * https://docs.google.com
2107  * /document/d/1NESu7RpTN3jwxbokaPfYORQyChYRmJgs40wMIRe8_-Q/edit
2108  *
2109  * Returns success or busy code.
2110  *
2111  */
2112 int tf_insert_em_entry(struct tf *tfp,
2113                        struct tf_insert_em_entry_parms *parms);
2114
2115 /**
2116  * delete em hash entry table memory
2117  *
2118  * Internal:
2119  *
2120  * This API deletes an exact match entry from internal EM table memory of the
2121  * specified direction. If a valid flow ptr is passed in then that takes
2122  * precedence over the pointer to the complete key passed in.
2123  *
2124  *
2125  * External:
2126  *
2127  * This API deletes an exact match entry from EM table memory of the specified
2128  * direction and table scope. If a valid flow handle is passed in then that
2129  * takes precedence over the pointer to the complete key passed in.
2130  *
2131  * The TruFlow library may release a dynamic bucket when an entry is deleted.
2132  *
2133  *
2134  * Returns success or not found code
2135  *
2136  *
2137  */
2138 int tf_delete_em_entry(struct tf *tfp,
2139                        struct tf_delete_em_entry_parms *parms);
2140
2141 /**
2142  * search em hash entry table memory (Future)
2143  *
2144  * Internal:
2145
2146  * This API looks up an EM entry in table memory with the specified EM
2147  * key or flow (flow takes precedence) and direction.
2148  *
2149  * The status will be one of: success or entry not found.  If the lookup
2150  * succeeds, a pointer to the matching entry and the result record associated
2151  * with the matching entry will be provided.
2152  *
2153  * If flow_handle is set, search shadow copy.
2154  *
2155  * Otherwise, query the fw with key to get result.
2156  *
2157  * External:
2158  *
2159  * This API looks up an EM entry in table memory with the specified EM
2160  * key or flow_handle (flow takes precedence), direction and table scope.
2161  *
2162  * The status will be one of: success or entry not found.  If the lookup
2163  * succeeds, a pointer to the matching entry and the result record associated
2164  * with the matching entry will be provided.
2165  *
2166  * Returns success or not found code
2167  *
2168  */
2169 int tf_search_em_entry(struct tf *tfp,
2170                        struct tf_search_em_entry_parms *parms);
2171
2172 /**
2173  * @page global Global Configuration
2174  *
2175  * @ref tf_set_global_cfg
2176  *
2177  * @ref tf_get_global_cfg
2178  */
2179 /**
2180  * Tunnel Encapsulation Offsets
2181  */
2182 enum tf_tunnel_encap_offsets {
2183         TF_TUNNEL_ENCAP_L2,
2184         TF_TUNNEL_ENCAP_NAT,
2185         TF_TUNNEL_ENCAP_MPLS,
2186         TF_TUNNEL_ENCAP_VXLAN,
2187         TF_TUNNEL_ENCAP_GENEVE,
2188         TF_TUNNEL_ENCAP_NVGRE,
2189         TF_TUNNEL_ENCAP_GRE,
2190         TF_TUNNEL_ENCAP_FULL_GENERIC
2191 };
2192 /**
2193  * Global Configuration Table Types
2194  */
2195 enum tf_global_config_type {
2196         TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
2197         TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
2198         TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
2199         TF_METER_CFG,     /**< Meter Config(ACTP4_FMTCR) */
2200         TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL)  */
2201         TF_GLOBAL_CFG_TYPE_MAX
2202 };
2203
2204 /**
2205  * tf_global_cfg parameter definition
2206  */
2207 struct tf_global_cfg_parms {
2208         /**
2209          * [in] receive or transmit direction
2210          */
2211         enum tf_dir dir;
2212         /**
2213          * [in] Global config type
2214          */
2215         enum tf_global_config_type type;
2216         /**
2217          * [in] Offset @ the type
2218          */
2219         uint32_t offset;
2220         /**
2221          * [in/out] Value of the configuration
2222          * set - Read, Modify and Write
2223          * get - Read the full configuration
2224          */
2225         uint8_t *config;
2226         /**
2227          * [in] Configuration mask
2228          * set - Read, Modify with mask and Write
2229          * get - unused
2230          */
2231         uint8_t *config_mask;
2232         /**
2233          * [in] struct containing size
2234          */
2235         uint16_t config_sz_in_bytes;
2236 };
2237
2238 /**
2239  * Get global configuration
2240  *
2241  * Retrieve the configuration
2242  *
2243  * Returns success or failure code.
2244  */
2245 int tf_get_global_cfg(struct tf *tfp,
2246                       struct tf_global_cfg_parms *parms);
2247
2248 /**
2249  * Update the global configuration table
2250  *
2251  * Read, modify write the value.
2252  *
2253  * Returns success or failure code.
2254  */
2255 int tf_set_global_cfg(struct tf *tfp,
2256                       struct tf_global_cfg_parms *parms);
2257
2258 /**
2259  * @page if_tbl Interface Table Access
2260  *
2261  * @ref tf_set_if_tbl_entry
2262  *
2263  * @ref tf_get_if_tbl_entry
2264  *
2265  * @ref tf_restore_if_tbl_entry
2266  */
2267 /**
2268  * Enumeration of TruFlow interface table types.
2269  */
2270 enum tf_if_tbl_type {
2271         /** Default Profile L2 Context Entry */
2272         TF_IF_TBL_TYPE_PROF_SPIF_DFLT_L2_CTXT,
2273         /** Default Profile TCAM/Lookup Action Record Pointer Table */
2274         TF_IF_TBL_TYPE_PROF_PARIF_DFLT_ACT_REC_PTR,
2275         /** Error Profile TCAM Miss Action Record Pointer Table */
2276         TF_IF_TBL_TYPE_PROF_PARIF_ERR_ACT_REC_PTR,
2277         /** Default Error Profile TCAM Miss Action Record Pointer Table */
2278         TF_IF_TBL_TYPE_LKUP_PARIF_DFLT_ACT_REC_PTR,
2279         /** Ingress lookup table */
2280         TF_IF_TBL_TYPE_ILT,
2281         /** VNIC/SVIF Properties Table */
2282         TF_IF_TBL_TYPE_VSPT,
2283         TF_IF_TBL_TYPE_MAX
2284 };
2285
2286 /**
2287  * tf_set_if_tbl_entry parameter definition
2288  */
2289 struct tf_set_if_tbl_entry_parms {
2290         /**
2291          * [in] Receive or transmit direction
2292          */
2293         enum tf_dir dir;
2294         /**
2295          * [in] Type of object to set
2296          */
2297         enum tf_if_tbl_type type;
2298         /**
2299          * [in] Entry data
2300          */
2301         uint8_t *data;
2302         /**
2303          * [in] Entry size
2304          */
2305         uint16_t data_sz_in_bytes;
2306         /**
2307          * [in] Interface to write
2308          */
2309         uint32_t idx;
2310 };
2311
2312 /**
2313  * set interface table entry
2314  *
2315  * Used to set an interface table. This API is used for managing tables indexed
2316  * by SVIF/SPIF/PARIF interfaces. In current implementation only the value is
2317  * set.
2318  * Returns success or failure code.
2319  */
2320 int tf_set_if_tbl_entry(struct tf *tfp,
2321                         struct tf_set_if_tbl_entry_parms *parms);
2322
2323 /**
2324  * tf_get_if_tbl_entry parameter definition
2325  */
2326 struct tf_get_if_tbl_entry_parms {
2327         /**
2328          * [in] Receive or transmit direction
2329          */
2330         enum tf_dir dir;
2331         /**
2332          * [in] Type of table to get
2333          */
2334         enum tf_if_tbl_type type;
2335         /**
2336          * [out] Entry data
2337          */
2338         uint8_t *data;
2339         /**
2340          * [in] Entry size
2341          */
2342         uint16_t data_sz_in_bytes;
2343         /**
2344          * [in] Entry index to read
2345          */
2346         uint32_t idx;
2347 };
2348
2349 /**
2350  * get interface table entry
2351  *
2352  * Used to retrieve an interface table entry.
2353  *
2354  * Reads the interface table entry value
2355  *
2356  * Returns success or failure code. Failure will be returned if the
2357  * provided data buffer is too small for the data type requested.
2358  */
2359 int tf_get_if_tbl_entry(struct tf *tfp,
2360                         struct tf_get_if_tbl_entry_parms *parms);
2361
2362 #endif /* _TF_CORE_H_ */