1/* Copyright (c) 2008-2012 Freescale Semiconductor, Inc.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *     * Redistributions of source code must retain the above copyright
7 *       notice, this list of conditions and the following disclaimer.
8 *     * Redistributions in binary form must reproduce the above copyright
9 *       notice, this list of conditions and the following disclaimer in the
10 *       documentation and/or other materials provided with the distribution.
11 *     * Neither the name of Freescale Semiconductor nor the
12 *       names of its contributors may be used to endorse or promote products
13 *       derived from this software without specific prior written permission.
14 *
15 *
16 * ALTERNATIVELY, this software may be distributed under the terms of the
17 * GNU General Public License ("GPL") as published by the Free Software
18 * Foundation, either version 2 of that License or (at your option) any
19 * later version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34/**************************************************************************//**
35 @File          fm_port_ext.h
36
37 @Description   FM-Port Application Programming Interface.
38*//***************************************************************************/
39#ifndef __FM_PORT_EXT
40#define __FM_PORT_EXT
41
42#include "error_ext.h"
43#include "std_ext.h"
44#include "fm_pcd_ext.h"
45#include "fm_ext.h"
46#include "net_ext.h"
47
48
49/**************************************************************************//**
50
51 @Group         FM_grp Frame Manager API
52
53 @Description   FM API functions, definitions and enums
54
55 @{
56*//***************************************************************************/
57
58/**************************************************************************//**
59 @Group         FM_PORT_grp FM Port
60
61 @Description   FM Port API
62
63                The FM uses a general module called "port" to represent a Tx port
64                (MAC), an Rx port (MAC) or Offline Parsing port.
65                The number of ports in an FM varies between SOCs.
66                The SW driver manages these ports as sub-modules of the FM, i.e.
67                after an FM is initialized, its ports may be initialized and
68                operated upon.
69
70                The port is initialized aware of its type, but other functions on
71                a port may be indifferent to its type. When necessary, the driver
72                verifies coherence and returns error if applicable.
73
74                On initialization, user specifies the port type and it's index
75                (relative to the port's type) - always starting at 0.
76
77 @{
78*//***************************************************************************/
79
80/**************************************************************************//**
81 @Description   An enum for defining port PCD modes.
82                This enum defines the superset of PCD engines support - i.e. not
83                all engines have to be used, but all have to be enabled. The real
84                flow of a specific frame depends on the PCD configuration and the
85                frame headers and payload.
86                Note: the first engine and the first engine after the parser (if
87                exists) should be in order, the order is important as it will
88                define the flow of the port. However, as for the rest engines
89                (the ones that follows), the order is not important anymore as
90                it is defined by the PCD graph itself.
91*//***************************************************************************/
92typedef enum e_FmPortPcdSupport {
93      e_FM_PORT_PCD_SUPPORT_NONE = 0                /**< BMI to BMI, PCD is not used */
94    , e_FM_PORT_PCD_SUPPORT_PRS_ONLY                /**< Use only Parser */
95    , e_FM_PORT_PCD_SUPPORT_PLCR_ONLY               /**< Use only Policer */
96    , e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR            /**< Use Parser and Policer */
97    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG              /**< Use Parser and Keygen */
98    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC       /**< Use Parser, Keygen and Coarse Classification */
99    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC_AND_PLCR
100                                                    /**< Use all PCD engines */
101    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_PLCR     /**< Use Parser, Keygen and Policer */
102    , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC              /**< Use Parser and Coarse Classification */
103    , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC_AND_PLCR     /**< Use Parser and Coarse Classification and Policer */
104    , e_FM_PORT_PCD_SUPPORT_CC_ONLY                 /**< Use only Coarse Classification */
105#ifdef FM_CAPWAP_SUPPORT
106    , e_FM_PORT_PCD_SUPPORT_CC_AND_KG               /**< Use Coarse Classification,and Keygen */
107    , e_FM_PORT_PCD_SUPPORT_CC_AND_KG_AND_PLCR      /**< Use Coarse Classification, Keygen and Policer */
108#endif /* FM_CAPWAP_SUPPORT */
109} e_FmPortPcdSupport;
110
111/**************************************************************************//**
112 @Description   Port interrupts
113*//***************************************************************************/
114typedef enum e_FmPortExceptions {
115    e_FM_PORT_EXCEPTION_IM_BUSY                 /**< Independent-Mode Rx-BUSY */
116} e_FmPortExceptions;
117
118
119/**************************************************************************//**
120 @Collection    General FM Port defines
121*//***************************************************************************/
122#define FM_PORT_PRS_RESULT_NUM_OF_WORDS     8   /**< Number of 4 bytes words in parser result */
123/* @} */
124
125/**************************************************************************//**
126 @Collection   FM Frame error
127*//***************************************************************************/
128typedef uint32_t    fmPortFrameErrSelect_t;                         /**< typedef for defining Frame Descriptor errors */
129
130#define FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT      FM_FD_ERR_UNSUPPORTED_FORMAT    /**< Not for Rx-Port! Unsupported Format */
131#define FM_PORT_FRM_ERR_LENGTH                  FM_FD_ERR_LENGTH                /**< Not for Rx-Port! Length Error */
132#define FM_PORT_FRM_ERR_DMA                     FM_FD_ERR_DMA                   /**< DMA Data error */
133#define FM_PORT_FRM_ERR_NON_FM                  FM_FD_RX_STATUS_ERR_NON_FM      /**< non Frame-Manager error; probably come from SEC that
134                                                                                     was chained to FM */
135
136#define FM_PORT_FRM_ERR_IPRE                    (FM_FD_ERR_IPR & ~FM_FD_IPR)        /**< IPR error */
137#define FM_PORT_FRM_ERR_IPR_NCSP                (FM_FD_ERR_IPR_NCSP & ~FM_FD_IPR)   /**< IPR non-consistent-sp */
138
139#define FM_PORT_FRM_ERR_IPFE                    0                                   /**< Obsolete; will be removed in the future */
140
141#ifdef FM_CAPWAP_SUPPORT
142#define FM_PORT_FRM_ERR_CRE                     FM_FD_ERR_CRE
143#define FM_PORT_FRM_ERR_CHE                     FM_FD_ERR_CHE
144#endif /* FM_CAPWAP_SUPPORT */
145
146#define FM_PORT_FRM_ERR_PHYSICAL                FM_FD_ERR_PHYSICAL              /**< Rx FIFO overflow, FCS error, code error, running disparity
147                                                                                     error (SGMII and TBI modes), FIFO parity error. PHY
148                                                                                     Sequence error, PHY error control character detected. */
149#define FM_PORT_FRM_ERR_SIZE                    FM_FD_ERR_SIZE                  /**< Frame too long OR Frame size exceeds max_length_frame  */
150#define FM_PORT_FRM_ERR_CLS_DISCARD             FM_FD_ERR_CLS_DISCARD           /**< indicates a classifier "drop" operation */
151#define FM_PORT_FRM_ERR_EXTRACTION              FM_FD_ERR_EXTRACTION            /**< Extract Out of Frame */
152#define FM_PORT_FRM_ERR_NO_SCHEME               FM_FD_ERR_NO_SCHEME             /**< No Scheme Selected */
153#define FM_PORT_FRM_ERR_KEYSIZE_OVERFLOW        FM_FD_ERR_KEYSIZE_OVERFLOW      /**< Keysize Overflow */
154#define FM_PORT_FRM_ERR_COLOR_RED               FM_FD_ERR_COLOR_RED             /**< Frame color is red */
155#define FM_PORT_FRM_ERR_COLOR_YELLOW            FM_FD_ERR_COLOR_YELLOW          /**< Frame color is yellow */
156#define FM_PORT_FRM_ERR_ILL_PLCR                FM_FD_ERR_ILL_PLCR              /**< Illegal Policer Profile selected */
157#define FM_PORT_FRM_ERR_PLCR_FRAME_LEN          FM_FD_ERR_PLCR_FRAME_LEN        /**< Policer frame length error */
158#define FM_PORT_FRM_ERR_PRS_TIMEOUT             FM_FD_ERR_PRS_TIMEOUT           /**< Parser Time out Exceed */
159#define FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT        FM_FD_ERR_PRS_ILL_INSTRUCT      /**< Invalid Soft Parser instruction */
160#define FM_PORT_FRM_ERR_PRS_HDR_ERR             FM_FD_ERR_PRS_HDR_ERR           /**< Header error was identified during parsing */
161#define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED    FM_FD_ERR_BLOCK_LIMIT_EXCEEDED  /**< Frame parsed beyind 256 first bytes */
162#define FM_PORT_FRM_ERR_PROCESS_TIMEOUT         0x00000001                      /**< FPM Frame Processing Timeout Exceeded */
163/* @} */
164
165
166
167/**************************************************************************//**
168 @Group         FM_PORT_init_grp FM Port Initialization Unit
169
170 @Description   FM Port Initialization Unit
171
172 @{
173*//***************************************************************************/
174
175/**************************************************************************//**
176 @Description   Exceptions user callback routine, will be called upon an
177                exception passing the exception identification.
178
179 @Param[in]     h_App      - User's application descriptor.
180 @Param[in]     exception  - The exception.
181  *//***************************************************************************/
182typedef void (t_FmPortExceptionCallback) (t_Handle h_App, e_FmPortExceptions exception);
183
184/**************************************************************************//**
185 @Description   User callback function called by driver with received data.
186
187                User provides this function. Driver invokes it.
188
189 @Param[in]     h_App           Application's handle originally specified to
190                                the API Config function
191 @Param[in]     p_Data          A pointer to data received
192 @Param[in]     length          length of received data
193 @Param[in]     status          receive status and errors
194 @Param[in]     position        position of buffer in frame
195 @Param[in]     h_BufContext    A handle of the user acossiated with this buffer
196
197 @Retval        e_RX_STORE_RESPONSE_CONTINUE - order the driver to continue Rx
198                                               operation for all ready data.
199 @Retval        e_RX_STORE_RESPONSE_PAUSE    - order the driver to stop Rx operation.
200*//***************************************************************************/
201typedef e_RxStoreResponse (t_FmPortImRxStoreCallback) (t_Handle h_App,
202                                                       uint8_t  *p_Data,
203                                                       uint16_t length,
204                                                       uint16_t status,
205                                                       uint8_t  position,
206                                                       t_Handle h_BufContext);
207
208/**************************************************************************//**
209 @Description   User callback function called by driver when transmit completed.
210
211                User provides this function. Driver invokes it.
212
213 @Param[in]     h_App           Application's handle originally specified to
214                                the API Config function
215 @Param[in]     p_Data          A pointer to data received
216 @Param[in]     status          transmit status and errors
217 @Param[in]     lastBuffer      is last buffer in frame
218 @Param[in]     h_BufContext    A handle of the user acossiated with this buffer
219 *//***************************************************************************/
220typedef void (t_FmPortImTxConfCallback) (t_Handle   h_App,
221                                         uint8_t    *p_Data,
222                                         uint16_t   status,
223                                         t_Handle   h_BufContext);
224
225/**************************************************************************//**
226 @Description   A structure for additional Rx port parameters
227*//***************************************************************************/
228typedef struct t_FmPortRxParams {
229    uint32_t                errFqid;            /**< Error Queue Id. */
230    uint32_t                dfltFqid;           /**< Default Queue Id.  */
231    uint16_t                liodnOffset;        /**< Port's LIODN offset. */
232    t_FmExtPools            extBufPools;        /**< Which external buffer pools are used
233                                                     (up to FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes. */
234} t_FmPortRxParams;
235
236/**************************************************************************//**
237 @Description   A structure for additional non-Rx port parameters
238*//***************************************************************************/
239typedef struct t_FmPortNonRxParams {
240    uint32_t                errFqid;            /**< Error Queue Id. */
241    uint32_t                dfltFqid;           /**< For Tx - Default Confirmation queue,
242                                                     0 means no Tx confirmation for processed
243                                                     frames. For OP port - default Rx queue. */
244    uint32_t                qmChannel;          /**< QM-channel dedicated to this port; will be used
245                                                     by the FM for dequeue. */
246} t_FmPortNonRxParams;
247
248/**************************************************************************//**
249 @Description   A structure for additional Rx port parameters
250*//***************************************************************************/
251typedef struct t_FmPortImRxTxParams {
252    t_Handle                    h_FmMuram;          /**< A handle of the FM-MURAM partition */
253    uint16_t                    liodnOffset;        /**< For Rx ports only. Port's LIODN Offset. */
254    uint8_t                     dataMemId;          /**< Memory partition ID for data buffers */
255    uint32_t                    dataMemAttributes;  /**< Memory attributes for data buffers */
256    t_BufferPoolInfo            rxPoolParams;       /**< For Rx ports only. */
257    t_FmPortImRxStoreCallback   *f_RxStore;         /**< For Rx ports only. */
258    t_FmPortImTxConfCallback    *f_TxConf;          /**< For Tx ports only. */
259} t_FmPortImRxTxParams;
260
261/**************************************************************************//**
262 @Description   A union for additional parameters depending on port type
263*//***************************************************************************/
264typedef union u_FmPortSpecificParams {
265    t_FmPortImRxTxParams        imRxTxParams;       /**< Rx/Tx Independent-Mode port parameter structure */
266    t_FmPortRxParams            rxParams;           /**< Rx port parameters structure */
267    t_FmPortNonRxParams         nonRxParams;        /**< Non-Rx port parameters structure */
268} u_FmPortSpecificParams;
269
270/**************************************************************************//**
271 @Description   A structure representing FM initialization parameters
272*//***************************************************************************/
273typedef struct t_FmPortParams {
274    uintptr_t                   baseAddr;           /**< Virtual Address of memory mapped FM Port registers.*/
275    t_Handle                    h_Fm;               /**< A handle to the FM object this port related to */
276    e_FmPortType                portType;           /**< Port type */
277    uint8_t                     portId;             /**< Port Id - relative to type;
278                                                         NOTE: When configuring Offline Parsing port for
279                                                         FMANv3 devices (DPAA_VERSION 11 and higher),
280                                                         it is highly recommended NOT to use portId=0 due to lack
281                                                         of HW resources on portId=0. */
282    bool                        independentModeEnable;
283                                                    /**< This port is Independent-Mode - Used for Rx/Tx ports only! */
284    uint16_t                    liodnBase;          /**< Irrelevant for P4080 rev 1. LIODN base for this port, to be
285                                                         used together with LIODN offset. */
286    u_FmPortSpecificParams      specificParams;     /**< Additional parameters depending on port
287                                                         type. */
288
289    t_FmPortExceptionCallback   *f_Exception;       /**< Relevant for IM only Callback routine to be called on BUSY exception */
290    t_Handle                    h_App;              /**< A handle to an application layer object; This handle will
291                                                         be passed by the driver upon calling the above callbacks */
292} t_FmPortParams;
293
294
295/**************************************************************************//**
296 @Function      FM_PORT_Config
297
298 @Description   Creates a descriptor for the FM PORT module.
299
300                The routine returns a handle (descriptor) to the FM PORT object.
301                This descriptor must be passed as first parameter to all other
302                FM PORT function calls.
303
304                No actual initialization or configuration of FM hardware is
305                done by this routine.
306
307 @Param[in]     p_FmPortParams   - Pointer to data structure of parameters
308
309 @Retval        Handle to FM object, or NULL for Failure.
310*//***************************************************************************/
311t_Handle FM_PORT_Config(t_FmPortParams *p_FmPortParams);
312
313/**************************************************************************//**
314 @Function      FM_PORT_Init
315
316 @Description   Initializes the FM PORT module by defining the software structure
317                and configuring the hardware registers.
318
319 @Param[in]     h_FmPort - FM PORT module descriptor
320
321 @Return        E_OK on success; Error code otherwise.
322*//***************************************************************************/
323t_Error FM_PORT_Init(t_Handle h_FmPort);
324
325/**************************************************************************//**
326 @Function      FM_PORT_Free
327
328 @Description   Frees all resources that were assigned to FM PORT module.
329
330                Calling this routine invalidates the descriptor.
331
332 @Param[in]     h_FmPort - FM PORT module descriptor
333
334 @Return        E_OK on success; Error code otherwise.
335*//***************************************************************************/
336t_Error FM_PORT_Free(t_Handle h_FmPort);
337
338
339/**************************************************************************//**
340 @Group         FM_PORT_advanced_init_grp    FM Port Advanced Configuration Unit
341
342 @Description   Configuration functions used to change default values.
343
344 @{
345*//***************************************************************************/
346
347/**************************************************************************//**
348 @Description   enum for defining QM frame dequeue
349*//***************************************************************************/
350typedef enum e_FmPortDeqType {
351   e_FM_PORT_DEQ_TYPE1,             /**< Dequeue from the SP channel - with priority precedence,
352                                         and Intra-Class Scheduling respected. */
353   e_FM_PORT_DEQ_TYPE2,             /**< Dequeue from the SP channel - with active FQ precedence,
354                                         and Intra-Class Scheduling respected. */
355   e_FM_PORT_DEQ_TYPE3              /**< Dequeue from the SP channel - with active FQ precedence,
356                                         and override Intra-Class Scheduling */
357} e_FmPortDeqType;
358
359/**************************************************************************//**
360 @Description   enum for defining QM frame dequeue
361*//***************************************************************************/
362typedef enum e_FmPortDeqPrefetchOption {
363   e_FM_PORT_DEQ_NO_PREFETCH,       /**< QMI preforms a dequeue action for a single frame
364                                         only when a dedicated portID Tnum is waiting. */
365   e_FM_PORT_DEQ_PARTIAL_PREFETCH,  /**< QMI preforms a dequeue action for 3 frames when
366                                         one dedicated portId tnum is waiting. */
367   e_FM_PORT_DEQ_FULL_PREFETCH      /**< QMI preforms a dequeue action for 3 frames when
368                                         no dedicated portId tnums are waiting. */
369
370} e_FmPortDeqPrefetchOption;
371
372/**************************************************************************//**
373 @Description   enum for defining port default color
374*//***************************************************************************/
375typedef enum e_FmPortColor {
376    e_FM_PORT_COLOR_GREEN,          /**< Default port color is green */
377    e_FM_PORT_COLOR_YELLOW,         /**< Default port color is yellow */
378    e_FM_PORT_COLOR_RED,            /**< Default port color is red */
379    e_FM_PORT_COLOR_OVERRIDE        /**< Ignore color */
380} e_FmPortColor;
381
382/**************************************************************************//**
383 @Description   A structure for defining Dual Tx rate limiting scale
384*//***************************************************************************/
385typedef enum e_FmPortDualRateLimiterScaleDown {
386    e_FM_PORT_DUAL_RATE_LIMITER_NONE = 0,           /**< Use only single rate limiter  */
387    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_2,    /**< Divide high rate limiter by 2 */
388    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_4,    /**< Divide high rate limiter by 4 */
389    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_8     /**< Divide high rate limiter by 8 */
390} e_FmPortDualRateLimiterScaleDown;
391
392
393/**************************************************************************//**
394 @Description   A structure for defining FM port resources
395*//***************************************************************************/
396typedef struct t_FmPortRsrc {
397    uint32_t    num;                /**< Committed required resource */
398    uint32_t    extra;              /**< Extra (not committed) required resource */
399} t_FmPortRsrc;
400
401/**************************************************************************//**
402 @Description   A structure for defining observed pool depletion
403*//***************************************************************************/
404typedef struct t_FmPortObservedBufPoolDepletion {
405    t_FmBufPoolDepletion    poolDepletionParams;/**< parameters to define pool depletion */
406    t_FmExtPools            poolsParams;        /**< Which external buffer pools are observed
407                                                     (up to FM_PORT_MAX_NUM_OF_OBSERVED_EXT_POOLS),
408                                                     and their sizes. */
409} t_FmPortObservedBufPoolDepletion;
410
411/**************************************************************************//**
412 @Description   A structure for defining Tx rate limiting
413*//***************************************************************************/
414typedef struct t_FmPortRateLimit {
415    uint16_t                            maxBurstSize;           /**< in KBytes for Tx ports, in frames
416                                                                     for OP ports. (note that
417                                                                     for early chips burst size is
418                                                                     rounded up to a multiply of 1000 frames).*/
419    uint32_t                            rateLimit;              /**< in Kb/sec for Tx ports, in frame/sec for
420                                                                     OP ports. Rate limit refers to
421                                                                     data rate (rather than line rate). */
422    e_FmPortDualRateLimiterScaleDown    rateLimitDivider;       /**< For OP ports only. Not-valid
423                                                                     for some earlier chip revisions */
424} t_FmPortRateLimit;
425
426/**************************************************************************//**
427 @Description   A structure for defining the parameters of
428                the Rx port performance counters
429*//***************************************************************************/
430typedef struct t_FmPortPerformanceCnt {
431    uint8_t     taskCompVal;            /**< Task compare value */
432    uint8_t     queueCompVal;           /**< Rx queue/Tx confirm queue compare
433                                             value (unused for H/O) */
434    uint8_t     dmaCompVal;             /**< Dma compare value */
435    uint32_t    fifoCompVal;            /**< Fifo compare value (in bytes) */
436} t_FmPortPerformanceCnt;
437
438
439/**************************************************************************//**
440 @Description   A structure for defining the sizes of the Deep Sleep
441                the Auto Response tables
442*//***************************************************************************/
443typedef struct t_FmPortDsarTablesSizes
444{
445    uint16_t   maxNumOfArpEntries;
446    uint16_t   maxNumOfEchoIpv4Entries;
447    uint16_t   maxNumOfNdpEntries;
448    uint16_t   maxNumOfEchoIpv6Entries;
449    uint16_t   maxNumOfSnmpIPV4Entries;
450    uint16_t   maxNumOfSnmpIPV6Entries;
451    uint16_t   maxNumOfSnmpOidEntries;
452    uint16_t   maxNumOfSnmpOidChar; /* total amount of character needed for the snmp table */
453
454    uint16_t   maxNumOfIpProtFiltering;
455    uint16_t   maxNumOfTcpPortFiltering;
456    uint16_t   maxNumOfUdpPortFiltering;
457} t_FmPortDsarTablesSizes;
458
459
460/**************************************************************************//**
461 @Function      FM_PORT_ConfigDsarSupport
462
463 @Description   This function will allocate the amount of MURAM needed for
464                this max number of entries for Deep Sleep Auto Response.
465                it will calculate all needed MURAM for autoresponse including
466                necesary common stuff.
467
468
469 @Param[in]     h_FmPort    A handle to a FM Port module.
470 @Param[in]     params      A pointer to a structure containing the maximum
471                            sizes of the auto response tables
472
473 @Return        E_OK on success; Error code otherwise.
474
475 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
476*//***************************************************************************/
477t_Error FM_PORT_ConfigDsarSupport(t_Handle h_FmPortRx, t_FmPortDsarTablesSizes *params);
478
479/**************************************************************************//**
480 @Function      FM_PORT_ConfigNumOfOpenDmas
481
482 @Description   Calling this routine changes the max number of open DMA's
483                available for this port. It changes this parameter in the
484                internal driver data base from its default configuration
485                [OP: 1]
486                [1G-RX, 1G-TX: 1 (+1)]
487                [10G-RX, 10G-TX: 8 (+8)]
488
489 @Param[in]     h_FmPort    A handle to a FM Port module.
490 @Param[in]     p_OpenDmas  A pointer to a structure of parameters defining
491                            the open DMA allocation.
492
493 @Return        E_OK on success; Error code otherwise.
494
495 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
496*//***************************************************************************/
497t_Error FM_PORT_ConfigNumOfOpenDmas(t_Handle h_FmPort, t_FmPortRsrc *p_OpenDmas);
498
499/**************************************************************************//**
500 @Function      FM_PORT_ConfigNumOfTasks
501
502 @Description   Calling this routine changes the max number of tasks
503                available for this port. It changes this parameter in the
504                internal driver data base from its default configuration
505                [OP: 1]
506                [1G-RX, 1G-TX: 3 (+2)]
507                [10G-RX, 10G-TX: 16 (+8)]
508
509 @Param[in]     h_FmPort        A handle to a FM Port module.
510 @Param[in]     p_NumOfTasks    A pointer to a structure of parameters defining
511                                the tasks allocation.
512
513 @Return        E_OK on success; Error code otherwise.
514
515 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
516*//***************************************************************************/
517t_Error FM_PORT_ConfigNumOfTasks(t_Handle h_FmPort, t_FmPortRsrc *p_NumOfTasks);
518
519/**************************************************************************//**
520 @Function      FM_PORT_ConfigSizeOfFifo
521
522 @Description   Calling this routine changes the max FIFO size configured for this port.
523
524                This function changes the internal driver data base from its
525                default configuration. Please refer to the driver's User Guide for
526                information on default FIFO sizes in the various devices.
527                [OP: 2KB]
528                [1G-RX, 1G-TX: 11KB]
529                [10G-RX, 10G-TX: 12KB]
530
531 @Param[in]     h_FmPort        A handle to a FM Port module.
532 @Param[in]     p_SizeOfFifo    A pointer to a structure of parameters defining
533                                the FIFO allocation.
534
535 @Return        E_OK on success; Error code otherwise.
536
537 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
538*//***************************************************************************/
539t_Error FM_PORT_ConfigSizeOfFifo(t_Handle h_FmPort, t_FmPortRsrc *p_SizeOfFifo);
540
541/**************************************************************************//**
542 @Function      FM_PORT_ConfigDeqHighPriority
543
544 @Description   Calling this routine changes the dequeue priority in the
545                internal driver data base from its default configuration
546                1G: [DEFAULT_PORT_deqHighPriority_1G]
547                10G: [DEFAULT_PORT_deqHighPriority_10G]
548
549                May be used for Non-Rx ports only
550
551 @Param[in]     h_FmPort    A handle to a FM Port module.
552 @Param[in]     highPri     TRUE to select high priority, FALSE for normal operation.
553
554 @Return        E_OK on success; Error code otherwise.
555
556 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
557*//***************************************************************************/
558t_Error FM_PORT_ConfigDeqHighPriority(t_Handle h_FmPort, bool highPri);
559
560/**************************************************************************//**
561 @Function      FM_PORT_ConfigDeqType
562
563 @Description   Calling this routine changes the dequeue type parameter in the
564                internal driver data base from its default configuration
565                [DEFAULT_PORT_deqType].
566
567                May be used for Non-Rx ports only
568
569 @Param[in]     h_FmPort    A handle to a FM Port module.
570 @Param[in]     deqType     According to QM definition.
571
572 @Return        E_OK on success; Error code otherwise.
573
574 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
575*//***************************************************************************/
576t_Error FM_PORT_ConfigDeqType(t_Handle h_FmPort, e_FmPortDeqType deqType);
577
578/**************************************************************************//**
579 @Function      FM_PORT_ConfigDeqPrefetchOption
580
581 @Description   Calling this routine changes the dequeue prefetch option parameter in the
582                internal driver data base from its default configuration
583                [DEFAULT_PORT_deqPrefetchOption]
584                Note: Available for some chips only
585
586                May be used for Non-Rx ports only
587
588 @Param[in]     h_FmPort            A handle to a FM Port module.
589 @Param[in]     deqPrefetchOption   New option
590
591 @Return        E_OK on success; Error code otherwise.
592
593 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
594*//***************************************************************************/
595t_Error FM_PORT_ConfigDeqPrefetchOption(t_Handle h_FmPort, e_FmPortDeqPrefetchOption deqPrefetchOption);
596
597/**************************************************************************//**
598 @Function      FM_PORT_ConfigDeqByteCnt
599
600 @Description   Calling this routine changes the dequeue byte count parameter in
601                the internal driver data base from its default configuration
602                1G:[DEFAULT_PORT_deqByteCnt_1G].
603                10G:[DEFAULT_PORT_deqByteCnt_10G].
604
605                May be used for Non-Rx ports only
606
607 @Param[in]     h_FmPort        A handle to a FM Port module.
608 @Param[in]     deqByteCnt      New byte count
609
610 @Return        E_OK on success; Error code otherwise.
611
612 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
613*//***************************************************************************/
614t_Error FM_PORT_ConfigDeqByteCnt(t_Handle h_FmPort, uint16_t deqByteCnt);
615
616/**************************************************************************//**
617 @Function      FM_PORT_ConfigBufferPrefixContent
618
619 @Description   Defines the structure, size and content of the application buffer.
620                The prefix will
621                In Tx ports, if 'passPrsResult', the application
622                should set a value to their offsets in the prefix of
623                the FM will save the first 'privDataSize', than,
624                depending on 'passPrsResult' and 'passTimeStamp', copy parse result
625                and timeStamp, and the packet itself (in this order), to the
626                application buffer, and to offset.
627                Calling this routine changes the buffer margins definitions
628                in the internal driver data base from its default
629                configuration: Data size:  [DEFAULT_PORT_bufferPrefixContent_privDataSize]
630                               Pass Parser result: [DEFAULT_PORT_bufferPrefixContent_passPrsResult].
631                               Pass timestamp: [DEFAULT_PORT_bufferPrefixContent_passTimeStamp].
632
633                May be used for all ports
634
635 @Param[in]     h_FmPort                        A handle to a FM Port module.
636 @Param[in,out] p_FmBufferPrefixContent         A structure of parameters describing the
637                                                structure of the buffer.
638                                                Out parameter: Start margin - offset
639                                                of data from start of external buffer.
640
641 @Return        E_OK on success; Error code otherwise.
642
643 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
644*//***************************************************************************/
645t_Error FM_PORT_ConfigBufferPrefixContent(t_Handle                      h_FmPort,
646                                          t_FmBufferPrefixContent       *p_FmBufferPrefixContent);
647
648/**************************************************************************//**
649 @Function      FM_PORT_ConfigCheksumLastBytesIgnore
650
651 @Description   Calling this routine changes the number of checksum bytes to ignore
652                parameter in the internal driver data base from its default configuration
653                [DEFAULT_PORT_cheksumLastBytesIgnore]
654
655                May be used by Tx & Rx ports only
656
657 @Param[in]     h_FmPort                A handle to a FM Port module.
658 @Param[in]     cheksumLastBytesIgnore  New value
659
660 @Return        E_OK on success; Error code otherwise.
661
662 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
663*//***************************************************************************/
664t_Error FM_PORT_ConfigCheksumLastBytesIgnore(t_Handle h_FmPort, uint8_t cheksumLastBytesIgnore);
665
666/**************************************************************************//**
667 @Function      FM_PORT_ConfigCutBytesFromEnd
668
669 @Description   Calling this routine changes the number of bytes to cut from a
670                frame's end parameter in the internal driver data base
671                from its default configuration [DEFAULT_PORT_cutBytesFromEnd]
672                Note that if the result of (frame length before chop - cutBytesFromEnd) is
673                less than 14 bytes, the chop operation is not executed.
674
675                May be used for Rx ports only
676
677 @Param[in]     h_FmPort            A handle to a FM Port module.
678 @Param[in]     cutBytesFromEnd     New value
679
680 @Return        E_OK on success; Error code otherwise.
681
682 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
683*//***************************************************************************/
684t_Error FM_PORT_ConfigCutBytesFromEnd(t_Handle h_FmPort, uint8_t cutBytesFromEnd);
685
686/**************************************************************************//**
687 @Function      FM_PORT_ConfigPoolDepletion
688
689 @Description   Calling this routine enables pause frame generation depending on the
690                depletion status of BM pools. It also defines the conditions to activate
691                this functionality. By default, this functionality is disabled.
692
693                May be used for Rx ports only
694
695 @Param[in]     h_FmPort                A handle to a FM Port module.
696 @Param[in]     p_BufPoolDepletion      A structure of pool depletion parameters
697
698 @Return        E_OK on success; Error code otherwise.
699
700 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
701*//***************************************************************************/
702t_Error FM_PORT_ConfigPoolDepletion(t_Handle h_FmPort, t_FmBufPoolDepletion *p_BufPoolDepletion);
703
704/**************************************************************************//**
705 @Function      FM_PORT_ConfigObservedPoolDepletion
706
707 @Description   Calling this routine enables a mechanism to stop port enqueue
708                depending on the depletion status of selected BM pools.
709                It also defines the conditions to activate
710                this functionality. By default, this functionality is disabled.
711
712                Note: Available for some chips only
713
714                May be used for OP ports only
715
716 @Param[in]     h_FmPort                            A handle to a FM Port module.
717 @Param[in]     p_FmPortObservedBufPoolDepletion    A structure of parameters for pool depletion.
718
719 @Return        E_OK on success; Error code otherwise.
720
721 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
722*//***************************************************************************/
723t_Error FM_PORT_ConfigObservedPoolDepletion(t_Handle                            h_FmPort,
724                                            t_FmPortObservedBufPoolDepletion    *p_FmPortObservedBufPoolDepletion);
725
726/**************************************************************************//**
727 @Function      FM_PORT_ConfigExtBufPools
728
729 @Description   This routine should be called for OP ports
730                that internally use BM buffer pools. In such cases, e.g. for fragmentation and
731                re-assembly, the FM needs new BM buffers. By calling this routine the user
732                specifies the BM buffer pools that should be used.
733
734                Note: Available for some chips only
735
736                May be used for OP ports only
737
738 @Param[in]     h_FmPort            A handle to a FM Port module.
739 @Param[in]     p_FmExtPools        A structure of parameters for the external pools.
740
741 @Return        E_OK on success; Error code otherwise.
742
743 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
744*//***************************************************************************/
745t_Error FM_PORT_ConfigExtBufPools(t_Handle h_FmPort, t_FmExtPools *p_FmExtPools);
746
747/**************************************************************************//**
748 @Function      FM_PORT_ConfigBackupPools
749
750 @Description   Calling this routine allows the configuration of some of the BM pools
751                defined for this port as backup pools.
752                A pool configured to be a backup pool will be used only if all other
753                enabled non-backup pools are depleted.
754
755                May be used for Rx ports only
756
757 @Param[in]     h_FmPort                A handle to a FM Port module.
758 @Param[in]     p_FmPortBackupBmPools   An array of pool id's. All pools specified here will
759                                        be defined as backup pools.
760
761 @Return        E_OK on success; Error code otherwise.
762
763 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
764*//***************************************************************************/
765t_Error FM_PORT_ConfigBackupPools(t_Handle h_FmPort, t_FmBackupBmPools *p_FmPortBackupBmPools);
766
767/**************************************************************************//**
768 @Function      FM_PORT_ConfigFrmDiscardOverride
769
770 @Description   Calling this routine changes the error frames destination parameter
771                in the internal driver data base from its default configuration:
772                override = [DEFAULT_PORT_frmDiscardOverride]
773
774                May be used for Rx and OP ports only
775
776 @Param[in]     h_FmPort    A handle to a FM Port module.
777 @Param[in]     override    TRUE to override discarding of error frames and
778                            enqueueing them to error queue.
779
780 @Return        E_OK on success; Error code otherwise.
781
782 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
783*//***************************************************************************/
784t_Error FM_PORT_ConfigFrmDiscardOverride(t_Handle h_FmPort, bool override);
785
786/**************************************************************************//**
787 @Function      FM_PORT_ConfigErrorsToDiscard
788
789 @Description   Calling this routine changes the behaviour on error parameter
790                in the internal driver data base from its default configuration:
791                [DEFAULT_PORT_errorsToDiscard].
792                If a requested error was previously defined as "ErrorsToEnqueue" it's
793                definition will change and the frame will be discarded.
794                Errors that were not defined either as "ErrorsToEnqueue" nor as
795                "ErrorsToDiscard", will be forwarded to CPU.
796
797                May be used for Rx and OP ports only
798
799 @Param[in]     h_FmPort    A handle to a FM Port module.
800 @Param[in]     errs        A list of errors to discard
801
802 @Return        E_OK on success; Error code otherwise.
803
804 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
805*//***************************************************************************/
806t_Error FM_PORT_ConfigErrorsToDiscard(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);
807
808/**************************************************************************//**
809 @Function      FM_PORT_ConfigDmaSwapData
810
811 @Description   Calling this routine changes the DMA swap data aparameter
812                in the internal driver data base from its default
813                configuration  [DEFAULT_PORT_dmaSwapData]
814
815                May be used for all port types
816
817 @Param[in]     h_FmPort    A handle to a FM Port module.
818 @Param[in]     swapData    New selection
819
820 @Return        E_OK on success; Error code otherwise.
821
822 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
823*//***************************************************************************/
824t_Error FM_PORT_ConfigDmaSwapData(t_Handle h_FmPort, e_FmDmaSwapOption swapData);
825
826/**************************************************************************//**
827 @Function      FM_PORT_ConfigDmaIcCacheAttr
828
829 @Description   Calling this routine changes the internal context cache
830                attribute parameter in the internal driver data base
831                from its default configuration  [DEFAULT_PORT_dmaIntContextCacheAttr]
832
833                May be used for all port types
834
835 @Param[in]     h_FmPort               A handle to a FM Port module.
836 @Param[in]     intContextCacheAttr    New selection
837
838 @Return        E_OK on success; Error code otherwise.
839
840 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
841*//***************************************************************************/
842t_Error FM_PORT_ConfigDmaIcCacheAttr(t_Handle h_FmPort, e_FmDmaCacheOption intContextCacheAttr);
843
844/**************************************************************************//**
845 @Function      FM_PORT_ConfigDmaHdrAttr
846
847 @Description   Calling this routine changes the header cache
848                attribute parameter in the internal driver data base
849                from its default configuration  [DEFAULT_PORT_dmaHeaderCacheAttr]
850
851                May be used for all port types
852
853 @Param[in]     h_FmPort                    A handle to a FM Port module.
854 @Param[in]     headerCacheAttr             New selection
855
856 @Return        E_OK on success; Error code otherwise.
857
858 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
859*//***************************************************************************/
860t_Error FM_PORT_ConfigDmaHdrAttr(t_Handle h_FmPort, e_FmDmaCacheOption headerCacheAttr);
861
862/**************************************************************************//**
863 @Function      FM_PORT_ConfigDmaScatterGatherAttr
864
865 @Description   Calling this routine changes the scatter gather cache
866                attribute parameter in the internal driver data base
867                from its default configuration  [DEFAULT_PORT_dmaScatterGatherCacheAttr]
868
869                May be used for all port types
870
871 @Param[in]     h_FmPort                    A handle to a FM Port module.
872 @Param[in]     scatterGatherCacheAttr      New selection
873
874 @Return        E_OK on success; Error code otherwise.
875
876 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
877*//***************************************************************************/
878t_Error FM_PORT_ConfigDmaScatterGatherAttr(t_Handle h_FmPort, e_FmDmaCacheOption scatterGatherCacheAttr);
879
880/**************************************************************************//**
881 @Function      FM_PORT_ConfigDmaWriteOptimize
882
883 @Description   Calling this routine changes the write optimization
884                parameter in the internal driver data base
885                from its default configuration:  By default optimize = [DEFAULT_PORT_dmaWriteOptimize].
886                Note:
887
888                1. For head optimization, data alignment must be >= 16 (supported by default).
889
890                3. For tail optimization, note that the optimization is performed by extending the write transaction
891                of the frame payload at the tail as needed to achieve optimal bus transfers, so that the last write
892                is extended to be on 16/64 bytes aligned block (chip dependent).
893
894                Relevant for non-Tx port types
895
896 @Param[in]     h_FmPort    A handle to a FM Port module.
897 @Param[in]     optimize    TRUE to enable optimization, FALSE for normal operation
898
899 @Return        E_OK on success; Error code otherwise.
900
901 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
902*//***************************************************************************/
903t_Error FM_PORT_ConfigDmaWriteOptimize(t_Handle h_FmPort, bool optimize);
904
905/**************************************************************************//**
906 @Function      FM_PORT_ConfigNoScatherGather
907
908 @Description    Calling this routine changes the noScatherGather parameter in internal driver data base
909                 from its default configuration.
910
911 @Param[in]     h_FmPort        A handle to a FM Port module.
912 @Param[in]     noScatherGather (TRUE - frame is discarded if can not be stored in single buffer,
913                                 FALSE - frame can be stored in scatter gather (S/G) format).
914
915 @Return        E_OK on success; Error code otherwise.
916
917 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
918*//***************************************************************************/
919t_Error FM_PORT_ConfigNoScatherGather(t_Handle h_FmPort, bool noScatherGather);
920
921/**************************************************************************//**
922 @Function      FM_PORT_ConfigDfltColor
923
924 @Description   Calling this routine changes the internal default color parameter
925                in the internal driver data base
926                from its default configuration  [DEFAULT_PORT_color]
927
928                May be used for all port types
929
930 @Param[in]     h_FmPort        A handle to a FM Port module.
931 @Param[in]     color           New selection
932
933 @Return        E_OK on success; Error code otherwise.
934
935 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
936*//***************************************************************************/
937t_Error FM_PORT_ConfigDfltColor(t_Handle h_FmPort, e_FmPortColor color);
938
939/**************************************************************************//**
940 @Function      FM_PORT_ConfigSyncReq
941
942 @Description   Calling this routine changes the synchronization attribute parameter
943                in the internal driver data base from its default configuration:
944                syncReq = [DEFAULT_PORT_syncReq]
945
946                May be used for all port types
947
948 @Param[in]     h_FmPort        A handle to a FM Port module.
949 @Param[in]     syncReq         TRUE to request synchronization, FALSE otherwize.
950
951 @Return        E_OK on success; Error code otherwise.
952
953 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
954*//***************************************************************************/
955t_Error FM_PORT_ConfigSyncReq(t_Handle h_FmPort, bool syncReq);
956
957/**************************************************************************//**
958 @Function      FM_PORT_ConfigForwardReuseIntContext
959
960 @Description   This routine is relevant for Rx ports that are routed to OP port.
961                It changes the internal context reuse option in the internal
962                driver data base from its default configuration:
963                reuse = [DEFAULT_PORT_forwardIntContextReuse]
964
965                May be used for Rx ports only
966
967 @Param[in]     h_FmPort        A handle to a FM Port module.
968 @Param[in]     reuse           TRUE to reuse internal context on frames
969                                forwarded to OP port.
970
971 @Return        E_OK on success; Error code otherwise.
972
973 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
974*//***************************************************************************/
975t_Error FM_PORT_ConfigForwardReuseIntContext(t_Handle h_FmPort, bool reuse);
976
977/**************************************************************************//**
978 @Function      FM_PORT_ConfigDontReleaseTxBufToBM
979
980 @Description   This routine should be called if no Tx confirmation
981                is done, and yet buffers should not be released to the BM.
982                Normally, buffers are returned using the Tx confirmation
983                process. When Tx confirmation is not used (defFqid=0),
984                buffers are typically released to the BM. This routine
985                may be called to avoid this behavior and not release the
986                buffers.
987
988                May be used for Tx ports only
989
990 @Param[in]     h_FmPort        A handle to a FM Port module.
991
992 @Return        E_OK on success; Error code otherwise.
993
994 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
995*//***************************************************************************/
996t_Error FM_PORT_ConfigDontReleaseTxBufToBM(t_Handle h_FmPort);
997
998/**************************************************************************//**
999 @Function      FM_PORT_ConfigIMMaxRxBufLength
1000
1001 @Description   Changes the maximum receive buffer length from its default
1002                configuration: Closest rounded down power of 2 value of the
1003                data buffer size.
1004
1005                The maximum receive buffer length directly affects the structure
1006                of received frames (single- or multi-buffered) and the performance
1007                of both the FM and the driver.
1008
1009                The selection between single- or multi-buffered frames should be
1010                done according to the characteristics of the specific application.
1011                The recommended mode is to use a single data buffer per packet,
1012                as this mode provides the best performance. However, the user can
1013                select to use multiple data buffers per packet.
1014
1015 @Param[in]     h_FmPort        A handle to a FM Port module.
1016 @Param[in]     newVal          Maximum receive buffer length (in bytes).
1017
1018 @Return        E_OK on success; Error code otherwise.
1019
1020 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1021                This routine is to be used only if Independent-Mode is enabled.
1022*//***************************************************************************/
1023t_Error FM_PORT_ConfigIMMaxRxBufLength(t_Handle h_FmPort, uint16_t newVal);
1024
1025/**************************************************************************//**
1026 @Function      FM_PORT_ConfigIMRxBdRingLength
1027
1028 @Description   Changes the receive BD ring length from its default
1029                configuration:[DEFAULT_PORT_rxBdRingLength]
1030
1031 @Param[in]     h_FmPort        A handle to a FM Port module.
1032 @Param[in]     newVal          The desired BD ring length.
1033
1034 @Return        E_OK on success; Error code otherwise.
1035
1036 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1037                This routine is to be used only if Independent-Mode is enabled.
1038*//***************************************************************************/
1039t_Error FM_PORT_ConfigIMRxBdRingLength(t_Handle h_FmPort, uint16_t newVal);
1040
1041/**************************************************************************//**
1042 @Function      FM_PORT_ConfigIMTxBdRingLength
1043
1044 @Description   Changes the transmit BD ring length from its default
1045                configuration:[DEFAULT_PORT_txBdRingLength]
1046
1047 @Param[in]     h_FmPort        A handle to a FM Port module.
1048 @Param[in]     newVal          The desired BD ring length.
1049
1050 @Return        E_OK on success; Error code otherwise.
1051
1052 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1053                This routine is to be used only if Independent-Mode is enabled.
1054*//***************************************************************************/
1055t_Error FM_PORT_ConfigIMTxBdRingLength(t_Handle h_FmPort, uint16_t newVal);
1056
1057/**************************************************************************//**
1058 @Function      FM_PORT_ConfigIMFmanCtrlExternalStructsMemory
1059
1060 @Description   Configures memory partition and attributes for FMan-Controller
1061                data structures (e.g. BD rings).
1062                Calling this routine changes the internal driver data base
1063                from its default configuration
1064                [DEFAULT_PORT_ImfwExtStructsMemId, DEFAULT_PORT_ImfwExtStructsMemAttr].
1065
1066 @Param[in]     h_FmPort        A handle to a FM Port module.
1067 @Param[in]     memId           Memory partition ID.
1068 @Param[in]     memAttributes   Memory attributes mask (a combination of MEMORY_ATTR_x flags).
1069
1070 @Return        E_OK on success; Error code otherwise.
1071*//***************************************************************************/
1072t_Error  FM_PORT_ConfigIMFmanCtrlExternalStructsMemory(t_Handle h_FmPort,
1073                                                       uint8_t  memId,
1074                                                       uint32_t memAttributes);
1075
1076/**************************************************************************//**
1077 @Function      FM_PORT_ConfigIMPolling
1078
1079 @Description   Changes the Rx flow from interrupt driven (default) to polling.
1080
1081 @Param[in]     h_FmPort        A handle to a FM Port module.
1082
1083 @Return        E_OK on success; Error code otherwise.
1084
1085 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1086                This routine is to be used only if Independent-Mode is enabled.
1087*//***************************************************************************/
1088t_Error FM_PORT_ConfigIMPolling(t_Handle h_FmPort);
1089
1090/**************************************************************************//**
1091 @Function      FM_PORT_ConfigMaxFrameLength
1092
1093 @Description   Changes the definition of the max size of frame that should be
1094                transmitted/received on this port from its default value [DEFAULT_PORT_maxFrameLength].
1095                This parameter is used for confirmation of the minimum Fifo
1096                size calculations and only for Tx ports or ports working in
1097                independent mode. This should be larger than the maximum possible
1098                MTU that will be used for this port (i.e. its MAC).
1099
1100 @Param[in]     h_FmPort        A handle to a FM Port module.
1101 @Param[in]     length          Max size of frame
1102
1103 @Return        E_OK on success; Error code otherwise.
1104
1105 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1106                This routine is to be used only if Independent-Mode is enabled.
1107*//***************************************************************************/
1108t_Error FM_PORT_ConfigMaxFrameLength(t_Handle h_FmPort, uint16_t length);
1109
1110/**************************************************************************//*
1111 @Function      FM_PORT_ConfigTxFifoMinFillLevel
1112
1113 @Description   Calling this routine changes the fifo minimum
1114                fill level parameter in the internal driver data base
1115                from its default configuration  [DEFAULT_PORT_txFifoMinFillLevel]
1116
1117                May be used for Tx ports only
1118
1119 @Param[in]     h_FmPort        A handle to a FM Port module.
1120 @Param[in]     minFillLevel    New value
1121
1122 @Return        E_OK on success; Error code otherwise.
1123
1124 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1125*//***************************************************************************/
1126t_Error FM_PORT_ConfigTxFifoMinFillLevel(t_Handle h_FmPort, uint32_t minFillLevel);
1127
1128/**************************************************************************//*
1129 @Function      FM_PORT_ConfigFifoDeqPipelineDepth
1130
1131 @Description   Calling this routine changes the fifo dequeue
1132                pipeline depth parameter in the internal driver data base
1133
1134                from its default configuration: 1G ports: [DEFAULT_PORT_fifoDeqPipelineDepth_1G],
1135                10G port: [DEFAULT_PORT_fifoDeqPipelineDepth_10G],
1136                OP port: [DEFAULT_PORT_fifoDeqPipelineDepth_OH]
1137
1138                May be used for Tx/OP ports only
1139
1140 @Param[in]     h_FmPort            A handle to a FM Port module.
1141 @Param[in]     deqPipelineDepth    New value
1142
1143 @Return        E_OK on success; Error code otherwise.
1144
1145 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1146*//***************************************************************************/
1147t_Error FM_PORT_ConfigFifoDeqPipelineDepth(t_Handle h_FmPort, uint8_t deqPipelineDepth);
1148
1149/**************************************************************************//*
1150 @Function      FM_PORT_ConfigTxFifoLowComfLevel
1151
1152 @Description   Calling this routine changes the fifo low comfort level
1153                parameter in internal driver data base
1154                from its default configuration [DEFAULT_PORT_txFifoLowComfLevel]
1155
1156                May be used for Tx ports only
1157
1158 @Param[in]     h_FmPort            A handle to a FM Port module.
1159 @Param[in]     fifoLowComfLevel    New value
1160
1161 @Return        E_OK on success; Error code otherwise.
1162
1163 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1164*//***************************************************************************/
1165t_Error FM_PORT_ConfigTxFifoLowComfLevel(t_Handle h_FmPort, uint32_t fifoLowComfLevel);
1166
1167/**************************************************************************//*
1168 @Function      FM_PORT_ConfigRxFifoThreshold
1169
1170 @Description   Calling this routine changes the threshold of the FIFO
1171                fill level parameter in the internal driver data base
1172                from its default configuration [DEFAULT_PORT_rxFifoThreshold]
1173
1174                If the total number of buffers which are
1175                currently in use and associated with the
1176                specific RX port exceed this threshold, the
1177                BMI will signal the MAC to send a pause frame
1178                over the link.
1179
1180                May be used for Rx ports only
1181
1182 @Param[in]     h_FmPort            A handle to a FM Port module.
1183 @Param[in]     fifoThreshold       New value
1184
1185 @Return        E_OK on success; Error code otherwise.
1186
1187 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1188*//***************************************************************************/
1189t_Error FM_PORT_ConfigRxFifoThreshold(t_Handle h_FmPort, uint32_t fifoThreshold);
1190
1191/**************************************************************************//*
1192 @Function      FM_PORT_ConfigRxFifoPriElevationLevel
1193
1194 @Description   Calling this routine changes the priority elevation level
1195                parameter in the internal driver data base from its default
1196                configuration  [DEFAULT_PORT_rxFifoPriElevationLevel]
1197
1198                If the total number of buffers which are currently in use and
1199                associated with the specific RX port exceed the amount specified
1200                in priElevationLevel, BMI will signal the main FM's DMA to
1201                elevate the FM priority on the system bus.
1202
1203                May be used for Rx ports only
1204
1205 @Param[in]     h_FmPort            A handle to a FM Port module.
1206 @Param[in]     priElevationLevel   New value
1207
1208 @Return        E_OK on success; Error code otherwise.
1209
1210 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1211*//***************************************************************************/
1212t_Error FM_PORT_ConfigRxFifoPriElevationLevel(t_Handle h_FmPort, uint32_t priElevationLevel);
1213
1214#ifdef FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669
1215/**************************************************************************//*
1216 @Function      FM_PORT_ConfigBCBWorkaround
1217
1218 @Description   Configures BCB errata workaround.
1219
1220                When BCB errata is applicable, the workaround is always
1221                performed by FM Controller. Thus, this functions doesn't
1222                actually enable errata workaround but rather allows driver
1223                to perform adjustments required due to errata workaround
1224                execution in FM controller.
1225
1226                Applying BCB workaround also configures FM_PORT_FRM_ERR_PHYSICAL
1227                errors to be discarded. Thus FM_PORT_FRM_ERR_PHYSICAL can't be
1228                set by FM_PORT_SetErrorsRoute() function.
1229
1230 @Param[in]     h_FmPort            A handle to a FM Port module.
1231
1232 @Return        E_OK on success; Error code otherwise.
1233
1234 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1235*//***************************************************************************/
1236t_Error FM_PORT_ConfigBCBWorkaround(t_Handle h_FmPort);
1237#endif /* FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669 */
1238
1239#if (DPAA_VERSION >= 11)
1240/**************************************************************************//*
1241 @Function      FM_PORT_ConfigInternalBuffOffset
1242
1243 @Description   Configures internal buffer offset.
1244
1245                May be used for Rx and OP ports only
1246
1247 @Param[in]     h_FmPort            A handle to a FM Port module.
1248 @Param[in]     val                 New value
1249
1250 @Return        E_OK on success; Error code otherwise.
1251
1252 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1253*//***************************************************************************/
1254t_Error FM_PORT_ConfigInternalBuffOffset(t_Handle h_FmPort, uint8_t val);
1255#endif /* (DPAA_VERSION >= 11) */
1256
1257/** @} */ /* end of FM_PORT_advanced_init_grp group */
1258/** @} */ /* end of FM_PORT_init_grp group */
1259
1260
1261/**************************************************************************//**
1262 @Group         FM_PORT_runtime_control_grp FM Port Runtime Control Unit
1263
1264 @Description   FM Port Runtime control unit API functions, definitions and enums.
1265
1266 @{
1267*//***************************************************************************/
1268
1269/**************************************************************************//**
1270 @Description   enum for defining FM Port counters
1271*//***************************************************************************/
1272typedef enum e_FmPortCounters {
1273    e_FM_PORT_COUNTERS_CYCLE,                       /**< BMI performance counter */
1274    e_FM_PORT_COUNTERS_TASK_UTIL,                   /**< BMI performance counter */
1275    e_FM_PORT_COUNTERS_QUEUE_UTIL,                  /**< BMI performance counter */
1276    e_FM_PORT_COUNTERS_DMA_UTIL,                    /**< BMI performance counter */
1277    e_FM_PORT_COUNTERS_FIFO_UTIL,                   /**< BMI performance counter */
1278    e_FM_PORT_COUNTERS_RX_PAUSE_ACTIVATION,         /**< BMI Rx only performance counter */
1279    e_FM_PORT_COUNTERS_FRAME,                       /**< BMI statistics counter */
1280    e_FM_PORT_COUNTERS_DISCARD_FRAME,               /**< BMI statistics counter */
1281    e_FM_PORT_COUNTERS_DEALLOC_BUF,                 /**< BMI deallocate buffer statistics counter */
1282    e_FM_PORT_COUNTERS_RX_BAD_FRAME,                /**< BMI Rx only statistics counter */
1283    e_FM_PORT_COUNTERS_RX_LARGE_FRAME,              /**< BMI Rx only statistics counter */
1284    e_FM_PORT_COUNTERS_RX_FILTER_FRAME,             /**< BMI Rx & OP only statistics counter */
1285    e_FM_PORT_COUNTERS_RX_LIST_DMA_ERR,             /**< BMI Rx, OP & HC only statistics counter */
1286    e_FM_PORT_COUNTERS_RX_OUT_OF_BUFFERS_DISCARD,   /**< BMI Rx, OP & HC statistics counter */
1287    e_FM_PORT_COUNTERS_PREPARE_TO_ENQUEUE_COUNTER,  /**< BMI Rx, OP & HC only statistics counter */
1288    e_FM_PORT_COUNTERS_WRED_DISCARD,                /**< BMI OP & HC only statistics counter */
1289    e_FM_PORT_COUNTERS_LENGTH_ERR,                  /**< BMI non-Rx statistics counter */
1290    e_FM_PORT_COUNTERS_UNSUPPRTED_FORMAT,           /**< BMI non-Rx statistics counter */
1291    e_FM_PORT_COUNTERS_DEQ_TOTAL,                   /**< QMI total QM dequeues counter */
1292    e_FM_PORT_COUNTERS_ENQ_TOTAL,                   /**< QMI total QM enqueues counter */
1293    e_FM_PORT_COUNTERS_DEQ_FROM_DEFAULT,            /**< QMI counter */
1294    e_FM_PORT_COUNTERS_DEQ_CONFIRM                  /**< QMI counter */
1295} e_FmPortCounters;
1296
1297typedef struct t_FmPortBmiStats {
1298    uint32_t cntCycle;
1299    uint32_t cntTaskUtil;
1300    uint32_t cntQueueUtil;
1301    uint32_t cntDmaUtil;
1302    uint32_t cntFifoUtil;
1303    uint32_t cntRxPauseActivation;
1304    uint32_t cntFrame;
1305    uint32_t cntDiscardFrame;
1306    uint32_t cntDeallocBuf;
1307    uint32_t cntRxBadFrame;
1308    uint32_t cntRxLargeFrame;
1309    uint32_t cntRxFilterFrame;
1310    uint32_t cntRxListDmaErr;
1311    uint32_t cntRxOutOfBuffersDiscard;
1312    uint32_t cntWredDiscard;
1313    uint32_t cntLengthErr;
1314    uint32_t cntUnsupportedFormat;
1315} t_FmPortBmiStats;
1316
1317/**************************************************************************//**
1318 @Description   Structure for Port id parameters.
1319                Fields commented 'IN' are passed by the port module to be used
1320                by the FM module.
1321                Fields commented 'OUT' will be filled by FM before returning to port.
1322*//***************************************************************************/
1323typedef struct t_FmPortCongestionGrps {
1324    uint16_t    numOfCongestionGrpsToConsider;          /**< The number of required CGs
1325                                                             to define the size of the following array */
1326    uint8_t     congestionGrpsToConsider[FM_PORT_NUM_OF_CONGESTION_GRPS];
1327                                                        /**< An array of CG indexes;
1328                                                             Note that the size of the array should be
1329                                                             'numOfCongestionGrpsToConsider'. */
1330#if (DPAA_VERSION >= 11)
1331    bool        pfcPrioritiesEn[FM_PORT_NUM_OF_CONGESTION_GRPS][FM_MAX_NUM_OF_PFC_PRIORITIES];
1332                                                        /**< a matrix that represents the map between the CG ids
1333                                                             defined in 'congestionGrpsToConsider' to the priorties
1334                                                             mapping array. */
1335#endif /* (DPAA_VERSION >= 11) */
1336} t_FmPortCongestionGrps;
1337
1338/**************************************************************************//**
1339 @Description   Structure for Deep Sleep Auto Response ARP Entry
1340*//***************************************************************************/
1341typedef struct t_FmPortDsarArpEntry
1342{
1343    uint32_t  ipAddress;
1344    uint8_t   mac[6];
1345    bool      isVlan;
1346    uint16_t  vid;
1347} t_FmPortDsarArpEntry;
1348
1349/**************************************************************************//**
1350 @Description   Structure for Deep Sleep Auto Response ARP info
1351*//***************************************************************************/
1352typedef struct t_FmPortDsarArpInfo
1353{
1354    uint8_t           tableSize;
1355    t_FmPortDsarArpEntry *p_AutoResTable;
1356    bool              enableConflictDetection; /* when TRUE Conflict Detection will be checked and wake the host if needed */
1357} t_FmPortDsarArpInfo;
1358
1359/**************************************************************************//**
1360 @Description   Structure for Deep Sleep Auto Response NDP Entry
1361*//***************************************************************************/
1362typedef struct t_FmPortDsarNdpEntry
1363{
1364    uint32_t  ipAddress[4];
1365    uint8_t   mac[6];
1366    bool      isVlan;
1367    uint16_t  vid;
1368} t_FmPortDsarNdpEntry;
1369
1370/**************************************************************************//**
1371 @Description   Structure for Deep Sleep Auto Response NDP info
1372*//***************************************************************************/
1373typedef struct t_FmPortDsarNdpInfo
1374{
1375    uint32_t              multicastGroup;
1376
1377    uint8_t               tableSizeAssigned;
1378    t_FmPortDsarNdpEntry  *p_AutoResTableAssigned; /* This list refer to solicitation IP addresses.
1379                                                                 Note that all IP adresses must be from the same multicast group.
1380                                                                 This will be checked and if not operation will fail. */
1381    uint8_t               tableSizeTmp;
1382    t_FmPortDsarNdpEntry  *p_AutoResTableTmp;      /* This list refer to temp IP addresses.
1383                                                             Note that all temp IP adresses must be from the same multicast group.
1384                                                             This will be checked and if not operation will fail. */
1385
1386    bool                  enableConflictDetection; /* when TRUE Conflict Detection will be checked and wake the host if needed */
1387
1388} t_FmPortDsarNdpInfo;
1389
1390/**************************************************************************//**
1391 @Description   Structure for Deep Sleep Auto Response ICMPV4 info
1392*//***************************************************************************/
1393typedef struct t_FmPortDsarEchoIpv4Info
1394{
1395    uint8_t            tableSize;
1396    t_FmPortDsarArpEntry  *p_AutoResTable;
1397} t_FmPortDsarEchoIpv4Info;
1398
1399/**************************************************************************//**
1400 @Description   Structure for Deep Sleep Auto Response ICMPV6 info
1401*//***************************************************************************/
1402typedef struct t_FmPortDsarEchoIpv6Info
1403{
1404    uint8_t            tableSize;
1405    t_FmPortDsarNdpEntry  *p_AutoResTable;
1406} t_FmPortDsarEchoIpv6Info;
1407
1408/**************************************************************************//**
1409@Description    Deep Sleep Auto Response SNMP OIDs table entry
1410
1411*//***************************************************************************/
1412typedef struct {
1413	uint16_t     oidSize;
1414	uint8_t      *oidVal; /* only the oid string */
1415	uint16_t     resSize;
1416	uint8_t      *resVal; /* resVal will be the entire reply,
1417				i.e. "Type|Length|Value" */
1418} t_FmPortDsarOidsEntry;
1419
1420/**************************************************************************//**
1421 @Description   Deep Sleep Auto Response SNMP IPv4 Addresses Table Entry
1422                Refer to the FMan Controller spec for more details.
1423*//***************************************************************************/
1424typedef struct
1425{
1426    uint32_t ipv4Addr; /*!< 32 bit IPv4 Address. */
1427    bool      isVlan;
1428    uint16_t vid;   /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
1429                       /*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
1430} t_FmPortDsarSnmpIpv4AddrTblEntry;
1431
1432/**************************************************************************//**
1433 @Description   Deep Sleep Auto Response SNMP IPv6 Addresses Table Entry
1434                Refer to the FMan Controller spec for more details.
1435*//***************************************************************************/
1436typedef struct
1437{
1438    uint32_t ipv6Addr[4];  /*!< 4 * 32 bit IPv6 Address.                                                     */
1439    bool      isVlan;
1440    uint16_t vid;       /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
1441                           /*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
1442} t_FmPortDsarSnmpIpv6AddrTblEntry;
1443
1444/**************************************************************************//**
1445 @Description   Deep Sleep Auto Response SNMP Descriptor
1446
1447*//***************************************************************************/
1448typedef struct
1449{
1450    uint16_t control;                          /**< Control bits [0-15]. */
1451    uint16_t maxSnmpMsgLength;                 /**< Maximal allowed SNMP message length. */
1452    uint16_t numOfIpv4Addresses;               /**< Number of entries in IPv4 addresses table. */
1453    uint16_t numOfIpv6Addresses;               /**< Number of entries in IPv6 addresses table. */
1454    t_FmPortDsarSnmpIpv4AddrTblEntry *p_Ipv4AddrTbl; /**< Pointer to IPv4 addresses table. */
1455    t_FmPortDsarSnmpIpv6AddrTblEntry *p_Ipv6AddrTbl; /**< Pointer to IPv6 addresses table. */
1456    uint8_t *p_RdOnlyCommunityStr;             /**< Pointer to the Read Only Community String. */
1457    uint8_t *p_RdWrCommunityStr;               /**< Pointer to the Read Write Community String. */
1458    t_FmPortDsarOidsEntry *p_OidsTbl;                 /**< Pointer to OIDs table. */
1459    uint32_t oidsTblSize;                      /**< Number of entries in OIDs table. */
1460} t_FmPortDsarSnmpInfo;
1461
1462/**************************************************************************//**
1463 @Description   Structure for Deep Sleep Auto Response filtering Entry
1464*//***************************************************************************/
1465typedef struct t_FmPortDsarFilteringEntry
1466{
1467    uint16_t    srcPort;
1468    uint16_t    dstPort;
1469    uint16_t    srcPortMask;
1470    uint16_t    dstPortMask;
1471} t_FmPortDsarFilteringEntry;
1472
1473/**************************************************************************//**
1474 @Description   Structure for Deep Sleep Auto Response filtering info
1475*//***************************************************************************/
1476typedef struct t_FmPortDsarFilteringInfo
1477{
1478    /* IP protocol filtering parameters */
1479    uint8_t     ipProtTableSize;
1480    uint8_t     *p_IpProtTablePtr;
1481    bool        ipProtPassOnHit;  /* when TRUE, miss in the table will cause the packet to be droped,
1482                                         hit will pass the packet to UDP/TCP filters if needed and if not
1483                                         to the classification tree. If the classification tree will pass
1484                                         the packet to a queue it will cause a wake interupt.
1485                                         When FALSE it the other way around. */
1486    /* UDP port filtering parameters */
1487    uint8_t     udpPortsTableSize;
1488    t_FmPortDsarFilteringEntry *p_UdpPortsTablePtr;
1489    bool        udpPortPassOnHit; /* when TRUE, miss in the table will cause the packet to be droped,
1490                                         hit will pass the packet to classification tree.
1491                                         If the classification tree will pass the packet to a queue it
1492                                         will cause a wake interupt.
1493                                         When FALSE it the other way around. */
1494    /* TCP port filtering parameters */
1495    uint16_t    tcpFlagsMask;
1496    uint8_t     tcpPortsTableSize;
1497    t_FmPortDsarFilteringEntry *p_TcpPortsTablePtr;
1498    bool        tcpPortPassOnHit; /* when TRUE, miss in the table will cause the packet to be droped,
1499                                         hit will pass the packet to classification tree.
1500                                         If the classification tree will pass the packet to a queue it
1501                                         will cause a wake interupt.
1502                                         When FALSE it the other way around. */
1503} t_FmPortDsarFilteringInfo;
1504
1505/**************************************************************************//**
1506 @Description   Structure for Deep Sleep Auto Response parameters
1507*//***************************************************************************/
1508typedef struct t_FmPortDsarParams
1509{
1510    t_Handle                  h_FmPortTx;
1511    t_FmPortDsarArpInfo       *p_AutoResArpInfo;
1512    t_FmPortDsarEchoIpv4Info  *p_AutoResEchoIpv4Info;
1513    t_FmPortDsarNdpInfo       *p_AutoResNdpInfo;
1514    t_FmPortDsarEchoIpv6Info  *p_AutoResEchoIpv6Info;
1515    t_FmPortDsarSnmpInfo      *p_AutoResSnmpInfo;
1516    t_FmPortDsarFilteringInfo *p_AutoResFilteringInfo;
1517} t_FmPortDsarParams;
1518
1519/**************************************************************************//**
1520 @Function      FM_PORT_EnterDsar
1521
1522 @Description   Enter Deep Sleep Auto Response mode.
1523                This function write the apropriate values to in the relevant
1524                tables in the MURAM.
1525
1526 @Param[in]     h_FmPortRx - FM PORT module descriptor
1527 @Param[in]     params - Auto Response parameters
1528
1529 @Return        E_OK on success; Error code otherwise.
1530
1531 @Cautions      Allowed only following FM_PORT_Init().
1532*//***************************************************************************/
1533t_Error FM_PORT_EnterDsar(t_Handle h_FmPortRx, t_FmPortDsarParams *params);
1534
1535/**************************************************************************//**
1536 @Function      FM_PORT_EnterDsarFinal
1537
1538 @Description   Enter Deep Sleep Auto Response mode.
1539                This function sets the Tx port in independent mode as needed
1540                and redirect the receive flow to go through the
1541                Dsar Fman-ctrl code
1542
1543 @Param[in]     h_DsarRxPort - FM Rx PORT module descriptor
1544 @Param[in]     h_DsarTxPort - FM Tx PORT module descriptor
1545
1546 @Return        E_OK on success; Error code otherwise.
1547
1548 @Cautions      Allowed only following FM_PORT_Init().
1549*//***************************************************************************/
1550t_Error FM_PORT_EnterDsarFinal(t_Handle h_DsarRxPort, t_Handle h_DsarTxPort);
1551
1552/**************************************************************************//**
1553 @Function      FM_PORT_ExitDsar
1554
1555 @Description   Exit Deep Sleep Auto Response mode.
1556                This function reverse the AR mode and put the ports back into
1557                their original wake mode
1558
1559 @Param[in]     h_FmPortRx - FM PORT Rx module descriptor
1560 @Param[in]     h_FmPortTx - FM PORT Tx module descriptor
1561
1562 @Return        E_OK on success; Error code otherwise.
1563
1564 @Cautions      Allowed only following FM_PORT_EnterDsar().
1565*//***************************************************************************/
1566void FM_PORT_ExitDsar(t_Handle h_FmPortRx, t_Handle h_FmPortTx);
1567
1568/**************************************************************************//**
1569 @Function      FM_PORT_IsInDsar
1570
1571 @Description   This function returns TRUE if the port was set as Auto Response
1572                and FALSE if not. Once Exit AR mode it will return FALSE as well
1573                until re-enabled once more.
1574
1575 @Param[in]     h_FmPort - FM PORT module descriptor
1576
1577 @Return        E_OK on success; Error code otherwise.
1578*//***************************************************************************/
1579bool FM_PORT_IsInDsar(t_Handle h_FmPort);
1580
1581typedef struct t_FmPortDsarStats
1582{
1583    uint32_t arpArCnt;
1584    uint32_t echoIcmpv4ArCnt;
1585    uint32_t ndpArCnt;
1586    uint32_t echoIcmpv6ArCnt;
1587    uint32_t snmpGetCnt;
1588    uint32_t snmpGetNextCnt;
1589} t_FmPortDsarStats;
1590
1591/**************************************************************************//**
1592 @Function      FM_PORT_GetDsarStats
1593
1594 @Description   Return statistics for Deep Sleep Auto Response
1595
1596 @Param[in]     h_FmPortRx - FM PORT module descriptor
1597 @Param[out]    stats - structure containing the statistics counters
1598
1599 @Return        E_OK on success; Error code otherwise.
1600*//***************************************************************************/
1601t_Error FM_PORT_GetDsarStats(t_Handle h_FmPortRx, t_FmPortDsarStats *stats);
1602
1603#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1604/**************************************************************************//**
1605 @Function      FM_PORT_DumpRegs
1606
1607 @Description   Dump all regs.
1608
1609                Calling this routine invalidates the descriptor.
1610
1611 @Param[in]     h_FmPort - FM PORT module descriptor
1612
1613 @Return        E_OK on success; Error code otherwise.
1614
1615 @Cautions      Allowed only following FM_PORT_Init().
1616*//***************************************************************************/
1617t_Error FM_PORT_DumpRegs(t_Handle h_FmPort);
1618#endif /* (defined(DEBUG_ERRORS) && ... */
1619
1620/**************************************************************************//**
1621 @Function      FM_PORT_GetBufferDataOffset
1622
1623 @Description   Relevant for Rx ports.
1624                Returns the data offset from the beginning of the data buffer
1625
1626 @Param[in]     h_FmPort - FM PORT module descriptor
1627
1628 @Return        data offset.
1629
1630 @Cautions      Allowed only following FM_PORT_Init().
1631*//***************************************************************************/
1632uint32_t FM_PORT_GetBufferDataOffset(t_Handle h_FmPort);
1633
1634/**************************************************************************//**
1635 @Function      FM_PORT_GetBufferICInfo
1636
1637 @Description   Returns the Internal Context offset from the beginning of the data buffer
1638
1639 @Param[in]     h_FmPort - FM PORT module descriptor
1640 @Param[in]     p_Data   - A pointer to the data buffer.
1641
1642 @Return        Internal context info pointer on success, NULL if 'allOtherInfo' was not
1643                configured for this port.
1644
1645 @Cautions      Allowed only following FM_PORT_Init().
1646*//***************************************************************************/
1647uint8_t * FM_PORT_GetBufferICInfo(t_Handle h_FmPort, char *p_Data);
1648
1649/**************************************************************************//**
1650 @Function      FM_PORT_GetBufferPrsResult
1651
1652 @Description   Returns the pointer to the parse result in the data buffer.
1653                In Rx ports this is relevant after reception, if parse
1654                result is configured to be part of the data passed to the
1655                application. For non Rx ports it may be used to get the pointer
1656                of the area in the buffer where parse result should be
1657                initialized - if so configured.
1658                See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
1659                configuration.
1660
1661 @Param[in]     h_FmPort    - FM PORT module descriptor
1662 @Param[in]     p_Data      - A pointer to the data buffer.
1663
1664 @Return        Parse result pointer on success, NULL if parse result was not
1665                configured for this port.
1666
1667 @Cautions      Allowed only following FM_PORT_Init().
1668*//***************************************************************************/
1669t_FmPrsResult * FM_PORT_GetBufferPrsResult(t_Handle h_FmPort, char *p_Data);
1670
1671/**************************************************************************//**
1672 @Function      FM_PORT_GetBufferTimeStamp
1673
1674 @Description   Returns the time stamp in the data buffer.
1675                Relevant for Rx ports for getting the buffer time stamp.
1676                See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
1677                configuration.
1678
1679 @Param[in]     h_FmPort    - FM PORT module descriptor
1680 @Param[in]     p_Data      - A pointer to the data buffer.
1681
1682 @Return        A pointer to the hash result on success, NULL otherwise.
1683
1684 @Cautions      Allowed only following FM_PORT_Init().
1685*//***************************************************************************/
1686uint64_t * FM_PORT_GetBufferTimeStamp(t_Handle h_FmPort, char *p_Data);
1687
1688/**************************************************************************//**
1689 @Function      FM_PORT_GetBufferHashResult
1690
1691 @Description   Given a data buffer, on the condition that hash result was defined
1692                as a part of the buffer content (see FM_PORT_ConfigBufferPrefixContent)
1693                this routine will return the pointer to the hash result location in the
1694                buffer prefix.
1695
1696 @Param[in]     h_FmPort    - FM PORT module descriptor
1697 @Param[in]     p_Data      - A pointer to the data buffer.
1698
1699 @Return        A pointer to the hash result on success, NULL otherwise.
1700
1701 @Cautions      Allowed only following FM_PORT_Init().
1702*//***************************************************************************/
1703uint8_t * FM_PORT_GetBufferHashResult(t_Handle h_FmPort, char *p_Data);
1704
1705/**************************************************************************//**
1706 @Function      FM_PORT_Disable
1707
1708 @Description   Gracefully disable an FM port. The port will not start new tasks after all
1709                tasks associated with the port are terminated.
1710
1711 @Param[in]     h_FmPort    A handle to a FM Port module.
1712
1713 @Return        E_OK on success; Error code otherwise.
1714
1715 @Cautions      Allowed only following FM_PORT_Init().
1716                This is a blocking routine, it returns after port is
1717                gracefully stopped, i.e. the port will not except new frames,
1718                but it will finish all frames or tasks which were already began
1719*//***************************************************************************/
1720t_Error FM_PORT_Disable(t_Handle h_FmPort);
1721
1722/**************************************************************************//**
1723 @Function      FM_PORT_Enable
1724
1725 @Description   A runtime routine provided to allow disable/enable of port.
1726
1727 @Param[in]     h_FmPort    A handle to a FM Port module.
1728
1729 @Return        E_OK on success; Error code otherwise.
1730
1731 @Cautions      Allowed only following FM_PORT_Init().
1732*//***************************************************************************/
1733t_Error FM_PORT_Enable(t_Handle h_FmPort);
1734
1735/**************************************************************************//**
1736 @Function      FM_PORT_SetRateLimit
1737
1738 @Description   Calling this routine enables rate limit algorithm.
1739                By default, this functionality is disabled.
1740                Note that rate-limit mechanism uses the FM time stamp.
1741                The selected rate limit specified here would be
1742                rounded DOWN to the nearest 16M.
1743
1744                May be used for Tx and OP ports only
1745
1746 @Param[in]     h_FmPort        A handle to a FM Port module.
1747 @Param[in]     p_RateLimit     A structure of rate limit parameters
1748
1749 @Return        E_OK on success; Error code otherwise.
1750
1751 @Cautions      Allowed only following FM_PORT_Init().
1752                If rate limit is set on a port that need to send PFC frames,
1753                it might violate the stop transmit timing.
1754*//***************************************************************************/
1755t_Error FM_PORT_SetRateLimit(t_Handle h_FmPort, t_FmPortRateLimit *p_RateLimit);
1756
1757/**************************************************************************//**
1758 @Function      FM_PORT_DeleteRateLimit
1759
1760 @Description   Calling this routine disables and clears rate limit
1761                initialization.
1762
1763                May be used for Tx and OP ports only
1764
1765 @Param[in]     h_FmPort        A handle to a FM Port module.
1766
1767 @Return        E_OK on success; Error code otherwise.
1768
1769 @Cautions      Allowed only following FM_PORT_Init().
1770*//***************************************************************************/
1771t_Error FM_PORT_DeleteRateLimit(t_Handle h_FmPort);
1772
1773/**************************************************************************//**
1774 @Function      FM_PORT_SetPfcPrioritiesMappingToQmanWQ
1775
1776 @Description   Calling this routine maps each PFC received priority to the transmit WQ.
1777                This WQ will be blocked upon receiving a PFC frame with this priority.
1778
1779                May be used for Tx ports only.
1780
1781 @Param[in]     h_FmPort        A handle to a FM Port module.
1782 @Param[in]     prio            PFC priority (0-7).
1783 @Param[in]     wq              Work Queue (0-7).
1784
1785 @Return        E_OK on success; Error code otherwise.
1786
1787 @Cautions      Allowed only following FM_PORT_Init().
1788*//***************************************************************************/
1789t_Error FM_PORT_SetPfcPrioritiesMappingToQmanWQ(t_Handle h_FmPort, uint8_t prio, uint8_t wq);
1790
1791/**************************************************************************//**
1792 @Function      FM_PORT_SetStatisticsCounters
1793
1794 @Description   Calling this routine enables/disables port's statistics counters.
1795                By default, counters are enabled.
1796
1797                May be used for all port types
1798
1799 @Param[in]     h_FmPort    A handle to a FM Port module.
1800 @Param[in]     enable      TRUE to enable, FALSE to disable.
1801
1802 @Return        E_OK on success; Error code otherwise.
1803
1804 @Cautions      Allowed only following FM_PORT_Init().
1805*//***************************************************************************/
1806t_Error FM_PORT_SetStatisticsCounters(t_Handle h_FmPort, bool enable);
1807
1808/**************************************************************************//**
1809 @Function      FM_PORT_SetFrameQueueCounters
1810
1811 @Description   Calling this routine enables/disables port's enqueue/dequeue counters.
1812                By default, counters are enabled.
1813
1814                May be used for all ports
1815
1816 @Param[in]     h_FmPort    A handle to a FM Port module.
1817 @Param[in]     enable      TRUE to enable, FALSE to disable.
1818
1819 @Return        E_OK on success; Error code otherwise.
1820
1821 @Cautions      Allowed only following FM_PORT_Init().
1822*//***************************************************************************/
1823t_Error FM_PORT_SetFrameQueueCounters(t_Handle h_FmPort, bool enable);
1824
1825/**************************************************************************//**
1826 @Function      FM_PORT_AnalyzePerformanceParams
1827
1828 @Description   User may call this routine to so the driver will analyze if the
1829                basic performance parameters are correct and also the driver may
1830                suggest of improvements; The basic parameters are FIFO sizes, number
1831                of DMAs and number of TNUMs for the port.
1832
1833                May be used for all port types
1834
1835 @Param[in]     h_FmPort                A handle to a FM Port module.
1836
1837 @Return        E_OK on success; Error code otherwise.
1838
1839 @Cautions      Allowed only following FM_PORT_Init().
1840*//***************************************************************************/
1841t_Error FM_PORT_AnalyzePerformanceParams(t_Handle h_FmPort);
1842
1843
1844/**************************************************************************//**
1845 @Function      FM_PORT_SetAllocBufCounter
1846
1847 @Description   Calling this routine enables/disables BM pool allocate
1848                buffer counters.
1849                By default, counters are enabled.
1850
1851                May be used for Rx ports only
1852
1853 @Param[in]     h_FmPort    A handle to a FM Port module.
1854 @Param[in]     poolId      BM pool id.
1855 @Param[in]     enable      TRUE to enable, FALSE to disable.
1856
1857 @Return        E_OK on success; Error code otherwise.
1858
1859 @Cautions      Allowed only following FM_PORT_Init().
1860*//***************************************************************************/
1861t_Error FM_PORT_SetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId, bool enable);
1862
1863/**************************************************************************//**
1864 @Function      FM_PORT_GetBmiCounters
1865
1866 @Description   Read port's BMI stat counters and place them into
1867                a designated structure of counters.
1868
1869 @Param[in]     h_FmPort    A handle to a FM Port module.
1870 @Param[out]    p_BmiStats  counters structure
1871
1872 @Return        E_OK on success; Error code otherwise.
1873
1874 @Cautions      Allowed only following FM_PORT_Init().
1875*//***************************************************************************/
1876t_Error FM_PORT_GetBmiCounters(t_Handle h_FmPort, t_FmPortBmiStats *p_BmiStats);
1877
1878/**************************************************************************//**
1879 @Function      FM_PORT_GetCounter
1880
1881 @Description   Reads one of the FM PORT counters.
1882
1883 @Param[in]     h_FmPort            A handle to a FM Port module.
1884 @Param[in]     fmPortCounter       The requested counter.
1885
1886 @Return        Counter's current value.
1887
1888 @Cautions      Allowed only following FM_PORT_Init().
1889                Note that it is user's responsibility to call this routine only
1890                for enabled counters, and there will be no indication if a
1891                disabled counter is accessed.
1892*//***************************************************************************/
1893uint32_t FM_PORT_GetCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter);
1894
1895/**************************************************************************//**
1896 @Function      FM_PORT_ModifyCounter
1897
1898 @Description   Sets a value to an enabled counter. Use "0" to reset the counter.
1899
1900 @Param[in]     h_FmPort            A handle to a FM Port module.
1901 @Param[in]     fmPortCounter       The requested counter.
1902 @Param[in]     value               The requested value to be written into the counter.
1903
1904 @Return        E_OK on success; Error code otherwise.
1905
1906 @Cautions      Allowed only following FM_PORT_Init().
1907*//***************************************************************************/
1908t_Error FM_PORT_ModifyCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter, uint32_t value);
1909
1910/**************************************************************************//**
1911 @Function      FM_PORT_GetAllocBufCounter
1912
1913 @Description   Reads one of the FM PORT buffer counters.
1914
1915 @Param[in]     h_FmPort            A handle to a FM Port module.
1916 @Param[in]     poolId              The requested pool.
1917
1918 @Return        Counter's current value.
1919
1920 @Cautions      Allowed only following FM_PORT_Init().
1921                Note that it is user's responsibility to call this routine only
1922                for enabled counters, and there will be no indication if a
1923                disabled counter is accessed.
1924*//***************************************************************************/
1925uint32_t FM_PORT_GetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId);
1926
1927/**************************************************************************//**
1928 @Function      FM_PORT_ModifyAllocBufCounter
1929
1930 @Description   Sets a value to an enabled counter. Use "0" to reset the counter.
1931
1932 @Param[in]     h_FmPort            A handle to a FM Port module.
1933 @Param[in]     poolId              The requested pool.
1934 @Param[in]     value               The requested value to be written into the counter.
1935
1936 @Return        E_OK on success; Error code otherwise.
1937
1938 @Cautions      Allowed only following FM_PORT_Init().
1939*//***************************************************************************/
1940t_Error FM_PORT_ModifyAllocBufCounter(t_Handle h_FmPort,  uint8_t poolId, uint32_t value);
1941
1942/**************************************************************************//**
1943 @Function      FM_PORT_AddCongestionGrps
1944
1945 @Description   This routine effects the corresponding Tx port.
1946                It should be called in order to enable pause
1947                frame transmission in case of congestion in one or more
1948                of the congestion groups relevant to this port.
1949                Each call to this routine may add one or more congestion
1950                groups to be considered relevant to this port.
1951
1952                May be used for Rx, or RX+OP ports only (depending on chip)
1953
1954 @Param[in]     h_FmPort            A handle to a FM Port module.
1955 @Param[in]     p_CongestionGrps    A pointer to an array of congestion groups
1956                                    id's to consider.
1957
1958 @Return        E_OK on success; Error code otherwise.
1959
1960 @Cautions      Allowed only following FM_PORT_Init().
1961*//***************************************************************************/
1962t_Error FM_PORT_AddCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);
1963
1964/**************************************************************************//**
1965 @Function      FM_PORT_RemoveCongestionGrps
1966
1967 @Description   This routine effects the corresponding Tx port. It should be
1968                called when congestion groups were
1969                defined for this port and are no longer relevant, or pause
1970                frames transmitting is not required on their behalf.
1971                Each call to this routine may remove one or more congestion
1972                groups to be considered relevant to this port.
1973
1974                May be used for Rx, or RX+OP ports only (depending on chip)
1975
1976 @Param[in]     h_FmPort            A handle to a FM Port module.
1977 @Param[in]     p_CongestionGrps    A pointer to an array of congestion groups
1978                                    id's to consider.
1979
1980 @Return        E_OK on success; Error code otherwise.
1981
1982 @Cautions      Allowed only following FM_PORT_Init().
1983*//***************************************************************************/
1984t_Error FM_PORT_RemoveCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);
1985
1986/**************************************************************************//**
1987 @Function      FM_PORT_IsStalled
1988
1989 @Description   A routine for checking whether the specified port is stalled.
1990
1991 @Param[in]     h_FmPort            A handle to a FM Port module.
1992
1993 @Return        TRUE if port is stalled, FALSE otherwize
1994
1995 @Cautions      Allowed only following FM_PORT_Init().
1996*//***************************************************************************/
1997bool FM_PORT_IsStalled(t_Handle h_FmPort);
1998
1999/**************************************************************************//**
2000 @Function      FM_PORT_ReleaseStalled
2001
2002 @Description   This routine may be called in case the port was stalled and may
2003                now be released.
2004                Note that this routine is available only on older FMan revisions
2005                (FMan v2, DPAA v1.0 only).
2006
2007 @Param[in]     h_FmPort    A handle to a FM Port module.
2008
2009 @Return        E_OK on success; Error code otherwise.
2010
2011 @Cautions      Allowed only following FM_PORT_Init().
2012*//***************************************************************************/
2013t_Error FM_PORT_ReleaseStalled(t_Handle h_FmPort);
2014
2015/**************************************************************************//**
2016 @Function      FM_PORT_SetRxL4ChecksumVerify
2017
2018 @Description   This routine is relevant for Rx ports (1G and 10G). The routine
2019                set/clear the L3/L4 checksum verification (on RX side).
2020                Note that this takes affect only if hw-parser is enabled!
2021
2022 @Param[in]     h_FmPort        A handle to a FM Port module.
2023 @Param[in]     l4Checksum      boolean indicates whether to do L3/L4 checksum
2024                                on frames or not.
2025
2026 @Return        E_OK on success; Error code otherwise.
2027
2028 @Cautions      Allowed only following FM_PORT_Init().
2029*//***************************************************************************/
2030t_Error FM_PORT_SetRxL4ChecksumVerify(t_Handle h_FmPort, bool l4Checksum);
2031
2032/**************************************************************************//**
2033 @Function      FM_PORT_SetErrorsRoute
2034
2035 @Description   Errors selected for this routine will cause a frame with that error
2036                to be enqueued to error queue.
2037                Errors not selected for this routine will cause a frame with that error
2038                to be enqueued to the one of the other port queues.
2039                By default all errors are defined to be enqueued to error queue.
2040                Errors that were configured to be discarded (at initialization)
2041                may not be selected here.
2042
2043                May be used for Rx and OP ports only
2044
2045 @Param[in]     h_FmPort    A handle to a FM Port module.
2046 @Param[in]     errs        A list of errors to enqueue to error queue
2047
2048 @Return        E_OK on success; Error code otherwise.
2049
2050 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
2051*//***************************************************************************/
2052t_Error FM_PORT_SetErrorsRoute(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);
2053
2054/**************************************************************************//**
2055 @Function      FM_PORT_SetIMExceptions
2056
2057 @Description   Calling this routine enables/disables FM PORT interrupts.
2058
2059 @Param[in]     h_FmPort        FM PORT module descriptor.
2060 @Param[in]     exception       The exception to be selected.
2061 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.
2062
2063 @Return        E_OK on success; Error code otherwise.
2064
2065 @Cautions      Allowed only following FM_PORT_Init().
2066                This routine should NOT be called from guest-partition
2067                (i.e. guestId != NCSW_MASTER_ID)
2068*//***************************************************************************/
2069t_Error FM_PORT_SetIMExceptions(t_Handle h_FmPort, e_FmPortExceptions exception, bool enable);
2070
2071/**************************************************************************//*
2072 @Function      FM_PORT_SetPerformanceCounters
2073
2074 @Description   Calling this routine enables/disables port's performance counters.
2075                By default, counters are enabled.
2076
2077                May be used for all port types
2078
2079 @Param[in]     h_FmPort                A handle to a FM Port module.
2080 @Param[in]     enable                  TRUE to enable, FALSE to disable.
2081
2082 @Return        E_OK on success; Error code otherwise.
2083
2084 @Cautions      Allowed only following FM_PORT_Init().
2085*//***************************************************************************/
2086t_Error FM_PORT_SetPerformanceCounters(t_Handle h_FmPort, bool enable);
2087
2088/**************************************************************************//*
2089 @Function      FM_PORT_SetPerformanceCountersParams
2090
2091 @Description   Calling this routine defines port's performance
2092                counters parameters.
2093
2094                May be used for all port types
2095
2096 @Param[in]     h_FmPort                A handle to a FM Port module.
2097 @Param[in]     p_FmPortPerformanceCnt  A pointer to a structure of performance
2098                                        counters parameters.
2099
2100 @Return        E_OK on success; Error code otherwise.
2101
2102 @Cautions      Allowed only following FM_PORT_Init().
2103*//***************************************************************************/
2104t_Error FM_PORT_SetPerformanceCountersParams(t_Handle h_FmPort, t_FmPortPerformanceCnt *p_FmPortPerformanceCnt);
2105
2106/**************************************************************************//**
2107 @Group         FM_PORT_pcd_runtime_control_grp FM Port PCD Runtime Control Unit
2108
2109 @Description   FM Port PCD Runtime control unit API functions, definitions and enums.
2110
2111 @{
2112*//***************************************************************************/
2113
2114/**************************************************************************//**
2115 @Description   A structure defining the KG scheme after the parser.
2116                This is relevant only to change scheme selection mode - from
2117                direct to indirect and vice versa, or when the scheme is selected directly,
2118                to select the scheme id.
2119
2120*//***************************************************************************/
2121typedef struct t_FmPcdKgSchemeSelect {
2122    bool        direct;                 /**< TRUE to use 'h_Scheme' directly, FALSE to use LCV. */
2123    t_Handle    h_DirectScheme;         /**< Scheme handle, selects the scheme after parser;
2124                                             Relevant only when 'direct' is TRUE. */
2125} t_FmPcdKgSchemeSelect;
2126
2127/**************************************************************************//**
2128 @Description   A structure of scheme parameters
2129*//***************************************************************************/
2130typedef struct t_FmPcdPortSchemesParams {
2131    uint8_t     numOfSchemes;                           /**< Number of schemes for port to be bound to. */
2132    t_Handle    h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES];    /**< Array of 'numOfSchemes' schemes for the
2133                                                             port to be bound to */
2134} t_FmPcdPortSchemesParams;
2135
2136/**************************************************************************//**
2137 @Description   Union for defining port protocol parameters for parser
2138*//***************************************************************************/
2139typedef union u_FmPcdHdrPrsOpts {
2140    /* MPLS */
2141    struct {
2142        bool            labelInterpretationEnable;  /**< When this bit is set, the last MPLS label will be
2143                                                         interpreted as described in HW spec table. When the bit
2144                                                         is cleared, the parser will advance to MPLS next parse */
2145        e_NetHeaderType nextParse;                  /**< must be equal or higher than IPv4 */
2146    } mplsPrsOptions;
2147    /* VLAN */
2148    struct {
2149        uint16_t        tagProtocolId1;             /**< User defined Tag Protocol Identifier, to be recognized
2150                                                         on VLAN TAG on top of 0x8100 and 0x88A8 */
2151        uint16_t        tagProtocolId2;             /**< User defined Tag Protocol Identifier, to be recognized
2152                                                         on VLAN TAG on top of 0x8100 and 0x88A8 */
2153    } vlanPrsOptions;
2154    /* PPP */
2155    struct{
2156        bool            enableMTUCheck;             /**< Check validity of MTU according to RFC2516 */
2157    } pppoePrsOptions;
2158
2159    /* IPV6 */
2160    struct{
2161        bool            routingHdrEnable;          /**< TRUE to enable routing header, otherwise ignore */
2162    } ipv6PrsOptions;
2163
2164    /* UDP */
2165    struct{
2166        bool            padIgnoreChecksum;          /**< TRUE to ignore pad in checksum */
2167    } udpPrsOptions;
2168
2169    /* TCP */
2170    struct {
2171        bool            padIgnoreChecksum;          /**< TRUE to ignore pad in checksum */
2172    } tcpPrsOptions;
2173} u_FmPcdHdrPrsOpts;
2174
2175/**************************************************************************//**
2176 @Description   A structure for defining each header for the parser
2177*//***************************************************************************/
2178typedef struct t_FmPcdPrsAdditionalHdrParams {
2179    e_NetHeaderType         hdr;            /**< Selected header; use  HEADER_TYPE_NONE
2180                                                 to indicate that sw parser is to run first
2181                                                 (before HW parser, and independent of the
2182                                                 existence of any protocol), in this case,
2183                                                 swPrsEnable must be set, and all other
2184                                                 parameters are irrelevant.  */
2185    bool                    errDisable;     /**< TRUE to disable error indication */
2186    bool                    swPrsEnable;    /**< Enable jump to SW parser when this
2187                                                 header is recognized by the HW parser. */
2188    uint8_t                 indexPerHdr;    /**< Normally 0, if more than one sw parser
2189                                                 attachments exists for the same header,
2190                                                 (in the main sw parser code) use this
2191                                                 index to distinguish between them. */
2192    bool                    usePrsOpts;     /**< TRUE to use parser options. */
2193    u_FmPcdHdrPrsOpts       prsOpts;        /**< A union according to header type,
2194                                                 defining the parser options selected.*/
2195} t_FmPcdPrsAdditionalHdrParams;
2196
2197/**************************************************************************//**
2198 @Description   struct for defining port PCD parameters
2199*//***************************************************************************/
2200typedef struct t_FmPortPcdPrsParams {
2201    uint8_t                         prsResultPrivateInfo;           /**< The private info provides a method of inserting
2202                                                                         port information into the parser result. This information
2203                                                                         may be extracted by Keygen and be used for frames
2204                                                                         distribution when a per-port distinction is required,
2205                                                                         it may also be used as a port logical id for analyzing
2206                                                                         incoming frames. */
2207    uint8_t                         parsingOffset;                  /**< Number of bytes from beginning of packet to start parsing */
2208    e_NetHeaderType                 firstPrsHdr;                    /**< The type of the first header expected at 'parsingOffset' */
2209    bool                            includeInPrsStatistics;         /**< TRUE to include this port in the parser statistics;
2210                                                                         NOTE: this field is not valid when the FM is in "guest" mode
2211                                                                               and IPC is not available. */
2212    uint8_t                         numOfHdrsWithAdditionalParams;  /**< Normally 0, some headers may get
2213                                                                         special parameters */
2214    t_FmPcdPrsAdditionalHdrParams   additionalParams[FM_PCD_PRS_NUM_OF_HDRS];
2215                                                                    /**< 'numOfHdrsWithAdditionalParams'  structures
2216                                                                         of additional parameters
2217                                                                         for each header that requires them */
2218    bool                            setVlanTpid1;                   /**< TRUE to configure user selection of Ethertype to
2219                                                                         indicate a VLAN tag (in addition to the TPID values
2220                                                                         0x8100 and 0x88A8). */
2221    uint16_t                        vlanTpid1;                      /**< extra tag to use if setVlanTpid1=TRUE. */
2222    bool                            setVlanTpid2;                   /**< TRUE to configure user selection of Ethertype to
2223                                                                         indicate a VLAN tag (in addition to the TPID values
2224                                                                         0x8100 and 0x88A8). */
2225    uint16_t                        vlanTpid2;                      /**< extra tag to use if setVlanTpid1=TRUE. */
2226} t_FmPortPcdPrsParams;
2227
2228/**************************************************************************//**
2229 @Description   struct for defining coarse alassification parameters
2230*//***************************************************************************/
2231typedef struct t_FmPortPcdCcParams {
2232    t_Handle            h_CcTree;                       /**< A handle to a CC tree */
2233} t_FmPortPcdCcParams;
2234
2235/**************************************************************************//**
2236 @Description   struct for defining keygen parameters
2237*//***************************************************************************/
2238typedef struct t_FmPortPcdKgParams {
2239    uint8_t             numOfSchemes;                   /**< Number of schemes for port to be bound to. */
2240    t_Handle            h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES];
2241                                                        /**< Array of 'numOfSchemes' schemes handles for the
2242                                                             port to be bound to */
2243    bool                directScheme;                   /**< TRUE for going from parser to a specific scheme,
2244                                                             regardless of parser result */
2245    t_Handle            h_DirectScheme;                 /**< relevant only if direct == TRUE, Scheme handle,
2246                                                             as returned by FM_PCD_KgSetScheme */
2247} t_FmPortPcdKgParams;
2248
2249/**************************************************************************//**
2250 @Description   struct for defining policer parameters
2251*//***************************************************************************/
2252typedef struct t_FmPortPcdPlcrParams {
2253    t_Handle                h_Profile;          /**< Selected profile handle */
2254} t_FmPortPcdPlcrParams;
2255
2256/**************************************************************************//**
2257 @Description   struct for defining port PCD parameters
2258*//***************************************************************************/
2259typedef struct t_FmPortPcdParams {
2260    e_FmPortPcdSupport      pcdSupport;         /**< Relevant for Rx and offline ports only.
2261                                                     Describes the active PCD engines for this port. */
2262    t_Handle                h_NetEnv;           /**< HL Unused in PLCR only mode */
2263    t_FmPortPcdPrsParams    *p_PrsParams;       /**< Parser parameters for this port */
2264    t_FmPortPcdCcParams     *p_CcParams;        /**< Coarse classification parameters for this port */
2265    t_FmPortPcdKgParams     *p_KgParams;        /**< Keygen parameters for this port */
2266    t_FmPortPcdPlcrParams   *p_PlcrParams;      /**< Policer parameters for this port; Relevant for one of
2267                                                     following cases:
2268                                                     e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or
2269                                                     e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR were selected,
2270                                                     or if any flow uses a KG scheme were policer
2271                                                     profile is not generated
2272                                                     ('bypassPlcrProfileGeneration selected'). */
2273    t_Handle                h_IpReassemblyManip;    /**< IP Reassembly manipulation */
2274#if (DPAA_VERSION >= 11)
2275    t_Handle                h_CapwapReassemblyManip;/**< CAPWAP Reassembly manipulation */
2276#endif /* (DPAA_VERSION >= 11) */
2277} t_FmPortPcdParams;
2278
2279/**************************************************************************//**
2280 @Description   A structure for defining the Parser starting point
2281*//***************************************************************************/
2282typedef struct t_FmPcdPrsStart {
2283    uint8_t             parsingOffset;  /**< Number of bytes from beginning of packet to
2284                                             start parsing */
2285    e_NetHeaderType     firstPrsHdr;    /**< The type of the first header axpected at
2286                                             'parsingOffset' */
2287} t_FmPcdPrsStart;
2288
2289#if (DPAA_VERSION >= 11)
2290/**************************************************************************//**
2291 @Description   struct for defining external buffer margins
2292*//***************************************************************************/
2293typedef struct t_FmPortVSPAllocParams {
2294    uint8_t     numOfProfiles;          /**< Number of Virtual Storage Profiles; must be a power of 2 */
2295    uint8_t     dfltRelativeId;         /**< The default Virtual-Storage-Profile-id dedicated to Rx/OP port
2296                                             The same default Virtual-Storage-Profile-id will be for coupled Tx port
2297                                             if relevant function called for Rx port */
2298    t_Handle    h_FmTxPort;             /**< Handle to coupled Tx Port; not relevant for OP port. */
2299} t_FmPortVSPAllocParams;
2300#endif /* (DPAA_VERSION >= 11) */
2301
2302
2303/**************************************************************************//**
2304 @Function      FM_PORT_SetPCD
2305
2306 @Description   Calling this routine defines the port's PCD configuration.
2307                It changes it from its default configuration which is PCD
2308                disabled (BMI to BMI) and configures it according to the passed
2309                parameters.
2310
2311                May be used for Rx and OP ports only
2312
2313 @Param[in]     h_FmPort        A handle to a FM Port module.
2314 @Param[in]     p_FmPortPcd     A Structure of parameters defining the port's PCD
2315                                configuration.
2316
2317 @Return        E_OK on success; Error code otherwise.
2318
2319 @Cautions      Allowed only following FM_PORT_Init().
2320*//***************************************************************************/
2321t_Error FM_PORT_SetPCD(t_Handle h_FmPort, t_FmPortPcdParams *p_FmPortPcd);
2322
2323/**************************************************************************//**
2324 @Function      FM_PORT_DeletePCD
2325
2326 @Description   Calling this routine releases the port's PCD configuration.
2327                The port returns to its default configuration which is PCD
2328                disabled (BMI to BMI) and all PCD configuration is removed.
2329
2330                May be used for Rx and OP ports which are
2331                in PCD mode  only
2332
2333 @Param[in]     h_FmPort        A handle to a FM Port module.
2334
2335 @Return        E_OK on success; Error code otherwise.
2336
2337 @Cautions      Allowed only following FM_PORT_Init().
2338*//***************************************************************************/
2339t_Error FM_PORT_DeletePCD(t_Handle h_FmPort);
2340
2341/**************************************************************************//**
2342 @Function      FM_PORT_AttachPCD
2343
2344 @Description   This routine may be called after FM_PORT_DetachPCD was called,
2345                to return to the originally configured PCD support flow.
2346                The couple of routines are used to allow PCD configuration changes
2347                that demand that PCD will not be used while changes take place.
2348
2349                May be used for Rx and OP ports which are
2350                in PCD mode only
2351
2352 @Param[in]     h_FmPort        A handle to a FM Port module.
2353
2354 @Return        E_OK on success; Error code otherwise.
2355
2356 @Cautions      Allowed only following FM_PORT_Init().
2357*//***************************************************************************/
2358t_Error FM_PORT_AttachPCD(t_Handle h_FmPort);
2359
2360/**************************************************************************//**
2361 @Function      FM_PORT_DetachPCD
2362
2363 @Description   Calling this routine detaches the port from its PCD functionality.
2364                The port returns to its default flow which is BMI to BMI.
2365
2366                May be used for Rx and OP ports which are
2367                in PCD mode only
2368
2369 @Param[in]     h_FmPort        A handle to a FM Port module.
2370
2371 @Return        E_OK on success; Error code otherwise.
2372
2373 @Cautions      Allowed only following FM_PORT_AttachPCD().
2374*//***************************************************************************/
2375t_Error FM_PORT_DetachPCD(t_Handle h_FmPort);
2376
2377/**************************************************************************//**
2378 @Function      FM_PORT_PcdPlcrAllocProfiles
2379
2380 @Description   This routine may be called only for ports that use the Policer in
2381                order to allocate private policer profiles.
2382
2383 @Param[in]     h_FmPort            A handle to a FM Port module.
2384 @Param[in]     numOfProfiles       The number of required policer profiles
2385
2386 @Return        E_OK on success; Error code otherwise.
2387
2388 @Cautions      Allowed only following FM_PORT_Init() and FM_PCD_Init(),
2389                and before FM_PORT_SetPCD().
2390*//***************************************************************************/
2391t_Error FM_PORT_PcdPlcrAllocProfiles(t_Handle h_FmPort, uint16_t numOfProfiles);
2392
2393/**************************************************************************//**
2394 @Function      FM_PORT_PcdPlcrFreeProfiles
2395
2396 @Description   This routine should be called for freeing private policer profiles.
2397
2398 @Param[in]     h_FmPort            A handle to a FM Port module.
2399
2400 @Return        E_OK on success; Error code otherwise.
2401
2402 @Cautions      Allowed only following FM_PORT_Init() and FM_PCD_Init(),
2403                and before FM_PORT_SetPCD().
2404*//***************************************************************************/
2405t_Error FM_PORT_PcdPlcrFreeProfiles(t_Handle h_FmPort);
2406
2407#if (DPAA_VERSION >= 11)
2408/**************************************************************************//**
2409 @Function      FM_PORT_VSPAlloc
2410
2411 @Description   This routine allocated VSPs per port and forces the port to work
2412                in VSP mode. Note that the port is initialized by default with the
2413                physical-storage-profile only.
2414
2415 @Param[in]     h_FmPort    A handle to a FM Port module.
2416 @Param[in]     p_Params    A structure of parameters for allocation VSP's per port
2417
2418 @Return        E_OK on success; Error code otherwise.
2419
2420 @Cautions      Allowed only following FM_PORT_Init(), and before FM_PORT_SetPCD()
2421                and also before FM_PORT_Enable(); i.e. the port should be disabled.
2422*//***************************************************************************/
2423t_Error FM_PORT_VSPAlloc(t_Handle h_FmPort, t_FmPortVSPAllocParams *p_Params);
2424#endif /* (DPAA_VERSION >= 11) */
2425
2426/**************************************************************************//**
2427 @Function      FM_PORT_PcdKgModifyInitialScheme
2428
2429 @Description   This routine may be called only for ports that use the keygen in
2430                order to change the initial scheme frame should be routed to.
2431                The change may be of a scheme id (in case of direct mode),
2432                from direct to indirect, or from indirect to direct - specifying the scheme id.
2433
2434 @Param[in]     h_FmPort            A handle to a FM Port module.
2435 @Param[in]     p_FmPcdKgScheme     A structure of parameters for defining whether
2436                                    a scheme is direct/indirect, and if direct - scheme id.
2437
2438 @Return        E_OK on success; Error code otherwise.
2439
2440 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2441*//***************************************************************************/
2442t_Error FM_PORT_PcdKgModifyInitialScheme (t_Handle h_FmPort, t_FmPcdKgSchemeSelect *p_FmPcdKgScheme);
2443
2444/**************************************************************************//**
2445 @Function      FM_PORT_PcdPlcrModifyInitialProfile
2446
2447 @Description   This routine may be called for ports with flows
2448                e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR
2449                only, to change the initial Policer profile frame should be
2450                routed to. The change may be of a profile and/or absolute/direct
2451                mode selection.
2452
2453 @Param[in]     h_FmPort                A handle to a FM Port module.
2454 @Param[in]     h_Profile               Policer profile handle
2455
2456 @Return        E_OK on success; Error code otherwise.
2457
2458 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2459*//***************************************************************************/
2460t_Error FM_PORT_PcdPlcrModifyInitialProfile (t_Handle h_FmPort, t_Handle h_Profile);
2461
2462/**************************************************************************//**
2463 @Function      FM_PORT_PcdCcModifyTree
2464
2465 @Description   This routine may be called for ports that use coarse classification tree
2466                if the user wishes to replace the tree. The routine may not be called while port
2467                receives packets using the PCD functionalities, therefor port must be first detached
2468                from the PCD, only than the routine may be called, and than port be attached to PCD again.
2469
2470 @Param[in]     h_FmPort            A handle to a FM Port module.
2471 @Param[in]     h_CcTree            A CC tree that was already built. The tree id as returned from
2472                                    the BuildTree routine.
2473
2474 @Return        E_OK on success; Error code otherwise.
2475
2476 @Cautions      Allowed only following FM_PORT_Init(), FM_PORT_SetPCD() and FM_PORT_DetachPCD()
2477*//***************************************************************************/
2478t_Error FM_PORT_PcdCcModifyTree (t_Handle h_FmPort, t_Handle h_CcTree);
2479
2480/**************************************************************************//**
2481 @Function      FM_PORT_PcdKgBindSchemes
2482
2483 @Description   These routines may be called for adding more schemes for the
2484                port to be bound to. The selected schemes are not added,
2485                just this specific port starts using them.
2486
2487 @Param[in]     h_FmPort        A handle to a FM Port module.
2488 @Param[in]     p_PortScheme    A structure defining the list of schemes to be added.
2489
2490 @Return        E_OK on success; Error code otherwise.
2491
2492 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2493*//***************************************************************************/
2494t_Error FM_PORT_PcdKgBindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);
2495
2496/**************************************************************************//**
2497 @Function      FM_PORT_PcdKgUnbindSchemes
2498
2499 @Description   These routines may be called for adding more schemes for the
2500                port to be bound to. The selected schemes are not removed or invalidated,
2501                just this specific port stops using them.
2502
2503 @Param[in]     h_FmPort        A handle to a FM Port module.
2504 @Param[in]     p_PortScheme    A structure defining the list of schemes to be added.
2505
2506 @Return        E_OK on success; Error code otherwise.
2507
2508 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2509*//***************************************************************************/
2510t_Error FM_PORT_PcdKgUnbindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);
2511
2512/**************************************************************************//**
2513 @Function      FM_PORT_GetIPv4OptionsCount
2514
2515 @Description   TODO
2516
2517 @Param[in]     h_FmPort            A handle to a FM Port module.
2518 @Param[out]    p_Ipv4OptionsCount  will hold the counter value
2519
2520 @Return        E_OK on success; Error code otherwise.
2521
2522 @Cautions      Allowed only following FM_PORT_Init()
2523*//***************************************************************************/
2524t_Error FM_PORT_GetIPv4OptionsCount(t_Handle h_FmPort, uint32_t *p_Ipv4OptionsCount);
2525
2526/** @} */ /* end of FM_PORT_pcd_runtime_control_grp group */
2527/** @} */ /* end of FM_PORT_runtime_control_grp group */
2528
2529
2530/**************************************************************************//**
2531 @Group         FM_PORT_runtime_data_grp FM Port Runtime Data-path Unit
2532
2533 @Description   FM Port Runtime data unit API functions, definitions and enums.
2534                This API is valid only if working in Independent-Mode.
2535
2536 @{
2537*//***************************************************************************/
2538
2539/**************************************************************************//**
2540 @Function      FM_PORT_ImTx
2541
2542 @Description   Tx function, called to transmit a data buffer on the port.
2543
2544 @Param[in]     h_FmPort    A handle to a FM Port module.
2545 @Param[in]     p_Data      A pointer to an LCP data buffer.
2546 @Param[in]     length      Size of data for transmission.
2547 @Param[in]     lastBuffer  Buffer position - TRUE for the last buffer
2548                            of a frame, including a single buffer frame
2549 @Param[in]     h_BufContext  A handle of the user acossiated with this buffer
2550
2551 @Return        E_OK on success; Error code otherwise.
2552
2553 @Cautions      Allowed only following FM_PORT_Init().
2554                NOTE - This routine can be used only when working in
2555                Independent-Mode mode.
2556*//***************************************************************************/
2557t_Error  FM_PORT_ImTx( t_Handle               h_FmPort,
2558                       uint8_t                *p_Data,
2559                       uint16_t               length,
2560                       bool                   lastBuffer,
2561                       t_Handle               h_BufContext);
2562
2563/**************************************************************************//**
2564 @Function      FM_PORT_ImTxConf
2565
2566 @Description   Tx port confirmation routine, optional, may be called to verify
2567                transmission of all frames. The procedure performed by this
2568                routine will be performed automatically on next buffer transmission,
2569                but if desired, calling this routine will invoke this action on
2570                demand.
2571
2572 @Param[in]     h_FmPort            A handle to a FM Port module.
2573
2574 @Cautions      Allowed only following FM_PORT_Init().
2575                NOTE - This routine can be used only when working in
2576                Independent-Mode mode.
2577*//***************************************************************************/
2578void FM_PORT_ImTxConf(t_Handle h_FmPort);
2579
2580/**************************************************************************//**
2581 @Function      FM_PORT_ImRx
2582
2583 @Description   Rx function, may be called to poll for received buffers.
2584                Normally, Rx process is invoked by the driver on Rx interrupt.
2585                Alternatively, this routine may be called on demand.
2586
2587 @Param[in]     h_FmPort            A handle to a FM Port module.
2588
2589 @Return        E_OK on success; Error code otherwise.
2590
2591 @Cautions      Allowed only following FM_PORT_Init().
2592                NOTE - This routine can be used only when working in
2593                Independent-Mode mode.
2594*//***************************************************************************/
2595t_Error  FM_PORT_ImRx(t_Handle h_FmPort);
2596
2597/** @} */ /* end of FM_PORT_runtime_data_grp group */
2598/** @} */ /* end of FM_PORT_grp group */
2599/** @} */ /* end of FM_grp group */
2600
2601
2602
2603#ifdef NCSW_BACKWARD_COMPATIBLE_API
2604#define FM_PORT_ConfigTxFifoDeqPipelineDepth FM_PORT_ConfigFifoDeqPipelineDepth
2605#endif /* NCSW_BACKWARD_COMPATIBLE_API */
2606
2607
2608#endif /* __FM_PORT_EXT */
2609