1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
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.
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
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.
33 /**************************************************************************//**
36 @Description FM-Port Application Programming Interface.
37 *//***************************************************************************/
41 #include "error_ext.h"
43 #include "fm_pcd_ext.h"
48 /**************************************************************************//**
50 @Group FM_grp Frame Manager API
52 @Description FM API functions, definitions and enums
55 *//***************************************************************************/
57 /**************************************************************************//**
58 @Group FM_PORT_grp FM Port
60 @Description FM Port API
62 The FM uses a general module called "port" to represent a Tx port
63 (MAC), an Rx port (MAC), offline parsing flow or host command
64 flow. There may be up to 17 (may change) ports in an FM - 5 Tx
65 ports (4 for the 1G MACs, 1 for the 10G MAC), 5 Rx Ports, and 7
66 Host command/Offline parsing ports. The SW driver manages these
67 ports as sub-modules of the FM, i.e. after an FM is initialized,
68 its ports may be initialized and operated upon.
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 coherency and returns error if applicable.
74 On initialization, user specifies the port type and it's index
75 (relative to the port's type). Host command and Offline parsing
76 ports share the same id range, I.e user may not initialized host
77 command port 0 and offline parsing port 0.
80 *//***************************************************************************/
82 /**************************************************************************//**
83 @Description An enum for defining port PCD modes.
84 This enum defines the superset of PCD engines support - i.e. not
85 all engines have to be used, but all have to be enabled. The real
86 flow of a specific frame depends on the PCD configuration and the
87 frame headers and payload.
88 *//***************************************************************************/
89 typedef enum e_FmPortPcdSupport {
90 e_FM_PORT_PCD_SUPPORT_NONE = 0, /**< BMI to BMI, PCD is not used */
91 e_FM_PORT_PCD_SUPPORT_PRS_ONLY, /**< Use only Parser */
92 e_FM_PORT_PCD_SUPPORT_PLCR_ONLY, /**< Use only Policer */
93 e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR, /**< Use Parser and Policer */
94 e_FM_PORT_PCD_SUPPORT_PRS_AND_KG, /**< Use Parser and Keygen */
95 e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC, /**< Use Parser, Keygen and Coarse Classification */
96 e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC_AND_PLCR,
97 /**< Use all PCD engines */
98 e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_PLCR /**< Use Parser, Keygen and Policer */
99 #ifdef FM_CAPWAP_SUPPORT
101 e_FM_PORT_PCD_SUPPORT_CC_ONLY, /**< Use only Coarse Classification */
102 e_FM_PORT_PCD_SUPPORT_CC_AND_KG, /**< Use Coarse Classification,and Keygen */
103 e_FM_PORT_PCD_SUPPORT_CC_AND_KG_AND_PLCR /**< Use Coarse Classification, Keygen and Policer */
104 #endif /* FM_CAPWAP_SUPPORT */
105 } e_FmPortPcdSupport;
107 /**************************************************************************//**
108 @Description Port interrupts
109 *//***************************************************************************/
110 typedef enum e_FmPortExceptions {
111 e_FM_PORT_EXCEPTION_IM_BUSY /**< Independent-Mode Rx-BUSY */
112 } e_FmPortExceptions;
115 /**************************************************************************//**
116 @Collection General FM Port defines
117 *//***************************************************************************/
118 #define FM_PORT_PRS_RESULT_NUM_OF_WORDS 8 /**< Number of 4 bytes words in parser result */
121 /**************************************************************************//**
122 @Collection FM Frame error
123 *//***************************************************************************/
124 typedef uint32_t fmPortFrameErrSelect_t; /**< typedef for defining Frame Descriptor errors */
126 #define FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT 0x04000000 /**< Offline parsing only! Unsupported Format */
127 #define FM_PORT_FRM_ERR_LENGTH 0x02000000 /**< Offline parsing only! Length Error */
128 #define FM_PORT_FRM_ERR_DMA 0x01000000 /**< DMA Data error */
129 #ifdef FM_CAPWAP_SUPPORT
130 #define FM_PORT_FRM_ERR_NON_FM 0x00400000 /**< non Frame-Manager error; probably come from SEC that
132 #endif /* FM_CAPWAP_SUPPORT */
133 #define FM_PORT_FRM_ERR_PHYSICAL 0x00080000 /**< Rx FIFO overflow, FCS error, code error, running disparity
134 error (SGMII and TBI modes), FIFO parity error. PHY
135 Sequence error, PHY error control character detected. */
136 #define FM_PORT_FRM_ERR_SIZE 0x00040000 /**< Frame too long OR Frame size exceeds max_length_frame */
137 #define FM_PORT_FRM_ERR_CLS_DISCARD 0x00020000 /**< classification discard */
138 #define FM_PORT_FRM_ERR_EXTRACTION 0x00008000 /**< Extract Out of Frame */
139 #define FM_PORT_FRM_ERR_NO_SCHEME 0x00004000 /**< No Scheme Selected */
140 #define FM_PORT_FRM_ERR_KEYSIZE_OVERFLOW 0x00002000 /**< Keysize Overflow */
141 #define FM_PORT_FRM_ERR_COLOR_YELLOW 0x00000400 /**< Frame color is yellow */
142 #define FM_PORT_FRM_ERR_COLOR_RED 0x00000800 /**< Frame color is red */
143 #define FM_PORT_FRM_ERR_ILL_PLCR 0x00000200 /**< Illegal Policer Profile selected */
144 #define FM_PORT_FRM_ERR_PLCR_FRAME_LEN 0x00000100 /**< Policer frame length error */
145 #define FM_PORT_FRM_ERR_PRS_TIMEOUT 0x00000080 /**< Parser Time out Exceed */
146 #define FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT 0x00000040 /**< Invalid Soft Parser instruction */
147 #define FM_PORT_FRM_ERR_PRS_HDR_ERR 0x00000020 /**< Header error was identified during parsing */
148 #define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED 0x00000008 /**< Frame parsed beyind 256 first bytes */
149 #define FM_PORT_FRM_ERR_PROCESS_TIMEOUT 0x00000001 /**< FPM Frame Processing Timeout Exceeded */
154 /**************************************************************************//**
155 @Group FM_PORT_init_grp FM Port Initialization Unit
157 @Description FM Port Initialization Unit
160 *//***************************************************************************/
162 /**************************************************************************//**
163 @Description Exceptions user callback routine, will be called upon an
164 exception passing the exception identification.
166 @Param[in] h_App - User's application descriptor.
167 @Param[in] exception - The exception.
168 *//***************************************************************************/
169 typedef void (t_FmPortExceptionCallback) (t_Handle h_App, e_FmPortExceptions exception);
171 /**************************************************************************//**
172 @Description User callback function called by driver with received data.
174 User provides this function. Driver invokes it.
176 @Param[in] h_App Application's handle originally specified to
177 the API Config function
178 @Param[in] p_Data A pointer to data received
179 @Param[in] length length of received data
180 @Param[in] status receive status and errors
181 @Param[in] position position of buffer in frame
182 @Param[in] h_BufContext A handle of the user acossiated with this buffer
184 @Retval e_RX_STORE_RESPONSE_CONTINUE - order the driver to continue Rx
185 operation for all ready data.
186 @Retval e_RX_STORE_RESPONSE_PAUSE - order the driver to stop Rx operation.
187 *//***************************************************************************/
188 typedef e_RxStoreResponse (t_FmPortImRxStoreCallback) (t_Handle h_App,
193 t_Handle h_BufContext);
195 /**************************************************************************//**
196 @Description User callback function called by driver when transmit completed.
198 User provides this function. Driver invokes it.
200 @Param[in] h_App Application's handle originally specified to
201 the API Config function
202 @Param[in] p_Data A pointer to data received
203 @Param[in] status transmit status and errors
204 @Param[in] lastBuffer is last buffer in frame
205 @Param[in] h_BufContext A handle of the user acossiated with this buffer
206 *//***************************************************************************/
207 typedef void (t_FmPortImTxConfCallback) (t_Handle h_App,
210 t_Handle h_BufContext);
212 /**************************************************************************//**
213 @Description A structure of information about each of the external
214 buffer pools used by the port,
215 *//***************************************************************************/
216 typedef struct t_FmPortExtPoolParams {
217 uint8_t id; /**< External buffer pool id */
218 uint16_t size; /**< External buffer pool buffer size */
219 } t_FmPortExtPoolParams;
221 /**************************************************************************//**
222 @Description A structure for informing the driver about the external
223 buffer pools allocated in the BM and used by this port.
224 *//***************************************************************************/
225 typedef struct t_FmPortExtPools {
226 uint8_t numOfPoolsUsed; /**< Number of pools use by this port */
227 t_FmPortExtPoolParams extBufPool[FM_PORT_MAX_NUM_OF_EXT_POOLS];
228 /**< Parameters for each port */
231 /**************************************************************************//**
232 @Description structure for additional Rx port parameters
233 *//***************************************************************************/
234 typedef struct t_FmPortRxParams {
235 uint32_t errFqid; /**< Error Queue Id. */
236 uint32_t dfltFqid; /**< Default Queue Id. */
237 uint16_t liodnOffset; /**< Port's LIODN offset. */
238 t_FmPortExtPools extBufPools; /**< Which external buffer pools are used
239 (up to FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes. */
242 /**************************************************************************//**
243 @Description structure for additional non-Rx port parameters
244 *//***************************************************************************/
245 typedef struct t_FmPortNonRxParams {
246 uint32_t errFqid; /**< Error Queue Id. */
247 uint32_t dfltFqid; /**< For Tx and HC - Default Confirmation queue,
248 0 means no Tx confirmation for processed
249 frames. For OP - default Rx queue. */
250 uint32_t qmChannel; /**< QM-channel dedicated to this port; will be used
251 by the FM for dequeue. */
252 #ifdef FM_OP_PARTITION_ERRATA_FMANx8
253 uint16_t opLiodnOffset; /**< For Offline Parsing ports only. Port's LIODN offset. */
254 #endif /* FM_OP_PARTITION_ERRATA_FMANx8 */
255 } t_FmPortNonRxParams;
257 /**************************************************************************//**
258 @Description structure for additional Rx port parameters
259 *//***************************************************************************/
260 typedef struct t_FmPortImRxTxParams {
261 t_Handle h_FmMuram; /**< A handle of the FM-MURAM partition */
262 uint16_t liodnOffset; /**< For Rx ports only. Port's LIODN Offset. */
263 uint8_t dataMemId; /**< Memory partition ID for data buffers */
264 uint32_t dataMemAttributes; /**< Memory attributes for data buffers */
265 t_BufferPoolInfo rxPoolParams; /**< For Rx ports only. */
266 t_FmPortImRxStoreCallback *f_RxStore; /**< For Rx ports only. */
267 t_FmPortImTxConfCallback *f_TxConf; /**< For Tx ports only. */
268 } t_FmPortImRxTxParams;
270 /**************************************************************************//**
271 @Description Union for additional parameters depending on port type
272 *//***************************************************************************/
273 typedef union u_FmPortSpecificParams {
274 t_FmPortImRxTxParams imRxTxParams; /**< Rx/Tx Independent-Mode port parameter structure */
275 t_FmPortRxParams rxParams; /**< Rx port parameters structure */
276 t_FmPortNonRxParams nonRxParams; /**< Non-Rx port parameters structure */
277 } u_FmPortSpecificParams;
279 /**************************************************************************//**
280 @Description structure representing FM initialization parameters
281 *//***************************************************************************/
282 typedef struct t_FmPortParams {
283 uintptr_t baseAddr; /**< Virtual Address of memory mapped FM Port registers.*/
284 t_Handle h_Fm; /**< A handle to the FM object this port related to */
285 e_FmPortType portType; /**< Port type */
286 uint8_t portId; /**< Port Id - relative to type */
287 bool independentModeEnable;
288 /**< This port is Independent-Mode - Used for Rx/Tx ports only! */
289 uint16_t liodnBase; /**< Irrelevant for P4080 rev 1. LIODN base for this port, to be
290 used together with LIODN offset. */
291 u_FmPortSpecificParams specificParams; /**< Additional parameters depending on port
294 t_FmPortExceptionCallback *f_Exception; /**< Callback routine to be called of PCD exception */
295 t_Handle h_App; /**< A handle to an application layer object; This handle will
296 be passed by the driver upon calling the above callbacks */
300 /**************************************************************************//**
301 @Function FM_PORT_Config
303 @Description Creates descriptor for the FM PORT module.
305 The routine returns a handle (descriptor) to the FM PORT object.
306 This descriptor must be passed as first parameter to all other
307 FM PORT function calls.
309 No actual initialization or configuration of FM hardware is
310 done by this routine.
312 @Param[in] p_FmPortParams - Pointer to data structure of parameters
314 @Retval Handle to FM object, or NULL for Failure.
315 *//***************************************************************************/
316 t_Handle FM_PORT_Config(t_FmPortParams *p_FmPortParams);
318 /**************************************************************************//**
319 @Function FM_PORT_Init
321 @Description Initializes the FM PORT module
323 @Param[in] h_FmPort - FM PORT module descriptor
325 @Return E_OK on success; Error code otherwise.
326 *//***************************************************************************/
327 t_Error FM_PORT_Init(t_Handle h_FmPort);
329 /**************************************************************************//**
330 @Function FM_PORT_Free
332 @Description Frees all resources that were assigned to FM PORT module.
334 Calling this routine invalidates the descriptor.
336 @Param[in] h_FmPort - FM PORT module descriptor
338 @Return E_OK on success; Error code otherwise.
339 *//***************************************************************************/
340 t_Error FM_PORT_Free(t_Handle h_FmPort);
343 /**************************************************************************//**
344 @Group FM_PORT_advanced_init_grp FM Port Advanced Configuration Unit
346 @Description Configuration functions used to change default values.
349 *//***************************************************************************/
351 /**************************************************************************//**
352 @Description enum for defining QM frame dequeue
353 *//***************************************************************************/
354 typedef enum e_FmPortDeqType {
355 e_FM_PORT_DEQ_TYPE1, /**< Dequeue from the SP channel - with priority precedence,
356 and Intra-Class Scheduling respected. */
357 e_FM_PORT_DEQ_TYPE2, /**< Dequeue from the SP channel - with active FQ precedence,
358 and Intra-Class Scheduling respected. */
359 e_FM_PORT_DEQ_TYPE3 /**< Dequeue from the SP channel - with active FQ precedence,
360 and override Intra-Class Scheduling */
363 #ifdef FM_QMI_DEQ_OPTIONS_SUPPORT
364 /**************************************************************************//**
365 @Description enum for defining QM frame dequeue
366 *//***************************************************************************/
367 typedef enum e_FmPortDeqPrefetchOption {
368 e_FM_PORT_DEQ_NO_PREFETCH, /**< QMI preforms a dequeue action for a single frame
369 only when a dedicated portID Tnum is waiting. */
370 e_FM_PORT_DEQ_PARTIAL_PREFETCH, /**< QMI preforms a dequeue action for 3 frames when
371 one dedicated portId tnum is waiting. */
372 e_FM_PORT_DEQ_FULL_PREFETCH /**< QMI preforms a dequeue action for 3 frames when
373 no dedicated portId tnums are waiting. */
375 } e_FmPortDeqPrefetchOption;
376 #endif /* FM_QMI_DEQ_OPTIONS_SUPPORT */
378 /**************************************************************************//**
379 @Description enum for defining port DMA swap mode
380 *//***************************************************************************/
381 typedef enum e_FmPortDmaSwap {
382 e_FM_PORT_DMA_NO_SWP, /**< No swap, transfer data as is.*/
383 e_FM_PORT_DMA_SWP_PPC_LE, /**< The transferred data should be swapped
384 in PowerPc Little Endian mode. */
385 e_FM_PORT_DMA_SWP_BE /**< The transferred data should be swapped
386 in Big Endian mode */
389 /**************************************************************************//**
390 @Description enum for defining port DMA cache attributes
391 *//***************************************************************************/
392 typedef enum e_FmPortDmaCache {
393 e_FM_PORT_DMA_NO_STASH = 0, /**< Cacheable, no Allocate (No Stashing) */
394 e_FM_PORT_DMA_STASH = 1 /**< Cacheable and Allocate (Stashing on) */
397 /**************************************************************************//**
398 @Description enum for defining port default color
399 *//***************************************************************************/
400 typedef enum e_FmPortColor {
401 e_FM_PORT_COLOR_GREEN, /**< Default port color is green */
402 e_FM_PORT_COLOR_YELLOW, /**< Default port color is yellow */
403 e_FM_PORT_COLOR_RED, /**< Default port color is red */
404 e_FM_PORT_COLOR_OVERRIDE /**< Ignore color */
407 /**************************************************************************//**
408 @Description struct for defining Dual Tx rate limiting scale
409 *//***************************************************************************/
410 typedef enum e_FmPortDualRateLimiterScaleDown {
411 e_FM_PORT_DUAL_RATE_LIMITER_NONE = 0, /**< Use only single rate limiter */
412 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_2, /**< Divide high rate limiter by 2 */
413 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_4, /**< Divide high rate limiter by 4 */
414 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_8 /**< Divide high rate limiter by 8 */
415 } e_FmPortDualRateLimiterScaleDown;
418 /**************************************************************************//**
419 @Description struct for defining FM port resources
420 *//***************************************************************************/
421 typedef struct t_FmPortRsrc {
422 uint32_t num; /**< Committed required resource */
423 uint32_t extra; /**< Extra (not committed) required resource */
426 /**************************************************************************//**
427 @Description struct for defining pool depletion criteria
428 *//***************************************************************************/
429 typedef struct t_FmPortBufPoolDepletion {
430 bool numberOfPoolsModeEnable; /**< select mode in which pause frames will be sent after
431 a number of pools are depleted */
432 uint8_t numOfPools; /**< the minimum number of depleted pools that will
433 invoke pause frames transmission. */
434 bool poolsToConsider[BM_MAX_NUM_OF_POOLS];
435 /**< For each pool, TRUE if it should be considered for
436 depletion (Note - this pool must be used by this port!) */
437 bool singlePoolModeEnable; /**< select mode in which pause frames will be sent after
438 a single of pools are depleted */
439 bool poolsToConsiderForSingleMode[BM_MAX_NUM_OF_POOLS];
440 /**< For each pool, TRUE if it should be considered for
441 depletion (Note - this pool must be used by this port!) */
442 } t_FmPortBufPoolDepletion;
444 /**************************************************************************//**
445 @Description struct for defining observed pool depletion
446 *//***************************************************************************/
447 typedef struct t_FmPortObservedBufPoolDepletion {
448 t_FmPortBufPoolDepletion poolDepletionParams;/**< parameters to define pool depletion */
449 t_FmPortExtPools poolsParams; /**< Which external buffer pools are observed
450 (up to FM_PORT_MAX_NUM_OF_OBSERVED_EXT_POOLS),
452 } t_FmPortObservedBufPoolDepletion;
454 /**************************************************************************//**
455 @Description struct for defining Tx rate limiting
456 *//***************************************************************************/
457 typedef struct t_FmPortRateLimit {
458 uint16_t maxBurstSize; /**< in kBytes for Tx ports, in frames
459 for offline parsing ports. (note that
460 for early chips burst size is
461 rounded up to a multiply of 1000 frames).*/
462 uint32_t rateLimit; /**< in Kb/sec for Tx ports, in frame/sec for
463 offline parsing ports. Rate limit refers to
464 data rate (rather than line rate). */
465 e_FmPortDualRateLimiterScaleDown rateLimitDivider; /**< For offline parsing ports only. Not-valid
466 for some earlier chip revisions */
469 /**************************************************************************//**
470 @Description struct for defining define the parameters of
471 the Rx port performance counters
472 *//***************************************************************************/
473 typedef struct t_FmPortPerformanceCnt {
474 uint8_t taskCompVal; /**< Task compare value */
475 uint8_t queueCompVal; /**< Rx queue/Tx confirm queue compare
476 value (unused for H/O) */
477 uint8_t dmaCompVal; /**< Dma compare value */
478 uint32_t fifoCompVal; /**< Fifo compare value (in bytes) */
479 } t_FmPortPerformanceCnt;
481 /**************************************************************************//**
482 @Description struct for defining buffer content.
483 *//***************************************************************************/
484 typedef struct t_FmPortBufferPrefixContent {
485 uint16_t privDataSize; /**< Number of bytes to be left at the beginning
486 of the external buffer */
487 bool passPrsResult; /**< TRUE to pass the parse result to/from the FM */
488 bool passTimeStamp; /**< TRUE to pass the timeStamp to/from the FM */
489 bool passHashResult; /**< TRUE to pass the KG hash result to/from the FM */
490 bool passAllOtherPCDInfo;/**< Add all other Internal-Context information:
491 AD, hash-result, key, etc. */
492 uint16_t dataAlign; /**< 0 to use driver's default alignment, other value
493 for selecting a data alignment (must be a
496 bool passDebugInfo; /**< Debug-information */
498 #ifdef FM_CAPWAP_SUPPORT
499 uint8_t manipExtraSpace; /**< Maximum extra size needed (insertion-size minus removal-size) */
500 #endif /* FM_CAPWAP_SUPPORT */
501 } t_FmPortBufferPrefixContent;
503 /**************************************************************************//**
504 @Description struct for defining backup Bm Pools.
505 *//***************************************************************************/
506 typedef struct t_FmPortBackupBmPools {
507 uint8_t numOfBackupPools; /**< Number of BM backup pools -
508 must be smaller than the total number of
509 pools defined for the specified port.*/
510 uint8_t poolIds[FM_PORT_MAX_NUM_OF_EXT_POOLS];
511 /**< numOfBackupPools pool id's, specifying which
512 pools should be used only as backup. Pool
513 id's specified here must be a subset of the
514 pools used by the specified port.*/
515 } t_FmPortBackupBmPools;
518 /**************************************************************************//**
519 @Function FM_PORT_ConfigDeqHighPriority
521 @Description Calling this routine changes the dequeue priority in the
522 internal driver data base from its default configuration
525 May be used for Non-Rx ports only
527 @Param[in] h_FmPort A handle to a FM Port module.
528 @Param[in] highPri TRUE to select high priority, FALSE for normal operation.
530 @Return E_OK on success; Error code otherwise.
532 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
533 *//***************************************************************************/
534 t_Error FM_PORT_ConfigDeqHighPriority(t_Handle h_FmPort, bool highPri);
536 /**************************************************************************//**
537 @Function FM_PORT_ConfigDeqType
539 @Description Calling this routine changes the dequeue type parameter in the
540 internal driver data base from its default configuration
541 [e_FM_PORT_DEQ_TYPE1].
543 May be used for Non-Rx ports only
545 @Param[in] h_FmPort A handle to a FM Port module.
546 @Param[in] deqType According to QM definition.
548 @Return E_OK on success; Error code otherwise.
550 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
551 *//***************************************************************************/
552 t_Error FM_PORT_ConfigDeqType(t_Handle h_FmPort, e_FmPortDeqType deqType);
554 #ifdef FM_QMI_DEQ_OPTIONS_SUPPORT
555 /**************************************************************************//**
556 @Function FM_PORT_ConfigDeqPrefetchOption
558 @Description Calling this routine changes the dequeue prefetch option parameter in the
559 internal driver data base from its default configuration
560 [e_FM_PORT_DEQ_FULL_PREFETCH]
561 Note: Available for some chips only
563 May be used for Non-Rx ports only
565 @Param[in] h_FmPort A handle to a FM Port module.
566 @Param[in] deqPrefetchOption New option
568 @Return E_OK on success; Error code otherwise.
570 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
571 *//***************************************************************************/
572 t_Error FM_PORT_ConfigDeqPrefetchOption(t_Handle h_FmPort, e_FmPortDeqPrefetchOption deqPrefetchOption);
573 #endif /* FM_QMI_DEQ_OPTIONS_SUPPORT */
575 /**************************************************************************//**
576 @Function FM_PORT_ConfigDeqByteCnt
578 @Description Calling this routine changes the dequeue byte count parameter in
579 the internal driver data base from its default configuration [2000].
581 May be used for Non-Rx ports only
583 @Param[in] h_FmPort A handle to a FM Port module.
584 @Param[in] deqByteCnt New byte count
586 @Return E_OK on success; Error code otherwise.
588 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
589 *//***************************************************************************/
590 t_Error FM_PORT_ConfigDeqByteCnt(t_Handle h_FmPort, uint16_t deqByteCnt);
592 /**************************************************************************//**
593 @Function FM_PORT_ConfigTxFifoMinFillLevel
595 @Description Calling this routine changes the fifo minimum
596 fill level parameter in the internal driver data base
597 from its default configuration [0]
599 May be used for Tx ports only
601 @Param[in] h_FmPort A handle to a FM Port module.
602 @Param[in] minFillLevel New value
604 @Return E_OK on success; Error code otherwise.
606 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
607 *//***************************************************************************/
608 t_Error FM_PORT_ConfigTxFifoMinFillLevel(t_Handle h_FmPort, uint32_t minFillLevel);
610 /**************************************************************************//**
611 @Function FM_PORT_ConfigTxFifoDeqPipelineDepth
613 @Description Calling this routine changes the fifo dequeue
614 pipeline depth parameter in the internal driver data base
616 from its default configuration: 1G ports: [2],
619 May be used for Tx ports only
621 @Param[in] h_FmPort A handle to a FM Port module.
622 @Param[in] deqPipelineDepth New value
624 @Return E_OK on success; Error code otherwise.
626 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
627 *//***************************************************************************/
628 t_Error FM_PORT_ConfigTxFifoDeqPipelineDepth(t_Handle h_FmPort, uint8_t deqPipelineDepth);
630 /**************************************************************************//**
631 @Function FM_PORT_ConfigTxFifoLowComfLevel
633 @Description Calling this routine changes the fifo low comfort level
634 parameter in internal driver data base
635 from its default configuration [5]
637 May be used for Tx ports only
639 @Param[in] h_FmPort A handle to a FM Port module.
640 @Param[in] fifoLowComfLevel New value
642 @Return E_OK on success; Error code otherwise.
644 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
645 *//***************************************************************************/
646 t_Error FM_PORT_ConfigTxFifoLowComfLevel(t_Handle h_FmPort, uint32_t fifoLowComfLevel);
648 /**************************************************************************//**
649 @Function FM_PORT_ConfigRxFifoThreshold
651 @Description Calling this routine changes the threshold of the FIFO
652 fill level parameter in the internal driver data base
653 from its default configuration [BMI_MAX_FIFO_SIZE]
655 If the total number of buffers which are
656 currently in use and associated with the
657 specific RX port exceed this threshold, the
658 BMI will signal the MAC to send a pause frame
661 May be used for Rx ports only
663 @Param[in] h_FmPort A handle to a FM Port module.
664 @Param[in] fifoThreshold New value
666 @Return E_OK on success; Error code otherwise.
668 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
669 *//***************************************************************************/
670 t_Error FM_PORT_ConfigRxFifoThreshold(t_Handle h_FmPort, uint32_t fifoThreshold);
672 /**************************************************************************//**
673 @Function FM_PORT_ConfigRxFifoPriElevationLevel
675 @Description Calling this routine changes the priority elevation level
676 parameter in the internal driver data base from its default
677 configuration [BMI_MAX_FIFO_SIZE]
679 If the total number of buffers which are currently in use and
680 associated with the specific RX port exceed the amount specified
681 in priElevationLevel, BMI will signal the main FM's DMA to
682 elevate the FM priority on the system bus.
684 May be used for Rx ports only
686 @Param[in] h_FmPort A handle to a FM Port module.
687 @Param[in] priElevationLevel New value
689 @Return E_OK on success; Error code otherwise.
691 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
692 *//***************************************************************************/
693 t_Error FM_PORT_ConfigRxFifoPriElevationLevel(t_Handle h_FmPort, uint32_t priElevationLevel);
695 /**************************************************************************//**
696 @Function FM_PORT_ConfigBufferPrefixContent
698 @Description Defines the structure, size and content of the application buffer.
700 In Tx ports, if 'passPrsResult', the application
701 should set a value to their offsets in the prefix of
702 the FM will save the first 'privDataSize', than,
703 depending on 'passPrsResult' and 'passTimeStamp', copy parse result
704 and timeStamp, and the packet itself (in this order), to the
705 application buffer, and to offset.
706 Calling this routine changes the buffer margins definitions
707 in the internal driver data base from its default
708 configuration: Data size: [0]
709 Pass Parser result: [FALSE].
710 Pass timestamp: [FALSE].
712 May be used for all ports
714 @Param[in] h_FmPort A handle to a FM Port module.
715 @Param[in,out] p_FmPortBufferPrefixContent A structure of parameters describing the
716 structure of the buffer.
717 Out parameter: Start margin - offset
718 of data from start of external buffer.
720 @Return E_OK on success; Error code otherwise.
722 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
723 *//***************************************************************************/
724 t_Error FM_PORT_ConfigBufferPrefixContent(t_Handle h_FmPort, t_FmPortBufferPrefixContent *p_FmPortBufferPrefixContent);
727 /**************************************************************************//**
728 @Function FM_PORT_ConfigCheksumLastBytesIgnore
730 @Description Calling this routine changes the number of checksum bytes to ignore
731 parameter in the internal driver data base from its default configuration
734 May be used by Tx & Rx ports only
736 @Param[in] h_FmPort A handle to a FM Port module.
737 @Param[in] cheksumLastBytesIgnore New value
739 @Return E_OK on success; Error code otherwise.
741 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
742 *//***************************************************************************/
743 t_Error FM_PORT_ConfigCheksumLastBytesIgnore(t_Handle h_FmPort, uint8_t cheksumLastBytesIgnore);
745 /**************************************************************************//**
746 @Function FM_PORT_ConfigCutBytesFromEnd
748 @Description Calling this routine changes the number of bytes to cut from a
749 frame's end parameter in the internal driver data base
750 from its default configuration [4]
751 Note that if the result of (frame length before chop - cutBytesFromEnd) is
752 less than 14 bytes, the chop operation is not executed.
754 May be used for Rx ports only
756 @Param[in] h_FmPort A handle to a FM Port module.
757 @Param[in] cutBytesFromEnd New value
759 @Return E_OK on success; Error code otherwise.
761 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
762 *//***************************************************************************/
763 t_Error FM_PORT_ConfigCutBytesFromEnd(t_Handle h_FmPort, uint8_t cutBytesFromEnd);
765 /**************************************************************************//**
766 @Function FM_PORT_ConfigPoolDepletion
768 @Description Calling this routine enables pause frame generation depending on the
769 depletion status of BM pools. It also defines the conditions to activate
770 this functionality. By default, this functionality is disabled.
772 May be used for Rx ports only
774 @Param[in] h_FmPort A handle to a FM Port module.
775 @Param[in] p_BufPoolDepletion A structure of pool depletion parameters
777 @Return E_OK on success; Error code otherwise.
779 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
780 *//***************************************************************************/
781 t_Error FM_PORT_ConfigPoolDepletion(t_Handle h_FmPort, t_FmPortBufPoolDepletion *p_BufPoolDepletion);
783 /**************************************************************************//**
784 @Function FM_PORT_ConfigObservedPoolDepletion
786 @Description Calling this routine enables a mechanism to stop port enqueue
787 depending on the depletion status of selected BM pools.
788 It also defines the conditions to activate
789 this functionality. By default, this functionality is disabled.
791 Note: Available for some chips only
793 May be used for Offline Parsing ports only
795 @Param[in] h_FmPort A handle to a FM Port module.
796 @Param[in] p_FmPortObservedBufPoolDepletion A structure of parameters for pool depletion.
799 @Return E_OK on success; Error code otherwise.
801 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
802 *//***************************************************************************/
803 t_Error FM_PORT_ConfigObservedPoolDepletion(t_Handle h_FmPort, t_FmPortObservedBufPoolDepletion *p_FmPortObservedBufPoolDepletion);
805 /**************************************************************************//**
806 @Function FM_PORT_ConfigExtBufPools
808 @Description This routine should be called for offline parsing ports
809 that internally use BM buffer pools. In such cases, e.g. for fragmentation and
810 re-assembly, the FM needs new BM buffers. By calling this routine the user
811 specifies the BM buffer pools that should be used.
813 Note: Available for some chips only
815 May be used for Offline Parsing ports only
817 @Param[in] h_FmPort A handle to a FM Port module.
818 @Param[in] p_FmPortExtPools A structure of parameters for the external pools.
821 @Return E_OK on success; Error code otherwise.
823 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
824 *//***************************************************************************/
825 t_Error FM_PORT_ConfigExtBufPools(t_Handle h_FmPort, t_FmPortExtPools *p_FmPortExtPools);
827 /**************************************************************************//**
828 @Function FM_PORT_ConfigBackupPools
830 @Description Calling this routine allows the configuration of some of the BM pools
831 defined for this port as backup pools.
832 A pool configured to be a backup pool will be used only if all other
833 enabled non-backup pools are depleted.
835 May be used for Rx ports only
837 @Param[in] h_FmPort A handle to a FM Port module.
838 @Param[in] p_FmPortBackupBmPools An array of pool id's. All pools specified here will
839 be defined as backup pools.
841 @Return E_OK on success; Error code otherwise.
843 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
844 *//***************************************************************************/
845 t_Error FM_PORT_ConfigBackupPools(t_Handle h_FmPort, t_FmPortBackupBmPools *p_FmPortBackupBmPools);
847 /**************************************************************************//**
848 @Function FM_PORT_ConfigFrmDiscardOverride
850 @Description Calling this routine changes the error frames destination parameter
851 in the internal driver data base from its default configuration:
854 May be used for Rx and offline parsing ports only
856 @Param[in] h_FmPort A handle to a FM Port module.
857 @Param[in] override TRUE to override dicarding of error frames and
858 enqueueing them to error queue.
860 @Return E_OK on success; Error code otherwise.
862 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
863 *//***************************************************************************/
864 t_Error FM_PORT_ConfigFrmDiscardOverride(t_Handle h_FmPort, bool override);
866 /**************************************************************************//**
867 @Function FM_PORT_ConfigErrorsToDiscard
869 @Description Calling this routine changes the behaviour on error parameter
870 in the internal driver data base from its default configuration:
871 [FM_PORT_FRM_ERR_CLS_DISCARD].
872 If a requested error was previously defined as "ErrorsToEnqueue" it's
873 definition will change and the frame will be discarded.
874 Errors that were not defined either as "ErrorsToEnqueue" nor as
875 "ErrorsToDiscard", will be forwarded to CPU.
878 May be used for Rx and offline parsing ports only
880 @Param[in] h_FmPort A handle to a FM Port module.
881 @Param[in] errs A list of errors to discard
883 @Return E_OK on success; Error code otherwise.
885 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
886 *//***************************************************************************/
887 t_Error FM_PORT_ConfigErrorsToDiscard(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);
889 /**************************************************************************//**
890 @Function FM_PORT_ConfigDmaSwapData
892 @Description Calling this routine changes the DMA swap data aparameter
893 in the internal driver data base from its default
894 configuration [e_FM_PORT_DMA_NO_SWP]
896 May be used for all port types
898 @Param[in] h_FmPort A handle to a FM Port module.
899 @Param[in] swapData New selection
901 @Return E_OK on success; Error code otherwise.
903 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
904 *//***************************************************************************/
905 t_Error FM_PORT_ConfigDmaSwapData(t_Handle h_FmPort, e_FmPortDmaSwap swapData);
907 /**************************************************************************//**
908 @Function FM_PORT_ConfigDmaIcCacheAttr
910 @Description Calling this routine changes the internal context cache
911 attribute parameter in the internal driver data base
912 from its default configuration [e_FM_PORT_DMA_NO_STASH]
914 May be used for all port types
916 @Param[in] h_FmPort A handle to a FM Port module.
917 @Param[in] intContextCacheAttr New selection
919 @Return E_OK on success; Error code otherwise.
921 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
922 *//***************************************************************************/
923 t_Error FM_PORT_ConfigDmaIcCacheAttr(t_Handle h_FmPort, e_FmPortDmaCache intContextCacheAttr);
925 /**************************************************************************//**
926 @Function FM_PORT_ConfigDmaHdrAttr
928 @Description Calling this routine changes the header cache
929 attribute parameter in the internal driver data base
930 from its default configuration [e_FM_PORT_DMA_NO_STASH]
932 May be used for all port types
934 @Param[in] h_FmPort A handle to a FM Port module.
935 @Param[in] headerCacheAttr New selection
937 @Return E_OK on success; Error code otherwise.
939 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
940 *//***************************************************************************/
941 t_Error FM_PORT_ConfigDmaHdrAttr(t_Handle h_FmPort, e_FmPortDmaCache headerCacheAttr);
943 /**************************************************************************//**
944 @Function FM_PORT_ConfigDmaScatterGatherAttr
946 @Description Calling this routine changes the scatter gather cache
947 attribute parameter in the internal driver data base
948 from its default configuration [e_FM_PORT_DMA_NO_STASH]
950 May be used for all port types
952 @Param[in] h_FmPort A handle to a FM Port module.
953 @Param[in] scatterGatherCacheAttr New selection
955 @Return E_OK on success; Error code otherwise.
957 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
958 *//***************************************************************************/
959 t_Error FM_PORT_ConfigDmaScatterGatherAttr(t_Handle h_FmPort, e_FmPortDmaCache scatterGatherCacheAttr);
961 /**************************************************************************//**
962 @Function FM_PORT_ConfigDmaWriteOptimize
964 @Description Calling this routine changes the write optimization
965 parameter in the internal driver data base
966 from its default configuration: optimize = [TRUE]
968 May be used for non-Tx port types
970 @Param[in] h_FmPort A handle to a FM Port module.
971 @Param[in] optimize TRUE to enable optimization, FALSE for normal operation
973 @Return E_OK on success; Error code otherwise.
975 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
976 *//***************************************************************************/
977 t_Error FM_PORT_ConfigDmaWriteOptimize(t_Handle h_FmPort, bool optimize);
979 /**************************************************************************//**
980 @Function FM_PORT_ConfigDfltColor
982 @Description Calling this routine changes the internal default color parameter
983 in the internal driver data base
984 from its default configuration [e_FM_PORT_COLOR_GREEN]
986 May be used for all port types
988 @Param[in] h_FmPort A handle to a FM Port module.
989 @Param[in] color New selection
991 @Return E_OK on success; Error code otherwise.
993 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
994 *//***************************************************************************/
995 t_Error FM_PORT_ConfigDfltColor(t_Handle h_FmPort, e_FmPortColor color);
997 /**************************************************************************//**
998 @Function FM_PORT_ConfigSyncReq
1000 @Description Calling this routine changes the synchronization attribute parameter
1001 in the internal driver data base from its default configuration:
1004 May be used for all port types
1006 @Param[in] h_FmPort A handle to a FM Port module.
1007 @Param[in] syncReq TRUE to request synchronization, FALSE otherwize.
1009 @Return E_OK on success; Error code otherwise.
1011 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1012 *//***************************************************************************/
1013 t_Error FM_PORT_ConfigSyncReq(t_Handle h_FmPort, bool syncReq);
1015 /**************************************************************************//**
1016 @Function FM_PORT_ConfigForwardReuseIntContext
1018 @Description This routine is relevant for Rx ports that are routed to offline
1019 parsing. It changes the internal context reuse option
1020 in the internal driver data base from its default configuration:
1023 May be used for Rx ports only
1025 @Param[in] h_FmPort A handle to a FM Port module.
1026 @Param[in] reuse TRUE to reuse internal context on frames
1027 forwarded to offline parsing.
1029 @Return E_OK on success; Error code otherwise.
1031 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1032 *//***************************************************************************/
1033 t_Error FM_PORT_ConfigForwardReuseIntContext(t_Handle h_FmPort, bool reuse);
1035 /**************************************************************************//**
1036 @Function FM_PORT_ConfigDontReleaseTxBufToBM
1038 @Description This routine should be called if no Tx confirmation
1039 is done, and yet buffers should not be released to the BM.
1040 Normally, buffers are returned using the Tx confirmation
1041 process. When Tx confirmation is not used (defFqid=0),
1042 buffers are typically released to the BM. This routine
1043 may be called to avoid this behavior and not release the
1046 May be used for Tx ports only
1048 @Param[in] h_FmPort A handle to a FM Port module.
1050 @Return E_OK on success; Error code otherwise.
1052 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1053 *//***************************************************************************/
1054 t_Error FM_PORT_ConfigDontReleaseTxBufToBM(t_Handle h_FmPort);
1056 /**************************************************************************//**
1057 @Function FM_PORT_ConfigIMMaxRxBufLength
1059 @Description Changes the maximum receive buffer length from its default
1060 configuration: Closest rounded down power of 2 value of the
1063 The maximum receive buffer length directly affects the structure
1064 of received frames (single- or multi-buffered) and the performance
1065 of both the FM and the driver.
1067 The selection between single- or multi-buffered frames should be
1068 done according to the characteristics of the specific application.
1069 The recommended mode is to use a single data buffer per packet,
1070 as this mode provides the best performance. However, the user can
1071 select to use multiple data buffers per packet.
1073 @Param[in] h_FmPort A handle to a FM Port module.
1074 @Param[in] newVal Maximum receive buffer length (in bytes).
1076 @Return E_OK on success; Error code otherwise.
1078 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1079 This routine is to be used only if Independent-Mode is enabled.
1080 *//***************************************************************************/
1081 t_Error FM_PORT_ConfigIMMaxRxBufLength(t_Handle h_FmPort, uint16_t newVal);
1083 /**************************************************************************//**
1084 @Function FM_PORT_ConfigIMRxBdRingLength
1086 @Description Changes the receive BD ring length from its default
1089 @Param[in] h_FmPort A handle to a FM Port module.
1090 @Param[in] newVal The desired BD ring length.
1092 @Return E_OK on success; Error code otherwise.
1094 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1095 This routine is to be used only if Independent-Mode is enabled.
1096 *//***************************************************************************/
1097 t_Error FM_PORT_ConfigIMRxBdRingLength(t_Handle h_FmPort, uint16_t newVal);
1099 /**************************************************************************//**
1100 @Function FM_PORT_ConfigIMTxBdRingLength
1102 @Description Changes the transmit BD ring length from its default
1105 @Param[in] h_FmPort A handle to a FM Port module.
1106 @Param[in] newVal The desired BD ring length.
1108 @Return E_OK on success; Error code otherwise.
1110 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1111 This routine is to be used only if Independent-Mode is enabled.
1112 *//***************************************************************************/
1113 t_Error FM_PORT_ConfigIMTxBdRingLength(t_Handle h_FmPort, uint16_t newVal);
1115 /**************************************************************************//**
1116 @Function FM_PORT_ConfigIMFmanCtrlExternalStructsMemory
1118 @Description Configures memory partition and attributes for FMan-Controller
1119 data structures (e.g. BD rings).
1120 Calling this routine changes the internal driver data base
1121 from its default configuration
1122 [0 , MEMORY_ATTR_CACHEABLE].
1124 @Param[in] h_FmPort A handle to a FM Port module.
1125 @Param[in] memId Memory partition ID.
1126 @Param[in] memAttributes Memory attributes mask (a combination of MEMORY_ATTR_x flags).
1128 @Return E_OK on success; Error code otherwise.
1129 *//***************************************************************************/
1130 t_Error FM_PORT_ConfigIMFmanCtrlExternalStructsMemory(t_Handle h_FmPort,
1132 uint32_t memAttributes);
1134 /**************************************************************************//**
1135 @Function FM_PORT_ConfigIMPolling
1137 @Description Changes the Rx flow from interrupt driven (default) to polling.
1139 @Param[in] h_FmPort A handle to a FM Port module.
1141 @Return E_OK on success; Error code otherwise.
1143 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1144 This routine is to be used only if Independent-Mode is enabled.
1145 *//***************************************************************************/
1146 t_Error FM_PORT_ConfigIMPolling(t_Handle h_FmPort);
1148 /** @} */ /* end of FM_PORT_advanced_init_grp group */
1149 /** @} */ /* end of FM_PORT_init_grp group */
1152 /**************************************************************************//**
1153 @Group FM_PORT_runtime_control_grp FM Port Runtime Control Unit
1155 @Description FM Port Runtime control unit API functions, definitions and enums.
1158 *//***************************************************************************/
1160 /**************************************************************************//**
1161 @Description enum for defining FM Port counters
1162 *//***************************************************************************/
1163 typedef enum e_FmPortCounters {
1164 e_FM_PORT_COUNTERS_CYCLE, /**< BMI performance counter */
1165 e_FM_PORT_COUNTERS_TASK_UTIL, /**< BMI performance counter */
1166 e_FM_PORT_COUNTERS_QUEUE_UTIL, /**< BMI performance counter */
1167 e_FM_PORT_COUNTERS_DMA_UTIL, /**< BMI performance counter */
1168 e_FM_PORT_COUNTERS_FIFO_UTIL, /**< BMI performance counter */
1169 e_FM_PORT_COUNTERS_RX_PAUSE_ACTIVATION, /**< BMI Rx only performance counter */
1170 e_FM_PORT_COUNTERS_FRAME, /**< BMI statistics counter */
1171 e_FM_PORT_COUNTERS_DISCARD_FRAME, /**< BMI statistics counter */
1172 e_FM_PORT_COUNTERS_DEALLOC_BUF, /**< BMI deallocate buffer statistics counter */
1173 e_FM_PORT_COUNTERS_RX_BAD_FRAME, /**< BMI Rx only statistics counter */
1174 e_FM_PORT_COUNTERS_RX_LARGE_FRAME, /**< BMI Rx only statistics counter */
1175 e_FM_PORT_COUNTERS_RX_OUT_OF_BUFFERS_DISCARD, /**< BMI Rx only statistics counter */
1176 e_FM_PORT_COUNTERS_RX_FILTER_FRAME, /**< BMI Rx & OP only statistics counter */
1177 e_FM_PORT_COUNTERS_RX_LIST_DMA_ERR, /**< BMI Rx, OP & HC only statistics counter */
1178 e_FM_PORT_COUNTERS_WRED_DISCARD, /**< BMI OP & HC only statistics counter */
1179 e_FM_PORT_COUNTERS_LENGTH_ERR, /**< BMI non-Rx statistics counter */
1180 e_FM_PORT_COUNTERS_UNSUPPRTED_FORMAT, /**< BMI non-Rx statistics counter */
1181 e_FM_PORT_COUNTERS_DEQ_TOTAL, /**< QMI counter */
1182 e_FM_PORT_COUNTERS_ENQ_TOTAL, /**< QMI counter */
1183 e_FM_PORT_COUNTERS_DEQ_FROM_DEFAULT, /**< QMI counter */
1184 e_FM_PORT_COUNTERS_DEQ_CONFIRM /**< QMI counter */
1187 /**************************************************************************//**
1188 @Description Structure for Port id parameters.
1189 Fields commented 'IN' are passed by the port module to be used
1191 Fields commented 'OUT' will be filled by FM before returning to port.
1192 *//***************************************************************************/
1193 typedef struct t_FmPortCongestionGrps {
1194 uint16_t numOfCongestionGrpsToConsider; /**< The number of required congestion groups
1195 to define the size of the following array */
1196 uint8_t congestionGrpsToConsider[FM_PORT_NUM_OF_CONGESTION_GRPS];
1197 /**< An array of 'numOfCongestionGrpsToConsider'
1198 describing the groups */
1199 } t_FmPortCongestionGrps;
1203 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1204 /**************************************************************************//**
1205 @Function FM_PORT_DumpRegs
1207 @Description Dump all regs.
1209 Calling this routine invalidates the descriptor.
1211 @Param[in] h_FmPort - FM PORT module descriptor
1213 @Return E_OK on success; Error code otherwise.
1215 @Cautions Allowed only following FM_PORT_Init().
1216 *//***************************************************************************/
1217 t_Error FM_PORT_DumpRegs(t_Handle h_FmPort);
1218 #endif /* (defined(DEBUG_ERRORS) && ... */
1220 /**************************************************************************//**
1221 @Function FM_PORT_GetBufferDataOffset
1223 @Description Relevant for Rx ports.
1224 Returns the data offset from the beginning of the data buffer
1226 @Param[in] h_FmPort - FM PORT module descriptor
1228 @Return data offset.
1230 @Cautions Allowed only following FM_PORT_Init().
1231 *//***************************************************************************/
1232 uint32_t FM_PORT_GetBufferDataOffset(t_Handle h_FmPort);
1234 /**************************************************************************//**
1235 @Function FM_PORT_GetBufferICInfo
1237 @Description Returns the Internal Context offset from the beginning of the data buffer
1239 @Param[in] h_FmPort - FM PORT module descriptor
1240 @Param[in] p_Data - A pointer to the data buffer.
1242 @Return Internal context info pointer on success, NULL if 'allOtherInfo' was not
1243 configured for this port.
1245 @Cautions Allowed only following FM_PORT_Init().
1246 *//***************************************************************************/
1247 uint8_t * FM_PORT_GetBufferICInfo(t_Handle h_FmPort, char *p_Data);
1250 /**************************************************************************//**
1251 @Function FM_PORT_GetBufferDebugInfo
1253 @Description Returns the debug info offset from the beginning of the data buffer
1255 @Param[in] h_FmPort - FM PORT module descriptor
1256 @Param[in] p_Data - A pointer to the data buffer.
1258 @Return Debug info pointer on success, NULL if 'passDebugInfo' was not
1259 configured for this port.
1261 @Cautions Allowed only following FM_PORT_Init().
1262 *//***************************************************************************/
1263 uint8_t * FM_PORT_GetBufferDebugInfo(t_Handle h_FmPort, char *p_Data);
1266 /**************************************************************************//**
1267 @Function FM_PORT_GetBufferPrsResult
1269 @Description Returns the pointer to the parse result in the data buffer.
1270 In Rx ports this is relevant after reception, if parse
1271 result is configured to be part of the data passed to the
1272 application. For non Rx ports it may be used to get the pointer
1273 of the area in the buffer where parse result should be
1274 initialized - if so configured.
1275 See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
1278 @Param[in] h_FmPort - FM PORT module descriptor
1279 @Param[in] p_Data - A pointer to the data buffer.
1281 @Return Parse result pointer on success, NULL if parse result was not
1282 configured for this port.
1284 @Cautions Allowed only following FM_PORT_Init().
1285 *//***************************************************************************/
1286 t_FmPrsResult * FM_PORT_GetBufferPrsResult(t_Handle h_FmPort, char *p_Data);
1288 /**************************************************************************//**
1289 @Function FM_PORT_GetBufferTimeStamp
1291 @Description Returns the time stamp in the data buffer.
1292 Relevant for Rx ports for getting the buffer time stamp.
1293 See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
1296 @Param[in] h_FmPort - FM PORT module descriptor
1297 @Param[in] p_Data - A pointer to the data buffer.
1299 @Return A pointer to the hash result on success, NULL otherwise.
1301 @Cautions Allowed only following FM_PORT_Init().
1302 *//***************************************************************************/
1303 uint64_t * FM_PORT_GetBufferTimeStamp(t_Handle h_FmPort, char *p_Data);
1305 /**************************************************************************//**
1306 @Function FM_PORT_GetBufferHashResult
1308 @Description Given a data buffer, on the condition that hash result was defined
1309 as a part of the buffer content (see FM_PORT_ConfigBufferPrefixContent)
1310 this routine will return the pointer to the hash result location in the
1313 @Param[in] h_FmPort - FM PORT module descriptor
1314 @Param[in] p_Data - A pointer to the data buffer.
1316 @Return A pointer to the hash result on success, NULL otherwise.
1318 @Cautions Allowed only following FM_PORT_Init().
1319 *//***************************************************************************/
1320 uint8_t * FM_PORT_GetBufferHashResult(t_Handle h_FmPort, char *p_Data);
1322 /**************************************************************************//**
1323 @Function FM_PORT_Disable
1325 @Description Gracefully disable an FM port. The port will not start new tasks after all
1326 tasks associated with the port are terminated.
1328 @Param[in] h_FmPort A handle to a FM Port module.
1330 @Return E_OK on success; Error code otherwise.
1332 @Cautions Allowed only following FM_PORT_Init().
1333 This is a blocking routine, it returns after port is
1334 gracefully stopped, i.e. the port will not except new frames,
1335 but it will finish all frames or tasks which were already began
1336 *//***************************************************************************/
1337 t_Error FM_PORT_Disable(t_Handle h_FmPort);
1339 /**************************************************************************//**
1340 @Function FM_PORT_Enable
1342 @Description A runtime routine provided to allow disable/enable of port.
1344 @Param[in] h_FmPort A handle to a FM Port module.
1346 @Return E_OK on success; Error code otherwise.
1348 @Cautions Allowed only following FM_PORT_Init().
1349 *//***************************************************************************/
1350 t_Error FM_PORT_Enable(t_Handle h_FmPort);
1352 /**************************************************************************//**
1353 @Function FM_PORT_SetRateLimit
1355 @Description Calling this routine enables rate limit algorithm.
1356 By default, this functionality is disabled.
1357 Note that rate-limit mechanism uses the FM time stamp.
1358 The selected rate limit specified here would be
1359 rounded DOWN to the nearest 16M.
1361 May be used for Tx and offline parsing ports only
1363 @Param[in] h_FmPort A handle to a FM Port module.
1364 @Param[in] p_RateLimit A structure of rate limit parameters
1366 @Return E_OK on success; Error code otherwise.
1368 @Cautions Allowed only following FM_PORT_Init().
1369 *//***************************************************************************/
1370 t_Error FM_PORT_SetRateLimit(t_Handle h_FmPort, t_FmPortRateLimit *p_RateLimit);
1372 /**************************************************************************//**
1373 @Function FM_PORT_DeleteRateLimit
1375 @Description Calling this routine disables and clears rate limit
1378 May be used for Tx and offline parsing ports only
1380 @Param[in] h_FmPort A handle to a FM Port module.
1382 @Return E_OK on success; Error code otherwise.
1384 @Cautions Allowed only following FM_PORT_Init().
1385 *//***************************************************************************/
1386 t_Error FM_PORT_DeleteRateLimit(t_Handle h_FmPort);
1388 /**************************************************************************//**
1389 @Function FM_PORT_SetStatisticsCounters
1391 @Description Calling this routine enables/disables port's statistics counters.
1392 By default, counters are enabled.
1394 May be used for all port types
1396 @Param[in] h_FmPort A handle to a FM Port module.
1397 @Param[in] enable TRUE to enable, FALSE to disable.
1399 @Return E_OK on success; Error code otherwise.
1401 @Cautions Allowed only following FM_PORT_Init().
1402 *//***************************************************************************/
1403 t_Error FM_PORT_SetStatisticsCounters(t_Handle h_FmPort, bool enable);
1405 /**************************************************************************//**
1406 @Function FM_PORT_SetFrameQueueCounters
1408 @Description Calling this routine enables/disables port's enqueue/dequeue counters.
1409 By default, counters are enabled.
1411 May be used for all ports
1413 @Param[in] h_FmPort A handle to a FM Port module.
1414 @Param[in] enable TRUE to enable, FALSE to disable.
1416 @Return E_OK on success; Error code otherwise.
1418 @Cautions Allowed only following FM_PORT_Init().
1419 *//***************************************************************************/
1420 t_Error FM_PORT_SetFrameQueueCounters(t_Handle h_FmPort, bool enable);
1422 /**************************************************************************//**
1423 @Function FM_PORT_SetPerformanceCounters
1425 @Description Calling this routine enables/disables port's performance counters.
1426 By default, counters are enabled.
1428 May be used for all port types
1430 @Param[in] h_FmPort A handle to a FM Port module.
1431 @Param[in] enable TRUE to enable, FALSE to disable.
1433 @Return E_OK on success; Error code otherwise.
1435 @Cautions Allowed only following FM_PORT_Init().
1436 *//***************************************************************************/
1437 t_Error FM_PORT_SetPerformanceCounters(t_Handle h_FmPort, bool enable);
1439 /**************************************************************************//**
1440 @Function FM_PORT_SetPerformanceCounters
1442 @Description Calling this routine defines port's performance
1443 counters parameters.
1445 May be used for all port types
1447 @Param[in] h_FmPort A handle to a FM Port module.
1448 @Param[in] p_FmPortPerformanceCnt A pointer to a structure of performance
1449 counters parameters.
1451 @Return E_OK on success; Error code otherwise.
1453 @Cautions Allowed only following FM_PORT_Init().
1454 *//***************************************************************************/
1455 t_Error FM_PORT_SetPerformanceCountersParams(t_Handle h_FmPort, t_FmPortPerformanceCnt *p_FmPortPerformanceCnt);
1457 /**************************************************************************//**
1458 @Function FM_PORT_AnalyzePerformanceParams
1460 @Description User may call this routine to so the driver will analyze if the
1461 basic performance parameters are correct and also the driver may
1462 suggest of improvments; The basic parameters are FIFO sizes, number
1463 of DMAs and number of TNUMs for the port.
1465 May be used for all port types
1467 @Param[in] h_FmPort A handle to a FM Port module.
1469 @Return E_OK on success; Error code otherwise.
1471 @Cautions Allowed only following FM_PORT_Init().
1472 *//***************************************************************************/
1473 t_Error FM_PORT_AnalyzePerformanceParams(t_Handle h_FmPort);
1475 /**************************************************************************//**
1476 @Function FM_PORT_SetNumOfOpenDmas
1478 @Description Calling this routine updates the number of open DMA requested for
1482 May be used for all port types.
1484 @Param[in] h_FmPort A handle to a FM Port module.
1485 @Param[in] p_NumOfOpenDmas A structure of resource requested parameters
1487 @Return E_OK on success; Error code otherwise.
1489 @Cautions Allowed only following FM_PORT_Init().
1490 *//***************************************************************************/
1491 t_Error FM_PORT_SetNumOfOpenDmas(t_Handle h_FmPort, t_FmPortRsrc *p_NumOfOpenDmas);
1493 /**************************************************************************//**
1494 @Function FM_PORT_SetNumOfTasks
1496 @Description Calling this routine updates the number of tasks requested for
1499 May be used for all port types.
1501 @Param[in] h_FmPort A handle to a FM Port module.
1502 @Param[in] p_NumOfTasks A structure of resource requested parameters
1504 @Return E_OK on success; Error code otherwise.
1506 @Cautions Allowed only following FM_PORT_Init().
1507 *//***************************************************************************/
1508 t_Error FM_PORT_SetNumOfTasks(t_Handle h_FmPort, t_FmPortRsrc *p_NumOfTasks);
1510 /**************************************************************************//**
1511 @Function FM_PORT_SetSizeOfFifo
1513 @Description Calling this routine updates the Fifo size resource requested for
1516 May be used for all port types - note that only Rx has 'extra'
1517 fifo size. For other ports 'extra' field must be disabled.
1519 @Param[in] h_FmPort A handle to a FM Port module.
1520 @Param[in] p_SizeOfFifo A structure of resource requested parameters
1522 @Return E_OK on success; Error code otherwise.
1524 @Cautions Allowed only following FM_PORT_Init().
1525 *//***************************************************************************/
1526 t_Error FM_PORT_SetSizeOfFifo(t_Handle h_FmPort, t_FmPortRsrc *p_SizeOfFifo);
1528 /**************************************************************************//**
1529 @Function FM_PORT_SetAllocBufCounter
1531 @Description Calling this routine enables/disables BM pool allocate
1533 By default, counters are enabled.
1535 May be used for Rx ports only
1537 @Param[in] h_FmPort A handle to a FM Port module.
1538 @Param[in] poolId BM pool id.
1539 @Param[in] enable TRUE to enable, FALSE to disable.
1541 @Return E_OK on success; Error code otherwise.
1543 @Cautions Allowed only following FM_PORT_Init().
1544 *//***************************************************************************/
1545 t_Error FM_PORT_SetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId, bool enable);
1547 /**************************************************************************//**
1548 @Function FM_PORT_GetCounter
1550 @Description Reads one of the FM PORT counters.
1552 @Param[in] h_FmPort A handle to a FM Port module.
1553 @Param[in] fmPortCounter The requested counter.
1555 @Return Counter's current value.
1557 @Cautions Allowed only following FM_PORT_Init().
1558 Note that it is user's responsibility to call this routine only
1559 for enabled counters, and there will be no indication if a
1560 disabled counter is accessed.
1561 *//***************************************************************************/
1562 uint32_t FM_PORT_GetCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter);
1564 /**************************************************************************//**
1565 @Function FM_PORT_ModifyCounter
1567 @Description Sets a value to an enabled counter. Use "0" to reset the counter.
1569 @Param[in] h_FmPort A handle to a FM Port module.
1570 @Param[in] fmPortCounter The requested counter.
1571 @Param[in] value The requested value to be written into the counter.
1573 @Return E_OK on success; Error code otherwise.
1575 @Cautions Allowed only following FM_PORT_Init().
1576 *//***************************************************************************/
1577 t_Error FM_PORT_ModifyCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter, uint32_t value);
1579 /**************************************************************************//**
1580 @Function FM_PORT_GetAllocBufCounter
1582 @Description Reads one of the FM PORT buffer counters.
1584 @Param[in] h_FmPort A handle to a FM Port module.
1585 @Param[in] poolId The requested pool.
1587 @Return Counter's current value.
1589 @Cautions Allowed only following FM_PORT_Init().
1590 Note that it is user's responsibility to call this routine only
1591 for enabled counters, and there will be no indication if a
1592 disabled counter is accessed.
1593 *//***************************************************************************/
1594 uint32_t FM_PORT_GetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId);
1596 /**************************************************************************//**
1597 @Function FM_PORT_ModifyAllocBufCounter
1599 @Description Sets a value to an enabled counter. Use "0" to reset the counter.
1601 @Param[in] h_FmPort A handle to a FM Port module.
1602 @Param[in] poolId The requested pool.
1603 @Param[in] value The requested value to be written into the counter.
1605 @Return E_OK on success; Error code otherwise.
1607 @Cautions Allowed only following FM_PORT_Init().
1608 *//***************************************************************************/
1609 t_Error FM_PORT_ModifyAllocBufCounter(t_Handle h_FmPort, uint8_t poolId, uint32_t value);
1611 /**************************************************************************//**
1612 @Function FM_PORT_AddCongestionGrps
1614 @Description This routine effects the corresponding Tx port.
1615 It should be called in order to enable pause
1616 frame transmission in case of congestion in one or more
1617 of the congestion groups relevant to this port.
1618 Each call to this routine may add one or more congestion
1619 groups to be considered relevant to this port.
1621 May be used for Rx, or RX+OP ports only (depending on chip)
1623 @Param[in] h_FmPort A handle to a FM Port module.
1624 @Param[in] p_CongestionGrps A pointer to an array of congestion groups
1627 @Return E_OK on success; Error code otherwise.
1629 @Cautions Allowed only following FM_PORT_Init().
1630 *//***************************************************************************/
1631 t_Error FM_PORT_AddCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);
1633 /**************************************************************************//**
1634 @Function FM_PORT_RemoveCongestionGrps
1636 @Description This routine effects the corresponding Tx port. It should be
1637 called when congestion groups were
1638 defined for this port and are no longer relevant, or pause
1639 frames transmitting is not required on their behalf.
1640 Each call to this routine may remove one or more congestion
1641 groups to be considered relevant to this port.
1643 May be used for Rx, or RX+OP ports only (depending on chip)
1645 @Param[in] h_FmPort A handle to a FM Port module.
1646 @Param[in] p_CongestionGrps A pointer to an array of congestion groups
1649 @Return E_OK on success; Error code otherwise.
1651 @Cautions Allowed only following FM_PORT_Init().
1652 *//***************************************************************************/
1653 t_Error FM_PORT_RemoveCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);
1655 /**************************************************************************//**
1656 @Function FM_PORT_IsStalled
1658 @Description A routine for checking whether the specified port is stalled.
1660 @Param[in] h_FmPort A handle to a FM Port module.
1662 @Return TRUE if port is stalled, FALSE otherwize
1664 @Cautions Allowed only following FM_PORT_Init().
1665 *//***************************************************************************/
1666 bool FM_PORT_IsStalled(t_Handle h_FmPort);
1668 /**************************************************************************//**
1669 @Function FM_PORT_ReleaseStalled
1671 @Description This routine may be called in case the port was stalled and may
1674 @Param[in] h_FmPort A handle to a FM Port module.
1676 @Return E_OK on success; Error code otherwise.
1678 @Cautions Allowed only following FM_PORT_Init().
1679 *//***************************************************************************/
1680 t_Error FM_PORT_ReleaseStalled(t_Handle h_FmPort);
1682 /**************************************************************************//**
1683 @Function FM_PORT_SetRxL4ChecksumVerify
1685 @Description This routine is relevant for Rx ports (1G and 10G). The routine
1686 set/clear the L3/L4 checksum verification (on RX side).
1687 Note that this takes affect only if hw-parser is enabled!
1689 @Param[in] h_FmPort A handle to a FM Port module.
1690 @Param[in] l4Checksum boolean indicates whether to do L3/L4 checksum
1693 @Return E_OK on success; Error code otherwise.
1695 @Cautions Allowed only following FM_PORT_Init().
1696 *//***************************************************************************/
1697 t_Error FM_PORT_SetRxL4ChecksumVerify(t_Handle h_FmPort, bool l4Checksum);
1699 /**************************************************************************//**
1700 @Function FM_PORT_SetErrorsRoute
1702 @Description Errors selected for this routine will cause a frame with that error
1703 to be enqueued to error queue.
1704 Errors not selected for this routine will cause a frame with that error
1705 to be enqueued to the one of the other port queues.
1706 By default all errors are defined to be enqueued to error queue.
1707 Errors that were configured to be discarded (at initialization)
1708 may not be selected here.
1710 May be used for Rx and offline parsing ports only
1712 @Param[in] h_FmPort A handle to a FM Port module.
1713 @Param[in] errs A list of errors to enqueue to error queue
1715 @Return E_OK on success; Error code otherwise.
1717 @Cautions Allowed only following FM_PORT_Config() and before FM_PORT_Init().
1718 *//***************************************************************************/
1719 t_Error FM_PORT_SetErrorsRoute(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);
1721 /**************************************************************************//**
1722 @Function FM_PORT_SetIMExceptions
1724 @Description Calling this routine enables/disables FM PORT interrupts.
1725 Note: Not available for guest partition.
1727 @Param[in] h_FmPort FM PORT module descriptor.
1728 @Param[in] exception The exception to be selected.
1729 @Param[in] enable TRUE to enable interrupt, FALSE to mask it.
1731 @Return E_OK on success; Error code otherwise.
1733 @Cautions Allowed only following FM_PORT_Init().
1734 *//***************************************************************************/
1735 t_Error FM_PORT_SetIMExceptions(t_Handle h_FmPort, e_FmPortExceptions exception, bool enable);
1739 /**************************************************************************//**
1740 @Group FM_PORT_pcd_runtime_control_grp FM Port PCD Runtime Control Unit
1742 @Description FM Port PCD Runtime control unit API functions, definitions and enums.
1745 *//***************************************************************************/
1747 /**************************************************************************//**
1748 @Description A structure defining the KG scheme after the parser.
1749 This is relevant only to change scheme selection mode - from
1750 direct to indirect and vice versa, or when the scheme is selected directly,
1751 to select the scheme id.
1753 *//***************************************************************************/
1754 typedef struct t_FmPcdKgSchemeSelect {
1755 bool direct; /**< TRUE to use 'h_Scheme' directly, FALSE to use LCV.*/
1756 t_Handle h_DirectScheme; /**< Relevant for 'direct'=TRUE only.
1757 'h_DirectScheme' selects the scheme after parser. */
1758 } t_FmPcdKgSchemeSelect;
1760 /**************************************************************************//**
1761 @Description A structure of scheme parameters
1762 *//***************************************************************************/
1763 typedef struct t_FmPcdPortSchemesParams {
1764 uint8_t numOfSchemes; /**< Number of schemes for port to be bound to. */
1765 t_Handle h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES]; /**< Array of 'numOfSchemes' schemes for the
1766 port to be bound to */
1767 } t_FmPcdPortSchemesParams;
1769 /**************************************************************************//**
1770 @Description Union for defining port protocol parameters for parser
1771 *//***************************************************************************/
1772 typedef union u_FmPcdHdrPrsOpts {
1775 bool labelInterpretationEnable; /**< When this bit is set, the last MPLS label will be
1776 interpreted as described in HW spec table. When the bit
1777 is cleared, the parser will advance to MPLS next parse */
1778 e_NetHeaderType nextParse; /**< must be equal or higher than IPv4 */
1782 uint16_t tagProtocolId1; /**< User defined Tag Protocol Identifier, to be recognized
1783 on VLAN TAG on top of 0x8100 and 0x88A8 */
1784 uint16_t tagProtocolId2; /**< User defined Tag Protocol Identifier, to be recognized
1785 on VLAN TAG on top of 0x8100 and 0x88A8 */
1789 bool enableMTUCheck; /**< Check validity of MTU according to RFC2516 */
1794 bool routingHdrDisable; /**< Disable routing header */
1799 bool padIgnoreChecksum; /**< TRUE to ignore pad in checksum */
1804 bool padIgnoreChecksum; /**< TRUE to ignore pad in checksum */
1806 } u_FmPcdHdrPrsOpts;
1808 /**************************************************************************//**
1809 @Description A structure for defining each header for the parser
1810 *//***************************************************************************/
1811 typedef struct t_FmPcdPrsAdditionalHdrParams {
1812 e_NetHeaderType hdr; /**< Selected header */
1813 bool errDisable; /**< TRUE to disable error indication */
1814 bool swPrsEnable; /**< Enable jump to SW parser when this
1815 header is recognized by the HW parser. */
1816 uint8_t indexPerHdr; /**< Normally 0, if more than one sw parser
1817 attachments exists for the same header,
1818 (in the main sw parser code) use this
1819 index to distinguish between them. */
1820 bool usePrsOpts; /**< TRUE to use parser options. */
1821 u_FmPcdHdrPrsOpts prsOpts; /**< A union according to header type,
1822 defining the parser options selected.*/
1823 } t_FmPcdPrsAdditionalHdrParams;
1825 /**************************************************************************//**
1826 @Description struct for defining port PCD parameters
1827 *//***************************************************************************/
1828 typedef struct t_FmPortPcdPrsParams {
1829 uint8_t prsResultPrivateInfo; /**< The private info provides a method of inserting
1830 port information into the parser result. This information
1831 may be extracted by Keygen and be used for frames
1832 distribution when a per-port distinction is required,
1833 it may also be used as a port logical id for analyzing
1835 uint8_t parsingOffset; /**< Number of bytes from beginning of packet to start parsing */
1836 e_NetHeaderType firstPrsHdr; /**< The type of the first header expected at 'parsingOffset' */
1837 bool includeInPrsStatistics; /**< TRUE to include this port in the parser statistics;
1838 NOTE: this field is not valid when the FN is in "guest" mode. */
1839 uint8_t numOfHdrsWithAdditionalParams; /**< Normally 0, some headers may get
1840 special parameters */
1841 t_FmPcdPrsAdditionalHdrParams additionalParams[FM_PCD_PRS_NUM_OF_HDRS];
1842 /**< 'numOfHdrsWithAdditionalParams' structures
1843 of additional parameters
1844 for each header that requires them */
1845 bool setVlanTpid1; /**< TRUE to configure user selection of Ethertype to
1846 indicate a VLAN tag (in addition to the TPID values
1847 0x8100 and 0x88A8). */
1848 uint16_t vlanTpid1; /**< extra tag to use if setVlanTpid1=TRUE. */
1849 bool setVlanTpid2; /**< TRUE to configure user selection of Ethertype to
1850 indicate a VLAN tag (in addition to the TPID values
1851 0x8100 and 0x88A8). */
1852 uint16_t vlanTpid2; /**< extra tag to use if setVlanTpid1=TRUE. */
1853 } t_FmPortPcdPrsParams;
1855 /**************************************************************************//**
1856 @Description struct for defining coarse alassification parameters
1857 *//***************************************************************************/
1858 typedef struct t_FmPortPcdCcParams {
1859 t_Handle h_CcTree; /**< A handle to a CC tree */
1860 } t_FmPortPcdCcParams;
1862 /**************************************************************************//**
1863 @Description struct for defining keygen parameters
1864 *//***************************************************************************/
1865 typedef struct t_FmPortPcdKgParams {
1866 uint8_t numOfSchemes; /**< Number of schemes for port to be bound to. */
1867 t_Handle h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES];
1868 /**< Array of 'numOfSchemes' schemes handles for the
1869 port to be bound to */
1870 bool directScheme; /**< TRUE for going from parser to a specific scheme,
1871 regardless of parser result */
1872 t_Handle h_DirectScheme; /**< relevant only if direct == TRUE, Scheme handle,
1873 as returned by FM_PCD_KgSetScheme */
1874 } t_FmPortPcdKgParams;
1876 /**************************************************************************//**
1877 @Description struct for defining policer parameters
1878 *//***************************************************************************/
1879 typedef struct t_FmPortPcdPlcrParams {
1880 t_Handle h_Profile; /**< Selected profile handle; Relevant for one of
1882 e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or
1883 e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR were selected,
1884 or if any flow uses a KG scheme were policer
1885 profile is not generated
1886 (bypassPlcrProfileGeneration selected) */
1887 } t_FmPortPcdPlcrParams;
1889 /**************************************************************************//**
1890 @Description struct for defining port PCD parameters
1891 *//***************************************************************************/
1892 typedef struct t_FmPortPcdParams {
1893 e_FmPortPcdSupport pcdSupport; /**< Relevant for Rx and offline ports only.
1894 Describes the active PCD engines for this port. */
1895 t_Handle h_NetEnv; /**< HL Unused in PLCR only mode */
1896 t_FmPortPcdPrsParams *p_PrsParams; /**< Parser parameters for this port */
1897 t_FmPortPcdCcParams *p_CcParams; /**< Coarse classification parameters for this port */
1898 t_FmPortPcdKgParams *p_KgParams; /**< Keygen parameters for this port */
1899 t_FmPortPcdPlcrParams *p_PlcrParams; /**< Policer parameters for this port */
1900 } t_FmPortPcdParams;
1902 /**************************************************************************//**
1903 @Description A structure for defining the Parser starting point
1904 *//***************************************************************************/
1905 typedef struct t_FmPcdPrsStart {
1906 uint8_t parsingOffset; /**< Number of bytes from beginning of packet to
1908 e_NetHeaderType firstPrsHdr; /**< The type of the first header axpected at
1913 /**************************************************************************//**
1914 @Function FM_PORT_SetPCD
1916 @Description Calling this routine defines the port's PCD configuration.
1917 It changes it from its default configuration which is PCD
1918 disabled (BMI to BMI) and configures it according to the passed
1921 May be used for Rx and offline parsing ports only
1923 @Param[in] h_FmPort A handle to a FM Port module.
1924 @Param[in] p_FmPortPcd A Structure of parameters defining the port's PCD
1927 @Return E_OK on success; Error code otherwise.
1929 @Cautions Allowed only following FM_PORT_Init().
1930 *//***************************************************************************/
1931 t_Error FM_PORT_SetPCD(t_Handle h_FmPort, t_FmPortPcdParams *p_FmPortPcd);
1933 /**************************************************************************//**
1934 @Function FM_PORT_DeletePCD
1936 @Description Calling this routine releases the port's PCD configuration.
1937 The port returns to its default configuration which is PCD
1938 disabled (BMI to BMI) and all PCD configuration is removed.
1940 May be used for Rx and offline parsing ports which are
1943 @Param[in] h_FmPort A handle to a FM Port module.
1945 @Return E_OK on success; Error code otherwise.
1947 @Cautions Allowed only following FM_PORT_Init().
1948 *//***************************************************************************/
1949 t_Error FM_PORT_DeletePCD(t_Handle h_FmPort);
1951 /**************************************************************************//**
1952 @Function FM_PORT_AttachPCD
1954 @Description This routine may be called after FM_PORT_DetachPCD was called,
1955 to return to the originally configured PCD support flow.
1956 The couple of routines are used to allow PCD configuration changes
1957 that demand that PCD will not be used while changes take place.
1959 May be used for Rx and offline parsing ports which are
1962 @Param[in] h_FmPort A handle to a FM Port module.
1964 @Return E_OK on success; Error code otherwise.
1966 @Cautions Allowed only following FM_PORT_Init().
1967 *//***************************************************************************/
1968 t_Error FM_PORT_AttachPCD(t_Handle h_FmPort);
1970 /**************************************************************************//**
1971 @Function FM_PORT_DetachPCD
1973 @Description Calling this routine detaches the port from its PCD functionality.
1974 The port returns to its default flow which is BMI to BMI.
1976 May be used for Rx and offline parsing ports which are
1979 @Param[in] h_FmPort A handle to a FM Port module.
1981 @Return E_OK on success; Error code otherwise.
1983 @Cautions Allowed only following FM_PORT_AttachPCD().
1984 *//***************************************************************************/
1985 t_Error FM_PORT_DetachPCD(t_Handle h_FmPort);
1987 /**************************************************************************//**
1988 @Function FM_PORT_PcdPlcrAllocProfiles
1990 @Description This routine may be called only for ports that use the Policer in
1991 order to allocate private policer profiles.
1993 @Param[in] h_FmPort A handle to a FM Port module.
1994 @Param[in] numOfProfiles The number of required policer profiles
1996 @Return E_OK on success; Error code otherwise.
1998 @Cautions Allowed only following FM_PORT_Init() and FM_PCD_Init(), and before FM_PORT_SetPCD().
1999 *//***************************************************************************/
2000 t_Error FM_PORT_PcdPlcrAllocProfiles(t_Handle h_FmPort, uint16_t numOfProfiles);
2002 /**************************************************************************//**
2003 @Function FM_PORT_PcdPlcrFreeProfiles
2005 @Description This routine should be called for freeing private policer profiles.
2007 @Param[in] h_FmPort A handle to a FM Port module.
2009 @Return E_OK on success; Error code otherwise.
2011 @Cautions Allowed only following FM_PORT_Init() and FM_PCD_Init(), and before FM_PORT_SetPCD().
2012 *//***************************************************************************/
2013 t_Error FM_PORT_PcdPlcrFreeProfiles(t_Handle h_FmPort);
2015 /**************************************************************************//**
2016 @Function FM_PORT_PcdKgModifyInitialScheme
2018 @Description This routine may be called only for ports that use the keygen in
2019 order to change the initial scheme frame should be routed to.
2020 The change may be of a scheme id (in case of direct mode),
2021 from direct to indirect, or from indirect to direct - specifying the scheme id.
2023 @Param[in] h_FmPort A handle to a FM Port module.
2024 @Param[in] p_FmPcdKgScheme A structure of parameters for defining whether
2025 a scheme is direct/indirect, and if direct - scheme id.
2027 @Return E_OK on success; Error code otherwise.
2029 @Cautions Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2030 *//***************************************************************************/
2031 t_Error FM_PORT_PcdKgModifyInitialScheme (t_Handle h_FmPort, t_FmPcdKgSchemeSelect *p_FmPcdKgScheme);
2033 /**************************************************************************//**
2034 @Function FM_PORT_PcdPlcrModifyInitialProfile
2036 @Description This routine may be called for ports with flows
2037 e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR
2038 only, to change the initial Policer profile frame should be
2039 routed to. The change may be of a profile and/or absolute/direct
2042 @Param[in] h_FmPort A handle to a FM Port module.
2043 @Param[in] h_Profile Policer profile handle
2045 @Return E_OK on success; Error code otherwise.
2047 @Cautions Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2048 *//***************************************************************************/
2049 t_Error FM_PORT_PcdPlcrModifyInitialProfile (t_Handle h_FmPort, t_Handle h_Profile);
2051 /**************************************************************************//**
2052 @Function FM_PORT_PcdCcModifyTree
2054 @Description This routine may be called for ports that use coarse classification tree
2055 if the user wishes to replace the tree. The routine may not be called while port
2056 receives packets using the PCD functionalities, therefor port must be first detached
2057 from the PCD, only than the routine may be called, and than port be attached to PCD again.
2059 @Param[in] h_FmPort A handle to a FM Port module.
2060 @Param[in] h_CcTree A CC tree that was already built. The tree id as returned from
2061 the BuildTree routine.
2063 @Return E_OK on success; Error code otherwise.
2065 @Cautions Allowed only following FM_PORT_Init(), FM_PORT_SetPCD() and FM_PORT_DetachPCD()
2066 *//***************************************************************************/
2067 t_Error FM_PORT_PcdCcModifyTree (t_Handle h_FmPort, t_Handle h_CcTree);
2069 /**************************************************************************//**
2070 @Function FM_PORT_PcdKgBindSchemes
2072 @Description These routines may be called for adding more schemes for the
2073 port to be bound to. The selected schemes are not added,
2074 just this specific port starts using them.
2076 @Param[in] h_FmPort A handle to a FM Port module.
2077 @Param[in] p_PortScheme A structure defining the list of schemes to be added.
2079 @Return E_OK on success; Error code otherwise.
2081 @Cautions Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2082 *//***************************************************************************/
2083 t_Error FM_PORT_PcdKgBindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);
2085 /**************************************************************************//**
2086 @Function FM_PORT_PcdKgUnbindSchemes
2088 @Description These routines may be called for adding more schemes for the
2089 port to be bound to. The selected schemes are not removed or invalidated,
2090 just this specific port stops using them.
2092 @Param[in] h_FmPort A handle to a FM Port module.
2093 @Param[in] p_PortScheme A structure defining the list of schemes to be added.
2095 @Return E_OK on success; Error code otherwise.
2097 @Cautions Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
2098 *//***************************************************************************/
2099 t_Error FM_PORT_PcdKgUnbindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);
2101 /**************************************************************************//**
2102 @Function FM_PORT_PcdPrsModifyStartOffset
2104 @Description Runtime change of the parser start offset within the header.
2105 The routine may not be called while port
2106 receives packets using the PCD functionalities, therefore port must be first detached
2107 from the PCD, only than the routine may be called, and than port be attached to PCD again.
2108 @Param[in] h_FmPort A handle to a FM Port module.
2109 @Param[in] p_FmPcdPrsStart A structure of parameters for defining the
2110 start point for the parser.
2112 @Return E_OK on success; Error code otherwise.
2114 @Cautions Allowed only following FM_PORT_Init(), FM_PORT_SetPCD() and FM_PORT_DetatchPCD().
2115 *//***************************************************************************/
2116 t_Error FM_PORT_PcdPrsModifyStartOffset (t_Handle h_FmPort, t_FmPcdPrsStart *p_FmPcdPrsStart);
2118 /** @} */ /* end of FM_PORT_pcd_runtime_control_grp group */
2119 /** @} */ /* end of FM_PORT_runtime_control_grp group */
2122 /**************************************************************************//**
2123 @Group FM_PORT_runtime_data_grp FM Port Runtime Data-path Unit
2125 @Description FM Port Runtime data unit API functions, definitions and enums.
2126 This API is valid only if working in Independent-Mode.
2129 *//***************************************************************************/
2131 /**************************************************************************//**
2132 @Function FM_PORT_ImTx
2134 @Description Tx function, called to transmit a data buffer on the port.
2136 @Param[in] h_FmPort A handle to a FM Port module.
2137 @Param[in] p_Data A pointer to an LCP data buffer.
2138 @Param[in] length Size of data for transmission.
2139 @Param[in] lastBuffer Buffer position - TRUE for the last buffer
2140 of a frame, including a single buffer frame
2141 @Param[in] h_BufContext A handle of the user acossiated with this buffer
2143 @Return E_OK on success; Error code otherwise.
2145 @Cautions Allowed only following FM_PORT_Init().
2146 NOTE - This routine can be used only when working in
2147 Independent-Mode mode.
2148 *//***************************************************************************/
2149 t_Error FM_PORT_ImTx( t_Handle h_FmPort,
2153 t_Handle h_BufContext);
2155 /**************************************************************************//**
2156 @Function FM_PORT_ImTxConf
2158 @Description Tx port confirmation routine, optional, may be called to verify
2159 transmission of all frames. The procedure performed by this
2160 routine will be performed automatically on next buffer transmission,
2161 but if desired, calling this routine will invoke this action on
2164 @Param[in] h_FmPort A handle to a FM Port module.
2166 @Cautions Allowed only following FM_PORT_Init().
2167 NOTE - This routine can be used only when working in
2168 Independent-Mode mode.
2169 *//***************************************************************************/
2170 void FM_PORT_ImTxConf(t_Handle h_FmPort);
2172 /**************************************************************************//**
2173 @Function FM_PORT_ImRx
2175 @Description Rx function, may be called to poll for received buffers.
2176 Normally, Rx process is invoked by the driver on Rx interrupt.
2177 Alternatively, this routine may be called on demand.
2179 @Param[in] h_FmPort A handle to a FM Port module.
2181 @Return E_OK on success; Error code otherwise.
2183 @Cautions Allowed only following FM_PORT_Init().
2184 NOTE - This routine can be used only when working in
2185 Independent-Mode mode.
2186 *//***************************************************************************/
2187 t_Error FM_PORT_ImRx(t_Handle h_FmPort);
2189 /** @} */ /* end of FM_PORT_runtime_data_grp group */
2190 /** @} */ /* end of FM_PORT_grp group */
2191 /** @} */ /* end of FM_grp group */
2196 #endif /* __FM_PORT_EXT */