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