1/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *     * Redistributions of source code must retain the above copyright
7 *       notice, this list of conditions and the following disclaimer.
8 *     * Redistributions in binary form must reproduce the above copyright
9 *       notice, this list of conditions and the following disclaimer in the
10 *       documentation and/or other materials provided with the distribution.
11 *     * Neither the name of Freescale Semiconductor nor the
12 *       names of its contributors may be used to endorse or promote products
13 *       derived from this software without specific prior written permission.
14 *
15 *
16 * ALTERNATIVELY, this software may be distributed under the terms of the
17 * GNU General Public License ("GPL") as published by the Free Software
18 * Foundation, either version 2 of that License or (at your option) any
19 * later version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/**************************************************************************//**
34 @File          fm_pcd_ext.h
35
36 @Description   FM PCD ...
37*//***************************************************************************/
38#ifndef __FM_PCD_EXT
39#define __FM_PCD_EXT
40
41#include "std_ext.h"
42#include "net_ext.h"
43#include "list_ext.h"
44#include "fm_ext.h"
45
46
47/**************************************************************************//**
48
49 @Group         FM_grp Frame Manager API
50
51 @Description   FM API functions, definitions and enums
52
53 @{
54*//***************************************************************************/
55
56/**************************************************************************//**
57 @Group         FM_PCD_grp FM PCD
58
59 @Description   FM PCD API functions, definitions and enums
60
61                The FM PCD module is responsible for the initialization of all
62                global classifying FM modules. This includes the parser general and
63                common registers, the key generator global and common registers,
64                and the Policer global and common registers.
65                In addition, the FM PCD SW module will initialize all required
66                key generator schemes, coarse classification flows, and Policer
67                profiles. When An FM module is configured to work with one of these
68                entities, it will register to it using the FM PORT API. The PCD
69                module will manage the PCD resources - i.e. resource management of
70                Keygen schemes, etc.
71
72 @{
73*//***************************************************************************/
74
75/**************************************************************************//**
76 @Collection    General PCD defines
77*//***************************************************************************/
78typedef uint32_t fmPcdEngines_t; /**< options as defined below: */
79
80#define FM_PCD_NONE                                 0                   /**< No PCD Engine indicated */
81#define FM_PCD_PRS                                  0x80000000          /**< Parser indicated */
82#define FM_PCD_KG                                   0x40000000          /**< Keygen indicated */
83#define FM_PCD_CC                                   0x20000000          /**< Coarse classification indicated */
84#define FM_PCD_PLCR                                 0x10000000          /**< Policer indicated */
85#define FM_PCD_MANIP                                0x08000000          /**< Manipulation indicated */
86
87#define FM_PCD_MAX_NUM_OF_PRIVATE_HDRS              2                   /**< Number of units/headers saved for user */
88
89#define FM_PCD_PRS_NUM_OF_HDRS                      16                  /**< Number of headers supported by HW parser */
90#define FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS         (32 - FM_PCD_MAX_NUM_OF_PRIVATE_HDRS)
91                                                                        /**< number of distinction units is limited by
92                                                                             register size (32), - reserved bits for
93                                                                             private headers. */
94
95#define FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS      4                   /**< Maximum number of interchangeable headers in a distinction unit */
96#define FM_PCD_KG_NUM_OF_GENERIC_REGS               8                   /**< Total number of generic KG registers */
97#define FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY       35                  /**< Max number allowed on any configuration.
98                                                                             For reason of HW implementation, in most
99                                                                             cases less than this will be allowed. The
100                                                                             driver will return error in initialization
101                                                                             time if resource is overused. */
102#define FM_PCD_KG_NUM_OF_EXTRACT_MASKS              4                   /**< Total number of masks allowed on KG extractions. */
103#define FM_PCD_KG_NUM_OF_DEFAULT_GROUPS             16                  /**< Number of default value logical groups */
104
105#define FM_PCD_PRS_NUM_OF_LABELS                    32                  /**< Max number of SW parser label */
106#define FM_PCD_SW_PRS_SIZE                          0x00000800          /**< Total size of sw parser area */
107#define FM_PCD_PRS_SW_OFFSET                        0x00000040          /**< Size of illegal addresses at the beginning
108                                                                             of the SW parser area */
109#define FM_PCD_PRS_SW_PATCHES_SIZE                  0x00000200          /**< Number of bytes saved for patches */
110#define FM_PCD_PRS_SW_TAIL_SIZE                     4                   /**< Number of bytes that must be cleared at
111                                                                             the end of the SW parser area */
112#define FM_SW_PRS_MAX_IMAGE_SIZE                    (FM_PCD_SW_PRS_SIZE-FM_PCD_PRS_SW_OFFSET-FM_PCD_PRS_SW_TAIL_SIZE-FM_PCD_PRS_SW_PATCHES_SIZE)
113                                                                        /**< Max possible size of SW parser code */
114
115#define FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE        128                 /**< Max possible size of insertion template for
116                                                                             insert manipulation*/
117/* @} */
118
119
120/**************************************************************************//**
121 @Group         FM_PCD_init_grp FM PCD Initialization Unit
122
123 @Description   FM PCD Initialization Unit
124
125 @{
126*//***************************************************************************/
127
128/**************************************************************************//**
129 @Description   PCD counters
130*//***************************************************************************/
131typedef enum e_FmPcdCounters {
132    e_FM_PCD_KG_COUNTERS_TOTAL,                                 /**< Policer counter */
133    e_FM_PCD_PLCR_COUNTERS_YELLOW,                              /**< Policer counter */
134    e_FM_PCD_PLCR_COUNTERS_RED,                                 /**< Policer counter */
135    e_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_RED,                    /**< Policer counter */
136    e_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_YELLOW,                 /**< Policer counter */
137    e_FM_PCD_PLCR_COUNTERS_TOTAL,                               /**< Policer counter */
138    e_FM_PCD_PLCR_COUNTERS_LENGTH_MISMATCH,                     /**< Policer counter */
139    e_FM_PCD_PRS_COUNTERS_PARSE_DISPATCH,                       /**< Parser counter */
140    e_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED,             /**< Parser counter */
141    e_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED,             /**< Parser counter */
142    e_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED,             /**< Parser counter */
143    e_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED,           /**< Parser counter */
144    e_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
145    e_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
146    e_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
147    e_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED_WITH_ERR,  /**< Parser counter */
148    e_FM_PCD_PRS_COUNTERS_SOFT_PRS_CYCLES,                      /**< Parser counter */
149    e_FM_PCD_PRS_COUNTERS_SOFT_PRS_STALL_CYCLES,                /**< Parser counter */
150    e_FM_PCD_PRS_COUNTERS_HARD_PRS_CYCLE_INCL_STALL_CYCLES,     /**< Parser counter */
151    e_FM_PCD_PRS_COUNTERS_MURAM_READ_CYCLES,                    /**< MURAM counter */
152    e_FM_PCD_PRS_COUNTERS_MURAM_READ_STALL_CYCLES,              /**< MURAM counter */
153    e_FM_PCD_PRS_COUNTERS_MURAM_WRITE_CYCLES,                   /**< MURAM counter */
154    e_FM_PCD_PRS_COUNTERS_MURAM_WRITE_STALL_CYCLES,             /**< MURAM counter */
155    e_FM_PCD_PRS_COUNTERS_FPM_COMMAND_STALL_CYCLES              /**< FPM counter */
156} e_FmPcdCounters;
157
158/**************************************************************************//**
159 @Description   PCD interrupts
160*//***************************************************************************/
161typedef enum e_FmPcdExceptions {
162    e_FM_PCD_KG_EXCEPTION_DOUBLE_ECC,                   /**< Keygen ECC error */
163    e_FM_PCD_PLCR_EXCEPTION_DOUBLE_ECC,                 /**< Read Buffer ECC error */
164    e_FM_PCD_KG_EXCEPTION_KEYSIZE_OVERFLOW,             /**< Write Buffer ECC error on system side */
165    e_FM_PCD_PLCR_EXCEPTION_INIT_ENTRY_ERROR,           /**< Write Buffer ECC error on FM side */
166    e_FM_PCD_PLCR_EXCEPTION_PRAM_SELF_INIT_COMPLETE,    /**< Self init complete */
167    e_FM_PCD_PLCR_EXCEPTION_ATOMIC_ACTION_COMPLETE,     /**< Atomic action complete */
168    e_FM_PCD_PRS_EXCEPTION_DOUBLE_ECC,                  /**< Parser ECC error */
169    e_FM_PCD_PRS_EXCEPTION_SINGLE_ECC                   /**< Parser single ECC */
170} e_FmPcdExceptions;
171
172
173/**************************************************************************//**
174 @Description   Exceptions user callback routine, will be called upon an
175                exception passing the exception identification.
176
177 @Param[in]     h_App      - User's application descriptor.
178 @Param[in]     exception  - The exception.
179  *//***************************************************************************/
180typedef void (t_FmPcdExceptionCallback) (t_Handle h_App, e_FmPcdExceptions exception);
181
182/**************************************************************************//**
183 @Description   Exceptions user callback routine, will be called upon an exception
184                passing the exception identification.
185
186 @Param[in]     h_App           - User's application descriptor.
187 @Param[in]     exception       - The exception.
188 @Param[in]     index           - id of the relevant source (may be scheme or profile id).
189 *//***************************************************************************/
190typedef void (t_FmPcdIdExceptionCallback) ( t_Handle           h_App,
191                                            e_FmPcdExceptions  exception,
192                                            uint16_t           index);
193
194/**************************************************************************//**
195 @Description   A callback for enqueuing frame onto a QM queue.
196
197 @Param[in]     h_App           - User's application descriptor.
198 @Param[in]     p_Fd            - Frame descriptor for the frame.
199
200 @Return        E_OK on success; Error code otherwise.
201 *//***************************************************************************/
202typedef t_Error (t_FmPcdQmEnqueueCallback) (t_Handle h_QmArg, void *p_Fd);
203
204/**************************************************************************//**
205 @Description   A structure for Host-Command
206                When using Host command for PCD functionalities, a dedicated port
207                must be used. If this routine is called for a PCD in a single partition
208                environment, or it is the Master partition in a Multi partition
209                environment, The port will be initialized by the PCD driver
210                initialization routine.
211 *//***************************************************************************/
212typedef struct t_FmPcdHcParams {
213    uintptr_t                   portBaseAddr;       /**< Host-Command Port Virtual Address of
214                                                         memory mapped registers.*/
215    uint8_t                     portId;             /**< Host-Command Port Id (0-6 relative
216                                                         to Host-Command/Offline parsing ports) */
217    uint16_t                    liodnBase;          /**< Irrelevant for P4080 rev 1. LIODN base for this port, to be
218                                                         used together with LIODN offset. */
219    uint32_t                    errFqid;            /**< Host-Command Port Error Queue Id. */
220    uint32_t                    confFqid;           /**< Host-Command Port Confirmation queue Id. */
221    uint32_t                    qmChannel;          /**< Host-Command port - QM-channel dedicated to
222                                                         this port will be used by the FM for dequeue. */
223    t_FmPcdQmEnqueueCallback    *f_QmEnqueue;       /**< Call back routine for enqueuing a frame to the QM */
224    t_Handle                    h_QmArg;            /**< A handle of the QM module */
225} t_FmPcdHcParams;
226
227/**************************************************************************//**
228 @Description   The main structure for PCD initialization
229 *//***************************************************************************/
230typedef struct t_FmPcdParams {
231    bool                        prsSupport;             /**< TRUE if Parser will be used for any
232                                                             of the FM ports */
233    bool                        ccSupport;              /**< TRUE if Coarse Classification will be used for any
234                                                             of the FM ports */
235    bool                        kgSupport;              /**< TRUE if Keygen will be used for any
236                                                             of the FM ports */
237    bool                        plcrSupport;            /**< TRUE if Policer will be used for any
238                                                             of the FM ports */
239    t_Handle                    h_Fm;                   /**< A handle to the FM module */
240    uint8_t                     numOfSchemes;           /**< Number of schemes dedicated to this partition. */
241    bool                        useHostCommand;         /**< Optional for single partition, Mandatory for Multi partition */
242    t_FmPcdHcParams             hc;                     /**< Relevant only if useHostCommand=TRUE.
243                                                             Host Command parameters. */
244
245    t_FmPcdExceptionCallback    *f_Exception;           /**< Relevant for master (or single) partition only: Callback routine
246                                                             to be called of PCD exception */
247    t_FmPcdIdExceptionCallback  *f_ExceptionId;         /**< Relevant for master (or single) partition only: Callback routine
248                                                             to be used for a single scheme and
249                                                             profile exceptions */
250    t_Handle                    h_App;                  /**< Relevant for master (or single) partition only: A handle to an
251                                                             application layer object; This handle will
252                                                             be passed by the driver upon calling the above callbacks */
253} t_FmPcdParams;
254
255
256/**************************************************************************//**
257 @Function      FM_PCD_Config
258
259 @Description   Basic configuration of the PCD module.
260                Creates descriptor for the FM PCD module.
261
262 @Param[in]     p_FmPcdParams    A structure of parameters for the initialization of PCD.
263
264 @Return        A handle to the initialized module.
265*//***************************************************************************/
266t_Handle FM_PCD_Config(t_FmPcdParams *p_FmPcdParams);
267
268/**************************************************************************//**
269 @Function      FM_PCD_Init
270
271 @Description   Initialization of the PCD module.
272
273 @Param[in]     h_FmPcd - FM PCD module descriptor.
274
275 @Return        E_OK on success; Error code otherwise.
276*//***************************************************************************/
277t_Error FM_PCD_Init(t_Handle h_FmPcd);
278
279/**************************************************************************//**
280 @Function      FM_PCD_Free
281
282 @Description   Frees all resources that were assigned to FM module.
283
284                Calling this routine invalidates the descriptor.
285
286 @Param[in]     h_FmPcd - FM PCD module descriptor.
287
288 @Return        E_OK on success; Error code otherwise.
289*//***************************************************************************/
290t_Error FM_PCD_Free(t_Handle h_FmPcd);
291
292/**************************************************************************//**
293 @Group         FM_PCD_advanced_init_grp    FM PCD Advanced Configuration Unit
294
295 @Description   Configuration functions used to change default values.
296
297 @{
298*//***************************************************************************/
299
300/**************************************************************************//**
301 @Function      FM_PCD_ConfigPlcrNumOfSharedProfiles
302
303 @Description   Calling this routine changes the internal driver data base
304                from its default selection of exceptions enablement.
305                [4].
306
307 @Param[in]     h_FmPcd                     FM PCD module descriptor.
308 @Param[in]     numOfSharedPlcrProfiles     Number of profiles to
309                                            be shared between ports on this partition
310
311 @Return        E_OK on success; Error code otherwise.
312*//***************************************************************************/
313t_Error FM_PCD_ConfigPlcrNumOfSharedProfiles(t_Handle h_FmPcd, uint16_t numOfSharedPlcrProfiles);
314
315/**************************************************************************//**
316 @Function      FM_PCD_ConfigException
317
318 @Description   Calling this routine changes the internal driver data base
319                from its default selection of exceptions enablement.
320                By default all exceptions are enabled.
321
322 @Param[in]     h_FmPcd         FM PCD module descriptor.
323 @Param[in]     exception       The exception to be selected.
324 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.
325
326 @Return        E_OK on success; Error code otherwise.
327
328 @Cautions      Not available for guest partition.
329*//***************************************************************************/
330t_Error FM_PCD_ConfigException(t_Handle h_FmPcd, e_FmPcdExceptions exception, bool enable);
331
332/**************************************************************************//**
333 @Function      FM_PCD_ConfigPlcrAutoRefreshMode
334
335 @Description   Calling this routine changes the internal driver data base
336                from its default selection of exceptions enablement.
337                By default autorefresh is enabled.
338
339 @Param[in]     h_FmPcd         FM PCD module descriptor.
340 @Param[in]     enable          TRUE to enable, FALSE to disable
341
342 @Return        E_OK on success; Error code otherwise.
343
344 @Cautions      Not available for guest partition.
345*//***************************************************************************/
346t_Error FM_PCD_ConfigPlcrAutoRefreshMode(t_Handle h_FmPcd, bool enable);
347
348/**************************************************************************//**
349 @Function      FM_PCD_ConfigPrsMaxCycleLimit
350
351 @Description   Calling this routine changes the internal data structure for
352                the maximum parsing time from its default value
353                [0].
354
355 @Param[in]     h_FmPcd         FM PCD module descriptor.
356 @Param[in]     value           0 to disable the mechanism, or new
357                                maximum parsing time.
358
359 @Return        E_OK on success; Error code otherwise.
360
361 @Cautions      Not available for guest partition.
362*//***************************************************************************/
363t_Error FM_PCD_ConfigPrsMaxCycleLimit(t_Handle h_FmPcd,uint16_t value);
364
365/** @} */ /* end of FM_PCD_advanced_init_grp group */
366/** @} */ /* end of FM_PCD_init_grp group */
367
368
369/**************************************************************************//**
370 @Group         FM_PCD_Runtime_grp FM PCD Runtime Unit
371
372 @Description   FM PCD Runtime Unit
373
374                The runtime control allows creation of PCD infrastructure modules
375                such as Network Environment Characteristics, Classification Plan
376                Groups and Coarse Classification Trees.
377                It also allows on-the-fly initialization, modification and removal
378                of PCD modules such as Keygen schemes, coarse classification nodes
379                and Policer profiles.
380
381
382                In order to explain the programming model of the PCD driver interface
383                a few terms should be explained, and will be used below.
384                  * Distinction Header - One of the 16 protocols supported by the FM parser,
385                    or one of the shim headers (1 or 2). May be a header with a special
386                    option (see below).
387                  * Interchangeable Headers Group- This is a group of Headers recognized
388                    by either one of them. For example, if in a specific context the user
389                    chooses to treat IPv4 and IPV6 in the same way, they may create an
390                    interchangeable Headers Unit consisting of these 2 headers.
391                  * A Distinction Unit - a Distinction Header or an Interchangeable Headers
392                    Group.
393                  * Header with special option - applies to ethernet, mpls, vlan, ipv4 and
394                    ipv6, includes multicast, broadcast and other protocol specific options.
395                    In terms of hardware it relates to the options available in the classification
396                    plan.
397                  * Network Environment Characteristics - a set of Distinction Units that define
398                    the total recognizable header selection for a certain environment. This is
399                    NOT the list of all headers that will ever appear in a flow, but rather
400                    everything that needs distinction in a flow, where distinction is made by keygen
401                    schemes and coarse classification action descriptors.
402
403                The PCD runtime modules initialization is done in stages. The first stage after
404                initializing the PCD module itself is to establish a Network Flows Environment
405                Definition. The application may choose to establish one or more such environments.
406                Later, when needed, the application will have to state, for some of its modules,
407                to which single environment it belongs.
408
409 @{
410*//***************************************************************************/
411
412/**************************************************************************//**
413 @Description   A structure for sw parser labels
414 *//***************************************************************************/
415typedef struct t_FmPcdPrsLabelParams {
416    uint32_t                instructionOffset;              /**< SW parser label instruction offset (2 bytes
417                                                                 resolution), relative to Parser RAM. */
418    e_NetHeaderType         hdr;                            /**< The existance of this header will envoke
419                                                                 the sw parser code. */
420    uint8_t                 indexPerHdr;                    /**< Normally 0, if more than one sw parser
421                                                                 attachments for the same header, use this
422                                                                 index to distinguish between them. */
423} t_FmPcdPrsLabelParams;
424
425/**************************************************************************//**
426 @Description   A structure for sw parser
427 *//***************************************************************************/
428typedef struct t_FmPcdPrsSwParams {
429    bool                    override;                   /**< FALSE to invoke a check that nothing else
430                                                             was loaded to this address, including
431                                                             internal patches.
432                                                             TRUE to override any existing code.*/
433    uint32_t                size;                       /**< SW parser code size */
434    uint16_t                base;                       /**< SW parser base (in instruction counts!
435                                                             must be larger than 0x20)*/
436    uint8_t                 *p_Code;                    /**< SW parser code */
437    uint32_t                swPrsDataParams[FM_PCD_PRS_NUM_OF_HDRS];
438                                                        /**< SW parser data (parameters) */
439    uint8_t                 numOfLabels;                /**< Number of labels for SW parser. */
440    t_FmPcdPrsLabelParams   labelsTable[FM_PCD_PRS_NUM_OF_LABELS];
441                                                        /**< SW parser labels table, containing
442                                                             numOfLabels entries */
443} t_FmPcdPrsSwParams;
444
445
446/**************************************************************************//**
447 @Function      FM_PCD_Enable
448
449 @Description   This routine should be called after PCD is initialized for enabling all
450                PCD engines according to their existing configuration.
451
452 @Param[in]     h_FmPcd         FM PCD module descriptor.
453
454 @Return        E_OK on success; Error code otherwise.
455
456 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
457*//***************************************************************************/
458t_Error FM_PCD_Enable(t_Handle h_FmPcd);
459
460/**************************************************************************//**
461 @Function      FM_PCD_Disable
462
463 @Description   This routine may be called when PCD is enabled in order to
464                disable all PCD engines. It may be called
465                only when none of the ports in the system are using the PCD.
466
467 @Param[in]     h_FmPcd         FM PCD module descriptor.
468
469 @Return        E_OK on success; Error code otherwise.
470
471 @Cautions      Allowed only following FM_PCD_Init() and when PCD is enabled.
472*//***************************************************************************/
473t_Error FM_PCD_Disable(t_Handle h_FmPcd);
474
475
476/**************************************************************************//**
477 @Function      FM_PCD_GetCounter
478
479 @Description   Reads one of the FM PCD counters.
480
481 @Param[in]     h_FmPcd     FM PCD module descriptor.
482 @Param[in]     counter     The requested counter.
483
484 @Return        Counter's current value.
485
486 @Cautions      Allowed only following FM_PCD_Init().
487                Note that it is user's responsibility to call this routine only
488                for enabled counters, and there will be no indication if a
489                disabled counter is accessed.
490*//***************************************************************************/
491uint32_t FM_PCD_GetCounter(t_Handle h_FmPcd, e_FmPcdCounters counter);
492
493/**************************************************************************//**
494@Function      FM_PCD_PrsLoadSw
495
496@Description   This routine may be called in order to load software parsing code.
497
498
499@Param[in]     h_FmPcd         FM PCD module descriptor.
500@Param[in]     p_SwPrs         A pointer to a structure of software
501                               parser parameters, including the software
502                               parser image.
503
504@Return        E_OK on success; Error code otherwise.
505
506@Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
507               Not available for guest partition.
508*//***************************************************************************/
509t_Error FM_PCD_PrsLoadSw(t_Handle h_FmPcd, t_FmPcdPrsSwParams *p_SwPrs);
510
511/**************************************************************************//**
512 @Function      FM_PCD_KgSetDfltValue
513
514 @Description   Calling this routine sets a global default value to be used
515                by the keygen when parser does not recognize a required
516                field/header.
517                By default default values are 0.
518
519 @Param[in]     h_FmPcd         FM PCD module descriptor.
520 @Param[in]     valueId         0,1 - one of 2 global default values.
521 @Param[in]     value           The requested default value.
522
523 @Return        E_OK on success; Error code otherwise.
524
525 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
526                Not available for guest partition.
527*//***************************************************************************/
528t_Error FM_PCD_KgSetDfltValue(t_Handle h_FmPcd, uint8_t valueId, uint32_t value);
529
530/**************************************************************************//**
531 @Function      FM_PCD_KgSetAdditionalDataAfterParsing
532
533 @Description   Calling this routine allows the keygen to access data past
534                the parser finishing point.
535
536 @Param[in]     h_FmPcd         FM PCD module descriptor.
537 @Param[in]     payloadOffset   the number of bytes beyond the parser location.
538
539 @Return        E_OK on success; Error code otherwise.
540
541 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
542                Not available for guest partition.
543*//***************************************************************************/
544t_Error FM_PCD_KgSetAdditionalDataAfterParsing(t_Handle h_FmPcd, uint8_t payloadOffset);
545
546/**************************************************************************//**
547 @Function      FM_PCD_SetException
548
549 @Description   Calling this routine enables/disables PCD interrupts.
550
551 @Param[in]     h_FmPcd         FM PCD module descriptor.
552 @Param[in]     exception       The exception to be selected.
553 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.
554
555 @Return        E_OK on success; Error code otherwise.
556
557 @Cautions      Allowed only following FM_PCD_Init().
558                Not available for guest partition.
559*//***************************************************************************/
560t_Error FM_PCD_SetException(t_Handle h_FmPcd, e_FmPcdExceptions exception, bool enable);
561
562/**************************************************************************//**
563 @Function      FM_PCD_ModifyCounter
564
565 @Description   Sets a value to an enabled counter. Use "0" to reset the counter.
566
567 @Param[in]     h_FmPcd     FM PCD module descriptor.
568 @Param[in]     counter     The requested counter.
569 @Param[in]     value       The requested value to be written into the counter.
570
571 @Return        E_OK on success; Error code otherwise.
572
573 @Cautions      Allowed only following FM_PCD_Init().
574                Not available for guest partition.
575*//***************************************************************************/
576t_Error FM_PCD_ModifyCounter(t_Handle h_FmPcd, e_FmPcdCounters counter, uint32_t value);
577
578/**************************************************************************//**
579 @Function      FM_PCD_SetPlcrStatistics
580
581 @Description   This routine may be used to enable/disable policer statistics
582                counter. By default the statistics is enabled.
583
584 @Param[in]     h_FmPcd         FM PCD module descriptor
585 @Param[in]     enable          TRUE to enable, FALSE to disable.
586
587 @Return        E_OK on success; Error code otherwise.
588
589 @Cautions      Allowed only following FM_PCD_Init().
590                Not available for guest partition.
591*//***************************************************************************/
592t_Error FM_PCD_SetPlcrStatistics(t_Handle h_FmPcd, bool enable);
593
594/**************************************************************************//**
595 @Function      FM_PCD_SetPrsStatistics
596
597 @Description   Defines whether to gather parser statistics including all ports.
598
599 @Param[in]     h_FmPcd     FM PCD module descriptor.
600 @Param[in]     enable      TRUE to enable, FALSE to disable.
601
602 @Return        None
603
604 @Cautions      Allowed only following FM_PCD_Init().
605                Not available for guest partition.
606*//***************************************************************************/
607void FM_PCD_SetPrsStatistics(t_Handle h_FmPcd, bool enable);
608
609/**************************************************************************//**
610 @Function      FM_PCD_ForceIntr
611
612 @Description   Causes an interrupt event on the requested source.
613
614 @Param[in]     h_FmPcd     FM PCD module descriptor.
615 @Param[in]     exception       An exception to be forced.
616
617 @Return        E_OK on success; Error code if the exception is not enabled,
618                or is not able to create interrupt.
619
620 @Cautions      Allowed only following FM_PCD_Init().
621                Not available for guest partition.
622*//***************************************************************************/
623t_Error FM_PCD_ForceIntr (t_Handle h_FmPcd, e_FmPcdExceptions exception);
624
625/**************************************************************************//**
626 @Function      FM_PCD_HcTxConf
627
628 @Description   This routine should be called to confirm frames that were
629                 received on the HC confirmation queue.
630
631 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
632 @Param[in]     p_Fd            Frame descriptor of the received frame.
633
634 @Cautions      Allowed only following FM_PCD_Init(). Allowed only if 'useHostCommand'
635                option was selected in the initialization.
636*//***************************************************************************/
637void FM_PCD_HcTxConf(t_Handle h_FmPcd, t_DpaaFD *p_Fd);
638
639#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
640/**************************************************************************//**
641 @Function      FM_PCD_DumpRegs
642
643 @Description   Dumps all PCD registers
644
645 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
646
647 @Return        E_OK on success; Error code otherwise.
648
649 @Cautions      Allowed only following FM_PCD_Init().
650*//***************************************************************************/
651t_Error FM_PCD_DumpRegs(t_Handle h_FmPcd);
652
653/**************************************************************************//**
654 @Function      FM_PCD_KgDumpRegs
655
656 @Description   Dumps all PCD KG registers
657
658 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
659
660 @Return        E_OK on success; Error code otherwise.
661
662 @Cautions      Allowed only following FM_PCD_Init().
663*//***************************************************************************/
664t_Error FM_PCD_KgDumpRegs(t_Handle h_FmPcd);
665
666/**************************************************************************//**
667 @Function      FM_PCD_PlcrDumpRegs
668
669 @Description   Dumps all PCD Plcr registers
670
671 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
672
673 @Return        E_OK on success; Error code otherwise.
674
675 @Cautions      Allowed only following FM_PCD_Init().
676*//***************************************************************************/
677t_Error FM_PCD_PlcrDumpRegs(t_Handle h_FmPcd);
678
679/**************************************************************************//**
680 @Function      FM_PCD_PlcrProfileDumpRegs
681
682 @Description   Dumps all PCD Plcr registers
683
684 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
685 @Param[in]     h_Profile       A handle to a profile.
686
687 @Return        E_OK on success; Error code otherwise.
688
689 @Cautions      Allowed only following FM_PCD_Init().
690*//***************************************************************************/
691t_Error FM_PCD_PlcrProfileDumpRegs(t_Handle h_FmPcd, t_Handle h_Profile);
692
693/**************************************************************************//**
694 @Function      FM_PCD_PrsDumpRegs
695
696 @Description   Dumps all PCD Prs registers
697
698 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
699
700 @Return        E_OK on success; Error code otherwise.
701
702 @Cautions      Allowed only following FM_PCD_Init().
703*//***************************************************************************/
704t_Error FM_PCD_PrsDumpRegs(t_Handle h_FmPcd);
705
706/**************************************************************************//**
707 @Function      FM_PCD_HcDumpRegs
708
709 @Description   Dumps HC Port registers
710
711 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
712
713 @Return        E_OK on success; Error code otherwise.
714
715 @Cautions      Allowed only following FM_PCD_Init().
716*//***************************************************************************/
717t_Error     FM_PCD_HcDumpRegs(t_Handle h_FmPcd);
718#endif /* (defined(DEBUG_ERRORS) && ... */
719
720
721
722/**************************************************************************//**
723 @Group         FM_PCD_Runtime_tree_buildgrp FM PCD Tree building Unit
724
725 @Description   FM PCD Runtime Unit
726
727                This group contains routines for setting, deleting and modifying
728                PCD resources, for defining the total PCD tree.
729 @{
730*//***************************************************************************/
731
732/**************************************************************************//**
733 @Collection    Definitions of coarse classification
734                parameters as required by keygen (when coarse classification
735                is the next engine after this scheme).
736*//***************************************************************************/
737#define FM_PCD_MAX_NUM_OF_CC_NODES          255
738#define FM_PCD_MAX_NUM_OF_CC_TREES          8
739#define FM_PCD_MAX_NUM_OF_CC_GROUPS         16
740#define FM_PCD_MAX_NUM_OF_CC_UNITS          4
741#define FM_PCD_MAX_NUM_OF_KEYS              256
742#define FM_PCD_MAX_SIZE_OF_KEY              56
743#define FM_PCD_MAX_NUM_OF_CC_ENTRIES_IN_GRP 16
744/* @} */
745
746/**************************************************************************//**
747 @Collection    A set of definitions to allow protocol
748                special option description.
749*//***************************************************************************/
750typedef uint32_t        protocolOpt_t;          /**< A general type to define a protocol option. */
751
752typedef protocolOpt_t   ethProtocolOpt_t;       /**< Ethernet protocol options. */
753#define ETH_BROADCAST               0x80000000  /**< Ethernet Broadcast. */
754#define ETH_MULTICAST               0x40000000  /**< Ethernet Multicast. */
755
756typedef protocolOpt_t   vlanProtocolOpt_t;      /**< Vlan protocol options. */
757#define VLAN_STACKED                0x20000000  /**< Vlan Stacked. */
758
759typedef protocolOpt_t   mplsProtocolOpt_t;      /**< MPLS protocol options. */
760#define MPLS_STACKED                0x10000000  /**< MPLS Stacked. */
761
762typedef protocolOpt_t   ipv4ProtocolOpt_t;      /**< IPv4 protocol options. */
763#define IPV4_BROADCAST_1            0x08000000  /**< IPv4 Broadcast. */
764#define IPV4_MULTICAST_1            0x04000000  /**< IPv4 Multicast. */
765#define IPV4_UNICAST_2              0x02000000  /**< Tunneled IPv4 - Unicast. */
766#define IPV4_MULTICAST_BROADCAST_2  0x01000000  /**< Tunneled IPv4 - Broadcast/Multicast. */
767
768typedef protocolOpt_t   ipv6ProtocolOpt_t;      /**< IPv6 protocol options. */
769#define IPV6_MULTICAST_1            0x00800000  /**< IPv6 Multicast. */
770#define IPV6_UNICAST_2              0x00400000  /**< Tunneled IPv6 - Unicast. */
771#define IPV6_MULTICAST_2            0x00200000  /**< Tunneled IPv6 - Multicast. */
772/* @} */
773
774/**************************************************************************//**
775 @Description   A type used for returning the order of the key extraction.
776                each value in this array represents the index of the extraction
777                command as defined by the user in the initialization extraction array.
778                The valid size of this array is the user define number of extractions
779                required (also marked by the second '0' in this array).
780*//***************************************************************************/
781typedef    uint8_t    t_FmPcdKgKeyOrder [FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY];
782
783/**************************************************************************//**
784 @Description   All PCD engines
785*//***************************************************************************/
786typedef enum e_FmPcdEngine {
787    e_FM_PCD_INVALID = 0,   /**< Invalid PCD engine indicated*/
788    e_FM_PCD_DONE,          /**< No PCD Engine indicated */
789    e_FM_PCD_KG,            /**< Keygen indicated */
790    e_FM_PCD_CC,            /**< Coarse classification indicated */
791    e_FM_PCD_PLCR,          /**< Policer indicated */
792    e_FM_PCD_PRS            /**< Parser indicated */
793} e_FmPcdEngine;
794
795/**************************************************************************//**
796 @Description   An enum for selecting extraction by header types
797*//***************************************************************************/
798typedef enum e_FmPcdExtractByHdrType {
799    e_FM_PCD_EXTRACT_FROM_HDR,      /**< Extract bytes from header */
800    e_FM_PCD_EXTRACT_FROM_FIELD,    /**< Extract bytes from header field */
801    e_FM_PCD_EXTRACT_FULL_FIELD     /**< Extract a full field */
802} e_FmPcdExtractByHdrType;
803
804/**************************************************************************//**
805 @Description   An enum for selecting extraction source
806                (when it is not the header)
807*//***************************************************************************/
808typedef enum e_FmPcdExtractFrom {
809    e_FM_PCD_EXTRACT_FROM_FRAME_START,          /**< KG & CC: Extract from beginning of frame */
810    e_FM_PCD_EXTRACT_FROM_DFLT_VALUE,           /**< KG only: Extract from a default value */
811    e_FM_PCD_EXTRACT_FROM_CURR_END_OF_PARSE,    /**< KG only: Extract from the point where parsing had finished */
812    e_FM_PCD_EXTRACT_FROM_KEY,                  /**< CC only: Field where saved KEY */
813    e_FM_PCD_EXTRACT_FROM_HASH,                 /**< CC only: Field where saved HASH */
814    e_FM_PCD_EXTRACT_FROM_PARSE_RESULT,         /**< KG & CC: Extract from the parser result */
815    e_FM_PCD_EXTRACT_FROM_ENQ_FQID,             /**< KG & CC: Extract from enqueue FQID */
816    e_FM_PCD_EXTRACT_FROM_FLOW_ID               /**< CC only: Field where saved Dequeue FQID */
817} e_FmPcdExtractFrom;
818
819/**************************************************************************//**
820 @Description   An enum for selecting extraction type
821*//***************************************************************************/
822typedef enum e_FmPcdExtractType {
823    e_FM_PCD_EXTRACT_BY_HDR,                /**< Extract according to header */
824    e_FM_PCD_EXTRACT_NON_HDR,               /**< Extract from data that is not the header */
825    e_FM_PCD_KG_EXTRACT_PORT_PRIVATE_INFO   /**< Extract private info as specified by user */
826} e_FmPcdExtractType;
827
828/**************************************************************************//**
829 @Description   An enum for selecting a default
830*//***************************************************************************/
831typedef enum e_FmPcdKgExtractDfltSelect {
832    e_FM_PCD_KG_DFLT_GBL_0,          /**< Default selection is KG register 0 */
833    e_FM_PCD_KG_DFLT_GBL_1,          /**< Default selection is KG register 1 */
834    e_FM_PCD_KG_DFLT_PRIVATE_0,      /**< Default selection is a per scheme register 0 */
835    e_FM_PCD_KG_DFLT_PRIVATE_1,      /**< Default selection is a per scheme register 1 */
836    e_FM_PCD_KG_DFLT_ILLEGAL         /**< Illegal selection */
837} e_FmPcdKgExtractDfltSelect;
838
839/**************************************************************************//**
840 @Description   An enum defining all default groups -
841                each group shares a default value, one of 4 user
842                initialized values.
843*//***************************************************************************/
844typedef enum e_FmPcdKgKnownFieldsDfltTypes {
845    e_FM_PCD_KG_MAC_ADDR,               /**< MAC Address */
846    e_FM_PCD_KG_TCI,                    /**< TCI field */
847    e_FM_PCD_KG_ENET_TYPE,              /**< ENET Type */
848    e_FM_PCD_KG_PPP_SESSION_ID,         /**< PPP Session id */
849    e_FM_PCD_KG_PPP_PROTOCOL_ID,        /**< PPP Protocol id */
850    e_FM_PCD_KG_MPLS_LABEL,             /**< MPLS label */
851    e_FM_PCD_KG_IP_ADDR,                /**< IP addr */
852    e_FM_PCD_KG_PROTOCOL_TYPE,          /**< Protocol type */
853    e_FM_PCD_KG_IP_TOS_TC,              /**< TOS or TC */
854    e_FM_PCD_KG_IPV6_FLOW_LABEL,        /**< IPV6 flow label */
855    e_FM_PCD_KG_IPSEC_SPI,              /**< IPSEC SPI */
856    e_FM_PCD_KG_L4_PORT,                /**< L4 Port */
857    e_FM_PCD_KG_TCP_FLAG,               /**< TCP Flag */
858    e_FM_PCD_KG_GENERIC_FROM_DATA,      /**< grouping implemented by sw,
859                                             any data extraction that is not the full
860                                             field described above  */
861    e_FM_PCD_KG_GENERIC_FROM_DATA_NO_V, /**< grouping implemented by sw,
862                                             any data extraction without validation */
863    e_FM_PCD_KG_GENERIC_NOT_FROM_DATA   /**< grouping implemented by sw,
864                                             extraction from parser result or
865                                             direct use of default value  */
866} e_FmPcdKgKnownFieldsDfltTypes;
867
868/**************************************************************************//**
869 @Description   enum for defining header index when headers may repeat
870*//***************************************************************************/
871typedef enum e_FmPcdHdrIndex {
872    e_FM_PCD_HDR_INDEX_NONE = 0,        /**< used when multiple headers not used, also
873                                             to specify regular IP (not tunneled). */
874    e_FM_PCD_HDR_INDEX_1,               /**< may be used for VLAN, MPLS, tunneled IP */
875    e_FM_PCD_HDR_INDEX_2,               /**< may be used for MPLS, tunneled IP */
876    e_FM_PCD_HDR_INDEX_3,               /**< may be used for MPLS */
877    e_FM_PCD_HDR_INDEX_LAST = 0xFF      /**< may be used for VLAN, MPLS */
878} e_FmPcdHdrIndex;
879
880/**************************************************************************//**
881 @Description   A structure for selcting the policer profile functional type
882*//***************************************************************************/
883typedef enum e_FmPcdProfileTypeSelection {
884    e_FM_PCD_PLCR_PORT_PRIVATE,         /**< Port dedicated profile */
885    e_FM_PCD_PLCR_SHARED                /**< Shared profile (shared within partition) */
886} e_FmPcdProfileTypeSelection;
887
888/**************************************************************************//**
889 @Description   A structure for selcting the policer profile algorithem
890*//***************************************************************************/
891typedef enum e_FmPcdPlcrAlgorithmSelection {
892    e_FM_PCD_PLCR_PASS_THROUGH,         /**< Policer pass through */
893    e_FM_PCD_PLCR_RFC_2698,             /**< Policer algorythm RFC 2698 */
894    e_FM_PCD_PLCR_RFC_4115              /**< Policer algorythm RFC 4115 */
895} e_FmPcdPlcrAlgorithmSelection;
896
897/**************************************************************************//**
898 @Description   A structure for selcting the policer profile color mode
899*//***************************************************************************/
900typedef enum e_FmPcdPlcrColorMode {
901    e_FM_PCD_PLCR_COLOR_BLIND,          /**< Color blind */
902    e_FM_PCD_PLCR_COLOR_AWARE           /**< Color aware */
903} e_FmPcdPlcrColorMode;
904
905/**************************************************************************//**
906 @Description   A structure for selcting the policer profile color functional mode
907*//***************************************************************************/
908typedef enum e_FmPcdPlcrColor {
909    e_FM_PCD_PLCR_GREEN,                /**< Green */
910    e_FM_PCD_PLCR_YELLOW,               /**< Yellow */
911    e_FM_PCD_PLCR_RED,                  /**< Red */
912    e_FM_PCD_PLCR_OVERRIDE              /**< Color override */
913} e_FmPcdPlcrColor;
914
915/**************************************************************************//**
916 @Description   A structure for selcting the policer profile packet frame length selector
917*//***************************************************************************/
918typedef enum e_FmPcdPlcrFrameLengthSelect {
919  e_FM_PCD_PLCR_L2_FRM_LEN,             /**< L2 frame length */
920  e_FM_PCD_PLCR_L3_FRM_LEN,             /**< L3 frame length */
921  e_FM_PCD_PLCR_L4_FRM_LEN,             /**< L4 frame length */
922  e_FM_PCD_PLCR_FULL_FRM_LEN            /**< Full frame length */
923} e_FmPcdPlcrFrameLengthSelect;
924
925/**************************************************************************//**
926 @Description   An enum for selecting rollback frame
927*//***************************************************************************/
928typedef enum e_FmPcdPlcrRollBackFrameSelect {
929  e_FM_PCD_PLCR_ROLLBACK_L2_FRM_LEN,    /**< Rollback L2 frame length */
930  e_FM_PCD_PLCR_ROLLBACK_FULL_FRM_LEN   /**< Rollback Full frame length */
931} e_FmPcdPlcrRollBackFrameSelect;
932
933/**************************************************************************//**
934 @Description   A structure for selcting the policer profile packet or byte mode
935*//***************************************************************************/
936typedef enum e_FmPcdPlcrRateMode {
937    e_FM_PCD_PLCR_BYTE_MODE,            /**< Byte mode */
938    e_FM_PCD_PLCR_PACKET_MODE           /**< Packet mode */
939} e_FmPcdPlcrRateMode;
940
941/**************************************************************************//**
942 @Description   An enum for defining action of frame
943*//***************************************************************************/
944typedef enum e_FmPcdDoneAction {
945    e_FM_PCD_ENQ_FRAME = 0,        /**< Enqueue frame */
946    e_FM_PCD_DROP_FRAME            /**< Drop frame */
947} e_FmPcdDoneAction;
948
949/**************************************************************************//**
950 @Description   A structure for selecting the policer counter
951*//***************************************************************************/
952typedef enum e_FmPcdPlcrProfileCounters {
953    e_FM_PCD_PLCR_PROFILE_GREEN_PACKET_TOTAL_COUNTER,               /**< Green packets counter */
954    e_FM_PCD_PLCR_PROFILE_YELLOW_PACKET_TOTAL_COUNTER,              /**< Yellow packets counter */
955    e_FM_PCD_PLCR_PROFILE_RED_PACKET_TOTAL_COUNTER,                 /**< Red packets counter */
956    e_FM_PCD_PLCR_PROFILE_RECOLOURED_YELLOW_PACKET_TOTAL_COUNTER,   /**< Recolored yellow packets counter */
957    e_FM_PCD_PLCR_PROFILE_RECOLOURED_RED_PACKET_TOTAL_COUNTER       /**< Recolored red packets counter */
958} e_FmPcdPlcrProfileCounters;
959
960/**************************************************************************//**
961 @Description   A structure for selecting action
962*//***************************************************************************/
963typedef enum e_FmPcdAction {
964    e_FM_PCD_ACTION_NONE,                           /**< NONE  */
965    e_FM_PCD_ACTION_EXACT_MATCH,                    /**< Exact match on the selected extraction*/
966    e_FM_PCD_ACTION_INDEXED_LOOKUP                  /**< Indexed lookup on the selected extraction*/
967} e_FmPcdAction;
968
969#if defined(FM_CAPWAP_SUPPORT)
970/**************************************************************************//**
971 @Description   An enum for selecting type of insert manipulation
972*//***************************************************************************/
973typedef enum e_FmPcdManipInsrtType {
974    e_FM_PCD_MANIP_INSRT_NONE = 0,                          /**< No insertion */
975    e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_INT_FRAME_HDR,   /**< Insert internal frame header to start of frame */
976    e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE         /**< Insert template to start of frame*/
977} e_FmPcdManipInsrtType;
978
979/**************************************************************************//**
980 @Description   An enum for selecting type of remove manipulation
981*//***************************************************************************/
982typedef enum e_FmPcdManipRmvParamsType {
983    e_FM_PCD_MANIP_RMV_NONE = 0,                                        /**< No remove */
984    e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_TILL_SPECIFIC_LOCATION,      /**< Remove from start of frame till (excluding) specified indication */
985    e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_INCLUDE_SPECIFIC_LOCATION,   /**< Remove from start of frame till (including) specified indication */
986    e_FM_PCD_MANIP_RMV_INT_FRAME_HDR                                    /**< Remove internal frame header to start of frame */
987} e_FmPcdManipRmvParamsType;
988
989/**************************************************************************//**
990 @Description   An enum for selecting type of location
991*//***************************************************************************/
992typedef enum e_FmPcdManipLocateType {
993    e_FM_PCD_MANIP_LOC_BY_HDR = 0,            /**< Locate according to header */
994    e_FM_PCD_MANIP_LOC_NON_HDR                /**< Locate from data that is not the header */
995} e_FmPcdManipLocateType;
996
997/**************************************************************************//**
998 @Description   An enum for selecting type of Timeout mode
999*//***************************************************************************/
1000typedef enum e_FmPcdManipReassemTimeOutMode {
1001    e_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAMES, /**< limits the time of the reassm process from the first frag to the last */
1002    e_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAG    /**< limits the time of receiving the fragment */
1003} e_FmPcdManipReassemTimeOutMode;
1004
1005/**************************************************************************//**
1006 @Description   An enum for selecting type of WaysNumber mode
1007*//***************************************************************************/
1008typedef enum e_FmPcdManipReassemWaysNumber {
1009    e_FM_PCD_MANIP_ONE_WAY_HASH = 1,    /**< -------------- */
1010    e_FM_PCD_MANIP_TWO_WAYS_HASH,       /**< -------------- */
1011    e_FM_PCD_MANIP_THREE_WAYS_HASH,     /**< -------------- */
1012    e_FM_PCD_MANIP_FOUR_WAYS_HASH,      /**< four ways hash */
1013    e_FM_PCD_MANIP_FIVE_WAYS_HASH,      /**< -------------- */
1014    e_FM_PCD_MANIP_SIX_WAYS_HASH,       /**< -------------- */
1015    e_FM_PCD_MANIP_SEVEN_WAYS_HASH,     /**< -------------- */
1016    e_FM_PCD_MANIP_EIGHT_WAYS_HASH      /**< eight ways hash*/
1017} e_FmPcdManipReassemWaysNumber;
1018
1019/**************************************************************************//**
1020 @Description   An enum for selecting type of statistics mode
1021*//***************************************************************************/
1022typedef enum e_FmPcdStatsType {
1023    e_FM_PCD_STATS_PER_FLOWID = 0   /**< type where flowId used as index for getting statistics */
1024} e_FmPcdStatsType;
1025
1026#endif /* FM_CAPWAP_SUPPORT */
1027
1028
1029/**************************************************************************//**
1030 @Description   A Union of protocol dependent special options
1031*//***************************************************************************/
1032typedef union u_FmPcdHdrProtocolOpt {
1033    ethProtocolOpt_t    ethOpt;     /**< Ethernet options */
1034    vlanProtocolOpt_t   vlanOpt;    /**< Vlan options */
1035    mplsProtocolOpt_t   mplsOpt;    /**< MPLS options */
1036    ipv4ProtocolOpt_t   ipv4Opt;    /**< IPv4 options */
1037    ipv6ProtocolOpt_t   ipv6Opt;    /**< IPv6 options */
1038} u_FmPcdHdrProtocolOpt;
1039
1040/**************************************************************************//**
1041 @Description   A union holding all known protocol fields
1042*//***************************************************************************/
1043typedef union t_FmPcdFields {
1044    headerFieldEth_t            eth;            /**< eth      */
1045    headerFieldVlan_t           vlan;           /**< vlan     */
1046    headerFieldLlcSnap_t        llcSnap;        /**< llcSnap  */
1047    headerFieldPppoe_t          pppoe;          /**< pppoe    */
1048    headerFieldMpls_t           mpls;           /**< mpls     */
1049    headerFieldIpv4_t           ipv4;           /**< ipv4     */
1050    headerFieldIpv6_t           ipv6;           /**< ipv6     */
1051    headerFieldUdp_t            udp;            /**< udp      */
1052    headerFieldTcp_t            tcp;            /**< tcp      */
1053    headerFieldSctp_t           sctp;           /**< sctp     */
1054    headerFieldDccp_t           dccp;           /**< dccp     */
1055    headerFieldGre_t            gre;            /**< gre      */
1056    headerFieldMinencap_t       minencap;       /**< minencap */
1057    headerFieldIpsecAh_t        ipsecAh;        /**< ipsecAh  */
1058    headerFieldIpsecEsp_t       ipsecEsp;       /**< ipsecEsp */
1059    headerFieldUdpEncapEsp_t    udpEncapEsp;    /**< udpEncapEsp */
1060} t_FmPcdFields;
1061
1062/**************************************************************************//**
1063 @Description   structure for defining header extraction for key generation
1064*//***************************************************************************/
1065typedef struct t_FmPcdFromHdr {
1066    uint8_t             size;           /**< Size in byte */
1067    uint8_t             offset;         /**< Byte offset */
1068} t_FmPcdFromHdr;
1069
1070/**************************************************************************//**
1071 @Description   structure for defining field extraction for key generation
1072*//***************************************************************************/
1073typedef struct t_FmPcdFromField {
1074    t_FmPcdFields       field;          /**< Field selection */
1075    uint8_t             size;           /**< Size in byte */
1076    uint8_t             offset;         /**< Byte offset */
1077} t_FmPcdFromField;
1078
1079/**************************************************************************//**
1080 @Description   A structure of parameters used to define a single network
1081                environment unit.
1082                A unit should be defined if it will later be used by one or
1083                more PCD engines to distinguich between flows.
1084*//***************************************************************************/
1085typedef struct t_FmPcdDistinctionUnit {
1086    struct {
1087        e_NetHeaderType         hdr;        /**< One of the headers supported by the FM */
1088        u_FmPcdHdrProtocolOpt   opt;        /**< only one option !! */
1089    } hdrs[FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS];
1090} t_FmPcdDistinctionUnit;
1091
1092/**************************************************************************//**
1093 @Description   A structure of parameters used to define the different
1094                units supported by a specific PCD Network Environment
1095                Characteristics module. Each unit represent
1096                a protocol or a group of protocols that may be used later
1097                by the different PCD engined to distinguich between flows.
1098*//***************************************************************************/
1099typedef struct t_FmPcdNetEnvParams {
1100    uint8_t                 numOfDistinctionUnits;                      /**< Number of different units to be identified */
1101    t_FmPcdDistinctionUnit  units[FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS]; /**< An array of numOfDistinctionUnits of the
1102                                                                             different units to be identified */
1103} t_FmPcdNetEnvParams;
1104
1105/**************************************************************************//**
1106 @Description   structure for defining a single extraction action
1107                when creating a key
1108*//***************************************************************************/
1109typedef struct t_FmPcdExtractEntry {
1110    e_FmPcdExtractType                  type;           /**< Extraction type select */
1111    union {
1112        struct {
1113            e_NetHeaderType             hdr;            /**< Header selection */
1114            bool                        ignoreProtocolValidation;
1115                                                        /**< Ignore protocol validation */
1116            e_FmPcdHdrIndex             hdrIndex;       /**< Relevant only for MPLS, VLAN and tunneled
1117                                                             IP. Otherwise should be cleared.*/
1118            e_FmPcdExtractByHdrType     type;           /**< Header extraction type select */
1119            union {
1120                t_FmPcdFromHdr          fromHdr;        /**< Extract bytes from header parameters */
1121                t_FmPcdFromField        fromField;      /**< Extract bytes from field parameters*/
1122                t_FmPcdFields           fullField;      /**< Extract full filed parameters*/
1123            } extractByHdrType;
1124        } extractByHdr;                                 /**< used when type = e_FM_PCD_KG_EXTRACT_BY_HDR */
1125        struct {
1126            e_FmPcdExtractFrom          src;            /**< Non-header extraction source */
1127            e_FmPcdAction               action;         /**< Relevant for CC Only */
1128            uint16_t                    icIndxMask;     /**< Relevant only for CC where
1129                                                             action=e_FM_PCD_ACTION_INDEXED_LOOKUP */
1130            uint8_t                     offset;         /**< Byte offset */
1131            uint8_t                     size;           /**< Size in byte */
1132        } extractNonHdr;                                /**< used when type = e_FM_PCD_KG_EXTRACT_NON_HDR */
1133    };
1134} t_FmPcdExtractEntry;
1135
1136/**************************************************************************//**
1137 @Description   A structure for defining masks for each extracted
1138                field in the key.
1139*//***************************************************************************/
1140typedef struct t_FmPcdKgExtractMask {
1141    uint8_t                         extractArrayIndex;   /**< Index in the extraction array, as initialized by user */
1142    uint8_t                         offset;              /**< Byte offset */
1143    uint8_t                         mask;                /**< A byte mask (selected bits will be used) */
1144} t_FmPcdKgExtractMask;
1145
1146/**************************************************************************//**
1147 @Description   A structure for defining default selection per groups
1148                of fields
1149*//***************************************************************************/
1150typedef struct t_FmPcdKgExtractDflt {
1151    e_FmPcdKgKnownFieldsDfltTypes       type;                /**< Default type select*/
1152    e_FmPcdKgExtractDfltSelect          dfltSelect;          /**< Default register select */
1153} t_FmPcdKgExtractDflt;
1154
1155/**************************************************************************//**
1156 @Description   A structure for defining all parameters needed for
1157                generation a key and using a hash function
1158*//***************************************************************************/
1159typedef struct t_FmPcdKgKeyExtractAndHashParams {
1160    uint32_t                    privateDflt0;                /**< Scheme default register 0 */
1161    uint32_t                    privateDflt1;                /**< Scheme default register 1 */
1162    uint8_t                     numOfUsedExtracts;           /**< defines the valid size of the following array */
1163    t_FmPcdExtractEntry         extractArray [FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY]; /**< An array of extractions definition. */
1164    uint8_t                     numOfUsedDflts;              /**< defines the valid size of the following array */
1165    t_FmPcdKgExtractDflt        dflts[FM_PCD_KG_NUM_OF_DEFAULT_GROUPS];
1166                                                             /**< For each extraction used in this scheme, specify the required
1167                                                                  default register to be used when header is not found.
1168                                                                  types not specified in this array will get undefined value. */
1169    uint8_t                     numOfUsedMasks;              /**< defines the valid size of the following array */
1170    t_FmPcdKgExtractMask        masks[FM_PCD_KG_NUM_OF_EXTRACT_MASKS];
1171    uint8_t                     hashShift;                   /**< hash result right shift. Select the 24 bits out of the 64 hash
1172                                                                  result. 0 means using the 24 LSB's, otherwise use the
1173                                                                  24 LSB's after shifting right.*/
1174    uint32_t                    hashDistributionNumOfFqids;  /**< must be > 1 and a power of 2. Represents the range
1175                                                                  of queues for the key and hash functionality */
1176    uint8_t                     hashDistributionFqidsShift;  /**< selects the FQID bits that will be effected by the hash */
1177    bool                        symmetricHash;               /**< TRUE to generate the same hash for frames with swapped source and
1178                                                                  destination fields on all layers; If TRUE, driver will check that for
1179                                                                  all layers, if SRC extraction is selected, DST extraction must also be
1180                                                                  selected, and vice versa. */
1181} t_FmPcdKgKeyExtractAndHashParams;
1182
1183/**************************************************************************//**
1184 @Description   A structure of parameters for defining a single
1185                Fqid mask (extracted OR).
1186*//***************************************************************************/
1187typedef struct t_FmPcdKgExtractedOrParams {
1188    e_FmPcdExtractType              type;               /**< Extraction type select */
1189    union {
1190        struct {                                        /**< used when type = e_FM_PCD_KG_EXTRACT_BY_HDR */
1191            e_NetHeaderType         hdr;
1192            e_FmPcdHdrIndex         hdrIndex;           /**< Relevant only for MPLS, VLAN and tunneled
1193                                                             IP. Otherwise should be cleared.*/
1194            bool                    ignoreProtocolValidation;
1195                                                        /**< continue extraction even if protocol is not recognized */
1196        } extractByHdr;
1197        e_FmPcdExtractFrom          src;                /**< used when type = e_FM_PCD_KG_EXTRACT_NON_HDR */
1198    };
1199    uint8_t                         extractionOffset;   /**< Offset for extraction (in bytes).  */
1200    e_FmPcdKgExtractDfltSelect      dfltValue;          /**< Select register from which extraction is taken if
1201                                                             field not found */
1202    uint8_t                         mask;               /**< Extraction mask (specified bits are used) */
1203    uint8_t                         bitOffsetInFqid;    /**< 0-31, Selects which bits of the 24 FQID bits to effect using
1204                                                             the extracted byte; Assume byte is placed as the 8 MSB's in
1205                                                             a 32 bit word where the lower bits
1206                                                             are the FQID; i.e if bitOffsetInFqid=1 than its LSB
1207                                                             will effect the FQID MSB, if bitOffsetInFqid=24 than the
1208                                                             extracted byte will effect the 8 LSB's of the FQID,
1209                                                             if bitOffsetInFqid=31 than the byte's MSB will effect
1210                                                             the FQID's LSB; 0 means - no effect on FQID;
1211                                                             Note that one, and only one of
1212                                                             bitOffsetInFqid or bitOffsetInPlcrProfile must be set (i.e,
1213                                                             extracted byte must effect either FQID or Policer profile).*/
1214    uint8_t                         bitOffsetInPlcrProfile;
1215                                                        /**< 0-15, Selects which bits of the 8 policer profile id bits to
1216                                                             effect using the extracted byte; Assume byte is placed
1217                                                             as the 8 MSB's in a 16 bit word where the lower bits
1218                                                             are the policer profile id; i.e if bitOffsetInPlcrProfile=1
1219                                                             than its LSB will effect the profile MSB, if bitOffsetInFqid=8
1220                                                             than the extracted byte will effect the whole policer profile id,
1221                                                             if bitOffsetInFqid=15 than the byte's MSB will effect
1222                                                             the Policer Profile id's LSB;
1223                                                             0 means - no effect on policer profile; Note that one, and only one of
1224                                                             bitOffsetInFqid or bitOffsetInPlcrProfile must be set (i.e,
1225                                                             extracted byte must effect either FQID or Policer profile).*/
1226} t_FmPcdKgExtractedOrParams;
1227
1228/**************************************************************************//**
1229 @Description   A structure for configuring scheme counter
1230*//***************************************************************************/
1231typedef struct t_FmPcdKgSchemeCounter {
1232    bool        update;     /**< FALSE to keep the current counter state
1233                                 and continue from that point, TRUE to update/reset
1234                                 the counter when the scheme is written. */
1235    uint32_t    value;      /**< If update=TRUE, this value will be written into the
1236                                 counter. clear this field to reset the counter. */
1237} t_FmPcdKgSchemeCounter;
1238
1239/**************************************************************************//**
1240 @Description   A structure for defining policer profile
1241                parameters as required by keygen (when policer
1242                is the next engine after this scheme).
1243*//***************************************************************************/
1244typedef struct t_FmPcdKgPlcrProfile {
1245    bool                sharedProfile;              /**< TRUE if this profile is shared between ports
1246                                                         (i.e. managed by master partition) May not be TRUE
1247                                                         if profile is after Coarse Classification*/
1248    bool                direct;                     /**< if TRUE, directRelativeProfileId only selects the profile
1249                                                         id, if FALSE fqidOffsetRelativeProfileIdBase is used
1250                                                         together with fqidOffsetShift and numOfProfiles
1251                                                         parameters, to define a range of profiles from
1252                                                         which the keygen result will determine the
1253                                                         destination policer profile.  */
1254    union {
1255        uint16_t        directRelativeProfileId;    /**< Used if 'direct' is TRUE, to select policer profile.
1256                                                         This parameter should
1257                                                         indicate the policer profile offset within the port's
1258                                                         policer profiles or SHARED window. */
1259        struct {
1260            uint8_t     fqidOffsetShift;            /**< shift of KG results without the qid base */
1261            uint8_t     fqidOffsetRelativeProfileIdBase;
1262                                                    /**< OR of KG results without the qid base
1263                                                         This parameter should indicate the policer profile
1264                                                         offset within the port's policer profiles window or
1265                                                         SHARED window depends on sharedProfile */
1266            uint8_t     numOfProfiles;              /**< Range of profiles starting at base */
1267        } indirectProfile;
1268    } profileSelect;
1269} t_FmPcdKgPlcrProfile;
1270
1271/**************************************************************************//**
1272 @Description   A structure for CC parameters if CC is the next engine after KG
1273*//***************************************************************************/
1274typedef struct t_FmPcdKgCc {
1275    t_Handle                h_CcTree;           /**< A handle to a CC Tree */
1276    uint8_t                 grpId;              /**< CC group id within the CC tree */
1277    bool                    plcrNext;           /**< TRUE if after CC, in case of data frame,
1278                                                     policing is required. */
1279    bool                    bypassPlcrProfileGeneration;
1280                                                /**< TRUE to bypass keygen policer profile
1281                                                     generation (profile selected is the one selected at
1282                                                     port initialization). */
1283    t_FmPcdKgPlcrProfile    plcrProfile;        /**< only if plcrNext=TRUE and bypassPlcrProfileGeneration=FALSE */
1284} t_FmPcdKgCc;
1285
1286/**************************************************************************//**
1287 @Description   A structure for initializing a keygen single scheme
1288*//***************************************************************************/
1289typedef struct t_FmPcdKgSchemeParams {
1290    bool                                modify;                 /**< TRUE to change an existing scheme */
1291    union
1292    {
1293        uint8_t                         relativeSchemeId;       /**< if modify=FALSE:Partition relative scheme id */
1294        t_Handle                        h_Scheme;               /**< if modify=TRUE: a handle of the existing scheme */
1295    }id;
1296    bool                                alwaysDirect;           /**< This scheme is reached only directly, i.e.                                                              no need for match vector. Keygen will ignore
1297                                                                     it when matching   */
1298    struct {                                                    /**< HL Relevant only if alwaysDirect = FALSE */
1299        t_Handle                        h_NetEnv;               /**< A handle to the Network environment as returned
1300                                                                     by FM_PCD_SetNetEnvCharacteristics() */
1301        uint8_t                         numOfDistinctionUnits;  /**< Number of netenv units listed in unitIds array */
1302        uint8_t                         unitIds[FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS];
1303                                                                /**< Indexes as passed to SetNetEnvCharacteristics array*/
1304    } netEnvParams;
1305    bool                                useHash;                /**< use the KG Hash functionality  */
1306    t_FmPcdKgKeyExtractAndHashParams    keyExtractAndHashParams;
1307                                                                /**< used only if useHash = TRUE */
1308    bool                                bypassFqidGeneration;   /**< Normally - FALSE, TRUE to avoid FQID update in the IC;
1309                                                                     In such a case FQID after KG will be the default FQID
1310                                                                     defined for the relevant port, or the FQID defined by CC
1311                                                                     in cases where CC was the previous engine. */
1312    uint32_t                            baseFqid;               /**< Base FQID; Relevant only if bypassFqidGeneration = FALSE;
1313                                                                     If hash is used and an even distribution is expected
1314                                                                     according to hashDistributionNumOfFqids, baseFqid must be aligned to
1315                                                                     hashDistributionNumOfFqids.  */
1316    uint8_t                             numOfUsedExtractedOrs;  /**< Number of Fqid masks listed in extractedOrs array*/
1317    t_FmPcdKgExtractedOrParams          extractedOrs[FM_PCD_KG_NUM_OF_GENERIC_REGS];
1318                                                                /**< IN: FM_PCD_KG_NUM_OF_GENERIC_REGS
1319                                                                     registers are shared between qidMasks
1320                                                                     functionality and some of the extraction
1321                                                                     actions; Normally only some will be used
1322                                                                     for qidMask. Driver will return error if
1323                                                                     resource is full at initialization time. */
1324    e_FmPcdEngine                       nextEngine;             /**< may be BMI, PLCR or CC */
1325    union {                                                     /**< depends on nextEngine */
1326        e_FmPcdDoneAction               doneAction;             /**< Used when next engine is BMI (done) */
1327        t_FmPcdKgPlcrProfile            plcrProfile;            /**< Used when next engine is PLCR */
1328        t_FmPcdKgCc                     cc;                     /**< Used when next engine is CC */
1329    } kgNextEngineParams;
1330    t_FmPcdKgSchemeCounter              schemeCounter;          /**< A structure of parameters for updating
1331                                                                     the scheme counter */
1332} t_FmPcdKgSchemeParams;
1333
1334/**************************************************************************//**
1335 @Description   A structure for defining CC params when CC is the
1336                next engine after a CC node.
1337*//***************************************************************************/
1338typedef struct t_FmPcdCcNextCcParams {
1339    t_Handle    h_CcNode;               /**< A handle of the next CC node */
1340} t_FmPcdCcNextCcParams;
1341
1342/**************************************************************************//**
1343 @Description   A structure for defining PLCR params when PLCR is the
1344                next engine after a CC node.
1345*//***************************************************************************/
1346typedef struct t_FmPcdCcNextPlcrParams {
1347    bool        overrideParams;         /**< TRUE if CC override previously decided parameters*/
1348    bool        sharedProfile;          /**< Relevant only if overrideParams=TRUE:
1349                                             TRUE if this profile is shared between ports */
1350    uint16_t    newRelativeProfileId;   /**< Relevant only if overrideParams=TRUE:
1351                                             (otherwise profile id is taken from keygen);
1352                                             This parameter should indicate the policer
1353                                             profile offset within the port's
1354                                             policer profiles or from SHARED window.*/
1355    uint32_t    newFqid;                /**< Relevant only if overrideParams=TRUE:
1356                                             FQID for enqueuing the frame;
1357                                             In earlier chips  if policer next engine is KEYGEN,
1358                                             this parameter can be 0, because the KEYGEN
1359                                             always decides the enqueue FQID.*/
1360    bool        statisticsEn;           /**< In the case of TRUE Statistic counter is
1361                                             incremented for each received frame passed through
1362                                             this Coarse Classification entry.*/
1363} t_FmPcdCcNextPlcrParams;
1364
1365/**************************************************************************//**
1366 @Description   A structure for defining enqueue params when BMI is the
1367                next engine after a CC node.
1368*//***************************************************************************/
1369typedef struct t_FmPcdCcNextEnqueueParams {
1370
1371    e_FmPcdDoneAction    action;        /**< Action - when next engine is BMI (done) */
1372    bool                 overrideFqid;  /**< TRUE if CC override previously decided Fqid(by Keygen),
1373                                             relevant if action = e_FM_PCD_ENQ_FRAME */
1374    uint32_t             newFqid;       /**< Valid if overrideFqid=TRUE, FQID for enqueuing the frame
1375                                             (otherwise FQID is taken from keygen),
1376                                             relevant if action = e_FM_PCD_ENQ_FRAME*/
1377    bool                 statisticsEn;  /**< In the case of TRUE Statistic counter is
1378                                             incremented for each received frame passed through
1379                                             this Coarse Classification entry.*/
1380} t_FmPcdCcNextEnqueueParams;
1381
1382/**************************************************************************//**
1383 @Description   A structure for defining KG params when KG is the
1384                next engine after a CC node.
1385*//***************************************************************************/
1386typedef struct t_FmPcdCcNextKgParams {
1387    bool        overrideFqid;           /**< TRUE if CC override previously decided Fqid (by keygen),
1388                                             Note - this parameters irrelevant for earlier chips*/
1389    uint32_t    newFqid;                /**< Valid if overrideFqid=TRUE, FQID for enqueuing the frame
1390                                             (otherwise FQID is taken from keygen),
1391                                             Note - this parameters irrelevant for earlier chips*/
1392    t_Handle    h_DirectScheme;         /**< Direct scheme handle to go to. */
1393    bool        statisticsEn;           /**< In the case of TRUE Statistic counter is
1394                                             incremented for each received frame passed through
1395                                             this Coarse Classification entry.*/
1396} t_FmPcdCcNextKgParams;
1397
1398/**************************************************************************//**
1399 @Description   A structure for defining next engine params after a CC node.
1400*//***************************************************************************/
1401typedef struct t_FmPcdCcNextEngineParams {
1402    e_FmPcdEngine                       nextEngine;    /**< User has to initialize parameters
1403                                                            according to nextEngine definition */
1404    union {
1405        t_FmPcdCcNextCcParams           ccParams;      /**< Parameters in case next engine is CC */
1406        t_FmPcdCcNextPlcrParams         plcrParams;    /**< Parameters in case next engine is PLCR */
1407        t_FmPcdCcNextEnqueueParams      enqueueParams; /**< Parameters in case next engine is BMI */
1408        t_FmPcdCcNextKgParams           kgParams;      /**< Parameters in case next engine is KG */
1409    } params;
1410#if defined(FM_CAPWAP_SUPPORT)
1411    t_Handle                            h_Manip;       /**< Handler to headerManip.
1412                                                            Relevant if next engine of the type result
1413                                                            (e_FM_PCD_PLCR, e_FM_PCD_KG, e_FM_PCD_DONE) */
1414#endif /* defined(FM_CAPWAP_SUPPORT) || ... */
1415} t_FmPcdCcNextEngineParams;
1416
1417/**************************************************************************//**
1418 @Description   A structure for defining a single CC Key parameters
1419*//***************************************************************************/
1420typedef struct t_FmPcdCcKeyParams {
1421    uint8_t                     *p_Key;     /**< pointer to the key of the size defined in keySize*/
1422    uint8_t                     *p_Mask;    /**< pointer to the Mask per key  of the size defined
1423                                                 in keySize. p_Key and p_Mask (if defined) has to be
1424                                                 of the same size defined in the keySize */
1425    t_FmPcdCcNextEngineParams   ccNextEngineParams;
1426                                            /**< parameters for the next for the defined Key in
1427                                                 the p_Key */
1428} t_FmPcdCcKeyParams;
1429
1430/**************************************************************************//**
1431 @Description   A structure for defining CC Keys parameters
1432*//***************************************************************************/
1433typedef struct t_KeysParams {
1434    uint8_t                     numOfKeys;      /**< Number Of relevant Keys  */
1435    uint8_t                     keySize;        /**< size of the key - in the case of the extraction of
1436                                                     the type FULL_FIELD keySize has to be as standard size of the relevant
1437                                                     key. In the another type of extraction keySize has to be as size of extraction.
1438                                                     In the case of action = e_FM_PCD_ACTION_INDEXED_LOOKUP the size of keySize has to be 2*/
1439    t_FmPcdCcKeyParams          keyParams[FM_PCD_MAX_NUM_OF_KEYS];
1440                                                /**< it's array with numOfKeys entries each entry in
1441                                                     the array of the type t_FmPcdCcKeyParams */
1442    t_FmPcdCcNextEngineParams   ccNextEngineParamsForMiss;
1443                                                /**< parameters for the next step of
1444                                                     unfound (or undefined) key . Not relevant in the case
1445                                                     of action = e_FM_PCD_ACTION_INDEXED_LOOKUP*/
1446} t_KeysParams;
1447
1448/**************************************************************************//**
1449 @Description   A structure for defining the CC node params
1450*//***************************************************************************/
1451typedef struct t_FmPcdCcNodeParams {
1452    t_FmPcdExtractEntry         extractCcParams;    /**< params which defines extraction parameters */
1453    t_KeysParams                keysParams;         /**< params which defines Keys parameters of the
1454                                                         extraction defined in extractCcParams */
1455} t_FmPcdCcNodeParams;
1456
1457/**************************************************************************//**
1458 @Description   A structure for defining each CC tree group in term of
1459                NetEnv units and the action to be taken in each case.
1460                the unitIds list must be in order from lower to higher indexes.
1461
1462                t_FmPcdCcNextEngineParams is a list of 2^numOfDistinctionUnits
1463                structures where each defines the next action to be taken for
1464                each units combination. for example:
1465                numOfDistinctionUnits = 2
1466                unitIds = {1,3}
1467                p_NextEnginePerEntriesInGrp[0] = t_FmPcdCcNextEngineParams for the case that
1468                                                        unit 1 - not found; unit 3 - not found;
1469                p_NextEnginePerEntriesInGrp[1] = t_FmPcdCcNextEngineParams for the case that
1470                                                        unit 1 - not found; unit 3 - found;
1471                p_NextEnginePerEntriesInGrp[2] = t_FmPcdCcNextEngineParams for the case that
1472                                                        unit 1 - found; unit 3 - not found;
1473                p_NextEnginePerEntriesInGrp[3] = t_FmPcdCcNextEngineParams for the case that
1474                                                        unit 1 - found; unit 3 - found;
1475*//***************************************************************************/
1476typedef struct t_FmPcdCcGrpParams {
1477    uint8_t                     numOfDistinctionUnits;          /**< up to 4 */
1478    uint8_t                     unitIds[FM_PCD_MAX_NUM_OF_CC_UNITS];
1479                                                                /**< Indexes of the units as defined in
1480                                                                     FM_PCD_SetNetEnvCharacteristics() */
1481    t_FmPcdCcNextEngineParams   nextEnginePerEntriesInGrp[FM_PCD_MAX_NUM_OF_CC_ENTRIES_IN_GRP];
1482                                                                /**< Max size is 16 - if only one group used */
1483} t_FmPcdCcGrpParams;
1484
1485/**************************************************************************//**
1486 @Description   A structure for defining the CC tree groups
1487*//***************************************************************************/
1488typedef struct t_FmPcdCcTreeParams {
1489    t_Handle                h_NetEnv;                                   /**< A handle to the Network environment as returned
1490                                                                             by FM_PCD_SetNetEnvCharacteristics() */
1491    uint8_t                 numOfGrps;                                  /**< Number of CC groups within the CC tree */
1492    t_FmPcdCcGrpParams      ccGrpParams[FM_PCD_MAX_NUM_OF_CC_GROUPS];   /**< Parameters for each group. */
1493} t_FmPcdCcTreeParams;
1494
1495/**************************************************************************//**
1496 @Description   A structure for defining parameters for byte rate
1497*//***************************************************************************/
1498typedef struct t_FmPcdPlcrByteRateModeParams {
1499    e_FmPcdPlcrFrameLengthSelect    frameLengthSelection;   /**< Frame length selection */
1500    e_FmPcdPlcrRollBackFrameSelect  rollBackFrameSelection; /**< relevant option only e_FM_PCD_PLCR_L2_FRM_LEN,
1501                                                                 e_FM_PCD_PLCR_FULL_FRM_LEN */
1502} t_FmPcdPlcrByteRateModeParams;
1503
1504/**************************************************************************//**
1505 @Description   A structure for selcting the policer profile RFC-2698 or
1506                RFC-4115 parameters
1507*//***************************************************************************/
1508typedef struct t_FmPcdPlcrNonPassthroughAlgParams {
1509    e_FmPcdPlcrRateMode              rateMode;                       /**< Byte / Packet */
1510    t_FmPcdPlcrByteRateModeParams    byteModeParams;                 /**< Valid for Byte NULL for Packet */
1511    uint32_t                         comittedInfoRate;               /**< KBits/Sec or Packets/Sec */
1512    uint32_t                         comittedBurstSize;              /**< Bytes/Packets */
1513    uint32_t                         peakOrAccessiveInfoRate;        /**< KBits/Sec or Packets/Sec */
1514    uint32_t                         peakOrAccessiveBurstSize;       /**< Bytes/Packets */
1515} t_FmPcdPlcrNonPassthroughAlgParams;
1516
1517/**************************************************************************//**
1518 @Description   A union for defining Policer next engine parameters
1519*//***************************************************************************/
1520typedef union u_FmPcdPlcrNextEngineParams {
1521        e_FmPcdDoneAction               action;             /**< Action - when next engine is BMI (done) */
1522        t_Handle                        h_Profile;          /**< Policer profile handle -  used when next engine
1523                                                                 is PLCR, must be a SHARED profile */
1524        t_Handle                        h_DirectScheme;     /**< Direct scheme select - when next engine is Keygen */
1525} u_FmPcdPlcrNextEngineParams;
1526
1527/**************************************************************************//**
1528 @Description   A structure for selecting the policer profile entry parameters
1529*//***************************************************************************/
1530typedef struct t_FmPcdPlcrProfileParams {
1531    bool                                modify;                     /**< TRUE to change an existing profile */
1532    union {
1533        struct {
1534            e_FmPcdProfileTypeSelection profileType;                /**< Type of policer profile */
1535            t_Handle                    h_FmPort;                   /**< Relevant for per-port profiles only */
1536            uint16_t                    relativeProfileId;          /**< Profile id - relative to shared group or to port */
1537        } newParams;                                                /**< use it when modify=FALSE */
1538        t_Handle                        h_Profile;                  /**< A handle to a profile - use it when modify=TRUE */
1539    } id;
1540    e_FmPcdPlcrAlgorithmSelection       algSelection;               /**< Profile Algorithm PASS_THROUGH, RFC_2698, RFC_4115 */
1541    e_FmPcdPlcrColorMode                colorMode;                  /**< COLOR_BLIND, COLOR_AWARE */
1542
1543    union {
1544        e_FmPcdPlcrColor                dfltColor;                  /**< For Color-Blind Pass-Through mode. the policer will re-color
1545                                                                         any incoming packet with the default value. */
1546        e_FmPcdPlcrColor                override;                   /**< For Color-Aware modes. The profile response to a
1547                                                                         pre-color value of 2'b11. */
1548    } color;
1549
1550    t_FmPcdPlcrNonPassthroughAlgParams  nonPassthroughAlgParams;    /**< RFC2698 or RFC4115 params */
1551
1552    e_FmPcdEngine                       nextEngineOnGreen;          /**< Green next engine type */
1553    u_FmPcdPlcrNextEngineParams         paramsOnGreen;              /**< Green next engine params */
1554
1555    e_FmPcdEngine                       nextEngineOnYellow;         /**< Yellow next engine type */
1556    u_FmPcdPlcrNextEngineParams         paramsOnYellow;             /**< Yellow next engine params */
1557
1558    e_FmPcdEngine                       nextEngineOnRed;            /**< Red next engine type */
1559    u_FmPcdPlcrNextEngineParams         paramsOnRed;                /**< Red next engine params */
1560
1561    bool                                trapProfileOnFlowA;         /**< Trap on flow A */
1562    bool                                trapProfileOnFlowB;         /**< Trap on flow B */
1563    bool                                trapProfileOnFlowC;         /**< Trap on flow C */
1564} t_FmPcdPlcrProfileParams;
1565
1566#if defined(FM_CAPWAP_SUPPORT)
1567/**************************************************************************//**
1568 @Description   A structure for selecting the location of manipulation
1569*//***************************************************************************/
1570typedef struct t_FmPcdManipLocationParams {
1571    e_FmPcdManipLocateType              type;           /**< location of manipulation type select */
1572    struct {                                            /**< used when type = e_FM_PCD_MANIP_BY_HDR */
1573        e_NetHeaderType                 hdr;            /**< Header selection */
1574        e_FmPcdHdrIndex                 hdrIndex;       /**< Relevant only for MPLS, VLAN and tunneled
1575                                                             IP. Otherwise should be cleared. */
1576        bool                            byField;        /**< TRUE if the location of manipulation is according to some field in the specific header*/
1577        t_FmPcdFields                   fullField;      /**< Relevant only when byField = TRUE: Extract field */
1578    } manipByHdr;
1579} t_FmPcdManipLocationParams;
1580
1581/**************************************************************************//**
1582 @Description   structure for defining insert manipulation
1583                of the type e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE
1584*//***************************************************************************/
1585typedef struct t_FmPcdManipInsrtByTemplateParams {
1586    uint8_t         size;                               /**< size of insert template to the start of the frame. */
1587    uint8_t         hdrTemplate[FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE];
1588                                                        /**< array of the insertion template. */
1589
1590    bool            modifyOuterIp;                      /**< TRUE if user want to modify some fields in outer IP. */
1591    struct {
1592        uint16_t    ipOuterOffset;                      /**< offset of outer IP in the insert template, relevant if modifyOuterIp = TRUE.*/
1593        uint16_t    dscpEcn;                            /**< value of dscpEcn in IP outer, relevant if modifyOuterIp = TRUE.
1594                                                             in IPV4 dscpEcn only byte - it has to be adjusted to the right*/
1595        bool        udpPresent;                         /**< TRUE if UDP is present in the insert template, relevant if modifyOuterIp = TRUE.*/
1596        uint8_t     udpOffset;                          /**< offset in the insert template of UDP, relevant if modifyOuterIp = TRUE and udpPresent=TRUE.*/
1597        uint8_t     ipIdentGenId;                       /**< Used by FMan-CTRL to calculate IP-identification field,relevant if modifyOuterIp = TRUE.*/
1598        bool        recalculateLength;                  /**< TRUE if recalculate length has to be performed due to the engines in the path which can change the frame later, relevant if modifyOuterIp = TRUE.*/
1599        struct {
1600            uint8_t blockSize;                          /**< The CAAM block-size; Used by FMan-CTRL to calculate the IP-total-len field.*/
1601            uint8_t extraBytesAddedAlignedToBlockSize;  /**< Used by FMan-CTRL to calculate the IP-total-len field and UDP length*/
1602            uint8_t extraBytesAddedNotAlignedToBlockSize;/**< Used by FMan-CTRL to calculate the IP-total-len field and UDP length.*/
1603        } recalculateLengthParams;                      /**< recalculate length parameters - relevant if modifyOuterIp = TRUE and recalculateLength = TRUE */
1604    } modifyOuterIpParams;                              /**< Outer IP modification parameters - ignored if modifyOuterIp is FALSE */
1605
1606    bool            modifyOuterVlan;                    /**< TRUE if user wants to modify vpri field in the outer VLAN header*/
1607    struct {
1608        uint8_t     vpri;                               /**< value of vpri, relevant if modifyOuterVlan = TRUE
1609                                                             vpri only 3 bits, it has to be adjusted to the right*/
1610    } modifyOuterVlanParams;
1611} t_FmPcdManipInsrtByTemplateParams;
1612#endif /* defined(FM_CAPWAP_SUPPORT) || ... */
1613
1614
1615#ifdef FM_CAPWAP_SUPPORT
1616/**************************************************************************//**
1617 @Description   structure for defining CAPWAP fragmentation
1618*//***************************************************************************/
1619typedef struct t_CapwapFragmentationParams {
1620    uint16_t         sizeForFragmentation;              /**< if length of the frame is greater than this value, CAPWAP fragmentation will be executed.*/
1621    bool             headerOptionsCompr;                /**< TRUE - first fragment include the CAPWAP header options field,
1622                                                             and all other fragments exclude the CAPWAP options field,
1623                                                             FALSE - all fragments include CAPWAP header options field. */
1624} t_CapwapFragmentationParams;
1625
1626/**************************************************************************//**
1627 @Description   structure for defining CAPWAP Re-assembly
1628*//***************************************************************************/
1629typedef struct t_CapwapReassemblyParams {
1630    uint16_t                        maxNumFramesInProcess;  /**< Number of frames which can be processed by Reassembly in the same time.
1631                                                                 It has to be power of 2.
1632                                                                 In the case numOfFramesPerHashEntry == e_FM_PCD_MANIP_FOUR_WAYS_HASH,
1633                                                                 maxNumFramesInProcess has to be in the range of 4 - 512,
1634                                                                 In the case numOfFramesPerHashEntry == e_FM_PCD_MANIP_EIGHT_WAYS_HASH,
1635                                                                 maxNumFramesInProcess has to be in the range of 8 - 2048 */
1636    bool                            haltOnDuplicationFrag;  /**< In the case of TRUE, Reassembly process halted due to duplicated fragment,
1637                                                                 and all processed fragments passed for enqueue with error indication.
1638                                                                 In the case of FALSE, only duplicated fragment passed for enqueue with error indication */
1639
1640    e_FmPcdManipReassemTimeOutMode  timeOutMode;            /**< Expiration delay initialized by Reassembly process */
1641    uint32_t                        fqidForTimeOutFrames;   /**< Fqid in which time out frames will enqueue during Time Out Process  */
1642    uint32_t                        timeoutRoutineRequestTime;
1643                                                            /**< Represents the time interval in microseconds between consecutive
1644                                                                 timeout routine requests It has to be power of 2. */
1645    uint32_t                        timeoutThresholdForReassmProcess;
1646                                                            /**< Represents the time interval in microseconds which defines
1647                                                                 if opened frame (at least one fragment was processed but not all the fragments)is found as too old*/
1648
1649    e_FmPcdManipReassemWaysNumber   numOfFramesPerHashEntry;/**< Number of frames per hash entry needed for reassembly process */
1650} t_CapwapReassemblyParams;
1651#endif /* FM_CAPWAP_SUPPORT */
1652
1653
1654#if defined(FM_CAPWAP_SUPPORT)
1655/**************************************************************************//**
1656 @Description   structure for defining fragmentation/reassembly
1657*//***************************************************************************/
1658typedef struct t_FmPcdManipFragOrReasmParams {
1659    bool                                frag;               /**< TRUE if using the structure for fragmentation,
1660                                                                 otherwise this structure is used for reassembly */
1661    uint8_t                             extBufPoolIndx;     /**< Index of the buffer pool ID which was configured for port
1662                                                                 and can be used for manipulation;
1663                                                                 NOTE: This field is relevant only for CAPWAP fragmentation
1664                                                                 and reassembly */
1665    e_NetHeaderType                     hdr;                /**< Header selection */
1666    union {
1667#ifdef FM_CAPWAP_SUPPORT
1668        t_CapwapFragmentationParams     capwapFragParams;   /**< Structure for CAPWAP fragmentation, relevant if frag = TRUE, hdr = HEADER_TYPE_CAPWAP */
1669        t_CapwapReassemblyParams        capwapReasmParams;  /**< Structure for CAPWAP reassembly, relevant if frag = FALSE, hdr = HEADER_TYPE_CAPWAP */
1670#endif /* FM_CAPWAP_SUPPORT */
1671    };
1672} t_FmPcdManipFragOrReasmParams;
1673
1674/**************************************************************************//**
1675 @Description   structure for defining insert manipulation
1676*//***************************************************************************/
1677typedef struct t_FmPcdManipInsrtParams {
1678    e_FmPcdManipInsrtType                       type;       /**< Type of insert manipulation */
1679    union {
1680        t_FmPcdManipInsrtByTemplateParams       insrtByTemplateParams;
1681                                                            /**< parameters for insert manipulation, relevant if
1682                                                                 type = e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE */
1683    };
1684} t_FmPcdManipInsrtParams;
1685
1686/**************************************************************************//**
1687 @Description   structure for defining remove manipulation
1688*//***************************************************************************/
1689typedef struct t_FmPcdManipRmvParams {
1690    e_FmPcdManipRmvParamsType                   type;   /**< Type of remove manipulation */
1691    t_FmPcdManipLocationParams                  rmvSpecificLocationParams;
1692                                                        /**< Specified location of remove manipulation;
1693                                                              This params should be initialized in cases:
1694                                                              - e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_TILL_SPECIFIC_LOCATION
1695                                                              - e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_INCLUDE_SPECIFIC_LOCATION */
1696} t_FmPcdManipRmvParams;
1697
1698/**************************************************************************//**
1699 @Description   structure for defining manipulation
1700*//***************************************************************************/
1701typedef struct t_FmPcdManipParams {
1702    bool                                        rmv;                /**< TRUE, if defined remove manipulation */
1703    t_FmPcdManipRmvParams                       rmvParams;          /**< Parameters for remove manipulation, relevant if rmv = TRUE */
1704
1705    bool                                        insrt;              /**< TRUE, if defined insert manipulation */
1706    t_FmPcdManipInsrtParams                     insrtParams;        /**< Parameters for insert manipulation, relevant if insrt = TRUE */
1707
1708    bool                                        fragOrReasm;        /**< TRUE, if defined fragmentation/reassembly manipulation */
1709    t_FmPcdManipFragOrReasmParams               fragOrReasmParams;  /**< Parameters for fragmentation/reassembly manipulation, relevant if fragOrReasm = TRUE */
1710
1711    /**< General parameters */
1712    bool                                        treatFdStatusFieldsAsErrors;
1713                                                                    /**< Set to TRUE when the port that is using this manip is chained
1714                                                                         to SEC (i.e. the traffic was forwarded from SEC) */
1715} t_FmPcdManipParams;
1716
1717/**************************************************************************//**
1718 @Description   structure for defining statistics node
1719*//***************************************************************************/
1720typedef struct t_FmPcdStatsParams {
1721    e_FmPcdStatsType        type; /**< type of statistics node */
1722} t_FmPcdStatsParams;
1723#endif /* defined(FM_CAPWAP_SUPPORT) || ... */
1724
1725
1726/**************************************************************************//**
1727 @Function      FM_PCD_SetNetEnvCharacteristics
1728
1729 @Description   Define a set of Network Environment Characteristics.
1730                When setting an environment it is important to understand its
1731                application. It is not meant to describe the flows that will run
1732                on the ports using this environment, but what the user means TO DO
1733                with the PCD mechanisms in order to parse-classify-distribute those
1734                frames.
1735                By specifying a distinction unit, the user means it would use that option
1736                for distinction between frames at either a keygen scheme keygen or a coarse
1737                classification action descriptor. Using interchangeable headers to define a
1738                unit means that the user is indifferent to which of the interchangeable
1739                headers is present in the frame, and they want the distinction to be based
1740                on the presence of either one of them.
1741                Depending on context, there are limitations to the use of environments. A
1742                port using the PCD functionality is bound to an environment. Some or even
1743                all ports may share an environment but also an environment per port is
1744                possible. When initializing a scheme, a classification plan group (see below),
1745                or a coarse classification tree, one of the initialized environments must be
1746                stated and related to. When a port is bound to a scheme, a classification
1747                plan group, or a coarse classification tree, it MUST be bound to the same
1748                environment.
1749                The different PCD modules, may relate (for flows definition) ONLY on
1750                distinction units as defined by their environment. When initializing a
1751                scheme for example, it may not choose to select IPV4 as a match for
1752                recognizing flows unless it was defined in the relating environment. In
1753                fact, to guide the user through the configuration of the PCD, each module's
1754                characterization in terms of flows is not done using protocol names, but using
1755                environment indexes.
1756                In terms of HW implementation, the list of distinction units sets the LCV vectors
1757                and later used for match vector, classification plan vectors and coarse classification
1758                indexing.
1759
1760 @Param[in]     h_FmPcd         FM PCD module descriptor.
1761 @Param[in]     p_NetEnvParams  A structure of parameters for the initialization of
1762                                the network environment.
1763
1764 @Return        A handle to the initialized object on success; NULL code otherwise.
1765
1766 @Cautions      Allowed only following FM_PCD_Init().
1767*//***************************************************************************/
1768t_Handle FM_PCD_SetNetEnvCharacteristics(t_Handle h_FmPcd, t_FmPcdNetEnvParams *p_NetEnvParams);
1769
1770/**************************************************************************//**
1771 @Function      FM_PCD_DeleteNetEnvCharacteristics
1772
1773 @Description   Deletes a set of Network Environment Characteristics.
1774
1775 @Param[in]     h_FmPcd         FM PCD module descriptor.
1776 @Param[in]     h_NetEnv        A handle to the Network environment.
1777
1778 @Return        E_OK on success; Error code otherwise.
1779*//***************************************************************************/
1780t_Error FM_PCD_DeleteNetEnvCharacteristics(t_Handle h_FmPcd, t_Handle h_NetEnv);
1781
1782/**************************************************************************//**
1783 @Function      FM_PCD_KgSetScheme
1784
1785 @Description   Initializing or modifying and enabling a scheme for the keygen.
1786                This routine should be called for adding or modifying a scheme.
1787                When a scheme needs modifying, the API requires that it will be
1788                rewritten. In such a case 'modify' should be TRUE. If the
1789                routine is called for a valid scheme and 'modify' is FALSE,
1790                it will return error.
1791
1792 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
1793 @Param[in,out] p_Scheme        A structure of parameters for defining the scheme
1794
1795 @Return        A handle to the initialized scheme on success; NULL code otherwise.
1796
1797 @Cautions      Allowed only following FM_PCD_Init().
1798*//***************************************************************************/
1799t_Handle FM_PCD_KgSetScheme (t_Handle                h_FmPcd,
1800                             t_FmPcdKgSchemeParams   *p_Scheme);
1801
1802/**************************************************************************//**
1803 @Function      FM_PCD_KgDeleteScheme
1804
1805 @Description   Deleting an initialized scheme.
1806
1807 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
1808 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme
1809
1810 @Return        E_OK on success; Error code otherwise.
1811 @Cautions      Allowed only following FM_PCD_Init().
1812*//***************************************************************************/
1813t_Error     FM_PCD_KgDeleteScheme(t_Handle h_FmPcd, t_Handle h_Scheme);
1814
1815/**************************************************************************//**
1816 @Function      FM_PCD_KgGetSchemeCounter
1817
1818 @Description   Reads scheme packet counter.
1819
1820 @Param[in]     h_FmPcd         FM PCD module descriptor.
1821 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme.
1822
1823 @Return        Counter's current value.
1824
1825 @Cautions      Allowed only following FM_PCD_Init().
1826*//***************************************************************************/
1827uint32_t  FM_PCD_KgGetSchemeCounter(t_Handle h_FmPcd, t_Handle h_Scheme);
1828
1829/**************************************************************************//**
1830 @Function      FM_PCD_KgSetSchemeCounter
1831
1832 @Description   Writes scheme packet counter.
1833
1834 @Param[in]     h_FmPcd         FM PCD module descriptor.
1835 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme.
1836 @Param[in]     value           New scheme counter value - typically '0' for
1837                                resetting the counter.
1838 @Return        E_OK on success; Error code otherwise.
1839
1840 @Cautions      Allowed only following FM_PCD_Init().
1841*//***************************************************************************/
1842t_Error  FM_PCD_KgSetSchemeCounter(t_Handle h_FmPcd, t_Handle h_Scheme, uint32_t value);
1843
1844/**************************************************************************//**
1845 @Function      FM_PCD_CcBuildTree
1846
1847 @Description   This routine must be called to define a complete coarse
1848                classification tree. This is the way to define coarse
1849                classification to a certain flow - the keygen schemes
1850                may point only to trees defined in this way.
1851
1852 @Param[in]     h_FmPcd                 FM PCD module descriptor.
1853 @Param[in]     p_FmPcdCcTreeParams     A structure of parameters to define the tree.
1854
1855 @Return        A handle to the initialized object on success; NULL code otherwise.
1856
1857 @Cautions      Allowed only following FM_PCD_Init().
1858*//***************************************************************************/
1859t_Handle FM_PCD_CcBuildTree (t_Handle             h_FmPcd,
1860                             t_FmPcdCcTreeParams  *p_FmPcdCcTreeParams);
1861
1862/**************************************************************************//**
1863 @Function      FM_PCD_CcDeleteTree
1864
1865 @Description   Deleting an built tree.
1866
1867 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
1868 @Param[in]     h_CcTree        A handle to a CC tree.
1869
1870 @Cautions      Allowed only following FM_PCD_Init().
1871*//***************************************************************************/
1872t_Error FM_PCD_CcDeleteTree(t_Handle h_FmPcd, t_Handle h_CcTree);
1873
1874/**************************************************************************//**
1875 @Function      FM_PCD_CcSetNode
1876
1877 @Description   This routine should be called for each CC (coarse classification)
1878                node. The whole CC tree should be built bottom up so that each
1879                node points to already defined nodes.
1880
1881 @Param[in]     h_FmPcd             FM PCD module descriptor.
1882 @Param[in]     p_CcNodeParam       A structure of parameters defining the CC node
1883
1884 @Return        A handle to the initialized object on success; NULL code otherwise.
1885
1886 @Cautions      Allowed only following FM_PCD_Init().
1887*//***************************************************************************/
1888t_Handle   FM_PCD_CcSetNode(t_Handle             h_FmPcd,
1889                            t_FmPcdCcNodeParams  *p_CcNodeParam);
1890
1891/**************************************************************************//**
1892 @Function      FM_PCD_CcDeleteNode
1893
1894 @Description   Deleting an built node.
1895
1896 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
1897 @Param[in]     h_CcNode        A handle to a CC node.
1898
1899 @Cautions      Allowed only following FM_PCD_Init().
1900*//***************************************************************************/
1901t_Error FM_PCD_CcDeleteNode(t_Handle h_FmPcd, t_Handle h_CcNode);
1902
1903/**************************************************************************//**
1904 @Function      FM_PCD_CcTreeModifyNextEngine
1905
1906 @Description   Modify the Next Engine Parameters in the entry of the tree.
1907
1908 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1909 @Param[in]     h_CcTree                    A handle to the tree
1910 @Param[in]     grpId                       A Group index in the tree
1911 @Param[in]     index                       Entry index in the group defined by grpId
1912 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params
1913
1914 @Return        E_OK on success; Error code otherwise.
1915
1916 @Cautions      Allowed only following FM_PCD_CcBuildTree().
1917*//***************************************************************************/
1918t_Error FM_PCD_CcTreeModifyNextEngine(t_Handle h_FmPcd, t_Handle h_CcTree, uint8_t grpId, uint8_t index, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);
1919
1920/**************************************************************************//**
1921 @Function      FM_PCD_CcNodeModifyNextEngine
1922
1923 @Description   Modify the Next Engine Parameters in the relevant key entry of the node.
1924
1925 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1926 @Param[in]     h_CcNode                    A handle to the node
1927 @Param[in]     keyIndex                    Key index for Next Engine Params modifications
1928 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params
1929
1930 @Return        E_OK on success; Error code otherwise.
1931
1932 @Cautions      Allowed only following FM_PCD_CcSetNode().
1933*//***************************************************************************/
1934t_Error FM_PCD_CcNodeModifyNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);
1935
1936/**************************************************************************//**
1937 @Function      FM_PCD_CcNodeModifyMissNextEngine
1938
1939 @Description   Modify the Next Engine Parameters of the Miss key case of the node.
1940
1941 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1942 @Param[in]     h_CcNode                    A handle to the node
1943 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params
1944
1945 @Return        E_OK on success; Error code otherwise.
1946
1947 @Cautions      Allowed only following FM_PCD_CcSetNode().
1948*//***************************************************************************/
1949t_Error FM_PCD_CcNodeModifyMissNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);
1950
1951/**************************************************************************//**
1952 @Function      FM_PCD_CcNodeRemoveKey
1953
1954 @Description   Remove the key (include Next Engine Parameters of this key) defined by the index of the relevant node .
1955
1956 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1957 @Param[in]     h_CcNode                    A handle to the node
1958 @Param[in]     keyIndex                    Key index for removing
1959
1960 @Return        E_OK on success; Error code otherwise.
1961
1962 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
1963                the node that points to this node
1964*//***************************************************************************/
1965t_Error FM_PCD_CcNodeRemoveKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex);
1966
1967/**************************************************************************//**
1968 @Function      FM_PCD_CcNodeAddKey
1969
1970 @Description   Add the key(include Next Engine Parameters of this key)in the index defined by the keyIndex .
1971
1972 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1973 @Param[in]     h_CcNode                    A handle to the node
1974 @Param[in]     keyIndex                    Key index for adding
1975 @Param[in]     keySize                     Key size of added key
1976 @Param[in]     p_KeyParams                 A pointer to the parameters includes new key with Next Engine Parameters
1977
1978 @Return        E_OK on success; Error code otherwise.
1979
1980 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
1981                the node that points to this node
1982*//***************************************************************************/
1983t_Error FM_PCD_CcNodeAddKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, t_FmPcdCcKeyParams  *p_KeyParams);
1984
1985/**************************************************************************//**
1986 @Function      FM_PCD_CcNodeModifyKeyAndNextEngine
1987
1988 @Description   Modify the key and Next Engine Parameters of this key in the index defined by the keyIndex .
1989
1990 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
1991 @Param[in]     h_CcNode                    A handle to the node
1992 @Param[in]     keyIndex                    Key index for adding
1993 @Param[in]     keySize                     Key size of added key
1994 @Param[in]     p_KeyParams                 A pointer to the parameters includes modified key and modified Next Engine Parameters
1995
1996 @Return        E_OK on success; Error code otherwise.
1997
1998 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
1999                the node that points to this node
2000*//***************************************************************************/
2001t_Error FM_PCD_CcNodeModifyKeyAndNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, t_FmPcdCcKeyParams  *p_KeyParams);
2002
2003/**************************************************************************//**
2004 @Function      FM_PCD_CcNodeModifyKey
2005
2006 @Description   Modify the key  in the index defined by the keyIndex .
2007
2008 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
2009 @Param[in]     h_CcNode                    A handle to the node
2010 @Param[in]     keyIndex                    Key index for adding
2011 @Param[in]     keySize                     Key size of added key
2012 @Param[in]     p_Key                       A pointer to the new key
2013 @Param[in]     p_Mask                      A pointer to the new mask if relevant, otherwise pointer to NULL
2014
2015 @Return        E_OK on success; Error code otherwise.
2016
2017 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
2018                the node that points to this node
2019*//***************************************************************************/
2020t_Error FM_PCD_CcNodeModifyKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, uint8_t  *p_Key, uint8_t *p_Mask);
2021
2022/**************************************************************************//**
2023 @Function      FM_PCD_CcNodeGetKeyCounter
2024
2025 @Description   This routine may be used to get a counter of specific key in a CC
2026                Node; This counter reflects how many frames passed that were matched
2027                this key.
2028
2029 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
2030 @Param[in]     h_CcNode                    A handle to the node
2031 @Param[in]     keyIndex                    Key index for adding
2032
2033 @Return        The specific key counter.
2034
2035 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
2036                the node that points to this node
2037*//***************************************************************************/
2038uint32_t FM_PCD_CcNodeGetKeyCounter(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex);
2039
2040/**************************************************************************//**
2041 @Function      FM_PCD_PlcrSetProfile
2042
2043 @Description   Sets a profile entry in the policer profile table.
2044                The routine overrides any existing value.
2045
2046 @Param[in]     h_FmPcd           A handle to an FM PCD Module.
2047 @Param[in]     p_Profile         A structure of parameters for defining a
2048                                  policer profile entry.
2049
2050 @Return        A handle to the initialized object on success; NULL code otherwise.
2051
2052 @Cautions      Allowed only following FM_PCD_Init().
2053*//***************************************************************************/
2054t_Handle FM_PCD_PlcrSetProfile(t_Handle                  h_FmPcd,
2055                               t_FmPcdPlcrProfileParams  *p_Profile);
2056
2057/**************************************************************************//**
2058 @Function      FM_PCD_PlcrDeleteProfile
2059
2060 @Description   Delete a profile entry in the policer profile table.
2061                The routine set entry to invalid.
2062
2063 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
2064 @Param[in]     h_Profile       A handle to the profile.
2065
2066 @Return        E_OK on success; Error code otherwise.
2067
2068 @Cautions      Allowed only following FM_PCD_Init().
2069*//***************************************************************************/
2070t_Error FM_PCD_PlcrDeleteProfile(t_Handle h_FmPcd, t_Handle h_Profile);
2071
2072/**************************************************************************//**
2073 @Function      FM_PCD_PlcrGetProfileCounter
2074
2075 @Description   Sets an entry in the classification plan.
2076                The routine overrides any existing value.
2077
2078 @Param[in]     h_FmPcd             A handle to an FM PCD Module.
2079 @Param[in]     h_Profile       A handle to the profile.
2080 @Param[in]     counter             Counter selector.
2081
2082 @Return        specific counter value.
2083
2084 @Cautions      Allowed only following FM_PCD_Init().
2085*//***************************************************************************/
2086uint32_t FM_PCD_PlcrGetProfileCounter(t_Handle h_FmPcd, t_Handle h_Profile, e_FmPcdPlcrProfileCounters counter);
2087
2088/**************************************************************************//**
2089 @Function      FM_PCD_PlcrSetProfileCounter
2090
2091 @Description   Sets an entry in the classification plan.
2092                The routine overrides any existing value.
2093
2094 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
2095 @Param[in]     h_Profile       A handle to the profile.
2096 @Param[in]     counter         Counter selector.
2097 @Param[in]     value           value to set counter with.
2098
2099 @Return        E_OK on success; Error code otherwise.
2100
2101 @Cautions      Allowed only following FM_PCD_Init().
2102*//***************************************************************************/
2103t_Error FM_PCD_PlcrSetProfileCounter(t_Handle h_FmPcd, t_Handle h_Profile, e_FmPcdPlcrProfileCounters counter, uint32_t value);
2104
2105#if defined(FM_CAPWAP_SUPPORT)
2106/**************************************************************************//**
2107 @Function      FM_PCD_ManipSetNode
2108
2109 @Description   This routine should be called for defining a manipulation
2110                node. A manipulation node must be defined before the CC node
2111                that precedes it.
2112
2113 @Param[in]     h_FmPcd             FM PCD module descriptor.
2114 @Param[in]     p_FmPcdManipParams  A structure of parameters defining the manipulation
2115
2116 @Return        A handle to the initialized object on success; NULL code otherwise.
2117
2118 @Cautions      Allowed only following FM_PCD_Init().
2119*//***************************************************************************/
2120t_Handle FM_PCD_ManipSetNode(t_Handle h_FmPcd, t_FmPcdManipParams *p_FmPcdManipParams);
2121
2122/**************************************************************************//**
2123 @Function      FM_PCD_ManipDeleteNode
2124
2125 @Description   Delete an existing manip node.
2126
2127 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
2128 @Param[in]     h_HdrManipNode  A handle to a Manip node.
2129
2130 @Cautions      Allowed only following FM_PCD_Init().
2131*//***************************************************************************/
2132t_Error  FM_PCD_ManipDeleteNode(t_Handle h_FmPcd, t_Handle h_HdrManipNode);
2133#endif /* defined(FM_CAPWAP_SUPPORT) || ... */
2134
2135
2136#ifdef FM_CAPWAP_SUPPORT
2137/**************************************************************************//**
2138 @Function      FM_PCD_StatisticsSetNode
2139
2140 @Description   This routine should be called for defining a statistics
2141                node.
2142
2143 @Param[in]     h_FmPcd             FM PCD module descriptor.
2144 @Param[in]     p_FmPcdstatsParams  A structure of parameters defining the statistics
2145
2146 @Return        A handle to the initialized object on success; NULL code otherwise.
2147
2148 @Cautions      Allowed only following FM_PCD_Init().
2149*//***************************************************************************/
2150t_Handle FM_PCD_StatisticsSetNode(t_Handle h_FmPcd, t_FmPcdStatsParams *p_FmPcdstatsParams);
2151#endif /* FM_CAPWAP_SUPPORT */
2152
2153/** @} */ /* end of FM_PCD_Runtime_tree_buildgrp group */
2154/** @} */ /* end of FM_PCD_Runtime_grp group */
2155/** @} */ /* end of FM_PCD_grp group */
2156/** @} */ /* end of FM_grp group */
2157
2158
2159
2160#endif /* __FM_PCD_EXT */
2161