]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/pa-lld.git/blob - pa.h
Egress Flow and PA 1.3 features merge
[keystone-rtos/pa-lld.git] / pa.h
1 #ifndef _PA_H
2 #define _PA_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 /* System level header files */
9 #include <stdint.h>
10 #include <stdlib.h>
12 #include <ti/drv/pa/paver.h>
14 /* ============================================================= */
15 /**
16  *   @file  pa.h
17  *
18  *   path  ti/drv/pa/pa.h
19  *
20  *   @brief  Packet Accelerator (PA) sub-system LLD API and Data Definitions
21  *
22  *  ============================================================================
23  *  Copyright (c) Texas Instruments Incorporated 2009-2013
24  * 
25  *  Redistribution and use in source and binary forms, with or without 
26  *  modification, are permitted provided that the following conditions 
27  *  are met:
28  *
29  *    Redistributions of source code must retain the above copyright 
30  *    notice, this list of conditions and the following disclaimer.
31  *
32  *    Redistributions in binary form must reproduce the above copyright
33  *    notice, this list of conditions and the following disclaimer in the 
34  *    documentation and/or other materials provided with the   
35  *    distribution.
36  *
37  *    Neither the name of Texas Instruments Incorporated nor the names of
38  *    its contributors may be used to endorse or promote products derived
39  *    from this software without specific prior written permission.
40  *
41  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
42  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
43  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
44  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
45  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
46  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
47  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
50  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
51  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52  *
53 */
54  
55 /**  @mainpage Packet Accelerator Low Level Driver
56  *
57  *   \image html doxydoc.wmf
58  *
59  *   @section intro  Introduction
60  *
61  *   The packet accelerator sub-system (PASS) is designed to provide the input packet classification, checksum/CRC 
62  *   verification and generation, data manipulation and etc. The PASS consists of the following resources
63  *      - Six PDSPs for packet and command processing
64  *      - Three 64-entry LUT1 (connected to PDSP0, PDSP1 and PDSP2) for Layer 2/3 or custom LUT1 lookup
65  *      - One 8192-entry LUT2 (connected to PDSP3) for Layer 4/5 or custom LUT2 lookup
66  *      - Six programmable CRC engines (connected to each PDSP respectively) for CRC computation and verification
67  *      - Six 16-bit general purpose timers
68  *
69  *   The packet accelerator low level driver (PA LLD) provides configuration and control of the packet accelerator
70  *   sub-system (PASS). The sub-system provides from network packet classification and routing based on  
71  *   network header information (see @ref netlayers). The packet accelerator low level driver module 
72  *   (referred to as the module) provides APIs to configure the criteria used for from-network packet
73  *   routing.
74  *
75  *   The module attempts to abstract the operation of the PASS from the application. The module uses the following rules 
76  *   when configuring the PASS:
77  *      - All received packets from Ethernet and/or SRIO are routed to PDSP0
78  *      - PDSP0 does L0-L2 (MAC/SRIO) lookup using LUT1-0. If the packet is IP, it is forwarded to PDSP1
79  *      - PDSP1 does the outer IP or Custom LUT1 lookup using LUT1-1
80  *      - PDSP2 does any subsequent IP or Custom LUT1 lookup using LUT1-2
81  *      - PDSP3 does all TCP/UDP and Custom LUT2 lookup using LUT2
82  *      - PDSP4 is used for post-lookup processes such as checksum/CRC result verification.
83  *      - PDSP4/5 can be used for pre-transmission operation such as transmit checksum generation.
84  *
85  *   With the exception of some initial setup functions, the module does not communicate directly with
86  *   the sub-system. The output of the module is a formatted data block along with a destination address.
87  *   The module user must send the formatted data to the sub-system. This is typically done by linking the
88  *   created data block to a host packet descriptor, and then using the addressing information to send
89  *   the created packet to the sub-system through the queue manager and PKTDMA.
90  *
91  *   For packets to the network, the sub-system provides ones complement checksum or CRC generation over
92  *   a range provided by the module user. The range is not determined by sub-system by parsing the
93  *   to-network packet, since it is assumed that the creator of the packet already has the start offset,
94  *   length, initial checksum value and etc.
95  *
96  *   The low level driver maintains two tables of layer 2 and layer 3 configuration information. The memory 
97  *   for these tables is provided by the module user at run time. The module maintains ownership of these 
98  *   tables and the module user must not write to the memory once provided to the module.
99  *
100  *   In multi-core devices the module can be used in two different configurations. In independent core
101  *   mode each core in a device has a unique set of tables. Although it is legal for any core to
102  *   reference handles from other cores, this is not typically done. In this case cache coherency and
103  *   cross core semaphores are not implemented by the module user. In common core mode there is only
104  *   one set of tables and they are shared by all cores. Each core that uses the module must initialize
105  *   it, but each core will provide the exact same buffers to the module. The module user will have
106  *   the first core to initialize the module also initialize the table. Other cores will initialize their
107  *   internal state but not initalize the table. In this mode @ref cache coherency and cross core @ref semaphores
108  *   must be implemented by the module user to insure the integrity of the tables.
109  */
110  
111 /* Define PALLD Module as a master group in Doxygen format and add all PA LLD API 
112    definitions to this group. */
113 /** @defgroup palld_module PA LLD Module API
114  *  @{
115  */
116 /** @} */
117    
118 /** @defgroup palld_api_functions PA LLD Functions
119  *  @ingroup palld_module
120  */
121  
122 /** @defgroup palld_api_macros PA LLD Macros
123  *  @ingroup palld_module
124  */
126 /** @defgroup palld_api_structures PA LLD Data Structures
127  *  @ingroup palld_module
128  */
130 /** @defgroup palld_api_constants PA LLD Constants (enum's and define's)
131  *  @ingroup palld_module
132  */
133  
134 /**
135  *  @def  pa_PARAMS_NOT_SPECIFIED
136  *        Used for unspecified classification parameters
137  */
138 #define pa_PARAMS_NOT_SPECIFIED                      0xFFFF
140 /**
141  *  @def  pa_LUT_INST_NOT_SPECIFIED
142  *        Used if LUT1(or LUT2) instance is not specified
143  *        In the case, the PA LLD will decide which LUT instance to use based on the API type and the previous link information 
144  */
145 #define pa_LUT_INST_NOT_SPECIFIED                    -1
147 /**
148  *  @def  pa_LUT1_INDEX_NOT_SPECIFIED
149  *        Used if LUT1 index is not specified
150  *        In the case, the PASS will use the first available entry 
151  */
152 #define pa_LUT1_INDEX_NOT_SPECIFIED                  -1
154 /**
155  *  @def  pa_MAX_NUM_LUT1_ENTRIES
156  *        The maximum number of LUT1 entries
157  *         
158  */
159 #define pa_MAX_NUM_LUT1_ENTRIES                      256
161 /**
162  *  @defgroup  ReturnValues  Function Return Values
163  *  @ingroup palld_api_constants
164  *  @{
165  *
166  *  @name PALLD Function Return Codes
167  *
168  *  Error codes returned by PALLD API functions.
169  */
170 /*@{*/
171 /**
172  *  @def  pa_OK
173  *        PA return code -- Function executed successfully
174  */
175 #define pa_OK                                    0
177 /**
178  *  @def  pa_ERR_CONFIG
179  *        Invalid configuration provided to PA
180  */
181 #define pa_ERR_CONFIG                          -10
183 /**
184  *   @def pa_INSUFFICIENT_CMD_BUFFER_SIZE
185  *        The provided buffer was too small to hold the command
186  */
187 #define pa_INSUFFICIENT_CMD_BUFFER_SIZE        -11
189 /**
190  *  @def pa_INVALID_CMD_REPLY_DEST
191  *       An invalid destination was provided for command replies
192  */
193 #define pa_INVALID_CMD_REPLY_DEST              -12
195 /**
196  *   @def  pa_DUP_ENTRY
197  *         A duplicate active entry was found in the L2/L3 table.
198  *         If the module user intends to replace the associate routing 
199  *         information for the same entry, command packet should be
200  *         delivered to the PASS via the PKTDMA sub-system     
201  *         Otherwise, module user may decide to drop the command packet and 
202  *         free the buffer.
203  */ 
204 #define pa_DUP_ENTRY                           -13
206 /**
207  *   @def  pa_INVALID_DUP_ENTRY
208  *         A duplicate pending entry was found in the handle table
209  *         This entry can not be handled until the pending entry
210  *         becomes active
211  */ 
212 #define pa_INVALID_DUP_ENTRY                   -14
214 /**
215  *   @def  pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT
216  *         A more specific entry was found in the handle table
217  */
218 #define pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT   -15
220 /**
221  *   @def  pa_INVALID_MPLS_LABEL
222  *         An MPLS label exceeded 20 bits
223  */
224 #define pa_INVALID_MPLS_LABEL                  -16
226 /**
227  *   @def  pa_HANDLE_TABLE_FULL
228  *         No room for an entry in the L2 table
229  */
230 #define pa_HANDLE_TABLE_FULL                   -17
232 /**
233  *   @def  pa_INVALID_INPUT_HANDLE
234  *         Invalid handle provided
235  */
236 #define pa_INVALID_INPUT_HANDLE                -18
238 /**
239  *   @def  pa_HANDLE_INACTIVE
240  *         Operation requested on an inactive handle
241  */
242 #define pa_HANDLE_INACTIVE                     -19
243  
244 /**
245  *   @def  pa_INVALID_IP_FLOW
246  *         A flow label exceeded 20 bits
247  */ 
248 #define  pa_INVALID_IP_FLOW                    -20
250 /**
251  *   @def  pa_WARN_ACTIVE_HANDLE_ACKED
252  *         Sub-system reported activation of a handle already marked active
253  */
254 #define pa_WARN_ACTIVE_HANDLE_ACKED            -21
256 /**
257  *   @def  pa_LUT_ENTRY_FAILED
258  *         Sub-system could not make an entry to the LUT1 table
259  */
260 #define pa_LUT_ENTRY_FAILED                    -22
263 /**
264  *   @def  pa_RESUBMIT_COMMAND
265  *         Sub-system could not handle the command due to memory. Command must be resubmitted
266  */
267 #define pa_RESUBMIT_COMMAND                    -23
269 /**
270  *   @def  pa_SYSTEM_STATE_INVALID
271  *         Tried to download an image to a running PDSP
272  */
273 #define pa_SYSTEM_STATE_INVALID                -24
275 /**
276  *   @def  pa_INVALID_LUT1_INDEX
277  *         LUT1 index exceeds the LUT1 table range
278  */
279 #define pa_INVALID_LUT1_INDEX                  -25
281 /**
282  *   @def  pa_WARN_LNK_CNT_UNSYNC
283  *         Warning: Link counter out of sync
284  */
285 #define pa_WARN_LNK_CNT_UNSYNC                 -26
287 /**
288  *   @def pa_CMDSET_TOO_BIG
289  *        The total length of commads in the command set exceeds the limit
290  */
291 #define pa_CMDSET_TOO_BIG                      -27
293 /**
294  *   @def  pa_INVALID_LUT_INST
295  *         The specified LUT1 or LUT2 instance does not exist
296  */
297 #define pa_INVALID_LUT_INST                    -28
299 /** 
300   *  @def pa_RESOURCE_INIT_DENIED
301   *       The resource initialization permission denied 
302   */
303 #define pa_RESOURCE_INIT_DENIED                -29
305 /** 
306   *  @def pa_RESOURCE_USE_DENIED
307   *       The resource usage permission denied 
308   */
309 #define pa_RESOURCE_USE_DENIED                 -30
311 /** 
312   *  @def pa_FIRMWARE_REVISION_DIFFERENCE
313   *       The firmware revision difference 
314   */
315 #define pa_FIRMWARE_REVISION_DIFFERENCE        -31
317 /** 
318   *  @def pa_VIRTUAL_LINK_TABLE_FULL
319   *       Virtual link table is full 
320   */
321 #define pa_VIRTUAL_LINK_TABLE_FULL              -32
322 /**
323  *   @def  pa_INVALID_DUP_ACL_ENTRY
324  *         A duplicate ACL entry is found in the ACL table
325  *         The ACL entry should be deleted before the same 
326  *         entry with updated action can be added.  
327  *         
328  */ 
329 #define pa_INVALID_DUP_ACL_ENTRY               -33
331 /**
332  *   @def  pa_INVALID_ACL_ACTION
333  *         The specified ACL action is not supported
334  */
335 #define pa_INVALID_ACL_ACTION                  -34
337 /**
338  *   @def  pa_INVALID_EF_REC_INDEX
339  *         The index of Egress Flow record is out of range 
340  */
341 #define pa_INVALID_EF_REC_INDEX                -35
344 /**
345  *   @def  pa_EF_REC_CONFIG_ERR
346  *         Egress Flow record update is rejected by PASS 
347  */
348 #define pa_EF_REC_CONFIG_ERR                   -36
351 /*@}*/
352 /** @} */
355 /**
356  *  @defgroup  cmdMinBufSize Command buffer minimum size requirements
357  *  @ingroup palld_api_constants
358  *  @{
359  *
360  *  @name Command buffer minimum sizes
361  *
362  *  Define command buffer minimum size requirements.
363  */
364 /* @{ */
366 /**
367  *  @def  pa_ADD_LUT1_MIN_CMD_BUF_SIZE_BYTES
368  *        The minimum command buffer size required when using the @ref Pa_addSrio and @ref Pa_addCustomLUT1 function
369  */
370 #define pa_ADD_LUT1_MIN_CMD_BUF_SIZE_BYTES          124
372 /**
373  *  @def  pa_ADD_MAC_MIN_CMD_BUF_SIZE_BYTES
374  *        The minimum command buffer size required when using the @ref Pa_addMac and @ref Pa_addMac2 function
375  */
376 #define pa_ADD_MAC_MIN_CMD_BUF_SIZE_BYTES           pa_ADD_LUT1_MIN_CMD_BUF_SIZE_BYTES
378 /**
379  *  @def  pa_DEL_HANDLE_MIN_CMD_BUF_SIZE_BYTES
380  *        The minimum command buffer size required when using the @ref Pa_delHandle function
381  */
382 #define pa_DEL_HANDLE_MIN_CMD_BUF_SIZE_BYTES        20
384 /**
385  *  @def  pa_DEL_L4_HANDLE_MIN_CMD_BUF_SIZE_BYTES
386  *        The minimum command buffer size required when using the @ref Pa_delL4Handle function
387  */
388 #define pa_DEL_L4_HANDLE_MIN_CMD_BUF_SIZE_BYTES     28
390 /**
391  *  @def  pa_ADD_IP_MIN_CMD_BUF_SIZE_BYTES
392  *        The minimum command buffer size required when using the @ref Pa_addIp and @ref Pa_addIp2 functions
393  */
394 #define pa_ADD_IP_MIN_CMD_BUF_SIZE_BYTES            240 
396 /**
397  *  @def  pa_ADD_LUT2_MIN_CMD_BUF_SIZE_BYTES
398  *        The minimum command buffer size required when using the @ref Pa_addCustomLUT2 function
399  */
400 #define pa_ADD_LUT2_MIN_CMD_BUF_SIZE_BYTES          48
402 /**
403  *  @def  pa_ADD_PORT_MIN_CMD_BUF_SIZE_BYTES
404  *        The minimum command buffer size required when using the @ref Pa_addPort function
405  */
406 #define pa_ADD_PORT_MIN_CMD_BUF_SIZE_BYTES          pa_ADD_LUT2_MIN_CMD_BUF_SIZE_BYTES
408 /**
409  *  @def  pa_CONFIG_EXCEPTION_ROUTE_MIN_CMD_BUF_SIZE_BYTES
410  *        The minimum command buffer size required when using the @ref Pa_configExceptionRoute function
411  */
412 #define pa_CONFIG_EXCEPTION_ROUTE_MIN_CMD_BUF_SIZE_BYTES   520
414 /**
415  *  @def  pa_CONFIG_CRC_ENGINE_MIN_CMD_BUF_SIZE_BYTES
416  *        The minimum command buffer size required when using the @ref Pa_configCrcEngine function
417  */
418 #define pa_CONFIG_CRC_ENGINE_MIN_CMD_BUF_SIZE_BYTES  88
420 /**
421  *  @def  pa_CONFIG_MULTI_ROUTE_MIN_CMD_BUF_SIZE_BYTES
422  *        The minimum command buffer size required when using the @ref Pa_configMultiRoute function
423  */
424 #define pa_CONFIG_MULTI_ROUTE_MIN_CMD_BUF_SIZE_BYTES 84
426 /**
427  *  @def  pa_SET_CUSTOM_LUT1_MIN_CMD_BUF_SIZE_BYTES
428  *        The minimum command buffer size required when using the @ref Pa_setCustomLUT1 function
429  */
430 #define pa_SET_CUSTOM_LUT1_MIN_CMD_BUF_SIZE_BYTES    60
432 /**
433  *  @def  pa_SET_CUSTOM_LUT2_MIN_CMD_BUF_SIZE_BYTES
434  *        The minimum command buffer size required when using the @ref Pa_setCustomLUT2 function
435  */
436 #define pa_SET_CUSTOM_LUT2_MIN_CMD_BUF_SIZE_BYTES    36
438 /**
439  *  @def  pa_CONFIG_CMD_SET_MIN_CMD_BUF_SIZE_BYTES
440  *        The minmium command buffer size allowed when using the @ref Pa_configCmdSet and @ref Pa_formatTxCmd function
441  */
442 #define pa_CONFIG_CMD_SET_MIN_CMD_BUF_SIZE_BYTES     144
444 /**
445  *  @def  pa_REQUEST_STATS_MIN_CMD_BUF_SIZE_BYTES
446  *        The minimum command buffer size required when using the @ref Pa_requestStats and @ref Pa_requestUsrStats functions
447  */
448 #define pa_REQUEST_STATS_MIN_CMD_BUF_SIZE_BYTES      24
450 /**
451  *  @def  pa_CONFIG_USR_STATS_MIN_CMD_BUF_SIZE_BYTES
452  *        The minmium command buffer size allowed when using the @ref Pa_configUsrStats function with the maximum number of 
453  *        user-defined statistics. The size of command packet is calculated as 20 + (number of statistic entries) * 4. 
454  */
455 #define pa_CONFIG_USR_STATS_MIN_CMD_BUF_SIZE_BYTES   2068
457 /**
458  *  @def  pa_GLOBAL_CONFIG_MIN_CMD_BUF_SIZE_BYTES
459  *        The minmium command buffer size allowed when using the @ref Pa_control (pa_CONTROL_SYS_CONFIG) function to perform PASS 
460  *        global configuration.
461  */
462 #define pa_GLOBAL_CONFIG_MIN_CMD_BUF_SIZE_BYTES      72
464 /**
465  *  @def  pa_802_1ag_DET_MIN_CMD_BUF_SIZE_BYTES
466  *        The minmium command buffer size allowed when using the @ref Pa_control (pa_CONTROL_802_1ag_CONFIG) function to configure 
467  *        the 802.1ag packet detector.
468  */
469 #define pa_802_1ag_DET_MIN_CMD_BUF_SIZE_BYTES        24
471 /**
472  *  @def  pa_IPSEC_NAT_T_DET_MIN_CMD_BUF_SIZE_BYTES
473  *        The minmium command buffer size allowed when using the @ref Pa_control (pa_CONTROL_IPSEC_NAT_T_CONFIG) function to configure 
474  *        the IPSEC NAT-T packet detector.
475  */
476 #define pa_IPSEC_NAT_T_DET_MIN_CMD_BUF_SIZE_BYTES    24
478 /**
479  *  @def  pa_GTPU_CONFIG_MIN_CMD_BUF_SIZE_BYTES
480  *        The minmium command buffer size allowed when using the @ref Pa_control (pa_CONTROL_GTPU_CONFIG) function to configure 
481  *        the GTUP classification operation.
482  */
483 #define pa_GTPU_CONFIG_MIN_CMD_BUF_SIZE_BYTES        24
485 /**
486  *  @def  pa_MAX_CMD_BUF_SIZE_BYTES
487  *        The maximum command buffer size requested when using any PA API call which generates command packet.
488  */
489 #define pa_MAX_CMD_BUF_SIZE_BYTES                    2068
491 /* @} */  
492 /** @} */
495 /**
496  * @ingroup palld_api_structures
497  * @brief MAC address specification
498  *
499  * @details  This type is used to pass MAC addresses (see @ref netlayers) to the module. The most significant byte
500  *           of the mac address is placed in array element 0.
501  */
502 #define pa_MAC_ADDR_SIZE       6 
503 typedef unsigned char paMacAddr_t[pa_MAC_ADDR_SIZE];
505 /**
506  * @ingroup palld_api_structures
507  * @brief  IPv4 address specification
508  *
509  * @details  This type is used to pass IPv4 addresses (see @ref netlayers) to the module. The most significant byte
510  *           of the IP address is placed in array element 0.
511  */
512 #define pa_IPV4_ADDR_SIZE      4
513 typedef unsigned char paIpv4Addr_t[pa_IPV4_ADDR_SIZE];
515 /**
516  * @ingroup palld_api_structures
517  * @brief  IPv6 address specificiation
518  *
519  * @details  This type is used to pass IPv6 addresses (see @ref netlayers) to the module. The most significant byte
520  *           of the IP address is placed in array element 0.
521  */
522 #define pa_IPV6_ADDR_SIZE      16 
523 typedef unsigned char paIpv6Addr_t[pa_IPV6_ADDR_SIZE];
525 /**
526  * @ingroup palld_api_structures
527  * @brief  IP address specification
528  *
529  * @details  This union is used to specify an IP address to the module. The type in the union is determined
530  *           through other parameters passed to the module (see @ref IpValues).
531  */
532 typedef union  {
534   paIpv6Addr_t  ipv6;   /**< IPv6 address */
535   paIpv4Addr_t  ipv4;   /**< IPv4 address */
536   
537 } paIpAddr_t;
539 /**
540  *  @defgroup  IpValues IP types
541  *  @ingroup palld_api_constants
542  *  @{
543  *
544  *  @name   IP Values
545  *  @brief  Defines the IP version type used.
546  *
547  *  @details The packet accelerator module parses both IPv4 and IPv6 network layer headers (see @ref netlayers). 
548  *           This group is used to distinguish which type of header will be used.
549  */
550 /* @{ */
551 /**
552  *  @def  pa_IPV4
553  *        IPv4
554  */
555 #define  pa_IPV4  4
557 /**
558  *  @def   pa_IPV6
559  *        IPv6
560  */
561 #define  pa_IPV6  6
562   
563 /*  @}  */  
564 /** @} */
567 /**
568  * @ingroup palld_api_structures
569  * @brief Specification of Pa_Handle 
570  *
571  * The Pa_Handle is used to identify a PA LLD instance
572  */
573 typedef void*  Pa_Handle;
575 /**
576  * @ingroup palld_api_structures
577  * @brief  PA handle specification for L2 and L3 (LUT1) handles
578  *
579  * @details  This type is used to reference L2 and L3 (LUT1) routing information (see @ref netlayers). The module
580  *           user is responsible for storing the handle and using it to refer to routing information already
581  *           created through calls to @ref Pa_addMac, @ref Pa_addSrio, @ref Pa_addCustomLUT1 and @ref Pa_addIp.
582  */
583 typedef void*  paHandleL2L3_t;
585 /**
586  * @ingroup palld_api_structures
587  * @brief  PA link handle specification for L2, L3 (LUT1) and virtual link handles
588  *
589  * @details  This type is used to reference L2, L3 (LUT1) and virtual link information. The module
590  *           user is responsible for storing the handle and using it to refer to L2/L3/Virtual link handle already
591  *           created through calls to @ref Pa_addMac, @ref Pa_addSrio, @ref Pa_addCustomLUT1, @ref Pa_addIp and
592  *           @ref Pa_addVirtualLink
593  */
594 typedef void* paLnkHandle_t;
596 /**
597  * @ingroup palld_api_structures
598  * @brief  PA handle specification for ACL (LUT1) handles
599  *
600  * @details  This type is used to reference ACL (LUT1) entry with the ACL table. The module
601  *           user is responsible for storing the handle and using it to refer to ACL entry already
602  *           created through calls to @ref Pa_addAcl.
603  */
604 typedef void*  paHandleAcl_t;
606 /**
607  * @ingroup palld_api_structures
608  * @brief  PA handle specification for Flow Cache (LUT1) handles
609  *
610  * @details  This type is used to reference Flow Cache (LUT1) entry with the Flow Cache (FC) table. The module
611  *           user is responsible for storing the handle and using it to refer to Flow Cache entry already
612  *           created through calls to @ref Pa_addFc.
613  */
614 typedef void*  paHandleFc_t;
616 /**
617  * @brief The un-linked inner IP handle
618  *
619  * @details This handle value is used to specify an inner IP (tunnel) which the application does not
620  *          want to link to an outer IP address.
621  */
622 #define PA_LLD_HANDLE_IP_INNER  ((paHandleL2L3_t)1)
624 /**
625  *  @ingroup palld_api_structures
626  *  @brief  PA handle specification for L4 (LUT2) handles
627  *
628  *  @details  This type is used to reference L4 (LUT2) routing information (see @ref netlayers). The module user
629  *            is responsible for storing the handle. It is used again only to delete a created route.
630  *            
631  */
632 typedef uint32_t paHandleL4_t[3];
635 /**
636  *  @ingroup palld_api_structures
637  *  @brief A generic entry handle types
638  *
639  *  @details  The union of both entry handle types used by the module is used only in function @ref Pa_forwardResult.
640  *            The function will return the corresponding entry type and its handle in the command response packets when a LUT1
641  *            or LUT2 entry is added into the LUT1/LUT2 table successfully.
642  *            The handle entry will be set to zero in all other cases 
643  */
644 typedef union  {
646   paHandleL2L3_t  l2l3Handle;  /**<  Level 2 or level 3 handle created by @ref Pa_addMac @ref Pa_addSrio, @ref Pa_addCustomLUT1 or @ref Pa_addIp */
647   paHandleAcl_t   aclHandle;   /**<  ACL handle created by @ref Pa_addAcl */
648   paHandleFc_t    fclHandle;   /**<  Flow Cache handle created by @ref Pa_addFc */
649   paHandleL4_t    l4Handle;    /**<  Level 4 handle created by @ref Pa_addPort or @ref Pa_addCustomLUT2 */
651 } paEntryHandle_t;
653 /**
654  *  @ingroup salld_api_constants
655  *  @{
656  *  @brief  The number of bytes available for custom lookup
657  *
658  *  @details Custom lookup sizes are fixed by hardware
659  */
660 #define pa_NUM_BYTES_CUSTOM_LUT1  32
661 #define pa_NUM_BYTES_CUSTOM_LUT2   4
662 /** @} */
664 /**
665  *  @defgroup HandleTypes Handle Types
666  *
667  *  @ingroup palld_api_constants
668  *  @{
669  *
670  *  @name Handle Types
671  *
672  *  @brief  These values are used to describe what type of handle is referenced.
673  *
674  *  @details  These values are used only for function @ref Pa_forwardResult. The function returns with a copy
675  *            of the handle, which the module user should already have, along with the type of handle. The
676  *            module user can use this information to verify that a particular handle has been fully activated
677  *            and can be used for linking reference in calls to @ref Pa_addIp, @ref Pa_addCustomLUT1, 
678  *            @ref Pa_addCustomLUT2,  @ref Pa_addPort or @ref Pa_addAcl.
679  */
680 /*  @{  */
681 /**
682  *
683   *  @def  pa_L2_HANDLE
684   *        Level 2 (MAC/SRIO) handle
685   */
686 #define  pa_L2_HANDLE   2
688 /**
689  *  @def  pa_L3_HANDLE
690  *        Level 3 (IP, Custom LUT1) handle
691  */
692 #define  pa_L3_HANDLE   3
694 /**
695  *  @def  pa_L4_HANDLE
696  *        Level 4 (TCP/UDP/GTP-U/Custom LUT2) handle
697  */
698 #define  pa_L4_HANDLE   4
700 /**
701  *  @def  pa_ACL_HANDLE
702  *        ACL (Access Control List) handle
703  */
704 #define  pa_ACL_HANDLE  10 
706 /**
707  *  @def  pa_FC_HANDLE
708  *        FC (Flow Cache) handle
709  */
710 #define  pa_FC_HANDLE   11 
712 /**
713  *  @def  pa_INVALID_HANDLE
714  *        Invalid handle type
715  */
716 #define pa_INVALID_HANDLE   -1
718 /*  @}  */  
719 /** @} */
722 /**
723  *  @defgroup ErouteTypes Exception Route Types
724  *  @ingroup palld_api_constants
725  *  @{
726  *
727  *  @name Exception Route Types
728  *
729  *  @brief  These values are used to define exception route conditions.
730  *
731  *  @details  The exception route defines the global routing information when the exception condition such
732  *            as LUT1 lookup failure, packet parsing failure, broadcast packet detection and etc. Multiple
733  *            exception routes can be configured through @ref Pa_configExceptionRoute. All the exception
734  *            routes are disabled by default.
735  */
736 /*  @{  */
737 /**
738  *
739  *   @def  pa_EROUTE_L2L3_FAIL
740  *         packet failed to match in L2/L3 (LUT1) table
741  */
742 #define pa_EROUTE_L2L3_FAIL         0
744 /**
745  *  @def  pa_EROUTE_VLAN_MAX_DEPTH
746  *        packet exceeded maximum number of VLAN tags
747  */
748 #define pa_EROUTE_VLAN_MAX_DEPTH    1
750 /**
751  *  @def  pa_EROUTE_IP_MAX_DEPTH
752  *        packet exceeded maximum number of IP headers
753  */
754 #define pa_EROUTE_IP_MAX_DEPTH      2
756 /**
757  *  @def  pa_EROUTE_MPLS_MAX_DEPTH
758  *        packet exceeded maximum number of MPLS headers
759  */
760 #define pa_EROUTE_MPLS_MAX_DEPTH    3
762 /**
763  *  @def  pa_EROUTE_GRE_MAX_DEPTH
764  *        packet exceeded maximum number of GRE headers
765  */
766 #define pa_EROUTE_GRE_MAX_DEPTH     4
768 /**
769  *  @def pa_EROUTE_PARSE_FAIL
770  *       packet failed to parse
771  */
772 #define pa_EROUTE_PARSE_FAIL        5
774 /**
775  *  @def pa_EROUTE_L4_FAIL
776  *       packet failed to match in L4 (LUT2) table
777  */
778 #define pa_EROUTE_L4_FAIL           6
780 /**
781  *  @def pa_EROUTE_IP_FRAG
782  *       IP fragmented packet 
783  */
784 #define pa_EROUTE_IP_FRAG           7
786 /**
787  *  @def pa_EROUTE_IPV6_OPT_FAIL
788  *       Packet failed due to unsupported IPV6 option header
789  */
790 #define pa_EROUTE_IPV6_OPT_FAIL     8
792 /**
793  *  @def pa_EROUTE_UDP_LITE_FAIL
794  *       UDP lite packet had invalid checksum coverage
795  */
796 #define pa_EROUTE_UDP_LITE_FAIL     9
798 /**
799  *  @def pa_EROUTE_ROUTE_OPTION
800  *       IP routing had incomplete routes
801  */
802 #define pa_EROUTE_ROUTE_OPTION      10
804 /**
805  *  @def  pa_EROUTE_SYSTEM_FAIL
806  *        Sub-system detected internal error
807  */
808 #define pa_EROUTE_SYSTEM_FAIL       11
810 /**
811  *  @def pa_EROUTE_MAC_BROADCAST
812  *       MAC broadcast packet which is not specified at the lookup table
813  */
814 #define pa_EROUTE_MAC_BROADCAST     12
816 /**
817  *  @def pa_EROUTE_MAC_MULTICAST
818  *       MAC multicast packet which is not specified at the lookup table
819  */
820 #define pa_EROUTE_MAC_MULTICAST     13
822 /**
823  *  @def pa_EROUTE_IP_BROADCAST
824  *       IP broadcast packet which is not specified at the lookup table
825  */
826 #define pa_EROUTE_IP_BROADCAST      14
828 /**
829  *  @def pa_EROUTE_IP_MULTICAST
830  *       IP multicast packet which is not specified at the lookup table
831  */
832 #define pa_EROUTE_IP_MULTICAST      15
834 /**
835  *  @def pa_EROUTE_GTPU_MESSAGE_TYPE_1
836  *       GTP-U PING Request packet
837  */
838 #define pa_EROUTE_GTPU_MESSAGE_TYPE_1      16
840 /**
841  *  @def pa_EROUTE_GTPU_MESSAGE_TYPE_2
842  *       GTP-U PING Response packet
843  */
844 #define pa_EROUTE_GTPU_MESSAGE_TYPE_2      17
846 /**
847  *  @def pa_EROUTE_GTPU_MESSAGE_TYPE_26
848  *       GTP-U Error Indication packet
849  */
850 #define pa_EROUTE_GTPU_MESSAGE_TYPE_26     18
852 /**
853  *  @def pa_EROUTE_GTPU_MESSAGE_TYPE_31
854  *       GTP-U Supported Header Notification packet
855  */
856 #define pa_EROUTE_GTPU_MESSAGE_TYPE_31     19
858 /**
859  *  @def pa_EROUTE_GTPU_MESSAGE_TYPE_254
860  *       GTP-U End Markr packet
861  */
862 #define pa_EROUTE_GTPU_MESSAGE_TYPE_254    20
864 /**
865  *  @def pa_EROUTE_GTPU_FAIL
866  *       Packet failed due to GTPU parsing error or unsupporte dmessage types
867  */
868 #define pa_EROUTE_GTPU_FAIL                21
870 /**
871  *  @def pa_EROUTE_PPPoE_FAIL
872  *       Packet failed due to PPPoE session packet parsing error
873  */
874 #define pa_EROUTE_PPPoE_FAIL               22
876 /**
877  *  @def pa_EROUTE_PPPoE_CTRL
878  *       PPPoE session stage non-IP packets
879  */
880 #define pa_EROUTE_PPPoE_CTRL               23
882 /**
883  *  @def pa_EROUTE_802_1ag
884  *       802.1ag Packet
885  */
886 #define pa_EROUTE_802_1ag                  24
888 /**
889  *  @def pa_EROUTE_IP_FAIL
890  *       Packet failed due to invalid IP header
891  */
892 #define pa_EROUTE_IP_FAIL                  25
894 /**
895  *  @def pa_EROUTE_NAT_T_KEEPALIVE
896  *       NAT-T Keep Alive packet where UDP Length = 9, data = 0xFF
897  */
898 #define pa_EROUTE_NAT_T_KEEPALIVE          26
900 /**
901  *  @def pa_EROUTE_NAT_T_CTRL
902  *       NAT-T control packet where UDP Length > 12 and the first 4 payload bytes are equal to 0
903  */
904 #define pa_EROUTE_NAT_T_CTRL               27
906 /**
907  *  @def pa_EROUTE_NAT_T_DATA
908  *       NAT-T IPSEC ESP data packet where UDP Length > 12 and the first 4 payload bytes are not equal to 0
909  */
910 #define pa_EROUTE_NAT_T_DATA               28
912 /**
913  *  @def pa_EROUTE_NAT_T_FAIL
914  *       Invalid NAT-T packet
915  */
916 #define pa_EROUTE_NAT_T_FAIL               29
918 /**
919  *  @def pa_EROUTE_GTPU_MATCH_FAIL
920  *       GTPU match failed 
921  */
922 #define pa_EROUTE_GTPU_MATCH_FAIL               30
924 /**
925  *  @def   pa_EROUTE_MAX
926  *         The maximum number of global route types
927  */
928 #define pa_EROUTE_MAX                      31
930 /*  @}  */  
931 /** @} */
934 /**
935  *  @defgroup NextHeaderTypes Next Header types 
936  *  @ingroup palld_api_constants
937  *  @{
938  *
939  *  @name Next Header types
940  *
941  *  @brief  These values are used to define the next header (protocol) types for continus parsing after the 
942  *          SRIO and custom parsing.
943  *
944  *  @details  The next header type can be derived from the upper layer header in a standard Ethernet packet.
945  *            For SRIO and custom LUT1 lookup, the next header type should be provided by the user in function
946  *            @ref Pa_setCustomLUT1 and @ref Pa_addSrio. 
947  */
948 /*  @{  */
949 /**
950  *
951  *   @def  pa_HDR_TYPE_MAC
952  *         MAC header
953  */
954 #define pa_HDR_TYPE_MAC         0
956 /**
957  *
958  *  @def   pa_HDR_TYPE_IPV4
959  *         IPv4 header
960  */
961 #define pa_HDR_TYPE_IPV4        1
964 /**
965  *
966  *  @def   pa_HDR_TYPE_IPV6
967  *         IPv6 header
968  */
969 #define pa_HDR_TYPE_IPV6        2
971 /**
972  *
973  *  @def   pa_HDR_TYPE_CUSTOM_LUT1
974  *         Custom LUT1 header
975  */
976 #define pa_HDR_TYPE_CUSTOM_LUT1 3
978 /**
979  *
980  *  @def   pa_HDR_TYPE_UDP
981  *         UDP header
982  */
983 #define pa_HDR_TYPE_UDP         4
985 /**
986  *
987  *  @def   pa_HDR_TYPE_UDP_LITE
988  */
989 #define pa_HDR_TYPE_UDP_LITE    5
991 /**
992  *
993  *  @def   pa_HDR_TYPE_TCP
994  *         TCP header
995  */
996 #define pa_HDR_TYPE_TCP         6
998 /**
999  *
1000  *  @def   pa_HDR_TYPE_CUSTOM_LUT2
1001  *         Custom LUT2 header
1002  */
1003 #define pa_HDR_TYPE_CUSTOM_LUT2 7
1005 /**
1006  *
1007  *  @def   pa_HDR_TYPE_UNKNOWN
1008  *         next header type is not specified 
1009  */
1010 #define pa_HDR_TYPE_UNKNOWN     8
1011  
1012 /*  @}  */  
1013 /** @} */
1015 /** 
1016  * @ingroup palld_api_structures
1017  * @brief pa RM Handle
1018  */
1019 typedef void *  pa_RmHnd;
1021 /** 
1022  * @ingroup palld_api_structures
1023  * @brief PA start configuration structure
1024  */
1025 typedef struct
1027     /** Provide a handle to the Resource Manager instance */
1028     pa_RmHnd rmHandle;
1029 } paStartCfg_t;
1031 /**
1032  *  @ingroup palld_api_structures
1033  *  @brief  Pointer to the buffer where the PASS command is placed
1034  *
1035  *  @details  Functions in this module produce formatted commands that must be sent to the packet accelerator 
1036  *            sub-system. These commands are always referred to through this type.
1037  */
1038 typedef void*  paCmd_t;
1041 /**
1042  * @ingroup palld_api_structures
1043  * @brief  PA Size Configuration Structure
1044  *
1045  * @details The module is configured at run time with a maximum number of handles supported. The module
1046  *          maintains a set of handles and links between handles.
1047  */
1048 typedef struct  {
1050   int nMaxL2;   /**< Maximum number of L2 handles supported */
1051   int nMaxL3;   /**< Maximum number of L3 handles supported */
1052   int nUsrStats;/**< Maximum number of user-defined statistics supported (maximum: 512)*/
1053   int nMaxVlnk; /**< Maximum number of virtual links supported */
1054   int nMaxAcl;  /**< Maximum number of Stateless ACL handles supported */
1055   int nMaxFc;   /**< Maximum number of Flow Cache Hanndles supported */
1057 } paSizeInfo_t;
1059 /**
1060  *  @ingroup salld_api_constants
1061  *  @{
1062  *  @brief  PA Reassembly Engine related constant definitions
1063  */
1064 #define pa_RA_MAX_HEAP_REGIONS    2    /**< Maxmium number of RA Heap Regions */ 
1065 #define pa_RA_NUM_GROUPS          2    /**< Number of RA groups */
1067 /**
1068  *  @ingroup palld_api_structures
1069  *  @brief PA Reassembly  Engine global config structure
1070  *
1071  *  @details The parameters in this structure are used to configure the Reassembly
1072  *           engine with PASS
1073  */
1074 typedef struct  {
1075   int           ipv4MinPktSize;     /**< Specify the minimum packet size in bytes for a fragment of an
1076                                          Ipv4 packet that is not the last fragment. The deafult value 
1077                                          is 68 byte to contain 60 bytes of IP header including options
1078                                          plus 8-byte of payload */
1079   int           numCxts;            /**< Total number of contexts the RA handles. This value affects 
1080                                          the amount of heap memory that needs to be allocated. This 
1081                                          value must be between 0x1 and 0x400 (1k). If set to 0, all 
1082                                          fragments will be discarded. The default value is 0x400. */
1083   int           cxtDiscardThresh;   /**< Number of concurrent contexts that, once reached, causes the 
1084                                          oldest current context to be forcibly timed out.  To prevent 
1085                                          this behavior, this value should be programmed to be equal to 
1086                                          or greater than the Total Contexts. This value must be between 
1087                                          0x1 and 0x400 (1k). The default value is 0x400. */
1088   int           nodeDiscardThresh;  /**< Number of Nodes that, once reached, causes the oldest current 
1089                                          context to be forcibly timed out.  To prevent this behavior, 
1090                                          this value should be programmed to be the maximum value 
1091                                          (there are 4K total nodes). This value must be between 0x1 
1092                                          and 0x1000 (4K). The default value is 0xFFF. */
1093   int           cxtTimeout;         /**< Amount of time (in ms) after a new context has been allocated until 
1094                                          that context times out.  If timeout occurs before a packet is completely 
1095                                          reassembled and the SOP fragment has been received, a packet containing 
1096                                          the IP header and the first 8 bytes of data is forwarded up to the host 
1097                                          that it can respond with an ICPM Time Exceeded message as per RFC 792.  
1098                                          If a context times out and the SOP fragment has not been received, 
1099                                          the packet is discarded and the context freed. */ 
1100   int           clockRate;          /**< Clock rate of the Reassembly engine in MHz. */                                        
1101   int           heapRegionThresh;   /**< Number of contexts handled in Region 0 of the Reassembly Heap. All contexts 
1102                                          in excess of this number are handled in Region 1. If Region 1 is not used, 
1103                                          this value should be set equal to (or higher) than Total Contexts. */
1104   uint64_t      heapBase[pa_RA_MAX_HEAP_REGIONS];   /**< Reassembly Heap addresses which should be 64-byte aligned */                                                                                                                                                                                                                                       
1105 } paRaConfig_t;
1108 /**
1109  *  @ingroup palld_api_structures
1110  *  @brief PA Initialization config structure
1111  *
1112  *  @details The parameters in this structure are used to do initial setup
1113  *           of the driver including its base address and other default settings.
1114  *           
1115  *  @note    The stream interface switch controls the destination of the traffic
1116  *           from the Ethernet switch. The default setting of the streaming
1117  *           interface switch is to route all traffic to the host. However, 
1118  *           this module is designed to receive the incoming packets at the PDSP0.
1119  *           If the initDeafultRoute is set to TRUE, this module will re-configure
1120  *           the stream interface switch to route all traffic to PDSP0. Otherwise,
1121  *           it is the module user's reponsibility to deliver incoming packets
1122  *           to PDSP0 via the CPPI/QMSS interface.           
1123  */
1124 typedef struct  {
1125   uint16_t      initTable;          /**< If True then the L2/L3/ACL tables are initialized */
1126   uint16_t      initDefaultRoute;   /**< If True then the switch default route is set to PASS PDSP0 */
1127   uint32_t      baseAddr;           /**< Specify the PASS base address */
1128   paSizeInfo_t* sizeCfg;            /**< Pointer to the size configuration information */
1129   paRaConfig_t* raCfg;              /**< Pointer to the RA global configuration information */
1130 } paConfig_t;
1132 /**
1133  *  @ingroup salld_api_constants
1134  *  @{
1135  *  @brief  Protocol Limit related constant definitions
1136  */
1137 #define pa_PROTOCOL_LIMIT_NUM_VLANS_DEF    2    /**< Number of VLAN supported: default value */ 
1138 #define pa_PROTOCOL_LIMIT_NUM_IP_DEF       2    /**< Number of IP layers supported: default value */ 
1139 #define pa_PROTOCOL_LIMIT_NUM_GRE_DEF      2    /**< Number of GRE layers supported: default value */
1140 #define pa_PROTOCOL_LIMIT_NUM_VLANS_MAX    3    /**< Number of VLAN supported: maximum value */ 
1141 #define pa_PROTOCOL_LIMIT_NUM_IP_MAX       7    /**< Number of IP layers supported: maximum value */ 
1142 #define pa_PROTOCOL_LIMIT_NUM_GRE_MAX      7    /**< Number of GRE layers supported: maximum value */
1143 /** @} */
1145 /**
1146  *  @ingroup palld_api_structures
1147  *  @brief  Protocol-specific Limitations.
1148  *
1149  *  @details  paProtocolLimit_t is used to defines the protocol-specific restrictions. For example, 
1150  *            it is necessary to limit the number of protocol layers such as GRE of the input packets 
1151  *            to prevent the irregular packets take too much processing time. 
1152  *            The PASS will detect the packets which violate the protocol-specific restrictions and either discard 
1153  *            or forward the packets to host queues which can be specified through API @ref Pa_configExceptionRoute.
1154  * 
1155  *  @note     The PASS will work when non-default values are used. However, it may limit the supported packet rate 
1156  *            below wire rate.
1157  */
1158 typedef struct {
1160   uint8_t vlanMax; /**< Maximum number of VLANs supported, default = 2, maximum = 3 */
1161   uint8_t ipMax;   /**< Maximum number of IP layers supported, default = 2, maximum = 7 */
1162   uint8_t greMax;  /**< Maximum number of GRE layers supported, default = 2, maximum = 7 */
1164 } paProtocolLimit_t;
1166 /**
1167  *  @ingroup palld_api_structures
1168  *  @brief  IP Reassembly Configuration Information.
1169  *
1170  *  @details  paIpReassmConfig_t is used to configure the PA-assisted IP reassembly operation. Two separate structures are used 
1171  *            for the outer IP and inner IP respectively. The IP reassembly assistance feature is disabled until 
1172  *            this information is provided. See section @ref appendix3 for deatiled description. 
1173  *  @note The maximum number of traffic flows is limited due to processing time and internal memory restriction.
1174  */
1175 typedef struct {
1177   uint8_t numTrafficFlow; /**< Maximum number of IP reassembly traffic flows supported, default = 0, maximum = 32 */
1178   uint8_t destFlowId;     /**< CPPI flow which instructs how the link-buffer queues are used for forwarding packets */
1179   uint16_t destQueue;     /**< Destination host queue where PASS will deliver the packets which require IP reassembly assistance */
1181 } paIpReassmConfig_t;
1183 /**
1184  *  @ingroup palld_api_constants
1185  *  @brief   Define the maximum number of IP reassembly traffic flows 
1186  *
1187  */
1188 #define pa_MAX_IP_REASM_TRAFFIC_FLOWS   32 
1190 /**
1191  *  @ingroup palld_api_structures
1192  *  @brief  Command Set Configuration Information.
1193  *
1194  *  @details  paCmdSetConfig_t defines command set configuration parameters such as the maximum number of command sets.
1195  *            The PASS supports either 64 of 64-byte or 32 of 128-byte command sets. The number of command sets should 
1196  *            be configured at system startup. 
1197  */
1198 typedef struct {
1200   uint8_t  numCmdSets; /**<  Number of command sets supported (32, 64), default = 64
1201                              @note If the number of command sets is set to 64, then each command entry will be limited to 64 bytes.
1202                                    If the number of command sets is set to 32, then each command entry will be limited to 128 bytes */
1203 } paCmdSetConfig_t;
1205 /**
1206  *  @ingroup palld_api_structures
1207  *  @brief  User-defined Statistics Configuration Information.
1208  *
1209  *  @details  paUsrStatsConfig_t defines the configuration parameters for multi-level hierarchical user-defined statistics 
1210  *            operation such as the number of user-defined counters. There are up to 512 user-defined statistics consisting of 
1211  *            some 64-bit counters and some 32-bit counters whereas the total size of all counters cannot exceed 2048 bytes. 
1212  *            The user-defined statistics feature is disabled until this configuration is invoked through API @ref Pa_control. 
1213  *
1214  *            - 64-bit Counters index: 0 - (num64bCounters - 1)
1215  *            - 32-bit Counters index: num64bCounters - (numCounters - 1)
1216  */
1217 typedef struct {
1219   uint16_t numCounters;     /**< Total number of user-defined counters, default = 0, maximum = 512 */
1220   uint16_t num64bCounters;  /**< Number of 64-bit user-defined counters, default = 0, maximum = 256 */
1221    
1222 } paUsrStatsConfig_t;
1223  
1224 /**
1225  *  @ingroup salld_api_constants
1226  *  @brief   Define the maximum number of user-defined statistics the module supports.
1227  *
1228  */
1229 #define pa_USR_STATS_MAX_COUNTERS        512
1231 /**
1232  *  @ingroup salld_api_constants
1233  *  @brief   Define the maximum number of user-defined 64-bit statistics 
1234  *
1235  */
1236 #define pa_USR_STATS_MAX_64B_COUNTERS    (pa_USR_STATS_MAX_COUNTERS/2)
1237 /**
1238  *  @ingroup salld_api_constants
1239  *  @brief   Define the maximum number of user-defined 32-bit statistics 
1240  *
1241  */
1242 #define pa_USR_STATS_MAX_32B_COUNTERS    pa_USR_STATS_MAX_COUNTERS
1244 /**
1245  *  @ingroup palld_api_structures
1246  *  @brief  Queue Diversion Configuration Information.
1247  *
1248  *  @details  The PASS supports optional queue diversion operation per LUT2 entry replacement. 
1249  *            paQueueDivertConfigl_t contains configuration information for the atomic queue diversion operation.
1250  *            The queue diversion feature is disabled until this configuration is invoked through API @ref Pa_control. 
1251  *
1252  */
1253 typedef struct {
1255   uint16_t destQueue;     /**< Destination queue where PASS will deliver the LUT2 response packet which contains the 
1256                                queue diversion information */
1257   uint8_t  destFlowId;    /**< CPPI flow which instructs how the link-buffer queues are used for forwarding 
1258                                the LUT2 response packets */
1259 } paQueueDivertConfig_t;
1262 /**
1263  *  @defgroup pktControlInfo  PA Packet Control Bit Definitions
1264  *  @ingroup palld_api_constants
1265  *  @{
1266  *
1267  *  @name PA Packet Control Bit Definitions
1268  *
1269  *  Bitmap definition of the ctrlBitMap in @ref paPacketControlConfig_t. 
1270  *         
1271  */ 
1272 /*@{*/
1273 /**
1274  *  @def  pa_PKT_CTRL_HDR_VERIFY_PPPoE
1275  *        Control Info -- Set: Perform enhanced error check of the PPPoE header
1276  *                        Clear: Perform basic error check of the PPPoE header
1277  */
1278 #define pa_PKT_CTRL_HDR_VERIFY_PPPoE       0x0001 
1279 /**
1280  *  @def  pa_PKT_CTRL_HDR_VERIFY_IP
1281  *        Control Info -- Set: Perform enhanced error check of the IP header
1282  *                        Clear: Perform basic error check of the IP header
1283  */
1284 #define pa_PKT_CTRL_HDR_VERIFY_IP          0x0002 
1285 /**
1286  *  @def  pa_PKT_CTRL_MAC_PADDING_CHK
1287  *        Control Info -- Set: Perform MAC (802.3) padding check
1288  *                             The packet with illegal padding will be dropped  
1289  *                        Clear: Do not perform MAC (802.3) padding check
1290  */
1291 #define pa_PKT_CTRL_MAC_PADDING_CHK        0x0004 
1292 /**
1293  *  @def  pa_PKT_CTRL_IP_FRAGS_TO_EROUTE
1294  *        Control Info -- Set: Forward IP Fragments through the exception route regardless of the routing destination 
1295  *                        Clear: Forward IP Fragments through the exception route only if the routing destination is set to SASS or CONTINUE_PARSE
1296  */
1297 #define pa_PKT_CTRL_IP_FRAGS_TO_EROUTE     0x0008 
1298 /**
1299  *  @def  pa_PKT_CTRL_L3OFFSET_TO_INNER_IP
1300  *        Control Info -- Set: L3offset of the packet information points to the inner IP header prior to payload
1301  *                        Clear: L3offset of the packet information points to the outer IP header (default)
1302  */
1303 #define pa_PKT_CTRL_L3OFFSET_TO_INNER_IP  0x0010 
1304 /*@}*/
1305 /** @} */
1307 /**
1308  *  @ingroup palld_api_structures
1309  *  @brief  Packet Control Configuration Information.
1310  *
1311  *  @details  This data structure defines miscellaneous packet control information for some non-default PASS operations. 
1312  *            For example, PASS always performs basic protocol header verification to ensure that it can continue parsing the  
1313  *            current and next protocol header. The PASS will perform enhanced error check of protocol headers specified
1314  *            by this configuration. For example,
1315  *            PPPoE header in session mode:
1316  *              - Version = 1
1317  *              - Type = 1
1318  *              - Code = 0
1319  *
1320  *            IPv4 header:
1321  *              - Header length >= 20
1322  *              - Total length > 20
1323  *              - Source address is not broadcast
1324  *              - Destination address is not 0
1325  *              - TTL is not 0
1326  *
1327  *  @note refer to the @ref ErouteTypes for the corresponding exception routes.
1328  */
1329 typedef struct {
1331   uint16_t ctrlBitMap;              /**< Packet control bit as defined at @ref pktControlInfo */
1332   uint16_t rxPaddingErrStatsIndex;  /**< Specify the user statistics index of Rx padding error counter */
1333   uint16_t txPaddingStatsIndex;     /**< Specify the user statistics index of Tx MAC padding counter */
1335 } paPacketControlConfig_t;
1337 /**
1338  *  @defgroup  paAclActionTypes PA ACL action types
1339  *  @ingroup palld_api_constants
1340  *  @{
1341  *
1342  *  @name   PA ACL action types
1343  *  @brief  Define the ACL action types.
1344  *
1345  *  @details Define actions to be taken when an ACL entry is matched
1346  */
1347 /* @{ */
1348 /**
1349  *  @def  pa_ACL_ACTION_PERMIT
1350  *        Allow matched packets to be forwarded to the next stage
1351  */
1352 #define  pa_ACL_ACTION_PERMIT    0
1354 /**
1355  *  @def  pa_ACL_ACTION_DENY
1356  *        Matched packets should be dropped
1357  */
1358 #define  pa_ACL_ACTION_DENY      1
1360 /**
1361  *  @def  pa_ACL_ACTION_MARK
1362  *        Matched packets should be forwarded with a mark which may be used later by hardware or software
1363  */
1364 #define  pa_ACL_ACTION_MARK      2
1366 /**
1367  *
1368  *   @def  pa_ACL_ACTION_HOST
1369  *         The packet should be forwarded to host for further processing 
1370  *   @note This action is only applicable to default rule
1371  */
1372 #define pa_ACL_ACTION_HOST       3
1374 #define pa_ACL_ACTION_MAX        pa_ACL_ACTION_HOST
1375   
1376 /*  @}  */  
1377 /** @} */
1379 /**
1380  *  @ingroup palld_api_structures
1381  *  @brief  Stateless ACL Configuration Information.
1382  *
1383  *  @details  paAclConfig_t is used to configure the default rule of stateless ACL operation. The PASS will follow
1384  *            this rule if no matches are found at the ACL table. Two separate structures are used 
1385  *            for the outer ACL and inner ACL respectively. The default rule is set to packet FORWARDING until  
1386  *            this information is provided. 
1387  */
1388 typedef struct {
1390   int      action;      /**< Default action (Deny/Permit/Host) as sepcified at @ref paAclActionTypes */
1391   uint8_t  destFlowId;  /**< CPPI flow which instructs how the link-buffer queues are used for forwarding packets to host. 
1392                              (valid only if action = pa_ACL_ACTION_HOST) */
1393   uint16_t destQueue;   /**< Destination host queue where PASS will deliver the packets if no ACL matches found 
1394                              (valid only if action = pa_ACL_ACTION_HOST) */
1395 } paAclConfig_t;
1397 /**
1398  *  @defgroup paRACtrlInfo  PA RA Control Bit Definitions
1399  *  @ingroup palld_api_constants
1400  *  @{
1401  *
1402  *  @name PA RA Control Bit Definitions
1403  *
1404  *  Bitmap definition of the ctrlBitMap in @ref paRaGroupConfig_t. 
1405  *         
1406  */ 
1407 /*@{*/
1408 /**
1409  *  @def  pa_RA_CTRL_ENABLE
1410  *        Control Info -- Set: Enable Reassembly operation, forward all packets to RA
1411  *                        Clear: Disable Reassembly operation, bypass RA
1412  */
1413 #define pa_RA_CTRL_ENABLE           0x0001 
1414 /*@}*/
1415 /**
1416  *  @def  pa_RA_CTRL_USE_LOCAL_DMA
1417  *        Control Info -- Set: Use NetCP internal DMA to send packets from PASS to RA engine
1418  *                        Clear: Use global DMA to send packets from PASS to RA engine
1419  */
1420 #define pa_RA_CTRL_USE_LOCAL_DMA    0x0002 
1421 /**
1422  *  @def  pa_RA_CTRL_TO_QUEUE
1423  *        Control Info -- Set: Forward RA output packets to the host queue specified by the RA output CPPI flow
1424  *                        Clear: Forward RA output pakets to the next PASS classification stage
1425  *  @note: The lower 8-bit of source tag of the input CPPI flow should be set to the output CPPI flow when this set
1426  *         this bit is set and the default queue of the output CPPI flow should be set to the desired destination queue 
1427  */
1428 #define pa_RA_CTRL_TO_QUEUE         0x0004 
1429 /*@}*/
1430 /** @} */
1432 /**
1433  *  @ingroup palld_api_structures
1434  *  @brief  RA exception Route Information.
1435  *
1436  *  @details  The reassembly engine is degined to forward packets to host queue specified by user when timwout or other
1437  *            error condition occurs. paRaERouteInfo_t contains the routing information required for this operation. 
1438  */
1439 typedef struct  {
1441   int      dest;      /**<  (TBD:) Packet destination as defined at @ref pktDest */
1442   uint8_t  flowId;    /**<  Specifies CPPI flow which defines free queues are used for receiving packets */
1443   uint16_t queue;     /**<  Specifies the destination host queue */
1444 } paRaERouteInfo_t;
1446 /**
1447  *  @ingroup palld_api_structures
1448  *  @brief  PA Reassembly Engine Group Configuration Information.
1449  *
1450  *  @details  paRaGroupConfig_t is used to specify the group specific configuration parameters of the PASS 
1451  *            reassembly Engine.  Two separate structures are used for the outer IP and inner IP reassembly 
1452  *            respectively. 
1453  */
1454 typedef struct {
1455   uint16_t              ctrlBitMap;    /**< RA control info as defined at @ref paRACtrlInfo */
1456   uint8_t               flowId;        /**< Specify the RA CPPI flow which defines free queues and other paramters 
1457                                             for sending packets from PASS to RA */ 
1458   paRaERouteInfo_t      timeoutER;     /**< Specify exception route for timeout packets */
1459   paRaERouteInfo_t      critErrER;     /**< Specify exception route for packets with critical error */
1460   paRaERouteInfo_t      genErrER;      /**< Specify exception route for packets with non-critical error*/
1461 } paRaGroupConfig_t;
1463 /**
1464  * @ingroup palld_api_structures
1465  * @brief PA System Configuration Information structure
1466  *
1467  * @details paSysConfig_t contains pointers to the system-level configuration structures defined above. The null pointer 
1468  *          indicates the configuration of the corresponding sub-group is not required.
1469  */
1470 typedef struct {
1471   paProtocolLimit_t*        pProtoLimit;           /**< Pointer to the protocol limit configuration structure */
1472   paIpReassmConfig_t*       pOutIpReassmConfig;    /**< Pointer to the outer IP PASS-assisted Reassembly configuration structure */
1473   paIpReassmConfig_t*       pInIpReassmConfig;     /**< Pointer to the inner IP PASS-assisted Reassembly configuration structure */
1474   paCmdSetConfig_t*         pCmdSetConfig;         /**< Pointer to the command set configuration structure */
1475   paUsrStatsConfig_t*       pUsrStatsConfig;       /**< Pointer to the user-defined statistics configuration structure */
1476   paQueueDivertConfig_t*    pQueueDivertConfig;    /**< Pointer to the queue-diversion configuration structure */
1477   paPacketControlConfig_t*  pPktControl;           /**< Pointer to the packet control configuration structure */
1478   paAclConfig_t*            pOutAclConfig;         /**< Pointer to the outer ACL configuration structure */
1479   paAclConfig_t*            pInAclConfig;          /**< Pointer to the inner ACL configuration structure */
1480   paRaGroupConfig_t*        pOutIpRaGroupConfig;   /**< Poimter to the outer IP Reassembly group configuration structure */
1481   paRaGroupConfig_t*        pInIpRaGroupConfig;    /**< Poimter to the inner IP Reassembly group configuration structure */
1482 } paSysConfig_t;
1484 /**
1485  *  @defgroup pa802p1agDetectInfo  PA 802.1ag Detector Control Bit Definitions
1486  *  @ingroup palld_api_constants
1487  *  @{
1488  *
1489  *  @name PA 802.1ag Detector Control Bit Definitions
1490  *
1491  *  Bitmap definition of the ctrlBitMap in @ref pa802p1agDetConfig_t. 
1492  *         
1493  */ 
1494 /*@{*/
1495 /**
1496  *  @def  pa_802_1ag_DETECT_ENABLE
1497  *        Control Info -- Set: Enable 802.1ag Detector
1498  *                        Clear: Disable 802.1ag Detector
1499  */
1500 #define pa_802_1ag_DETECT_ENABLE           0x0001 
1501 /**
1502  *  @def  pa_802_1ag_DETECT_STANDARD
1503  *        Control Info -- Set: Perform 802.1ag packet detection per 802.1ag formal standard
1504  *                        Clear:  Perform 802.1ag packet detection per 802.1ag draft 
1505  */
1506 #define pa_802_1ag_DETECT_STANDARD         0x0002 
1507 /*@}*/
1508 /** @} */
1510 /**
1511  *  @ingroup palld_api_structures
1512  *  @brief   802.1ag Detection Configuration Information.
1513  *
1514  *  @details  The 802.1ag packet can be recognized with ether type equal to 0x8902 normally. However, the PASS can be 
1515  *            configured to further qualify the IEEE 802.1ag packet per one of the following criteria: 
1516  *            - 802.1ag standard: Destion MAC address = 01-80-c2-00-00-3x, Ether type = 0x8902
1517  *            - 802.1ag draft: Destion MAC address = 01-80-c2-xx-xx-xx, Ether type = 0x8902 
1518  *
1519  *  @note The 802.1ag detector is disabled by default.
1520  *  @note refer to the @ref ErouteTypes for the corresponding exception routes.
1521  * 
1522  */
1523 typedef struct {
1524   uint16_t ctrlBitMap;     /**< 802.1ag Detector control info as defined at @ref pa802p1agDetectInfo */
1525 } pa802p1agDetConfig_t;
1528 /**
1529  *  @defgroup ipsecNatTCtrlInfo  PA IPSEC NAT-T Control Bit Definitions
1530  *  @ingroup palld_api_constants
1531  *  @{
1532  *
1533  *  @name PA IPSEC NAT-T Control Bit Definitions
1534  *
1535  *  Bitmap definition of the ctrlBitMap in @ref paIpsecNatTConfig_t. 
1536  *         
1537  */ 
1538 /*@{*/
1539 /**
1540  *  @def  pa_IPSEC_NAT_T_CTRL_ENABLE
1541  *        Control Info -- Set: Enable IPSEC NAT-T packet detection
1542  *                        Clear: Disable IPSEC NAT-T packet detection
1543  */
1544 #define pa_IPSEC_NAT_T_CTRL_ENABLE           0x0001 
1545 /*@}*/
1546 /** @} */
1548 /**
1549  *  @ingroup palld_api_structures
1550  *  @brief   IPSEC NAT-T Packet Detection Configuration Information.
1551  *
1552  *  @details  paIpsecNatTConfig_t is used to configure the IPSEC NAT-T packet detector which is disabled
1553  *            until this configuration is invoked through API @ref Pa_control. 
1554  *
1555  *  @note The IPSEC NAT-T packet detector is disabled by default.
1556  *  @note refer to the @ref ErouteTypes for the corresponding exception routes.
1557  * 
1558  */
1559 typedef struct {
1561   uint16_t ctrlBitMap;     /**< IPSEC NAT-T control info as defined at @ref ipsecNatTCtrlInfo */
1562   uint16_t udpPort;        /**< Specify the UDP port number which uniquely identifies the IPSEC NAT-T packets */
1563 } paIpsecNatTConfig_t;
1565 /**
1566  *  @defgroup paGtpuCtrlInfo  PA GTPU Control Bit Definitions
1567  *  @ingroup palld_api_constants
1568  *  @{
1569  *
1570  *  @name PA GTPU Control Bit Definitions
1571  *
1572  *  Bitmap definition of the ctrlBitmap in @ref paGtpuConfig_t. 
1573  *         
1574  */ 
1575 /*@{*/
1576 /**
1577  *  @def  pa_GTPU_CTRL_USE_LINK
1578  *        Control Info -- Set: GTU-U classification vector consists of the least significant 24-bit of tunnel ID and 8-bit link 
1579  *                             of previous matching
1580  *                        Clear: GTU-U classification vector consists of the 32-bit of tunnel ID only (Default)
1581  */
1582 #define pa_GTPU_CTRL_USE_LINK              0x0001 
1583 /*@}*/
1584 /** @} */
1586 /**
1587  *  @ingroup palld_api_structures
1588  *  @brief   GTP-U Configuration Information.
1589  *
1590  *  @details  Due to the LUT2 engine using 32-bit matching parameter, the default GTP-U classification is solely based 
1591  *            on its 32-bit tunnel ID. However, it is desirable to match the GTP-U tunnel with both tunnel ID and 
1592  *            previous link information. This configuration can be used to modify GTP-U classification vector by 
1593  *            combining least significant 24-bit of tunnel ID and an 8-bit previous link. It should be passed to
1594  *            @ref Pa_control() API at system startup.
1595  *
1596  *  @note GTP-U configuration should be performed at system startup. PASS does not support GTP-U 
1597  *        reconfiguration at run time.
1598  * 
1599  */
1600 typedef struct {
1601   uint16_t ctrlBitMap;     /**< GTP-U configuration control info as defined at @ref paGtpuCtrlInfo */
1602 } paGtpuConfig_t;
1605 /**
1606  * @defgroup  paCtrlCode PA Control Code
1607  * @ingroup palld_api_constants
1608  * @{
1609  *
1610  * @name PA Control Code
1611  *
1612  * @brief Define the PA LLD control code  
1613  *
1614  */
1615 /** @ingroup paCtrlCode */
1616 /* @{ */
1617 /**
1618  *  @def  pa_CONTROL_SYS_CONFIG
1619  *        system-level configuration 
1620  */
1621 #define  pa_CONTROL_SYS_CONFIG              0  
1623 /**
1624  *  @def  pa_CONTROL_802_1ag_CONFIG
1625  *        802.1ag Detector configuration 
1626  */
1627 #define  pa_CONTROL_802_1ag_CONFIG          1 
1629 /**
1630  *  @def  pa_CONTROL_IPSEC_NAT_T_CONFIG
1631  *        IPSEC NAT-T Packet Detector configuration 
1632  */
1633 #define  pa_CONTROL_IPSEC_NAT_T_CONFIG      2  
1635 /**
1636  *  @def  pa_CONTROL_GTPU_CONFIG
1637  *        GTP-U configuration 
1638  */
1639 #define  pa_CONTROL_GTPU_CONFIG             3  
1641 /**
1642  *  @def  pa_CONTROL_RA_CONFIG
1643  *        Global RA_configuration 
1644  */
1645 #define  pa_CONTROL_RA_CONFIG               4  
1647 /*  @}  */  
1648 /** @} */
1651 /**
1652  * @ingroup palld_api_structures
1653  * @brief PA Control Information structure
1654  *
1655  * @details Data structure defines PA control information used by API @ref Pa_control. 
1656  *
1657  */
1658 typedef struct {
1659   uint16_t    code;                          /**< Specify the PA control code as defined at @ref paCtrlCode */
1660   union {
1661     paSysConfig_t           sysCfg;          /**< Specify system-level configuration parameters */
1662     pa802p1agDetConfig_t    pa802p1agDetCfg; /**< Specify 802.1ag Detector configuration parameters */
1663     paIpsecNatTConfig_t     ipsecNatTDetCfg; /**< Specify IPSEC NAT-T Detector configuration parameters */
1664     paGtpuConfig_t          gtpuCfg;         /**< Specify GTP-U configuration parameters */
1665     paRaConfig_t            raCfg;           /**< Specify RA global configuration information */
1666   }params;                                   /**< Contain the control operation specific parameters */
1668 } paCtrlInfo_t;
1669  
1671 /**
1672  *  @ingroup palld_api_structures
1673  *  @brief  The return type for module functions
1674  *
1675  *  @details  Function calls to this module return values used to determine if the command was successful or
1676  *            the reason for failure (see @ref ReturnValues).
1677  */
1679 typedef int paReturn_t;
1681 /**
1682  *   @ingroup palld_api_structures
1683  *   @brief  paCmdReply_t is used to specify command result (from PASS) routing information
1684  *
1685  *   @details Commands sent to packet accelerator sub-system will generate replies. These replies
1686  *            can be either discarded by the sub-system or routed to a queue. Command replies that
1687  *            must be forwarded back to this module are detailed for each command. The module user
1688  *            typically either selects a unique destination queue for command replies, or else supplies
1689  *            a unique value for replyId. This value is placed into software info word 0 in the 
1690  *            packet descriptor for the returned command. The data in the returned packet is not
1691  *            typically examined by the module user, but passed directly back to this module through 
1692  *            API function @ref Pa_forwardResult to examine the results of the command.
1693  */
1694 typedef struct  {
1696   int       dest;        /**<  Packet destination, must be pa_DEST_HOST or pa_DEST_DISCARD, see @ref pktDest */
1697   uint32_t  replyId;     /**<  Value placed in swinfo0 in reply packet */
1698   uint16_t  queue;       /**<  Destination queue for destination pa_DEST_HOST */
1699   uint8_t   flowId;      /**<  Flow ID used on command reply from PASS */
1700   
1701 } paCmdReply_t;
1703 /**
1704  *  @ingroup palld_api_constants
1705  *  @brief   Define the maximum number of buffers the module can request
1706  *
1707  */
1708 #define pa_N_BUFS               7
1710 /**
1711  *  @defgroup  paBufIndex PA Memory Buffer Index
1712  *  @ingroup palld_api_constants
1713  *  @{
1714  *
1715  *  @name   PA Memory Buffer Index
1716  *  @brief  Define the buffer inedex of the PA LLD memory blocks.
1717  *
1718  */
1719 /* @{ */
1720 /**
1721  *  @def  pa_BUF_INST
1722  *        PA LLD instance buffer
1723  */
1724 #define pa_BUF_INST             0
1725 /**
1726  *  @def  pa_BUF_L2_TABLE
1727  *        PA LLD match table of Layer 2 (MAC/SRIO) entries
1728  */
1729 #define pa_BUF_L2_TABLE         1
1730 /**
1731  *  @def  pa_BUF_L3_TABLE
1732  *        PA LLD match table of Layer 3 (IP/CustomLUT1) entries
1733  */
1734 #define pa_BUF_L3_TABLE         2
1735 /**
1736  *  @def  pa_BUF_USR_STATS_TABLE
1737  *        PA LLD link table of user-defined statistics 
1738  */
1739 #define pa_BUF_USR_STATS_TABLE  3
1740 /**
1741  *  @def  pa_BUF_VLINK_TABLE
1742  *        PA LLD match table of virtual link entries
1743  */
1744 #define pa_BUF_VLINK_TABLE      4
1745 /**
1746  *  @def  pa_BUF_ACL_TABLE
1747  *        PA LLD match table of ACL entries 
1748  */
1749 #define pa_BUF_ACL_TABLE        5
1750 /**
1751  *  @def  pa_BUF_FC_TABLE
1752  *        PA LLD match table of Flow Cache entries 
1753  */
1754 #define pa_BUF_FC_TABLE         6
1756 /*  @}  */  
1757 /** @} */
1760 /**
1761  *  @ingroup palld_api_functions
1762  *  @brief Pa_getBufferReq returns the memory requirements for the PA driver
1763  *
1764  *  @details This function returns the memory buffer requirements in term
1765  *           of the size and alignment array. The PA LLD requires up to 
1766  *           four memory blocks as described below:
1767  *           - PA Instance: PA instance data
1768  *           - L2 Table: Layer-2 (MAC/SRIO) entry information
1769  *           - L3 Table: Layer-3 (IP/Custom LUT1) entry information
1770  *           - User Statistics Link Table: User-defined Statistics entry information (Optional)
1771  *
1772  *  @param[in]   sizeCfg     Size configuration information
1773  *  @param[out]  sizes       Array of size requirements
1774  *  @param[out]  aligns      Array of alignment requirements
1775  *  @retval                  Value (@ref ReturnValues)
1776  *
1777  *  @note This function specifies the minimum memory buffer requirements, it is up to the
1778  *        module user to round up the buffer alignemnt and size to the cache line boundary
1779  *        to ensure cache coherency if cacheable memory is used.
1780  */
1781 paReturn_t Pa_getBufferReq (paSizeInfo_t *sizeCfg, int sizes[], int aligns[]);
1783 /**
1784  *  @ingroup palld_api_functions
1785  *  @brief  Pa_create creates the PA driver instance
1786  *
1787  *  @details This function initializes the PA driver based on user configuration
1788  *
1789  *  @param[in]  cfg     Configuration information
1790  *  @param[in]  bases   Array of the memory buffer base addresses 
1791  *  @param[out] pHandle Instance handle. This is a pointer to an initialized
1792  *                      instance structure. 
1793  *  @retval             Value (@ref ReturnValues)
1794  */
1795 paReturn_t Pa_create (paConfig_t *cfg, void* bases[], Pa_Handle *pHandle);
1797 /**
1798  *  @ingroup palld_api_functions
1799  *  @brief   Pa_startCfg Adds PA configuration
1800  *  @details This function needs to be called from all cores to initialize PA with 
1801  *           per core configurations
1802  *
1803  *  @param[in]  handle  The PA LLD instance identifier
1804  *  @param[in]  startCfg PA start configuration
1805  *  @retval     None
1806  */
1807 void Pa_startCfg (Pa_Handle handle, paStartCfg_t *startCfg);
1809 /**
1810  *  @ingroup palld_api_functions
1811  *  @brief Pa_close decativates the PA driver instance
1812  *
1813  *  @details This function deactivates the PA driver instance, all the associated
1814  *           memory buffers can be freed after this call. 
1815  *
1816  *  @param[in]  handle  The PA LLD instance identifier
1817  *  @param[out] bases   Array of the memory buffer base addresses 
1818  *  @retval             Value (@ref ReturnValues)
1819  */
1820 paReturn_t Pa_close (Pa_Handle handle, void* bases[]);
1822 /**
1823  *  @ingroup palld_api_functions
1824  *  @brief  Pa_control performs system-level control and configuration
1825  *
1826  *  @details This function performs PASS control operations including system-level figurations. 
1827  *           The system-level configurations are divided into several sub-groups which can be configured 
1828  *           independently. The default configuration will be used until this API is invoked.
1829  *
1830  *           On return the command buffer (cmd) contains a formatted command for the sub-system when the cmdSize
1831  *           is set to non-zero. The destination for the command is provided in cmdDest. The module user must send 
1832  *           the formatted command to the sub-system. The sub-system will generate a reply
1833  *           and this reply must be sent back to this module through the @ref Pa_forwardResult API.
1834  *
1835  *
1836  *  @param[in]      handle      The PA LLD instance identifier
1837  *  @param[in]      ctrl        Control information
1838  *  @param[out]     cmd         Where the created command is placed
1839  *  @param[in,out]  cmdSize     Input the size of cmd buffer, on output the actual size used. @ref cmdMinBufSize
1840  *  @param[in]      reply       Where the sub-system sends the command reply
1841  *  @param[out]     cmdDest     Value (@ref cmdTxDest) 
1842  *  @retval                     Value (@ref ReturnValues)
1843  */
1844 paReturn_t Pa_control (Pa_Handle      handle, 
1845                        paCtrlInfo_t  *ctrl, 
1846                        paCmd_t        cmd,
1847                        uint16_t       *cmdSize,
1848                        paCmdReply_t   *reply,
1849                        int            *cmdDest);
1852 /**
1853  * @defgroup  pktDest Routed Packet Destinations
1854  * @ingroup palld_api_constants
1855  * @{
1856  *
1857  * @name Routed Packet Destinations
1858  *
1859  * @brief The module user specifies packet destinations for packets exiting the packet accelerator sub-system.
1860  *
1861  * @details  The destination of packets that leave the packet accelerator sub-system
1862  *           are provided to the module in the @ref paRouteInfo_t structure and passed
1863  *           to the module through the @ref Pa_addMac, @ref Pa_addSrio, @ref Pa_addIp, @ref Pa_addCustomLUT1, 
1864  *           @ref Pa_addCustomLUT2 and @ref Pa_addPort functions
1865  */
1866 /** @ingroup pktDest */
1867 /* @{ */
1869 /** 
1870  *  @def  pa_DEST_DISCARD
1871  *        packet is discarded
1872  */
1873 #define  pa_DEST_DISCARD  3  /**< Packet is discarded */
1875 /** 
1876  *  @def  pa_DEST_CONTINUE_PARSE_LUT1
1877  *        packet remains in PA sub-system for more parsing and LUT1 classification
1878  */
1879 #define  pa_DEST_CONTINUE_PARSE_LUT1  4 /**< Packet remains in PA sub-system for more parsing and LUT1 classification */
1881 /** 
1882  *  @def  pa_DEST_CONTINUE_PARSE_LUT2
1883  *        packet remains in PA sub-system for more parsing and LUT2 classification. 
1884  */
1885 #define  pa_DEST_CONTINUE_PARSE_LUT2  5  /**< Packet remains in PA sub-system for more parsing and LUT2 classification */
1887 /**
1888  *  @def  pa_DEST_HOST
1889  *        host thread 
1890  */
1891 #define  pa_DEST_HOST   6   /**< Packet is routed to host */
1893 /** 
1894  *  @def  pa_DEST_EMAC
1895  *        ethernet mac port (of the switch)
1896  */
1897 #define  pa_DEST_EMAC   7   /**< Packet is routed to  EMAC */
1899 /** 
1900  *  @def  pa_DEST_SASS
1901  *        security accelerator destination 
1902  */
1903 #define  pa_DEST_SASS   8   /**< Packet is routed to SA */
1905 /** 
1906  *  @def  pa_DEST_SASS_LOC_DMA
1907  *        security accelerator destination via local DMA
1908  */
1909 #define  pa_DEST_SASS_LOC_DMA   11   /**< Packet is routed to SA through local DMA */
1911 /** 
1912  *  @def  pa_DEST_SRIO
1913  *        SRIO interface
1914  */
1915 #define  pa_DEST_SRIO   9   /**< Packet is routed to SRIO */
1917 /** 
1918  *  @def  pa_DEST_CASCADED_FORWARDING_LUT1
1919  *        Cascaded forwarding packet remains in PA sub-system for next LUT1 (IP) parsing. Those packets are expected to
1920  *        be delivered to QoS queues based on the VLAN/DSCP priority at the next stage so that some PASS actions such
1921  *        as IP reassembly and IP fragment exception route will be disabled.
1922  */
1923 #define  pa_DEST_CASCADED_FORWARDING_LUT1  10  
1925 /** 
1926  *  @def  pa_DEST_EFLOW
1927  *        packet remains in PA sub-system for egress flow operation
1928  */
1929 #define  pa_DEST_EFLOW   12   /**< Packet is routed to Egress Flow Path */
1931 /** 
1932  *  @def  pa_DEST_RES_1
1933  *        Reseved destination for internal usage
1934  */
1935 #define  pa_DEST_RES_1  20   
1937 /** 
1938  *  @def  pa_DEST_RES_2
1939  *        Reseved destination for internal usage
1940  */
1941 #define  pa_DEST_RES_2  21   
1943   
1944 /*  @}  */  
1945 /** @} */
1947 /**
1948  * @defgroup  paEmacPort Ethernet MAC port
1949  * @ingroup palld_api_constants
1950  * @{
1951  *
1952  * @name Ethernet MAC port
1953  *
1954  * @brief The module user specifies the Ethernet MAC port of the ingress and egress packets.
1955  *
1956  * @details  In the from-network direction, the module user can specify the input port as one of classification parameters.
1957  *           In the to-network direction, the module user can force the egress packets to be sent over the specified 
1958  *           destination Ethernet MAC port of the switch regreless of its states or configurations.
1959  */
1960 /** @ingroup customType */
1961 /* @{ */
1962 /**
1963  *  @def  pa_EMAC_PORT_NOT_SPECIFIED
1964  *        From-Netwprk: Don't care
1965  *        To-Network: Use standard switch forwarding 
1966  */
1967 #define  pa_EMAC_PORT_NOT_SPECIFIED   0   
1969 /* @def   pa_EMAC_PORT_0
1970  *        Use EMAC Port 0
1971  */
1972 #define  pa_EMAC_PORT_0               1   
1974 /* @def   pa_EMAC_PORT_1
1975  *        Use EMAC Port 1
1976  */
1977 #define  pa_EMAC_PORT_1               2   
1979 /* @def   pa_EMAC_PORT_2
1980  *        Use EMAC Port 2
1981  */
1982 #define  pa_EMAC_PORT_2               3   
1984 /* @def   pa_EMAC_PORT_3
1985  *        Use EMAC Port 3
1986  */
1987 #define  pa_EMAC_PORT_3               4   
1989 /*  @}  */  
1990 /** @} */
1992 /**
1993  * @defgroup emcOutputCtrlBits Ethernet MAC Output Control Bit Definitions
1994  * @ingroup palld_api_constants
1995  * @{
1996  *
1997  * @name Ethernet MAC Output Control Bit Definition
1998  *
1999  * Bitmap definition of the emacCtrl at @ref paRouteInfo_t. 
2000  *  
2001  */ 
2002 /*@{*/
2003 /**
2004  *  @def  pa_EMAC_CTRL_PORT_MASK
2005  *        Control Info -- EMAC port mask
2006  */
2007 #define pa_EMAC_CTRL_PORT_MASK            0x0F 
2008 /**
2009  *  @def  pa_EMAC_CTRL_CRC_DISABLE
2010  *        Control Info -- 0:EMAC port computes and inserts CRC
2011  *                        1:EMAC port does not generate CRC  
2012  */
2013 #define pa_EMAC_CTRL_CRC_DISABLE          0x80 
2015 /*  @}  */  
2016 /** @} */
2018 /**
2019  * @defgroup  customType Custom Classification Types
2020  * @ingroup palld_api_constants
2021  * @{
2022  *
2023  * @name Custom Classification Types
2024  *
2025  * @brief The module user specifies the custom classification types.
2026  *
2027  * @details  The optional custom classification rule may be used to further parse and calssify the incoming
2028  *           packet.
2029  */
2030 /** @ingroup customType */
2031 /* @{ */
2032 /**
2033  *  @def  pa_CUSTOM_TYPE_NONE
2034  *        Use standard classification 
2035  */
2036 #define  pa_CUSTOM_TYPE_NONE   0   
2038 /* @def   pa_CUSTOM_TYPE_LUT1
2039  *        Custom classification with LUT1
2040  */
2041 #define  pa_CUSTOM_TYPE_LUT1   1   
2043 /* @def   pa_CUSTOM_TYPE_LUT2
2044  *        Custom classification with LUT2
2045  */
2046 #define  pa_CUSTOM_TYPE_LUT2   2   
2048 /*  @}  */  
2049 /** @} */
2051 /**
2052  *   @brief  The maximum number of LUT1 Custom Types supported
2053  */
2054 #define pa_MAX_CUSTOM_TYPES_LUT1   4
2057 /**
2058  *   @brief  The maximum number of LUT2 Custom Types supported
2059  */
2060 #define pa_MAX_CUSTOM_TYPES_LUT2   16
2063 /**
2064  * @defgroup  cmdTxDest Command/Transmit Packet Destinations
2065  * @ingroup palld_api_constants
2066  * @{
2067  *
2068  * @name Command/Transmit Packet Destinations
2069  *
2070  * @brief These values are used by the module user to deliver the configuration packets to the specific PDSP Cluster within PASS.
2071  */
2072 /* @{ */
2073 /**
2074  *   @def  pa_CMD_TX_DEST_0
2075  *         Destination CLUSTER0
2076  */
2077 #define  pa_CMD_TX_DEST_0    0  /**< Packet is sent to INGRESS0 */
2079 /**
2080  *   @def  pa_CMD_TX_DEST_1
2081  *         Destination CLUSTER1
2082  */
2083 #define  pa_CMD_TX_DEST_1    1  /**< Packet is sent to INGRESS1 */
2085 /**
2086  *   @def  pa_CMD_TX_DEST_2
2087  *         Destination CLUSTER2
2088  */
2089 #define  pa_CMD_TX_DEST_2    2  /**< Packet is sent to INGRESS2 */
2091 /**
2092  *   @def  pa_CMD_TX_DEST_3
2093  *         Destination CLUSTER3
2094  */
2095 #define  pa_CMD_TX_DEST_3    3  /**< Packet is sent to INGRESS3 */
2097 /**
2098  *   @def  pa_CMD_TX_DEST_4
2099  *         Destination CLUSTER4
2100  */
2101 #define  pa_CMD_TX_DEST_4    4  /**< Packet is sent to INGRESS4 */
2103 /**
2104  *   @def  pa_CMD_TX_DEST_5
2105  *         Destination CLUSTER5
2106  */
2107 #define  pa_CMD_TX_DEST_5    5  /**< Packet is sent to POST  */
2109 /**
2110  *   @def  pa_CMD_TX_DEST_6
2111  *         Destination CLUSTER6
2112  */
2113 #define  pa_CMD_TX_DEST_6    6  /**< Packet is sent to EGRESS0  */
2114  
2115 /**
2116  *   @def  pa_CMD_TX_DEST_7
2117  *         Destination CLUSTER7
2118  */
2119 #define  pa_CMD_TX_DEST_7    7  /**< Packet is sent to EGRESS1  */
2120 /**
2121  *   @def  pa_CMD_TX_DEST_8
2122  *         Destination CLUSTER8
2123  */
2124 #define  pa_CMD_TX_DEST_8    8  /**< Packet is sent to EGRESS2  */
2125  
2126 /*  @}  */  
2127 /** @} */
2129 /**
2130  * @defgroup  paLut1Inst PA LUT1 Instance Destinations
2131  * @ingroup palld_api_constants
2132  * @{
2133  *
2134  * @name PA LUT1 Instance Destinations
2135  *
2136  * @brief These values are used by the module user to specify the LUT1 table instance used by the specified IP, ACL or customLUT1 entry
2137  */
2138 /* @{ */
2139 /**
2140  *   @def  pa_LUT1_INST_0_0
2141  *         LUT1 instance of Ingress0, PDSP0
2142  */
2143 #define  pa_LUT1_INST_0_0    0  /**< LUT1 table connected to Ingress0, PDSP0 */
2145 /**
2146  *   @def  pa_LUT1_INST_0_1
2147  *         LUT1 instance of Ingress0, PDSP1
2148  */
2149 #define  pa_LUT1_INST_0_1    1  /**< LUT1 table connected to Ingress0, PDSP1 */
2151 /**
2152  *   @def  pa_LUT1_INST_1_0
2153  *         LUT1 instance of Ingress1, PDSP0
2154  */
2155 #define  pa_LUT1_INST_1_0    2  /**< LUT1 table connected to Ingress1, PDSP0 */
2157 /**
2158  *   @def  pa_LUT1_INST_0_1
2159  *         LUT1 instance of Ingress1, PDSP1
2160  */
2161 #define  pa_LUT1_INST_1_1    3  /**< LUT1 table connected to Ingress1, PDSP1 */
2163 /**
2164  *   @def  pa_LUT1_INST_2_0
2165  *         LUT1 instance of Ingress2, PDSP0
2166  */
2167 #define  pa_LUT1_INST_2_0    4  /**< LUT1 table connected to Ingress2, PDSP0 */
2169 /**
2170  *   @def  pa_LUT1_INST_3_0
2171  *         LUT1 instance of Ingress3, PDSP0
2172  */
2173 #define  pa_LUT1_INST_3_0    5  /**< LUT1 table connected to Ingress3, PDSP0 */
2175 /**
2176  *   @def  pa_LUT1_INST_4_0
2177  *         LUT1 instance of Ingress4, PDSP0
2178  */
2179 #define  pa_LUT1_INST_4_0    6  /**< LUT1 table connected to Ingress4, PDSP0 */
2181 /**
2182  *   @def  pa_LUT1_INST_5_0
2183  *         LUT1 instance of Egress0, PDSP0
2184  */
2185 #define  pa_LUT1_INST_5_0    7  /**< LUT1 table connected to Egress0, PDSP0 */
2187 /**
2188  *   @def  pa_LUT1_INST_0
2189  *         LUT1 instance 0 of NetCP 1.0 equivalent
2190  */
2191 #define  pa_LUT1_INST_0    pa_LUT1_INST_0_0   /**< LUT1 table equivalent to Netcp 1.0 LUT1_0  */
2193 /**
2194  *   @def  pa_LUT1_INST_1
2195  *         LUT1 instance 1 of NetCP 1.0 equivalent
2196  */
2197 #define  pa_LUT1_INST_1    pa_LUT1_INST_1_0   /**< LUT1 table equivalent to Netcp 1.0 LUT1_1  */
2199 /**
2200  *   @def  pa_LUT1_INST_2
2201  *         LUT1 instance 2 of NetCP 1.0 equivalent
2202  */
2203 #define  pa_LUT1_INST_2    pa_LUT1_INST_4_0   /**< LUT1 table equivalent to Netcp 1.0 LUT1_2  */
2205 /**
2206  *   @def  pa_LUT1_INST_MAX
2207  *         Specify the maximum LUT1 instance
2208  */
2209 #define  pa_LUT1_INST_MAX  pa_LUT1_INST_5_0   
2211 /*  @}  */  
2212 /** @} */
2214 /**
2215  * @defgroup  paAclInst PA ACL LUT Instance Destinations
2216  * @ingroup palld_api_constants
2217  * @{
2218  *
2219  * @name PA ACL Lut Instance Destinations
2220  *
2221  * @brief These values are used by the module user to specify the ACL Lut instance 
2222  */
2223 /* @{ */
2225 /**
2226  *   @def  pa_ACL_INST_OUTER_IP
2227  *         LUT1 instance of ACL Table 0 for Outer IP
2228  */
2229 #define  pa_ACL_INST_OUTER_IP     pa_LUT1_INST_0_1   /**< LUT1 table used for ACL Table 0  */
2232 /**
2233  *   @def  pa_ACL_INST_INNER_IP
2234  *         LUT1 instance of ACL Table 1 for Inner IP
2235  */
2236 #define  pa_ACL_INST_INNER_IP     pa_LUT1_INST_3_0   /**< LUT1 table used for ACL Table 1  */
2237  
2238 /*  @}  */  
2239 /** @} */
2242 /**
2243  * @defgroup  paCrcInst PA CRC Engine Instance Destinations
2244  * @ingroup palld_api_constants
2245  * @{
2246  *
2247  * @name PA CRC Engine Instance Destinations
2248  *
2249  * @brief These values are used by the module user to specify the CRC Engine instance 
2250  */
2251 /* @{ */
2252 /**
2253  *   @def  pa_CRC_INST_0_0
2254  *         CRC instance of Ingress0
2255  */
2256 #define  pa_CRC_INST_0_0    0  /**< CRC Engine between Ingress0, CDE0 and CED1 */
2258 /**
2259  *   @def  pa_CRC_INST_1_0
2260  *         CRC instance of Ingress1
2261  */
2262 #define  pa_CRC_INST_1_0    1  /**< CRC Engine between Ingress1, CDE0 and CED1 */
2264 /**
2265  *   @def  pa_CRC_INST_4_0
2266  *         LUT1 instance of Ingress4
2267  */
2268 #define  pa_CRC_INST_4_0    2  /**< CRC Engine between Ingress4, CDE0 and CED1 */
2270 /**
2271  *   @def  pa_CRC_INST_5_0
2272  *         LUT1 instance of Post
2273  */
2274 #define  pa_CRC_INST_5_0    3  /**< CRC Engine between Post, CDE0 and CED1 */
2276 /**
2277  *   @def  pa_CRC_INST_6_0
2278  *         CRC instance 0 of Egress0
2279  */
2280 #define  pa_CRC_INST_6_0    4  /**< CRC Engine between Egress0, CDE0 and CED1 */
2282 /**
2283  *   @def  pa_CRC_INST_6_1
2284  *         CRC instance 1 of Egress0
2285  */
2286 #define  pa_CRC_INST_6_1    5  /**< CRC Engine between Egress0, CDE1 and CED2 */
2288 /**
2289  *   @def  pa_CRC_INST_MAX
2290  *         Specify the maximum CRC Engine instance
2291  */
2292 #define  pa_CRC_INST_MAX  pa_CRC_INST_6_1   
2293  
2294 /*  @}  */  
2295 /** @} */
2297 /**
2298  * @defgroup  paRaInst PA RA Instance Destinations
2299  * @ingroup palld_api_constants
2300  * @{
2301  *
2302  * @name PA RA Instance Destinations
2303  *
2304  * @brief These values are used by the module user to specify the RA instance (group)
2305  */
2306 /* @{ */
2307 /**
2308  *   @def  pa_RA_INST_0
2309  *         RA instance of Outer IP
2310  */
2311 #define  pa_RA_INST_0       0  /**< RA instance to be accessed from Ingress0, PDSP1 for outer IP reassembly */
2314 /**
2315  *   @def  pa_RA_INST_1
2316  *         RA instance of Inner IP
2317  */
2318 #define  pa_RA_INST_1       1  /**< RA instance to be accessed from Ingress3, PDSP0 for inner IP reassembly */
2320 /**
2321  *   @def  pa_RA_INST_MAX
2322  *         Specify the maximum RA instance
2323  */
2324 #define  pa_RA_INST_MAX     pa_RA_INST_1   
2325  
2326 /*  @}  */  
2327 /** @} */
2329 /**
2330  * @defgroup  paCmdCode Command Code
2331  * @ingroup palld_api_constants
2332  * @{
2333  *
2334  * @name PA Command Codes
2335  *
2336  * @brief Define the commands which can be executed in PASS 
2337  *
2338  * @details  A single command or a set of commands can be executed to support fully-offloaded 
2339  *           data path in both the transmit (to network) and receive (from network) directions.  
2340  *           In the to-network direction, the list of commands formatted by the module should 
2341  *           be stored as the protocol-specific information at the packet descriptor with the 
2342  *           packet. The commands will be executed in order at PASS and the associated security
2343  *           accelerator sub-system (SASS). The executed commands will be removed by PASS and 
2344  *           SASS so that the output packet will not contain any command.
2345  *           In the from-network direction, the list of commands formatted by the module will 
2346  *           be stored at the PASS as a command set which can be referred to by the command set 
2347  *           index. A single command including a command set can be executed per the enhanced 
2348  *           routing information @ref paRouteInfo_t after a LUT1 or LUT2 matches.
2349  *
2350  * @note     The packet offset specified at each command of the command list should be strictly 
2351  *           in ascending order becasue the PASS processes the list of commands in order and it
2352  *           can not move backwards. The command violating the order requirement may be detected
2353  *           and rejected by the API @ref Pa_formatTxCmd and @ref Pa_configCmdSet. In the case, 
2354  *           the order constraint can not be validated at the LLD, the violating command will 
2355  *           be ignored by the PASS.    
2356  */
2357 /** @ingroup paCmdCode */
2358 /* @{ */
2359 /**
2360  *  @def  pa_CMD_NONE
2361  *        End of commands 
2362  */
2363 #define  pa_CMD_NONE                        0   
2365 /* @def   pa_CMD_NEXT_ROUTE
2366  *        Specifies next route 
2367  */
2368 #define  pa_CMD_NEXT_ROUTE                  1   
2370 /*  @def  pa_CMD_CRC_OP
2371  *        CRC generation or verification 
2372  */
2373 #define  pa_CMD_CRC_OP                      2   
2375 /*  @def  pa_CMD_COPY_DATA_TO_PSINFO
2376  *        Copy Data from the packet to the PS Info Area in the packet descriptor 
2377  */
2378 #define  pa_CMD_COPY_DATA_TO_PSINFO         3
2380 /*  @def  pa_CMD_PATCH_DATA
2381  *        Insert or patch packet data at the specific location  
2382  */
2383 #define  pa_CMD_PATCH_DATA                  4  
2385 /*  @def  pa_CMD_TX_CHECKSUM
2386  *        Compute and insert checksum  
2387  */
2388 #define  pa_CMD_TX_CHECKSUM                 5 
2390 /*  @def  pa_CMD_MULTI_ROUTE
2391  *        Duplicate packet to multiple destinations  
2392  */
2393 #define  pa_CMD_MULTI_ROUTE                 6  
2395 /*  @def  pa_CMD_REPORT_TX_TIMESTAMP
2396  *        Report the PA 32-bit timestamp at the timestamp field of the packet descriptor
2397  */
2398 #define  pa_CMD_REPORT_TX_TIMESTAMP         7 
2400 /*  @def  pa_CMD_REMOVE_HEADER
2401  *        Remove the parsed packet header 
2402  *  @note It should be the first command in the rx command set 
2403  */
2404 #define  pa_CMD_REMOVE_HEADER               8 
2406 /*  @def  pa_CMD_REMOVE_TAIL
2407  *        Remove the parsed packet tail 
2408  *
2409  *  @note It should be the last command next to the next route or multi-route command       
2410  */
2411 #define  pa_CMD_REMOVE_TAIL                 9 
2414 /*  @def  pa_CMD_CMDSET
2415  *        Specify the command set to be executed  
2416  */
2417 #define  pa_CMD_CMDSET                      10   
2419 /*  @def  pa_CMD_SA_PAYLOAD
2420  *        Specify the payload information required by SASS  
2421  */
2422 #define  pa_CMD_SA_PAYLOAD                  11   
2424 /*  @def  pa_CMD_IP_FRAGMENT
2425  *        Perform IPv4 fragmentation  
2426  */
2427 #define  pa_CMD_IP_FRAGMENT                 12 
2429 /*  @def  pa_CMD_USR_STATS
2430  *        Update the specified user-defined counter and the counters which are linked to this counter  
2431  */
2432 #define  pa_CMD_USR_STATS                   13    
2433    
2434    
2435 /*  @def  pa_CMD_CMDSET_AND_USR_STATS
2436  *        Combination of the CMDSET and USR_STATS commands. 
2437  *  @note It is only used as a command executed after the last classification per the enhanced routing 
2438  *        information      
2439  */
2440 #define  pa_CMD_CMDSET_AND_USR_STATS        14   
2442 /*  @def  pa_CMD_PATCH_MSG_LEN
2443  *        Update the message length field within some L2 protocol header such as 802.3 and PPPoE after the
2444  *        potential IP fragmentation operation
2445  *  @note This command is only used in conjunction with the pa_CMD_IP_FRAGMENT command.    
2446  */
2447 #define  pa_CMD_PATCH_MSG_LEN               15 
2449 /*  @def  pa_CMD_VERIFY_PKT_ERROR
2450  *        Verify the packet error based on the CPPI error flags as specified at @ref Appendix2 and forward
2451  *        the error packet to the specified destination 
2452  *  @note This packet error verification is not applicable to the CRC verification operation within the same
2453  *        command set.
2454  *  @note This command should be either the last command or the second last to the nextRoute command since 
2455  *        all commands following this operation will be ignored if packet error is found. 
2456  */
2457 #define  pa_CMD_VERIFY_PKT_ERROR            16 
2460 /*  @def  pa_CMD_SPLIT
2461  *        Split the packet into header and payload portion to be delivered to different queues with 
2462  *        different CPPI flows 
2463  *  @note This command is only supported in the from-network direction
2464  *  @note This command should be placed ahead of any pa_CMD_PATCH command so that the header size can be adjusted accordingly
2465  *  @note The first 8-byte of psInfo area is reserved for this operation, therefore, the destOffset of pa_CMD_COPY_DATA_TO_PSINFO
2466  *        commands within the same command set should be 8 or larger.
2467  *        
2468  */
2470 #define  pa_CMD_SPLIT                      17
2472 /*  @def  pa_CMD_EF_OP
2473  *        Egress Flow operation command either triggers flow cache lookup to find the corresponding packet modification records 
2474  *        or provides those records directly. 
2475  *  @note This command can not be combined with any other commands
2476  */
2477 #define  pa_CMD_EF_OP                      18 
2479    
2480 /*  @}  */  
2481 /** @} */
2483 /**
2484  *  @defgroup routeCtrlInfo  PA Routing Control Info Bit Definitions
2485  *  @ingroup palld_api_constants
2486  *  @{
2487  *
2488  *  @name PA Routing Control Info Bit Definitions
2489  *
2490  *  Bitmap definition of the ctrlBitField in @ref paCmdNextRoute_t. 
2491  */ 
2492 /*@{*/
2493 /**
2494  *  @def  pa_NEXT_ROUTE_PARAM_PRESENT
2495  *        Control Info -- Set: Routing information such as flowId, queue are in command
2496  *                        Clear: Routing information such as flowId, queue are in packet
2497  */
2498 #define pa_NEXT_ROUTE_PARAM_PRESENT              0x0001 
2499 /**
2500  *  @def  pa_NEXT_ROUTE_PROC_NEXT_CMD
2501  *        Control Info -- Set: Process the next command prior to forward the packet to its final destination
2502  *                        Clear: Forward the packet to the next destination without executing any more command
2503  *  @note The data patch command (pa_CMD_PATCH_DATA) is the only one which can follow the next route command.
2504  *  @note: This option is only valid in the transmit (to-network) direction      
2505  */
2506 #define pa_NEXT_ROUTE_PROC_NEXT_CMD              0x0002 
2507 /**
2508  *  @def  pa_NEXT_ROUTE_PROC_MULTI_ROUTE
2509  *        Control Info -- Set: Multi-route is valid, the packet should be forwarded and then perform multi-route
2510  *                        Clear: Multi-route is invalid
2511  *  @note: This option is only valid in the receive (from-network) direction      
2512  */
2513 #define pa_NEXT_ROUTE_PROC_MULTI_ROUTE           0x0004 
2514 /**
2515  *  @def  pa_NEXT_ROUTE_TX_L2_PADDING
2516  *        Control Info -- Set: Perform MAC padding for packet with size smaller than 60
2517  *                        Clear: Do not perform MAC padding
2518  *  @note: This option is only valid in the transmit (to-network) direction      
2519  */
2520 #define pa_NEXT_ROUTE_TX_L2_PADDING              0x0008 
2521 /*@}*/
2522 /** @} */
2525 /**
2526  *  @ingroup palld_api_structures
2527  *  @brief  Next Route Command
2528  *
2529  *  @details paCmdNextRoute_t defines the final route information
2530  *           The next route command can be used in both to-network and from-network directions. 
2531  *           In the to-network direction, it may be used multiple times to route traffic between PASS and SASS 
2532  *           before the packet is finally forwarded to the network. For example, the following steps show the 
2533  *           SRTP over IPSEC AH to-network traffic:
2534  *  @verbatim 
2535                1. Packet is delivered to SASS for SRTP operation
2536                2. Packet is delivered to PASS for UDP checksum operation
2537                3. Packet is delivered to SASS for IPSEC AH operation
2538                4. Packet is delivered to PASS for AH authentication tag insertion
2539                5. Packet is delivered to the network.
2540     @endverbatim
2541  *           The next route commands are required for step 3 and 5. The complete routing information should be provided 
2542  *           in the to-network direction.
2543  *
2544  *           In the from-network direction, the next route command is used only if the multiple routes are required or when
2545  *           dest is set to EMAC to forward the ingress packets out to another EMAC port. 
2546  *           In this case, only the parameter "ctrlBitfield", "multiRouteIndex" and/or "dest" are valid. After all the 
2547  *           commands in the command set are executed, the PASS will deliver packets to their desired destination based 
2548  *           on the parameters specified at the routing information upon the LUT1/LUT2 matching.  
2549  *           If the next route command is specified, it must be the last command within a command set. The commands following 
2550  *           the next route command will not be executed.  
2551  */
2553 typedef struct {
2555   uint16_t    ctrlBitfield;    /**< Routing control information as defined at @ref routeCtrlInfo */
2556   int         dest;            /**< Packet destination as defined at @ref pktDest */
2557   uint8_t     pktType_emacCtrl;/**<  For destination SRIO, specify the 5-bit packet type toward SRIO 
2558                                      For destination HOST, EMAC, specify the EMAC control @ref emcOutputCtrlBits to the network */
2559   uint8_t     flowId;          /**< For host, SA or SRIO destinations, specifies return free descriptor setup */
2560   uint16_t    queue;           /**< For host, SA or SRIO destinations, specifies the dest queue */
2561   uint32_t    swInfo0;         /**< Placed in SwInfo0 for packets to host or SA; Placed in the PS Info for packets to SRIO*/
2562   uint32_t    swInfo1;         /**< Placed in SwInfo1 for packets to the SA; Placed in the PS Info for packets to SRIO */
2563   uint16_t    multiRouteIndex; /**< Multi-route index. It is valid in the from-network direction only */
2564 } paCmdNextRoute_t;
2566 /**
2567  *  @defgroup  crcFrameTypes CRC Frame types 
2568  *  @ingroup palld_api_constants
2569  *  @{
2570  *
2571  *  @name CRC Frame types
2572  *
2573  *  @brief  Define the frame types which are used to extract and derive the CRC operation parameters such as CRC starting 
2574  *          offset and CRC payload length from the frame header. 
2575  *
2576  *  @details  Both the payload length and the byte location where CRC calculation begins may vary in some protocl 
2577  *            frame such as WCDMA FP HS-DSCH Data Frame type 2 and type 3. The CRC Frame type is used for PASS to
2578  *            extract and/or derive the CRC starting offset and payload length.
2579  *
2580  *  @note     Only the following frame types are supported.
2581  */
2582 /*  @{  */
2583 /**
2584  *
2585  *   @def  pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2
2586  *         WCDMA FP HS-DSCH Data Frame Type 2
2587  */
2588 #define pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2         0
2590 /**
2591  *
2592  *  @def   pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE3
2593  *         WCDMA FP HS-DSCH Data Frame Type 3
2594  */
2595 #define pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE3         1
2597 #define pa_CRC_OP_FRAME_TYPE_MAX                          pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE3
2599  
2600 /*  @}  */  
2601 /** @} */
2604 /**
2605  *  @defgroup crcOpCtrlInfo  PA CRC Command Control Info Bit Definitions
2606  *  @ingroup palld_api_constants
2607  *  @{
2608  *
2609  *  @name PA CRC Command Control Info Bit Definitions
2610  *
2611  *  Bitmap definition of the ctrlBitField in @ref paCmdCrcOp_t. 
2612  */ 
2613 /*@{*/
2614 /**
2615  *  @def  pa_CRC_OP_CRC_VALIDATE
2616  *        Control Info -- Set: CRC Validate
2617  *                        Clear: CRC Computation
2618  */
2619 #define pa_CRC_OP_CRC_VALIDATE              0x0001 
2620 /**
2621  *  @def  pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER
2622  *        Control Info -- Set: CRC length field in the header
2623  *                        Clear: CRC length specified in command
2624  */
2625 #define pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER  0x0002 
2626 /**
2627  *  @def  pa_CRC_OP_PAYLOAD_LENGTH_OFFSET_IS_NEGATIVE
2628  *        Control Info -- Set: Payload length field resides prior to the parsed header offset 
2629  *                             length field offset = offset from the current parsed header - lenOffset
2630  *                        Clear: Payload length field resides after the parsed header offset
2631  *                             length field offset = offset from the current parsed header + lenOffset
2632  */
2633 #define pa_CRC_OP_PAYLOAD_LENGTH_OFFSET_IS_NEGATIVE  0x0004 
2634 /**
2635  *  @def  pa_CRC_OP_CRC_FRAME_TYPE
2636  *        Control Info -- Set: Frame Type is specified
2637  *                        Clear: Frame Type is not specified, use offset 
2638  *                               parameter
2639  */
2640 #define pa_CRC_OP_CRC_FRAME_TYPE            0x0008 
2641 /**
2642  *  @def  pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD
2643  *        Control Info -- Set: CRC field following payload
2644  *                        Clear: CRC offset specified in command
2645  */
2646 #define pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD 0x0010 
2647 /*@}*/
2648 /** @} */
2650 /**
2651  *  @ingroup palld_api_structures
2652  *  @brief  CRC Generation/Verification Command
2653  *
2654  *  @details paCmdCrcOp_t is used to create CRC operation command instruct the PASS to 
2655  *           perform CRC operation in both to-network and from-network directions. The
2656  *           module user is responsible for configuring the corresponding CRC engines
2657  *           which are used for the specified CRC operation. 
2658  *
2659  *           In the to-network direction, the payload offset, payload length and CRC offset 
2660  *           should be available in the command. The generated CRC will be inserted into
2661  *           the CRC location in the packet.
2662  *
2663  *           In the from-network direction, the payload length is either a constant or 
2664  *           available in the custom header. The CRC verification will be performed by
2665  *           the CRC engine connected to the PDSP where the CRC command is executed. 
2666  *           The CRC verification result will be indicated by the error flags within 
2667  *           the CPPI descriptor as described at section table @ref appendix2 
2668  */
2670 typedef struct {
2672   uint16_t    ctrlBitfield;    /**< CRC operation control information as defined at @ref crcOpCtrlInfo */
2673   uint16_t    startOffset;     /**< Byte location, from SOP/Protocol Header, where the CRC computation begins 
2674                                     if frame type is not specified
2675                                     Byte location, from SOP/Protocol header, where the specific frame header begins
2676                                     if frame type is specified
2677                                     In to-network direction: offset from SOP
2678                                     In from-network direction: offset from the current parsed header 
2679                                     */
2680   uint16_t    len;             /**< Number of bytes covered by the CRC computation 
2681                                     valid only if pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER is clear */
2682   uint16_t    lenOffset;       /**< Payload length field offset in the custom header */
2683   uint16_t    lenMask;         /**< Payload length field mask */
2684   uint16_t    lenAdjust;       /**< Payload length adjustment: valid only if pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER is set */
2685   uint16_t    crcOffset;       /**< Offset from SOP/Protocol Header to the CRC field 
2686                                     In to-network direction: offset from SOP
2687                                     In from-network direction: offset from the current parsed header */
2688   uint16_t    crcSize;         /**< Size of CRC in bytes */ 
2689   uint16_t    frameType;       /**< Frame type @ref crcFrameTypes, vaild if pa_CRC_OP_CRC_FRAME_TYPE is set */   
2690   uint32_t    initValue;       /**< CRC initial value */   
2691 } paCmdCrcOp_t;
2693 /**
2694  *  @defgroup splitOpCtrlInfo  PA SPLIT Command Control Info Bit Definitions
2695  *  @ingroup palld_api_constants
2696  *  @{
2697  *
2698  *  @name PA SPLIT Command Control Info Bit Definitions
2699  *
2700  *  Bitmap definition of the ctrlBitField in @ref paCmdSplitOp_t. 
2701  */ 
2702 /*@{*/
2703 /**
2704  *  @def  pa_SPLIT_OP_FRAME_TYPE
2705  *        Control Info -- Set: Frame Type is specified
2706  *                        Clear: Frame Type is not specified, use offset 
2707  *                               parameter
2708  */
2709 #define pa_SPLIT_OP_FRAME_TYPE            0x0001 
2710 /*@}*/
2711 /** @} */
2713 /**
2714  *  @ingroup palld_api_structures
2715  *  @brief  Split Command
2716  *
2717  *  @details paCmdSplitOp_t is used to create Split command to instruct the PASS to 
2718  *           divide the ingress packet into the header and payload portion and deliver them
2719  *           to specified destination queues with specified CPPI flows respectively.
2720  *           Where the destination information of the header packet is specified by the 
2721  *           classification routing information and the destination information of the payload  
2722  *           packet is specified in this structure. 
2723  *
2724  */
2725 typedef struct {
2726   uint16_t    ctrlBitfield; /**< Split operation control information as defined at @ref splitOpCtrlInfo */
2727   uint16_t    startOffset;  /**< Byte location, from Protocol Header, where the payload begins 
2728                                  if frame type is not specified
2729                                  Byte location, from Protocol header, where the specific frame header begins
2730                                  if frame type is specified
2731                                  In from-network direction: offset from the current parsed header 
2732                                  */
2733   uint16_t    frameType;    /**< Frame type @ref crcFrameTypes, vaild if pa_SPLIT_OP_FRAME_TYPE is set */         
2734   uint16_t    destQueue;    /**< Host queue for the payload packet */
2735   uint16_t    flowId;       /**< CPPI flow which instructs how link-buffer queues are used for sending payload packets. */   
2736                             
2737 } paCmdSplitOp_t;   
2739 /**
2740  *  @ingroup palld_api_structures
2741  *  @brief  Transmit checksum configuration
2742  *
2743  *  @details  paTxChksum_t is used in the call to @ref Pa_formatTxRoute or @ref Pa_formatTxCmd to create a tx 
2744  *            command header that instructs the packet accelerator sub-system to generate ones' complement
2745  *             checksums into network packets. The checksums are typically used for TCP and UDP payload checksums as
2746  *            well as IPv4 header checksums. In the case of TCP and UDP payload checksums the psuedo header
2747  *            checksum must be pre-calculated and provided, the sub-system does not calculate it.
2748  */
2749 typedef struct {
2751   uint16_t startOffset;   /**<  Byte location, from SOP, where the checksum calculation begins */
2752   uint16_t lengthBytes;   /**<  Number of bytes covered by the checksum. Must be even */
2753   uint16_t resultOffset;  /**<  Byte offset, from startOffset, to place the resulting checksum */
2754   uint16_t initialSum;    /**<  Initial value of the checksum */
2755   uint16_t negative0;     /**<  If TRUE, a computed value of 0 is written as -0 */
2757 } paTxChksum_t;
2760 /**
2761  *  @defgroup copyCtrlInfo  PA Copy Command Control Info Bit Definitions
2762  *  @ingroup palld_api_constants
2763  *  @{
2764  *
2765  *  @name PA Copy Command Control Info Bit Definitions
2766  *
2767  *  Bitmap definition of the ctrlBitField in @ref paCmdCopy_t. 
2768  *         
2769  */ 
2770 /*@{*/
2771 /**
2772  *  @def  pa_COPY_OP_FROM_END
2773  *        Control Info -- Set: Copy data from the end of the payload
2774  *                        Clear: Copy data from the beginning of the payload
2775  */
2776 #define pa_COPY_OP_FROM_END                 0x0001 
2777 /*@}*/
2778 /** @} */
2779  
2780 /**
2781  *  @ingroup palld_api_structures
2782  *  @brief  Copy Command
2783  *
2784  *  @details paCmdCopy_t is used to define how to copy number of bytes from the data packet to 
2785  *           the descriptor. The copy command is used to instruct the PASS to copy up to 8 byte 
2786  *           from packet to the PS info section in the packet descriptor in the from-network direction. 
2787  *           If the desired copy area crosses over the packet boundary, then garbage data will be copied.
2788  *
2789  *  @note: There are 20-byte packet information stored in the PS Info section. It is recommended to copy 
2790  *         packet data after the packet information area. Otherwise, the packet information will be 
2791  *         overwritten. There are upto 12 bytes can be copied with the packet information or upto
2792  *         32 bytes can be copied without the packet information. 
2793  */
2795 typedef struct {
2797   uint16_t    ctrlBitfield;    /**< Copy operation control information as defined at @ref copyCtrlInfo */
2798   uint16_t    srcOffset;       /**< Offset from the start of current protocol header for the data copy to begin */
2799   uint16_t    destOffset;      /**< Offset from the top of the PSInfo for the data to be copied to */
2800   uint16_t    numBytes;        /**< Number of bytes to be copied */   
2801 } paCmdCopy_t;
2804 /**
2805  *  @ingroup palld_api_structures
2806  *  @brief  Multi-route Command
2807  *
2808  *  @details paCmdMultiRoute_t is used to specify the desired PA multi-route set.
2809  *           The multi-route command instructs the PASS to route the packets to multiple 
2810  *           destinations in the from-network direction only. It must be the last command 
2811  *           within a command set. The commands following the multi-route command will
2812  *           not be executed.  
2813  */
2814 typedef struct {
2816   uint16_t    index;        /**<  Multi-route set Index */
2817 } paCmdMultiRoute_t;
2820 /**
2821  *  @ingroup palld_api_constants
2822  *  @def  pa_MAX_CMD_SETS
2823  *        The maximum number of command sets supported
2824  */
2825 #define pa_MAX_CMD_SETS     64
2827 /**
2828  *  @ingroup palld_api_structures
2829  *  @brief  Command Set Command
2830  *
2831  *  @details paCmdSet_t is used to specify the desired PA command set. The command set command 
2832  *           instructs the PASS to execute a list of commands after a LUT1 or LUT2 match occurs. 
2833  *           It is one of the command which can be embedded within the @ref paRouteInfo_t. 
2834  */
2835 typedef struct {
2837   uint16_t    index;        /**< Command Set Index */
2838 } paCmdSet_t;
2840 /**
2841  *   @ingroup palld_api_constants
2842  *   @def  pa_MAX_PATCH_BYTES
2843  *         The maximum number of bytes that a patch command can accept
2844  */
2845 #define pa_MAX_PATCH_BYTES     16      /**< PATCH Command in to-netweok direction */
2846 #define pa_MAX_RX_PATCH_BYTES  32      /**< PATCH Command within a command set */
2848 /**
2849  *  @defgroup patchCtrlInfo  PA Patch Command Control Info Bit Definitions
2850  *  @ingroup palld_api_constants
2851  *  @{
2852  *
2853  *  @name PA Patch Command Control Info Bit Definitions
2854  *
2855  *  Bitmap definition of the ctrlBitField in @ref paPatchInfo_t. 
2856  *         
2857  */ 
2858 /*@{*/
2859 /**
2860  *  @def  pa_PATCH_OP_INSERT
2861  *        Control Info -- Set: Insert data into the packet
2862  *                        Clear: Patch data replaces existing packet data
2863  */
2864 #define pa_PATCH_OP_INSERT                 0x0001 
2865 /**
2866  *  @def  pa_PATCH_OP_MAC_HDR
2867  *        Control Info -- Set: Replace MAC header with patch data
2868  *                        Clear: Normal Patch/Insert operation
2869  */
2870 #define pa_PATCH_OP_MAC_HDR                0x0002 
2871 /**
2872  *  @def  pa_PATCH_OP_DELETE
2873  *        Control Info -- Set: Delete data in the packet
2874  *                        Clear: Normal Patch/Insert operation
2875  */
2876 #define pa_PATCH_OP_DELETE                 0x0004 
2877 /*@}*/
2878 /** @} */
2881 /**
2882  *  @ingroup palld_api_structures
2883  *  @brief  Packet patching configuration
2884  *
2885  *  @details paPatchInfo_t is used to create data patch command. The patch command is used to patch 
2886  *           existing data or insert data in the packet in both to-network and from-network directions.
2887  *
2888  *           In the to-network direction, it can be used to patch the authentication tag provided by SASS 
2889  *           into the AH header within the packet. In this case, the patch data is not present at the command 
2890  *           when it is formatted and it is appended by the SASS. The @ref Pa_formatRoutePatch is used to create
2891  *           a command block along with a packet routing command to forward the packet after the patch is complete
2892  *
2893  *           In the from-network direction, it can be used to insert up to 32 bytes to the offset location
2894  *           as part of the command set to be executed after a LUT1 or LUT2 match. 
2895  *           This command can be used to patch the entire MAC header for MAC router functionality. It may be further 
2896  *           enhanced and combined with other commands to support IP forwarding operation in the future.
2897  *           A short version of the patch command can be used to insert up to 2 bytes into the current parsing
2898  *           location of the packet after a LUT2 match.
2899  */
2901 typedef struct {
2903   uint16_t   ctrlBitfield;      /**<  Patch operation control information as defined at @ref patchCtrlInfo */
2904   uint16_t   nPatchBytes;       /**<  The number of bytes to be patched */
2905   uint16_t   totalPatchSize;    /**<  The number of patch bytes in the patch command, must be >= to nPatchBytes and a multiple of 4 bytes */
2906   uint16_t   offset;            /**<  Offset from the start of the packet for the patch to begin in the to-network direction 
2907                                       Offset from the start of the current header for the patch to begin in the from-network direction */
2908   uint8_t    *patchData;        /**<  Pointer to the patch data */
2910 } paPatchInfo_t;
2914 /**
2915  *  @ingroup palld_api_structures
2916  *  @brief  paPayloadInfo_t defines the packet payload information in the short format.
2917  *          It is required by the Security Accelerator sub-system (SASS)
2918  *
2919  *  @details paPayloadInfo_t defines the packet parsing information in terms of
2920  *           payload offset and payload length as described below
2921  *  @li      SRTP:      offset to the RTP header; RTP payload length including ICV
2922  *  @li      IPSEC AH:  offset to the Outer IP; IP payload length
2923  *  @li      IPSEC ESP: offset to the ESP header; ESP papload length including ICV
2924  */
2926 typedef struct  {
2927     uint16_t  offset;    /**< The offset to where the SA packet parsing starts */
2928     uint16_t  len;       /**< The total length of the protocal payload to be processed by SA */
2929     uint32_t  supData;   /**< Optional supplement data such as the 32-bit CountC for some 3GPP operation modes */
2930 } paPayloadInfo_t;
2933 /**
2934  *  @ingroup palld_api_structures
2935  *  @brief   Tx timestamp reporting information
2936  *
2937  *  @details paCmdTxTimestamp_t specifies the tx timestamp reporting information. The report tx timestamp command is used to instruct 
2938  *           the PASS to report the PA timestamp when the packet is transmitting out of PASS in a return (null) packet to the specified 
2939  *           host queue. The transmit timestamp may be used for the Precision Timing Protocol (PTP). The reported tx timestamp will be 
2940              a 48 bit value, with the lower 32 bits stored in timestamp field, and the upper 16 bits stored in swInfo1. 
2941  */
2943 typedef struct  {
2944     uint16_t  destQueue; /**< Host queue for the tx timestamp reporting packet */
2945     uint16_t  flowId;    /**< CPPI flow which instructs how link-buffer queues are used for sending tx timestamp reporting packets. */
2946     uint32_t  swInfo0;   /**< lower 32 bit value returned in the descriptor as swInfo0 which can be used as event identifier */
2947 } paCmdTxTimestamp_t;
2949 /**
2950  *  @ingroup palld_api_structures
2951  *  @brief   IP fragmentation information
2952  *
2953  *  @details paCmdIpFrag_t is used to create the IPv4 fragment command. The IP fragment command is used to instruct the PASS to 
2954  *           perform IPv4 fragmentation operation. This operation can be applied to both inner IP prior to IPSEC encapsulation and 
2955  *           outer IP after IPSEC encapsulation.  This command should go with a next route command which provides the destination 
2956  *           information prior to the fragmentation operation. 
2957  *    
2958  *           For the inner IP fragmentation, follow the following procedure:
2959  *  @li      Host sends packets with the IP fragment command and the destination queue set to a host queue to PASS PDSP5 
2960  *           for IP fragmentation operation.
2961  *  @li      All fragments will be delivered to the specified host queue.
2962  *  @li      Host adds the outer MAC/IP header, invokes the SA LLD sendData function and then sends the fragments to the SA queue.
2963  *  @li      Each fragment will be encrypted, authenticated and forwarded to the final destination.
2964  *
2965  *           For the outer IP fragmentation, the overall operation is stated below: 
2966  *  @li      Packet is delivered to SASS for IPSEC operation
2967  *  @li      Packet is delivered to PASS for IP Fragmentation operation
2968  *  @li      The entire packet or its fragments are delivered to the network.
2969  *
2970  *  @note the next route command is required for step 2
2971  *  @note The IP fragment command can not be combined with some other tx commands such as checksum and CRC commands since
2972  *        those commands may require the PASS operation across multiple fragments. The workaround is to break the tx commands into
2973  *        two groups. The first group consists of the checksum, CRC, other commands and a next route command which routes the packet
2974  *        back to the same PDSP to execute the second command group which consists of the IP fragment command and the next route 
2975  *        command which points to the final destination.
2976  *
2977  *        The IP fragment command can be combined with a single blind patch command to support the IPSEC AH use case in which the SASS 
2978  *        passes the IPSEC AH packet with the blind patch command to the PASS so that the autentication tag can be inserted into the AH 
2979  *        header. The recommended order of the tx commands is as the followings:
2980  *        - pa_CMD_IP_FRAGMENT
2981  *        - pa_CMD_NEXT_ROUTE with flag pa_NEXT_ROUTE_PROC_NEXT_CMD set
2982  *        - pa_CMD_PATCH_DATA 
2983  *
2984  *        The IP fragment command can be also combined with up to two message length patching commands to support the message length 
2985  *        field updating for each IP fragment. This operation is required for certain L2 header which contains a length field such as
2986  *        802.3 and PPPoE. The order of tx command is as the followings:
2987  *        - pa_CMD_PATCH_MSG_LEN (optional)
2988  *        - pa_CMD_PATCH_MSG_LEN (optional)
2989  *        - pa_CMD_IP_FRAGMENT
2990  *        - pa_CMD_NEXT_ROUTE 
2991  */
2993 typedef struct  {
2994     uint16_t  ipOffset; /**< Offset to the IP header. */
2995     uint16_t  mtuSize;  /**< Size of the maximum transmission unit (>= 68) */
2996 } paCmdIpFrag_t;
2998 /**
2999  *  @ingroup palld_api_structures
3000  *  @brief   Message length patching configuration
3001  *
3002  *  @details paPatchMsgLenInfo_t is used to create message length patch command which is used in conjunction with
3003  *           the Ip fragmentation command. This command instruct the PASS to update the message length field within 
3004  *           some L2 protocol header such as 802.3 and PPPoE after the potential IP fragmentation operation.
3005  *
3006  *           The PASS support up to two message length patching operations per IP fragmentation command.
3007  */
3009 typedef struct {
3011   uint8_t    msgLenSize;    /**<  Size of message length field in bytes (@note only 2-byte and 4=byte message length is supported) */
3012   uint8_t    offset;        /**<  Offset from the start of the packet to the message length field */ 
3013   uint16_t   msgLen;        /**<  Message length excluding the IP header and payload length */
3015 } paPatchMsgLenInfo_t;
3017 /**
3018  *  @ingroup palld_api_structures
3019  *  @brief  User-defined Statistics Command
3020  *
3021  *  @details paCmdUsrStats_t is used to specify the desired User-defined counter. The user stats command 
3022  *           instructs the PASS to update the specified user-defined counter and all the counters which are 
3023  *           linked to this counter 
3024  *           It is one of the command which can be embedded within the @ref paRouteInfo_t. 
3025  */
3026 typedef struct {
3027   uint16_t    index;        /**< User-defined statistics index */
3028 } paCmdUsrStats_t;
3030 /**
3031  *  @ingroup palld_api_structures
3032  *  @brief  Command Set plus User-defined Statistics Command
3033  *
3034  *  @details paCmdSetUsrStats_t is used to specify the desired PA command set and User-defined counter. This command
3035  *           provides the module user a mechanism to specify different user-defined counters with the same command set 
3036  *           for different LUT entries and vice versa. 
3037  *           This command instructs the PASS to update the specified user-defined counter and all the counters which are 
3038  *           linked to this counter and then execute the specified command set.
3039  *           It is one of the command which can be embedded within the @ref paRouteInfo_t. 
3040  */
3041 typedef struct {
3042   uint16_t    setIndex;          /**< Commad Set Index */
3043   uint16_t    statsIndex;        /**< User-defined statistics index */
3044 } paCmdSetUsrStats_t;
3047 /**
3048  *  @defgroup pktErrInfo  PA Packet Error Info Bit Definitions
3049  *  @ingroup palld_api_constants
3050  *  @{
3051  *
3052  *  @name PA Packet Error Info Bit Definitions
3053  *
3054  *  Bitmap definition of the errorBitfield in @ref paCmdVerifyPktErr_t. 
3055  *         
3056  */ 
3057 /*@{*/
3058 /**
3059  *  @def  pa_PKT_ERR_IP_CHECKSUM
3060  *        Control Info -- Set: Re-direct packet if IP checksum error occurs
3061  *                        Clear: Ignore IP checksum Error
3062  */
3063 #define pa_PKT_ERR_IP_CHECKSUM                 0x0001 
3064 /**
3065  *  @def  pa_PKT_ERR_L4_CHECKSUM
3066  *        Control Info -- Set: Re-direct packet if UDP/TCP checksum error occurs
3067  *                        Clear: Ignore UDP/TCP checksum Error
3068  */
3069 #define pa_PKT_ERR_L4_CHECKSUM                 0x0002 
3070 /**
3071  *  @def  pa_PKT_ERR_CRC
3072  *        Control Info -- Set: Re-direct packet if CRC error occurs
3073  *                        Clear: Ignore CRC Error
3074  */
3075 #define pa_PKT_ERR_CRC                         0x0004 
3076 /*@}*/
3077 /** @} */
3078  
3079 /**
3080  *  @ingroup palld_api_structures
3081  *  @brief  Verify Packet Error Command
3082  *
3083  *  @details paCmdVerifyPktErr_t is used to construct the "Verify Packet Error" command. The  
3084  *           IPv4 header checksum, UDP/TCP checksum and SCTP CRC-32c checksum verification are performed by 
3085  *           the PASS autonomously while the CRC verification is performed per command. The corresponding error bit 
3086  *           in the CPPI descriptor will be set and can be verified by the application when packet is delivered 
3087  *           to the host. This command instructs PASS to examine the specified error flags and forward the error 
3088  *           packet accordingly.
3089  */
3091 typedef struct {
3093   uint16_t errorBitfield;   /**<  Packet Error information as defined at @ref pktErrInfo */
3094   uint8_t  dest;            /**<  Packet destination as defined at @ref pktDest */
3095   uint8_t  flowId;          /**<  For host destination, specifies CPPI flow which defines free queues are used for receiving packets */
3096   uint16_t queue;           /**<  For host destination, specifies the destination queue */
3097   uint32_t swInfo0;         /**<  Placed in SwInfo0 for packets to host */
3098 } paCmdVerifyPktErr_t;
3100 /**
3101  *  @defgroup efOpCtrlInfo  PA Egress Flow Command Control Info Bit Definitions
3102  *  @ingroup palld_api_constants
3103  *  @{
3104  *
3105  *  @name PA Egress Flow Command Control Info Bit Definitions
3106  *
3107  *  Bitmap definition of the ctrlBitField in @ref paCmdEfOp_t. 
3108  */ 
3109 /*@{*/
3110 /**
3111  *  @def  pa_EF_OP_CMD_FC_LOOKUP
3112  *        Control Info -- Set: Perform flow cache lookup to look for the associated packet modification records per match
3113  *                        Clear: Skip flow cache lookup and use the packet modification records specified in this command.
3114  */
3115 #define pa_EF_OP_CMD_FC_LOOKUP             0x0001 
3116 /**
3117  *  @def  pa_EF_OP_CMD_VALID_LVL1
3118  *        Control Info -- Egress Flow level 1 index is present
3119  */
3120 #define pa_EF_OP_CMD_VALID_LVL1            0x0010 
3121 /**
3122  *  @def  pa_EF_OP_CMD_VALID_LVL2
3123  *        Control Info -- Egress Flow level 2 index is present
3124  */
3125 #define pa_EF_OP_CMD_VALID_LVL2            0x0020 
3126 /**
3127  *  @def  pa_EF_OP_CMD_VALID_LVL3
3128  *        Control Info -- Egress Flow level 3 index is present
3129  */
3130 #define pa_EF_OP_CMD_VALID_LVL3            0x0040 
3131 /**
3132  *  @def  pa_EF_OP_CMD_VALID_LVL4
3133  *        Control Info -- Egress Flow level 4 index is present
3134  */
3135 #define pa_EF_OP_CMD_VALID_LVL4            0x0080 
3136 /*@}*/
3137 /** @} */
3139 /**
3140  *  @ingroup palld_api_structures
3141  *  @brief  Egress Flow Operation Command 
3142  *
3143  *  @details paCmdEfOp_t is used to create Egress Flow operation command which instructs 
3144  *           the PASS to perform optional flow cache lookup to find the associated 
3145  *           packet modification records or provides those records in the command. Then
3146  *           PASS will execute the specified packet modification records in order to 
3147  *           perform one or multiple of the following actions:
3148  *           - Update inner L3/L4 headers
3149  *           - Insert or update outer L3 header
3150  *           - Insert IPSEC header and trailer
3151  *           - Perform inner and/or outer IP fragmentation
3152  *           - Insert or update L2 header
3153  */
3155 typedef struct {
3157   uint16_t    ctrlBitfield; /**< Egress Flow operation control information as defined at @ref efOpCtrlInfo */
3158   uint16_t    l2Offset;     /**< Offset to the layer 2 header from SOP */
3159   uint16_t    l3Offset;     /**< Offset to the outer IP from SOP */
3160   uint16_t    l3Offset2;    /**< Offset to the inner IP from SOP, which should be set to L3Offset if there is 
3161                                  only one IP layer */
3162   uint16_t    ipsecOffset;  /**< Offset to the IPSEC ESP/AH header if the IPSEC header resides in the egress
3163                                  packets */                                     
3164   uint16_t    endOffset;     /**< Offset to the end of L4 (UDP/UDPLite/TCP) payload */
3165   uint16_t    lvl1Index;    /**< Specify egress flow level 1 record index */
3166   uint16_t    lvl2Index;    /**< Specify egress flow level 2 record index */
3167   uint16_t    lvl3Index;    /**< Specify egress flow level 3 record index */
3168   uint16_t    lvl4Index;    /**< Specify egress flow level 4 record index */
3169 } paCmdEfOp_t;
3171 /**
3172  * @ingroup palld_api_structures
3173  * @brief PA Command Information structure
3174  *
3175  * @details Data structure defines PA commands. The PA command can be invoked by the @ref paRouteInfo_t as a simple command. 
3176  *          They are the building blocks for function @ref Pa_configCmdSet to create a list of commands refered as a command
3177  *          set in the from-network direction. They can be used by the function @ref Pa_formatTxCmd to create or update the
3178  *          list of tx commands.
3179  *
3180  */
3181 typedef struct {
3182   uint16_t    cmd;         /**< Specify the PA command code as defined at @ref paCmdCode */
3183   union {
3184     paCmdNextRoute_t   route;    /**< Specify nextRoute command specific parameters */
3185     paTxChksum_t       chksum;   /**< Specify Tx Checksum command specific parameters */
3186     paCmdCrcOp_t       crcOp;    /**< Specify CRC operation command specific parameters */
3187     paCmdCopy_t        copy;     /**< Specify Copy command specific parameters */
3188     paPatchInfo_t      patch;    /**< Specify Patch command specific parameters */
3189     paPayloadInfo_t    payload;  /**< Specify the payload information required by SA */
3190     paCmdSet_t         cmdSet;   /**< Specify Command Set command specific parameters */
3191     paCmdMultiRoute_t  mRoute;   /**< Specify Multi-route command specific parameters */
3192     paCmdTxTimestamp_t txTs;     /**< Specify Report Tx Timestamp command specific parameters */
3193     paCmdIpFrag_t      ipFrag;   /**< Specify IP fragmentation command specific parameters */
3194     paCmdUsrStats_t    usrStats; /**< Specify User-defined Statistics command specific parameters */
3195     paCmdSetUsrStats_t cmdSetUsrStats; /**< Specify Command Set and User-defined Statistics command specific parameters */
3196     paPatchMsgLenInfo_t patchMsgLen;   /**< Specify Patch Message Length command specific parameters */
3197     paCmdVerifyPktErr_t verifyPktErr;  /**< Specify Packet error Verification command specific parameters */
3198     paCmdSplitOp_t      split;   /**< Specify Split command sepcific parameters */
3199     paCmdEfOp_t         efOp;    /**< Specify Egress Flow operation command specific parameters */
3200   }params;                      /**< Contain the command specific parameters */
3202 } paCmdInfo_t;
3204 /**
3205  *  @ingroup palld_api_structures
3206  *  @brief  IP lookup information
3207  *
3208  *  @details  paIpInfo_t is used to specifiy the IPv4 or IPv6 parameters used in packet routing.
3209  *            With the exception of parameter tos, a value of 0 in any parameter means that that
3210  *            field is not used in packet routing. Since a value of 0 is valid for tos, the paramter
3211  *            tosCare is used to indicate if the tos field (IPv4) or traffic class (Ipv6) is used 
3212  *            for packet routing.
3213  */
3214 typedef struct  {
3216   paIpAddr_t  src;       /**<  Source IP address */
3217   paIpAddr_t  dst;       /**<  Destination IP address */
3218   uint32_t    spi;       /**<  ESP or AH header Security Parameters Index */
3219   uint32_t    flow;      /**<  IPv6 flow label in 20 lsbs */
3220   int         ipType;    /**<  @ref IpValues */
3221   uint16_t    greProto;  /**<  GRE protocol field */
3222   uint8_t     proto;     /**<  IP Protocol (IPv4) / Next Header (IPv6) */
3223   uint8_t     tos;       /**<  IP Type of Service (IPv4) / Traffic class (IPv6) */
3224   uint16_t    tosCare;   /**<  TRUE if the tos value is used for matching */
3225   uint16_t    sctpPort;  /**<  SCTP Destination Port */
3226 } paIpInfo_t;
3227   
3228 /**
3229  *  @defgroup paIpInfoValidBits  PA IP Info Valid Bit Definitions
3230  *  @ingroup palld_api_constants
3231  *  @{
3232  *
3233  *  @name PA IP Info Valid Bit Definitions
3234  *
3235  *  Bitmap definition of the validBitmap in @ref paIpInfo2_t. 
3236  */ 
3237 /*@{*/
3238 /**
3239  *  @def  pa_IP_INFO_VALID_SRC
3240  *        - Source IP address is present
3241  */
3242 #define pa_IP_INFO_VALID_SRC                (1<<0)
3244 /**
3245  *  @def  pa_IP_INFO_VALID_DST
3246  *        - Destination IP address is present
3247  */
3248 #define pa_IP_INFO_VALID_DST                (1<<1)
3250 /**
3251  *  @def  pa_IP_INFO_VALID_SPI
3252  *        - 32-bit Security Parameters Index of IPSEC ESP/AH is present
3253  */
3254 #define pa_IP_INFO_VALID_SPI                (1<<2)
3256 /**
3257  *  @def  pa_IP_INFO_VALID_FLOW
3258  *        - IPv6 flow label is present
3259  */
3260 #define pa_IP_INFO_VALID_FLOW               (1<<3)
3262 /**
3263  *  @def  pa_IP_INFO_VALID_GREPROTO
3264  *        - GRE protocol field is present
3265  */
3266 #define pa_IP_INFO_VALID_GREPROTO           (1<<4)
3268 /**
3269  *  @def  pa_IP_INFO_VALID_PROTO
3270  *        - IPv4 protocol or IPv6 next header is present
3271  */
3272 #define pa_IP_INFO_VALID_PROTO              (1<<5)
3274 /**
3275  *  @def  pa_IP_INFO_VALID_TOS
3276  *        - IPv4 type of service or IPv6 traffic class is present
3277  */
3278 #define pa_IP_INFO_VALID_TOS                (1<<6)
3280 /**
3281  *  @def  pa_IP_INFO_VALID_SCTPPORT
3282  *        - SCTP destination port is present
3283  */
3285 #define pa_IP_INFO_VALID_SCTPPORT           (1<<7)
3287 /* @} */ /* ingroup */
3288 /** @} */
3290 /**
3291  *  @ingroup palld_api_structures
3292  *  @brief  Enhanced IP lookup information
3293  *
3294  *  @details  paIpInfo2_t is the upgraded version of paIpInfo_t to support additional IP lookup 
3295  *            parameters over time while still maintaining backward compatibility. Future feature 
3296  *            enhancements will be supported through this API data structure only.
3297  *
3298  *            Since not all fields are used all the time, validBitmap is used to specify which field 
3299  *            is used for packet classification. 
3300  */
3301 typedef struct  {
3302   uint32_t    validBitMap;/**<  32-bit valid Bitmap corresponding to each optional field as defined at @ref paIpInfoValidBits */
3303   paIpAddr_t  src;        /**<  Source IP address */
3304   paIpAddr_t  dst;        /**<  Destination IP address */
3305   uint32_t    spi;        /**<  ESP or AH header Security Parameters Index */
3306   uint32_t    flow;       /**<  IPv6 flow label in 20 lsbs */
3307   int         ipType;     /**<  Mandatory if src or dst is valid @ref IpValues */
3308   uint16_t    greProto;   /**<  GRE protocol field */
3309   uint8_t     proto;      /**<  IP Protocol (IPv4) / Next Header (IPv6) */
3310   uint8_t     tos;        /**<  IP Type of Service (IPv4) / Traffic class (IPv6) */
3311   uint16_t    sctpPort;   /**<  SCTP Destination Port */
3312 } paIpInfo2_t;
3314 /**
3315  *  @ingroup palld_api_structures
3316  *  @brief  MAC/Ethernet lookup information
3317  *
3318  *  @details  paEthInfo_t is used to specify the MAC/Ethernet parameters used in packet classification.
3319  *            A value in 0 for any of the fields indicates that the field is not used for
3320  *            packet classification.
3321  */
3322 typedef struct  {
3323   paMacAddr_t        src;           /**< Source MAC addresss  */
3324   paMacAddr_t        dst;           /**< Destination MAC address */
3325   uint16_t           vlan;          /**< VLAN tag VID field, 12 lsbs  */
3326   uint16_t           ethertype;     /**< Ethertype field. */
3327   uint32_t           mplsTag;       /**< MPLS tag. Only the outer tag is examined */
3328   uint16_t           inport;        /**< Input EMAC port number as specified by @ref paEmacPort */
3329 } paEthInfo_t;
3331 /**
3332  *  @defgroup paEthInfoValidBits  PA ETH Info Valid Bit Definitions
3333  *  @ingroup palld_api_constants
3334  *  @{
3335  *
3336  *  @name PA ETH Info Valid Bit Definitions
3337  *
3338  *  Bitmap definition of the validBitmap in @ref paEthInfo2_t. 
3339  */ 
3340 /*@{*/
3342 /**
3343  *  @def  pa_ETH_INFO_VALID_SRC
3344  *        - Source MAC is present
3345  */
3346 #define pa_ETH_INFO_VALID_SRC                   (1<<0)
3348 /**
3349  *  @def  pa_ETH_INFO_VALID_DST
3350  *        - Destination MAC is present
3351  */
3352 #define pa_ETH_INFO_VALID_DST                   (1<<1)
3354 /**
3355  *  @def  pa_ETH_INFO_VALID_VLAN
3356  *        - VLAN ID is present
3357  */
3358 #define pa_ETH_INFO_VALID_VLAN                  (1<<2)
3360 /**
3361  *  @def  pa_ETH_INFO_VALID_ETHERTYPE
3362  *        - Ether type is present
3363  */
3364 #define pa_ETH_INFO_VALID_ETHERTYPE             (1<<3)
3366 /**
3367  *  @def  pa_ETH_INFO_VALID_MPLSTAG
3368  *        - MPLS tag is present
3369  */
3370 #define pa_ETH_INFO_VALID_MPLSTAG               (1<<4)
3372 /**
3373  *  @def  pa_ETH_INFO_VALID_INPORT
3374  *        - Input EMAC port is present
3375  */
3376 #define pa_ETH_INFO_VALID_INPORT                (1<<5)
3378 /* @} */ /* ingroup */
3379 /** @} */
3381 /**
3382  *  @ingroup palld_api_structures
3383  *  @brief  Enhanced MAC/Ethernet lookup information
3384  *
3385  *  @details  paEthInfo2_t is the upgraded version of paEthInfo_t to support additional MAC lookup 
3386  *            parameters over time while still maintaining backward compatibility. Future feature 
3387  *            enhancements will be supported through this API data structure only.
3388  *
3389  *            Since not all fields are used all the time, validBitmap is used to specify which field 
3390  *            is used for packet classification. 
3391  *
3392  */
3393 typedef struct  {
3394   uint32_t           validBitMap;   /**< 32-bit valid Bitmap corresponding to each optional field as defined at @ref paEthInfoValidBits */
3395   paMacAddr_t        src;           /**< Source MAC addresss  */
3396   paMacAddr_t        dst;           /**< Destination MAC address */
3397   uint16_t           vlan;          /**< VLAN tag VID field, 12 lsbs  */
3398   uint16_t           ethertype;     /**< Ethertype field. */
3399   uint32_t           mplsTag;       /**< MPLS tag. Only the outer tag is examined */
3400   uint16_t           inport;        /**< Input EMAC port number as specified by @ref paEmacPort */
3401 } paEthInfo2_t;
3403 /**
3404  *  @defgroup paAclInfoValidBit  PA ACL Matching Info Valid Bit Definitions
3405  *  @ingroup palld_api_constants
3406  *  @{
3407  *
3408  *  @name PA ACL Matching Info Valid Bit Definitions
3409  *  Bitmap definition of the validBitfield in paAclInfo_t. 
3410  *  It allows selective ACL matching parameters
3411  */ 
3412 /*@{*/
3413 /**
3414  *  @def  pa_ACL_INFO_VALID_SRC_IP
3415  *        srcIp is present
3416  */
3417 #define pa_ACL_INFO_VALID_SRC_IP            0x0001 
3418 /**
3419  *  @def  pa_ACL_INFO_VALID_SRC_IP_MASK
3420  *        srcIpMask is present. This flag is valid only if srcIp is present.
3421  *        If srcIp is present and this flag is clear, it means all IP address bits are valid.
3422  */
3423 #define pa_ACL_INFO_VALID_SRC_IP_MASK       0x0002 
3424 /**
3425  *  @def  pa_ACL_INFO_VALID_DST_IP
3426  *        dstIp is present
3427  */
3428 #define pa_ACL_INFO_VALID_DST_IP            0x0004 
3429 /**
3430  *  @def  pa_ACL_INFO_VALID_DST_IP_MASK
3431  *        dstIpMask is present. This flag is valid only if dstIp is present.
3432  *        If dstIp is present and this flag is clear, it means all IP address bits are valid.
3433  */
3434 #define pa_ACL_INFO_VALID_DST_IP_MASK       0x0008 
3435 /**
3436  *  @def  pa_ACL_INFO_VALID_CTRL_FLAG
3437  *        ctrlFlag and ctrlFlagMask are present
3438  */
3439 #define pa_ACL_INFO_VALID_CTRL_FLAG         0x0010
3440 /**
3441  *  @def  pa_ACL_INFO_VALID_PROTO
3442  *        proto is present
3443  */
3444 #define pa_ACL_INFO_VALID_PROTO             0x0020 
3445 /**
3446  *  @def  pa_ACL_INFO_VALID_DSCP
3447  *        dscp is present
3448  */
3449 #define pa_ACL_INFO_VALID_DSCP              0x0040 
3450 /**
3451  *  @def  pa_ACL_INFO_VALID_SRC_PORT
3452  *        srcPortBegin and srcPortEnd  are present */
3453 #define pa_ACL_INFO_VALID_SRC_PORT          0x0100 
3454 /**
3455  *  @def  pa_ACL_INFO_VALID_DST_PORT
3456  *        dstPortBegin and dstPortEnd are present */
3457 #define pa_ACL_INFO_VALID_DST_PORT          0x0200 
3459 /*@}*/
3460 /** @} */
3462 /**
3463  *  @defgroup paAclInfoCtrlFlags  PA ACL Info Control Flag Definitions
3464  *  @ingroup palld_api_constants
3465  *  @{
3466  *
3467  *  @name PA ACL Info Control Flag Definitions
3468  *  Bitmap definition of the ctrlFlags and ctrlFlagsMask in paAclnfo_t. 
3469  */ 
3470 /*@{*/
3471 /**
3472  *  @def  pa_ACL_INFO_CONTROL_FLAG_FRAG
3473  *        Flag -- 1: IP fragments 
3474  */
3475 #define pa_ACL_INFO_CONTROL_FLAG_FRAG           0x0001 
3476 /**
3477  *  @def  pa_ACL_INFO_CONTROL_FLAG_CONTAIN_L4
3478  *        Flag -- 1: Packet or fragment which conatins L4 header 
3479  */
3480 #define pa_ACL_INFO_CONTROL_FLAG_CONTAIN_L4     0x0002 
3481 /*@}*/
3482 /** @} */
3484 /**
3485  *  @ingroup palld_api_structures
3486  *  @brief  ACL lookup information
3487  *
3488  *  @details  paAclInfo_t is used to specifiy the ACL matching parameters.
3489  */
3490 typedef struct  {
3491   uint16_t    validBitMap;  /**< Specify valid parameters as defined at @ref paAclInfoValidBit */
3492   uint16_t    ctrlFlag;     /**< Specify ACL contrl flags as defined at @ref paAclInfoCtrlFlags */
3493   uint16_t    ctrlFlagMask; /**< ACL control flag valid masks */
3494   uint16_t    ipType;       /**< @ref IpValues */
3495   paIpAddr_t  srcIp;        /**< Source IP address */
3496   paIpAddr_t  srcIpMask;    /**< Source IP subnet mask*/
3497   paIpAddr_t  dstIp;        /**< Destination IP address */
3498   paIpAddr_t  dstIpMask;    /**< Destination IP subnet mask */
3499   uint8_t     proto;        /**< IP Protocol (IPv4) / Next Header (IPv6) */
3500   uint8_t     dscp;         /**< DSCP value */
3501   uint16_t    srcPortBegin; /**< Minimum Source Port Number */
3502   uint16_t    srcPortEnd;   /**< Maximum Source Port Number */
3503   uint16_t    dstPortBegin; /**< Minimum Destinatio Port Number */
3504   uint16_t    dstPortEnd;   /**< Maximum Destinatio Port Number */
3505 } paAclInfo_t;
3507 /** 
3508  * @ingroup palld_api_structures
3509  * @brief SRIO Type11 header information
3510  *
3511  * @details  The structure describes the SRIO type 11 specific Lo-L2 header information.
3512  */
3513 typedef struct paSrioType11Info_s
3515     uint16_t      mbox;     /**< Mail Box */
3516     uint16_t      letter;   /**< Letter Identifier */
3517 } paSrioType11Info_t;
3519 /**
3520  * @ingroup palld_api_structures
3521  * @brief SRIO Type9 header information
3522  *
3523  * @details  The structure describes the SRIO type 9 specific L0-L2 header information.
3524  */
3525 typedef struct paSrioType9Info_s
3527     uint16_t        streamId;  /**< Stream identifier */
3528     uint16_t        cos;       /**< Class of service  */
3529 } paSrioType9Info_t;
3532 /**
3533  * @ingroup palld_api_structures
3534  * @brief  Srio message type specific header information
3535  *
3536  * @details  This union is used to specify the SRIO type specific header information to the module. 
3537  *            The type in the union is determined through other parameters passed to the module 
3538  *            (see @ref srioMessageTypes).
3539  */
3540 typedef union  {
3542   paSrioType9Info_t  type9;   /**< SRIO type 9 specific information */
3543   paSrioType11Info_t type11;  /**< SRIO type 11 specific information */
3544   
3545 } paSrioTypeInfo_t;
3547 /**
3548  *  @defgroup  srioMessageTypes SRIO Message types
3549  *  @ingroup palld_api_constants
3550  *  @{
3551  *
3552  *  @name   SRIO Type Values
3553  *  @brief  Defines the SRIO message types.
3554  *
3555  *  @details The packet accelerator sub-system parses both SRIO Type 9 and Type 11 message headers (see @ref netlayers). 
3556  *           This group is used to distinguish which type of header will be used.
3557  */
3558 /* @{ */
3559 /**
3560  *  @def  pa_SRIO_TYPE_9
3561  *        SRIO Message Type 9
3562  */
3563 #define  pa_SRIO_TYPE_9    9
3565 /**
3566  *  @def  pa_SRIO_TYPE_11
3567  *        SRIO Message Type 11
3568  */
3569 #define  pa_SRIO_TYPE_11   11
3570   
3571 /*  @}  */  
3572 /** @} */
3574 /**
3575  *  @defgroup  srioTransportTypes SRIO Transport types
3576  *  @ingroup palld_api_constants
3577  *  @{
3578  *
3579  *  @name   SRIO Transport Type Values
3580  *  @brief  Defines the SRIO tansport types used.
3581  *
3582  */
3583 /* @{ */
3584 /**
3585  *  @def  pa_SRIO_TRANSPORT_TYPE_0
3586  *        SRIO Transport type 0: 8 bit device identifiers 
3587  */
3588 #define  pa_SRIO_TRANSPORT_TYPE_0    0
3590 /**
3591  *  @def  pa_SRIO_TRANSPORT_TYPE_1
3592  *        SRIO Transport type 1: 16 bit device identifiers
3593  */
3594 #define  pa_SRIO_TRANSPORT_TYPE_1    1
3595   
3596 /*  @}  */  
3597 /** @} */
3599 /**
3600  *  @defgroup paSrioInfoValidBits  PA SRIO Info Valid Bit Definitions
3601  *  @ingroup palld_api_constants
3602  *  @{
3603  *
3604  *  @name PA SRIO Info Valid Bit Definitions
3605  *
3606  *  Bitmap definition of the validBitMap in @ref paSrioInfo_t. 
3607  */ 
3608 /*@{*/
3609 /**
3610  *  @def  pa_SRIO_INFO_VALID_SRC_ID
3611  *        - srcId is present
3612  */
3613 #define pa_SRIO_INFO_VALID_SRC_ID               0x0001 
3614 /**
3615  *  @def  pa_SRIO_INFO_VALID_DEST_ID
3616  *        - destId is present
3617  */
3618 #define pa_SRIO_INFO_VALID_DEST_ID              0x0002 
3619 /**
3620  *  @def  pa_SRIO_INFO_VALID_ID
3621  *        - Id is present
3622  */
3623 #define pa_SRIO_INFO_VALID_ID                  (pa_SRIO_INFO_VALID_SRC_ID | pa_SRIO_INFO_VALID_DEST_ID)  
3625 /**
3626  *  @def  pa_SRIO_INFO_VALID_CC
3627  *        - cc is present
3628  */
3629 #define pa_SRIO_INFO_VALID_CC                   0x0004 
3630 /**
3631  *  @def  pa_SRIO_INFO_VALID_PRI
3632  *        - pri is present
3633  */
3634 #define pa_SRIO_INFO_VALID_PRI                  0x0008 
3635 /**
3636  *  @def  pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID
3637  *        - typeInfo.type9.streamId is present
3638  */
3639 #define pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID   0x0010 
3640 /**
3641  *  @def  pa_SRIO_INFO_VALID_TYPE_INFO_COS
3642  *        - typeInfo.type9.cos is present
3643  */
3644 #define pa_SRIO_INFO_VALID_TYPE_INFO_COS        0x0020
3645 /**
3646  *  @def  pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX
3647  *        - typeInfo.type11.mbox is present
3648  */
3649 #define pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX    0x0010 
3650 /**
3651  *  @def  pa_SRIO_INFO_VALID_TYPE_INFO_LETTER
3652  *        - typeInfo.type11.letter is present
3653  */
3654 #define pa_SRIO_INFO_VALID_TYPE_INFO_LETTER     0x0020
3655 /**
3656  *  @def  pa_SRIO_INFO_VALID_TYPE_INFO
3657  *        - typeInfo is present
3658  */
3659 #define pa_SRIO_INFO_VALID_TYPE_INFO            (pa_SRIO_INFO_VALID_TYPE_INFO_COS       |   \
3660                                                  pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID  |   \
3661                                                  pa_SRIO_INFO_VALID_TYPE_INFO_LETTER    |   \
3662                                                  pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX )     
3663 /* @} */ /* ingroup */
3664 /** @} */
3667 /**
3668  *  @ingroup palld_api_structures
3669  *  @brief  SRIO lookup information
3670  *
3671  *  @details  srioIpInfo_t is used to specifiy the SRIO type 9 and type 11 L0-L2 parameters used in packet routing.
3672  *            set the corresponding valid bit at validBitmap for the parameters required for SRIO message
3673  *            classification.  
3674  *            Where tt should be provided if srcId or destId is required
3675  *                  msgType should be provided if typeInfo is required 
3676  */
3677 typedef struct  {
3679   uint16_t    validBitMap;   /**< Specify which parameters are valid as defined at @ref paSrioInfoValidBits */
3680   uint16_t    srcId;         /**< Source ID */
3681   uint16_t    destId;        /**< Destination ID */
3682   uint16_t    tt;            /**< Transport Type: 16 bit or 8 bit identifiers as defined at @ref srioTransportTypes */  
3683   uint16_t    cc;            /**< Completion code */
3684   uint16_t    pri;           /**< 3-bit priority */
3685   uint16_t    msgType;       /**< Message type as defined at @ref srioMessageTypes */
3686   paSrioTypeInfo_t typeInfo; /**< Message Type specific parameters */
3687 } paSrioInfo_t;
3690 /**
3691  *  @ingroup palld_api_structures
3692  *  @brief  Packet routing configuration
3693  *
3694  *  @details paRouteInfo_t is used to specify the physical routing of packets out of the packet accelerator
3695  *           sub-system. Not all fields are required for all destinations. 
3696  *  @li      pa_DEST_DISCARD: none
3697  *  @li      pa_DEST_CONTINUE_PARSE_LUT1: 
3698  *  @li      pa_DEST_CONTINUE_PARSE_LUT2: customType, customIndex
3699  *  @li      pa_DEST_HOST: flowId, queue, mRoutehandle, swInfo0, cmd
3700  *  @li      pa_DEST_SASS: flowId, queue, swInfo0, swInfo1, cmd
3701  *  @li      pa_DEST_ETH: emacCtrl
3702  *  @li      pa_DEST_SRIO: flowId, queue, swInfo0, swInfo2, pktType
3703  */
3704 typedef struct  {
3706   int      dest;                  /**<  Packet destination as defined at @ref pktDest */
3707   uint8_t  flowId;                /**<  For host, SA or SRIO destinations, specifies CPPI flow which defines free queues are used for receiving packets */
3708   uint16_t queue;                 /**<  For host, SA or SRIO destinations, specifies the destination queue */
3709   int      mRouteIndex;           /**<  For host, Multi-queue routing index (0 to (@ref pa_MAX_MULTI_ROUTE_SETS - 1)) 
3710                                         or @ref pa_NO_MULTI_ROUTE if multi routing not used */
3711   uint32_t swInfo0;               /**<  Placed in SwInfo0 for packets to host or SA; Placed in the PS Info for packets to SRIO */
3712   uint32_t swInfo1;               /**<  Placed in SwInfo1 for packets to the SA; Placed in the PS Info for packets to SRIO */
3713   int      customType;            /**<  For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom type as defined at @ref customType */
3714   uint8_t  customIndex;           /**<  For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom classification entry index */                                
3715   uint8_t  pktType_emacCtrl;      /**<  For destination SRIO, specify the 5-bit packet type toward SRIO 
3716                                         For destination HOST, EMAC, specify the EMAC control @ref emcOutputCtrlBits to the network */
3717   paCmdInfo_t *pCmd;              /**<  Pointer to the Command info to be executed prior to the packet forwarding. 
3718                                         NULL: no commads 
3719                                         @note only the following commands are supported within paRouteInfo_t 
3720                                               - pa_CMD_PATCH_DATA (up to two bytes only) (LUT2 only)
3721                                               - pa_CMD_CMDSET
3722                                               - pa_CMD_USR_STATS
3723                                               - pa_CMD_CMDSET_AND_USR_STATS 
3724                                    */                                                                                    
3726 } paRouteInfo_t;
3728 /**
3729  *   @def  pa_NO_MULTI_ROUTE
3730  *         Multi Route not enabled in this route
3731  */
3732 #define pa_NO_MULTI_ROUTE   -1
3734 /**
3735  *   @def  pa_MAX_MULTI_ROUTE_SETS
3736  *         The maximum number of multi-route sets supported
3737  */
3738 #define pa_MAX_MULTI_ROUTE_SETS     32
3740 /**
3741  *   @def  pa_MAX_MULTI_ROUTE_ENTRIES
3742  *         The maximum number of multi-route entries per muli-route set
3743  */
3744 #define pa_MAX_MULTI_ROUTE_ENTRIES   8
3746 /**
3747  *  @defgroup paEfOpInfoCtrlFlags  PA Egress Flow Operation Info Control Flag Definitions
3748  *  @ingroup palld_api_constants
3749  *  @{
3750  *
3751  *  @name PA Egress Flow Operation Info Control Flag Definitions
3752  *  Bitmap definition of the ctrlFlags in @ref paEfOpInfo_t. 
3753  */ 
3754 /*@{*/
3755 /**
3756  *  @def  pa_EF_OP_CONTROL_FLAG_FC_LOOKUP
3757  *        Flag -- 1: Perform Flow Cache lookup 
3758  *                0: Do not perform Flow Cache lookup, use the Eflow records specified within @ref paEfOpInfo_t 
3759  */
3760 #define pa_EF_OP_CONTROL_FLAG_FC_LOOKUP           0x0001 
3761 /*@}*/
3762 /** @} */
3764 /**
3765  *  @defgroup paEfOpInfoValidBit  PA Egress Flow Operation Info Valid Bit Definitions
3766  *  @ingroup palld_api_constants
3767  *  @{
3768  *
3769  *  @name PA Egress Flow Operation Info Valid Bit Definitions
3770  *  Bitmap definition of the validBitfield in paEfOpInfo_t. 
3771  *  It allows selective Egress Flow opertaion parameters
3772  */ 
3773 /*@{*/
3774 /**
3775  *  @def  pa_EF_OP_INFO_VALID_LVL1
3776  *        Egress Flow level 1 index is present
3777  */
3778 #define pa_EF_OP_INFO_VALID_LVL1            0x0001 
3779 /**
3780  *  @def  pa_EF_OP_INFO_VALID_LVL2
3781  *        Egress Flow level 2 index is present
3782  */
3783 #define pa_EF_OP_INFO_VALID_LVL2            0x0002 
3784 /**
3785  *  @def  pa_EF_OP_INFO_VALID_LVL3
3786  *        Egress Flow level 3 index is present
3787  */
3788 #define pa_EF_OP_INFO_VALID_LVL3            0x0004 
3789 /**
3790  *  @def  pa_EF_OP_INFO_VALID_LVL4
3791  *        Egress Flow level 4 index is present
3792  */
3793 #define pa_EF_OP_INFO_VALID_LVL4            0x0008 
3795 /*@}*/
3796 /** @} */
3798 /**
3799  *  @ingroup palld_api_structures
3800  *  @brief  Egress Flow operation information
3801  *
3802  *  @details  paEfOpInfo_t is used to specifiy the Egress Flow operation parameters.
3803  */
3804 typedef struct  {
3805   uint16_t    ctrlFlags;    /**< Specify Egress flow control flags as defined at @ref paEfOpInfoCtrlFlags */
3806   uint16_t    validBitmap;  /**< Specify valid parameters as defined at @ref paEfOpInfoValidBit */
3807   uint16_t    lvl1Index;    /**< Specify egress flow level 1 record index */
3808   uint16_t    lvl2Index;    /**< Specify egress flow level 2 record index */
3809   uint16_t    lvl3Index;    /**< Specify egress flow level 3 record index */
3810   uint16_t    lvl4Index;    /**< Specify egress flow level 4 record index */
3811 } paEfOpInfo_t;
3814 /**
3815  @defgroup paPriorityRouteMode Priority-based routing mode
3816  *  @ingroup palld_api_constants
3817  *  @{
3818  *
3819  *  @name Priority-based routing mode
3820  *
3821  *  paRoutePriority_e is used to specify the mode of priority-based routing.
3822  *  PASS forwards the matched packets to the desired QoS queue which is equal
3823  *  to the base queue plus an offset specified by the VLAN priority or DSCP value
3824  *  in prority-based routing.
3825  *
3826  *  @note: There is some use cases where output packets from QoS are delivered to
3827  *         PASS for pre-routing operation such as tx timestamp report and both 
3828  *         egress and ingress forwarding packets go through the same QoS. To support
3829  *         this use case, the PASS is enhanced to delay the post-classification command
3830  *         set execution until the packets re-entering PASS from QoS if Priority-based
3831  *         routing is selected. 
3832  */ 
3833 /** @ingroup paPriorityRouteMode */
3834 /*@{*/
3835 typedef enum {
3836   pa_ROUTE_PRIORITY_VLAN = 1, /**< Route by using VLAN bits as priority */
3837   pa_ROUTE_PRIORITY_DSCP      /**< Route by using DSCP bits as priority */
3838 } paRoutePriority_e;
3840 /*@}*/
3841 /** @} */
3843 /**
3844  *  @defgroup paRouteInfoValidBits  PA Route Info Valid Bit Definitions
3845  *  @ingroup palld_api_constants
3846  *  @{
3847  *
3848  *  @name PA Route Info Valid Bit Definitions
3849  *
3850  *  Bitmap definition of the validBitMap in @ref paRouteInfo2_t. 
3851  */ 
3852 /*@{*/
3854 /**
3855  *  @def  pa_ROUTE_INFO_VALID_MROUTEINDEX
3856  *        - Optional parameter mRouteIndex for Host routing is valid
3857  */
3858 #define pa_ROUTE_INFO_VALID_MROUTEINDEX             (1<<0)
3860 /**
3861  *  @def  pa_ROUTE_INFO_VALID_PKTTYPE_EMAC
3862  *        - Optional parameter pktType_emacCtrl for Host or EMAC routing is valid
3863  */
3864 #define pa_ROUTE_INFO_VALID_PKTTYPE_EMAC            (1<<1)
3866 /**
3867  *  @def  pa_ROUTE_INFO_VALID_PCMD
3868  *        - Optional parameter pCmd is valid
3869  */
3870 #define pa_ROUTE_INFO_VALID_PCMD                    (1<<2)
3872 /**
3873  *  @def  pa_ROUTE_INFO_VALID_PRIORITY_TYPE
3874  *        - Optional parameter priorityType for Host routing is valid
3875  */
3876 #define pa_ROUTE_INFO_VALID_PRIORITY_TYPE           (1<<3)
3878 /**
3879  *  @def  pa_ROUTE_INFO_VALID_EFLOW_INFO
3880  *        - Optional parameter efOpInfo for egress path operation is valid
3881  */
3882 #define pa_ROUTE_INFO_VALID_EFLOW_INFO              (1<<4)
3885 /* @} */ /* ingroup */
3886 /** @} */
3888 /**
3889  *  @ingroup palld_api_structures
3890  *  @brief  Enhanced Packet routing configuration
3891  *
3892  *  @details  paRouteInfo2_t is the upgraded version of paRouteInfo_t to support additional routing 
3893  *            parameters over time while still maintaining backward compatibility. Future feature 
3894  *            enhancements will be supported through this API data structure only.
3895  *
3896  *            The validBitmap is used to specify which field is used for packet routing. 
3897  */
3898 typedef struct  {
3899   uint32_t      validBitMap;      /**< 32-bit valid bitmap corresponding to each optional field as defined at @ref paRouteInfoValidBits */
3900   int           dest;             /**< Packet destination as defined at @ref pktDest */
3901   uint8_t       flowId;           /**< For host, SA or SRIO destinations, specifies CPPI flow which defines free queues are used for receiving packets */
3902   uint16_t      queue;            /**< For host, SA or SRIO destinations, specifies the destination queue */
3903   int           mRouteIndex;      /**< validBitmap[t0] For host, Multi-queue routing index (0 to (@ref pa_MAX_MULTI_ROUTE_SETS - 1) */
3904   uint32_t      swInfo0;          /**< For host, SA or SRIO destinations, placed in SwInfo0 for packets to host or SA; Placed in the PS Info for packets to SRIO */
3905   uint32_t      swInfo1;          /**< For host, SA or SRIO destinations, placed in SwInfo1 for packets to the SA; Placed in the PS Info for packets to SRIO */
3906   int           customType;       /**< For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom type as defined at @ref customType */
3907   uint8_t       customIndex;      /**< For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom classification entry index */                               
3908   uint8_t       pktType_emacCtrl; /**< validBitMap[t1] For destination SRIO, specify the 5-bit packet type toward SRIO
3909                                        For destination HOST, EMAC, specify the EMAC control @ref emcOutputCtrlBits to the network */
3910   paCmdInfo_t  *pCmd;             /**< validBitMap[t2] Pointer to the Command info to be executed prior to the packet forwarding.
3911                                        NULL: no commads
3912                                        @note only the following commands are supported within paRouteInfo_t and paRouteInfo2_t
3913                                         for ingress packets 
3914                                              - pa_CMD_PATCH_DATA (up to two bytes only) (LUT2 only)
3915                                              - pa_CMD_CMDSET
3916                                              - pa_CMD_USR_STATS
3917                                              - pa_CMD_CMDSET_AND_USR_STATS
3918                                        @note the post-classification commands specified by the command set will be executed when the packets re-entering PASS 
3919                                              from the QoS queue if priority-based routing is selected       
3920                                     */                                                                                   
3921   uint8_t       priorityType;     /**< validBitMap[t3]: For Host only, specify VLAN or DSCP priority @ref paRoutePriority_e */
3922   paEfOpInfo_t *efOpInfo;         /**< For EFLOW only, egress flow operation info */  
3923 } paRouteInfo2_t;
3924  
3925 /**
3926  *  @defgroup mrEntryCtrlInfo   Multiroute Entry Control Info Bit Definitions
3927  *  @ingroup palld_api_constants
3928  *  @{
3929  *
3930  *  @name Multiroute Entry Control Info Bit Definitions
3931  *
3932  *  Bitmap definition of the ctrlBitField in @ref paMultiRouteEntry_t. 
3933  */ 
3934 /*@{*/
3935 /**
3936  *  @def  pa_MULTI_ROUTE_DESCRIPTOR_ONLY
3937  *        Control Info -- Set: Send descriptor without packet to the destination
3938  *                        Clear: Send both descriptor and the packet to the destination
3939  *  
3940  */
3941 #define pa_MULTI_ROUTE_DESCRIPTOR_ONLY            0x01 
3942 /*@{*/
3943 /**
3944  *  @def  pa_MULTI_ROUTE_REPLACE_SWINFO
3945  *        Control Info -- Set: Replace the swInfo0 with the value provided here
3946  *                        Clear: Keep the original swInfo0 
3947  *  
3948  */
3949 #define pa_MULTI_ROUTE_REPLACE_SWINFO             0x02 
3950 /*@}*/
3951 /** @} */
3952  
3953 /**
3954  *  @ingroup palld_api_structures
3955  *  @brief  Packet Multi-route entry configuration
3956  *
3957  *  @details paMultiRouteEntry_t is used to specify the physical routing of packets per multi-route entry.
3958  *           It is only a subset of the Routing information defined at @ref paRouteInfo_t because those common 
3959  *           parameters such as swInfo0, swInfo1 must be already present in the packet descriptor.
3960  *           There is no restriction of the destination as long as it is accessible through PKTDMA queue. 
3961  */
3962 typedef struct  {
3964   uint8_t   ctrlBitfield;    /**< Multi-Routing control information as defined at @ref mrEntryCtrlInfo */
3965   uint8_t   flowId;          /**< For host, specifies the CPPI flow which defines the free queues are used for receiving packets */
3966   uint16_t  queue;           /**< For host, specifies the destination queue */
3967   uint32_t  swInfo0;         /**< Placed in SwInfo0 for packets to host */
3969 } paMultiRouteEntry_t;
3971 /**
3972  *  @defgroup paMultiRouteModes Multi-route group configuration mode
3973  *  @ingroup palld_api_constants
3974  *  @{
3975  *
3976  *  @name Multi-route group configuration mode
3977  *
3978  *  Definition of Multi-route group configuration mode supported in PA sub-system
3979  */ 
3980 /** @ingroup paMultiRouteModes */
3981 /*@{*/
3982 typedef enum {
3983   pa_MULTI_ROUTE_MODE_CONFIG = 0, /**< Add or reconfigure the multi-route group */
3984   pa_MULTI_ROUTE_MODE_RESET       /**< Delete the multi-route group */
3985 } paMultiRouteModes_e;
3986 /*@}*/
3987 /** @} */
3989 /**
3990  *  @defgroup paCrcSizes PA CRC Sizes
3991  *  @ingroup palld_api_constants
3992  *  @{
3993  *
3994  *  @name CRC Sizes
3995  *
3996  *  Definition of CRC sizes supported in PA sub-system
3997  */ 
3998 /** @ingroup paCrcSizes */
3999 /*@{*/
4000 typedef enum {
4001   pa_CRC_SIZE_8 = 0,        /**< 8-bit CRC */
4002   pa_CRC_SIZE_16,           /**< 16-bit CRC */
4003   pa_CRC_SIZE_24,           /**< 24-bit CRC */
4004   pa_CRC_SIZE_32            /**< 32-bit CRC */
4005 } paCrcSizes_e;
4006 /*@}*/
4007 /** @} */
4009 /**
4010  *  @defgroup crcConfigCtrlInfo  CRC Engine Configuration Control Info Bit Definitions
4011  *  @ingroup palld_api_constants
4012  *  @{
4013  *
4014  *  @name CRC Engine Configuration Control Info Bit Definitions
4015  *
4016  *  Bitmap definition of the ctrlBitField in @ref paCrcConfig_t. 
4017  */ 
4018 /*@{*/
4019 /**
4020  *  @def  pa_CRC_CONFIG_RIGHT_SHIFT
4021  *        Control Info -- Set: Right shift CRC (b0 to b7)
4022  *                        Clear: Left shift CRC (b7 to b0)
4023  */
4024 #define pa_CRC_CONFIG_RIGHT_SHIFT           0x0001 
4025 /**
4026  *  @def  pa_CRC_CONFIG_INVERSE_RESULT
4027  *        Control Info -- Set: a 'NOT' operation is applied to the final CRC result
4028  */
4029 #define pa_CRC_CONFIG_INVERSE_RESULT        0x0002 
4030 /*@}*/
4031 /** @} */
4033 /**
4034  *  @ingroup palld_api_structures
4035  *  @brief  CRC Engine configuration
4036  *
4037  *  @details paCrcConfig_t is used to configure the CRC engines within the PA sub-system.
4038  *           There is one CRC engine connected to each PDSP in the PA sub-system. It will 
4039  *           be used to perform CRC operation required by some network protocol such as
4040  *           SCTP and/or the user-specified CRC command. It only supports one type of CRC
4041  *           per configuration.
4042  *
4043  *  @note Only one type of CRC calcualtion is supported by one CRC engine per configuration.
4044  *        It is the responsibility of the module user to configure the specific CRC engine by 
4045  *        calling @ref Pa_configCrcEngine.
4046  */
4047  
4048 typedef struct {
4050   uint16_t      ctrlBitfield;   /**< CRC configuration control information as defined at @ref crcConfigCtrlInfo */
4051   paCrcSizes_e  size;           /**< CRC sizes as defined at @ref paCrcSizes_e (obsolote at new device)*/
4052   uint32_t      polynomial;     /**< Specify the CRC polynomial in the format of 0xabcdefgh. For example,
4053                                      x32+x28+x27+x26+x25+x23+x22+x20+x19+x18+x14+x13+x11+x10+x9+x8+x6+1 
4054                                      ==> 0x1EDC6F41
4055                                      x16+x15+x2+1 ==>0x80050000 */
4056   uint32_t      initValue;      /**< CRC initial value (obsolote at new dwvice)*/   
4057 } paCrcConfig_t;
4060 /**
4061  *  @defgroup timestampScalerFactor Timestamp Scaler Factor
4062  *  @ingroup palld_api_constants
4063  *  @{
4064  *
4065  *  @name Timestamp Scaler Factor
4066  *
4067  *  Definition of PA timestamp scaler factor supported in PA sub-system
4068  *
4069  *  @note  pa_TIMESTAMP_SCALER_FACTOR_1 is not supported. It is defined here
4070  *         for reference purpose.
4071  */ 
4072 /** @ingroup timestampScalerFactor */
4073 /*@{*/
4074 typedef enum {
4075   pa_TIMESTAMP_SCALER_FACTOR_1 = -1,       
4076   pa_TIMESTAMP_SCALER_FACTOR_2 = 0,       
4077   pa_TIMESTAMP_SCALER_FACTOR_4,       
4078   pa_TIMESTAMP_SCALER_FACTOR_8,       
4079   pa_TIMESTAMP_SCALER_FACTOR_16,       
4080   pa_TIMESTAMP_SCALER_FACTOR_32,       
4081   pa_TIMESTAMP_SCALER_FACTOR_64,       
4082   pa_TIMESTAMP_SCALER_FACTOR_128,       
4083   pa_TIMESTAMP_SCALER_FACTOR_256,       
4084   pa_TIMESTAMP_SCALER_FACTOR_512,       
4085   pa_TIMESTAMP_SCALER_FACTOR_1024,       
4086   pa_TIMESTAMP_SCALER_FACTOR_2048,       
4087   pa_TIMESTAMP_SCALER_FACTOR_4096,       
4088   pa_TIMESTAMP_SCALER_FACTOR_8192       
4089 } paTimestampScalerFactor_e;
4090 /*@}*/
4091 /** @} */
4093 /**
4094  *  @ingroup palld_api_structures
4095  *  @brief  Timestamp configuration
4096  *
4097  *  @details paTimestampConfig_t is used to configure the timer which is used to generate timestamp in
4098  *           the PA sub-system.
4099  *  @verbatim 
4100              The 16-bit timer connected to PDSP0 is reserved for timestamp generation.
4101              The timestamp will be 0 until the timer is enabled.
4102              The timestamp unit is equal to (the scaler factor)/350 us.  
4103     @endverbatim
4104  *
4105  *  @note: The PDSP timer does not support pa_TIMESTAMP_SCALER_FACTOR_1.
4106  *         The timer will be disabled if unspported scaler factor is used.
4107  */
4108  
4109 typedef struct {
4110   uint16_t                   enable;     /**< Enable/Disable(1/0) the timestamp generation */
4111   paTimestampScalerFactor_e  factor;     /**< Timestamp scaler factor as defined at @ref timestampScalerFactor */
4112 } paTimestampConfig_t;
4114 /**
4115  *  @defgroup paUsrStatsTypes PA User-defined Ststaistics Counter Types
4116  *  @ingroup palld_api_constants
4117  *  @{
4118  *
4119  *  @name User-defined Ststaistics Counter Types
4120  *
4121  *  Definition of Counter types of the User-defined Statistics
4122  */ 
4123 /** @ingroup paUsrStatsTypes */
4124 /*@{*/
4125 typedef enum {
4126   pa_USR_STATS_TYPE_PACKET = 0,   /**< Packet Counter */
4127   pa_USR_STATS_TYPE_BYTE          /**< Byte Counter */
4128 } paUsrStatsTypes_e;
4129 /*@}*/
4130 /** @} */
4133 /**
4134  *  @ingroup palld_api_structures
4135  *  @brief  User-defined statistics counter entry configuration information
4136  *
4137  *  @details paUsrStatsCounterEntryConfig_t defines the operation parameters of each user-defined statistics.
4138  */
4139  
4140 typedef struct {
4141   uint16_t          cntIndex; /**< Index of the counter */
4142   uint16_t          cntLnk;   /**< Index of the next level counter. 0xFFFF: No linking counter */ 
4143   paUsrStatsTypes_e cntType;  /**< Counter type (packet counter */
4144 } paUsrStatsCounterEntryConfig_t;
4146 /**
4147  *   @def  pa_USR_STATS_LNK_END
4148  *         Indicate that there is no next layer counter
4149  */
4150 #define pa_USR_STATS_LNK_END                0xFFFF
4153 /**
4154  *  @defgroup usrStatsCounterConfigCtrlInfo  User-defined Statistics Counter Configuration Control Info Bit Definitions
4155  *  @ingroup palld_api_constants
4156  *  @{
4157  *
4158  *  @name User-defined Statistics Counter Configuration Control Info Bit Definitions
4159  *
4160  *  Bitmap definition of the ctrlBitField in @ref paUsrStatsCounterConfig_t 
4161  */ 
4162 /*@{*/
4163 /**
4164  *  @def  pa_USR_STATS_CONFIG_RESET
4165  *        Control Info -- Set: Reset all counter control blocks to its default setting (packet counter without link to the next layer)
4166  */
4167 #define pa_USR_STATS_CONFIG_RESET           0x0001 
4168 /*@}*/
4169 /** @} */
4171 /**
4172  *  @ingroup palld_api_structures
4173  *  @brief  User-defined statistics counter configuration information
4174  *
4175  *  @details paUsrStatsCounterConfig_t contains an array of the entry configuration information.
4176  */
4177  
4178 typedef struct {
4179   uint16_t          ctrlBitfield;      /**< User-defined statistics counter configuration control information as defined at @ref usrStatsCounterConfigCtrlInfo */
4180   uint16_t          numCnt;            /**< Number of counters to be configured */
4181   paUsrStatsCounterEntryConfig_t* cntInfo;  /**< Array of counter configuration as specified at @ref paUsrStatsCounterEntryConfig_t */
4182 } paUsrStatsCounterConfig_t;
4184 /**
4185  *  @ingroup palld_api_structures
4186  *  @brief  User-defined statistics configuration information
4187  *
4188  *  @details paUsrStatsConfigInfo_t is used to perform user-defined statistics related configuration. It is used by 
4189  *           API function @ref Pa_configUsrStats.
4190  */
4191  
4192 typedef struct {
4193   paUsrStatsCounterConfig_t* pCntCfg;  /**< Pointer to the user-defined statistics counter configuration. */
4194 } paUsrStatsConfigInfo_t;
4196 /**
4197  * @defgroup  paSubSysStates PA Sub-system Queries and States
4198  * @ingroup palld_api_constants
4199  * @{
4200  *
4201  * @name PA Sub-system Queries and States
4202  *
4203  *  PA Sub-system reset state and query arguments used by API function @ref Pa_resetControl
4204  */
4205 /* @{ */
4206 /**
4207  *  @def  pa_STATE_RESET  
4208  *        The Sub-system is in reset
4209  */
4210 #define pa_STATE_RESET            0  /**< Sub-system state reset */
4212 /**
4213  *  @def  pa_STATE_ENABLE
4214  *        The Sub-system state is enabled
4215  */
4216 #define pa_STATE_ENABLE           1  /**< Sub-system state enable  */
4218 /**
4219  *  @def  pa_STATE_QUERY
4220  *        Query the Sub-system state
4221  */
4222 #define pa_STATE_QUERY            2  /**< Query the Sub-system state */
4224 /**
4225  *  @def  pa_STATE_INCONSISTENT
4226  *        The Sub-system state is partially enabled
4227  */
4228 #define pa_STATE_INCONSISTENT     3  /**< Sub-system is partially enabled */
4230 /**
4231  *  @def  pa_STATE_INVALID_REQUEST
4232  *        Invalid state command to the Sub-system
4233  */
4234 #define pa_STATE_INVALID_REQUEST  4  /**< Invalid state command to the Sub-system */
4236 /**
4237  *  @def  pa_STATE_ENABLE_FAILED
4238  *        The Sub-system did not respond after restart
4239  */
4240 #define pa_STATE_ENABLE_FAILED    5  /**<  The Sub-system did not respond after restart */
4242 /* @}  */ 
4243 /** @} */
4246 /**
4247  *  @ingroup palld_api_structures
4248  *  @brief  paSState_t defines the operating state of the packet accelerator sub-system
4249  *
4250  *  @details  The values in @ref paSubSysStates are used both to set the state of the packet accelerator
4251  *            sub-system (pa_STATE_RESET and pa_STATE_ENABLE) as well as show the current state
4252  *            of the system (all values).
4253  */
4254 typedef int paSSstate_t;
4256 /**
4257  * @ingroup palld_api_structures
4258  * @brief PA Classify1 Statistics Structure
4259  *
4260  * @details This structures define the PA Classify1-specific statistics provided 
4261  *          with API function @ref Pa_formatStatsReply ().
4262  */
4263 typedef struct paClassify1Stats_s {
4265   uint32_t nPackets;                /**< Number of packets entering Classify1 PDSPs */
4266   uint32_t nIpv4Packets;            /**< Number of IPv4 packets */
4267   uint32_t nIpv4PacketsInner;       /**< Number of Inner IPv4 packets */
4268   uint32_t nIpv6Packets;            /**< Number of IPv6 packets */
4269   uint32_t nIpv6PacketsInner;       /**< Number of Inner IPv6 packets */
4270   uint32_t nCustomPackets;          /**< Number of custom LUT1 packets */
4271   uint32_t nSrioPackets;            /**< Number of SRIO packets */
4272   uint32_t nLlcSnapFail;            /**< Number of packets with corrupt LLC Snap */
4273   uint32_t nTableMatch;             /**< Number of packets with table match found */
4274   uint32_t nNoTableMatch;           /**< Number of packets without table match found */
4275   uint32_t nIpFrag;                 /**< Number of Ingress fragmented IP packets */
4276   uint32_t nIpDepthOverflow;        /**< Number of packets with too many IP layers */
4277   uint32_t nVlanDepthOverflow;      /**< Number of packets with too many VLANs */
4278   uint32_t nGreDepthOverflow;       /**< Number of packets with too many GREs */
4279   uint32_t nMplsPackets;            /**< Number of MPLS packets */
4280   uint32_t nParseFail;              /**< Number of packets which can not be parsed */
4281   uint32_t nInvalidIPv6Opt;         /**< Number of IPv6 packets which contains invalid IPv6 options */
4282   uint32_t nTxIpFrag;               /**< Number of Egress fragmented IP packets */
4283   uint32_t nSilentDiscard;          /**< Number of packets dropped */
4284   uint32_t nInvalidControl;         /**< Number of packet received with invalid control information */
4285   uint32_t nInvalidState;           /**< Number of times the PA detected an illegal state and recovered */
4286   uint32_t nSystemFail;             /**< Number of times the PA detected an unrecoverable state and restarted */
4287   
4288 } paClassify1Stats_t;
4290 /**
4291  * @ingroup palld_api_structures
4292  * @brief PA Classify2 Statistics Structure
4293  *
4294  * @details This structures define the PA Classify2-specific statistics provided 
4295  *          with API function @ref Pa_formatStatsReply ().
4296  */
4297 typedef struct paClassify2Stats_s  {
4298   
4299   uint32_t nPackets;                /**< Number of packets entering Classify2 PDSP */ 
4300   uint32_t nUdp;                    /**< Number of UDP packets */
4301   uint32_t nTcp;                    /**< Number of TCP packets */
4302   uint32_t nCustom;                 /**< Number of custom LUT2 packets */
4303   uint32_t reserved3;               /**< Reserved for future use */
4304   uint32_t reserved4;               /**< Reserved for future use */
4305   uint32_t nSilentDiscard;          /**< Number of packets dropped */
4306   uint32_t nInvalidControl;         /**< Number of packet received with invalid control information */
4308 } paClassify2Stats_t;
4310 /**
4311  * @ingroup palld_api_structures
4312  * @brief PA Modifier Statistics Structure
4313  *
4314  * @details This structures define the PA Modifier-specific statistics provided 
4315  *          with API function @ref Pa_formatStatsReply ().
4316  */
4317 typedef struct paModifyStats_s   {
4318   uint32_t nCommandFail;            /**< Number of invalid commands */
4319   
4320 } paModifyStats_t;
4322 /**
4323  * @ingroup palld_api_structures
4324  * @brief PA Common Statistics Structure
4325  *
4326  * @details This structures define the PA Common statistics provided 
4327  *          with API function @ref Pa_formatStatsReply ().
4328  */
4329 typedef struct paCommonStats_s  {
4331   uint32_t reserved5;               /**< Reserved for future use */
4332   
4333 } paCommonStats_t;
4335 /**
4336  * @ingroup palld_api_structures
4337  * @brief PA System Statistics Structure
4338  *
4339  * @details This structures define the PA System statistics provided 
4340  *          with API function @ref Pa_formatStatsReply ().
4341  */
4343 typedef struct paSysStats_s  {
4345   paClassify1Stats_t classify1;     /**< Classify1-specific statistics */
4346   paClassify2Stats_t classify2;     /**< Classify2-specific statistics */
4347   paModifyStats_t    modify;        /**< Modifier-specific statistics */
4348   paCommonStats_t    common;        /**< Common statistics */
4349   
4350 } paSysStats_t;
4352 /**
4353  * @ingroup palld_api_structures
4354  * @brief PA User-defined Statistics Structure
4355  *
4356  * @details This structures define the PA User-defined statistics provided 
4357  *          with API function @ref Pa_requestUsrStats ().
4358  */
4360 typedef struct paUsrStats_s  {
4362   uint64_t   count64[pa_USR_STATS_MAX_64B_COUNTERS];     /**< Array of general purpose 64-bit counters */
4363   uint32_t   count32[pa_USR_STATS_MAX_32B_COUNTERS];     /**< Array of general purpose 32-bit counters */
4364   
4365 } paUsrStats_t;
4367 /**
4368  * @ingroup palld_api_structures
4369  * @brief PA Reassembly Group Statistics Structure
4370  *
4371  * @details This structures define the PA RA group-specific statistics  
4372  */
4373 typedef struct paRaGroupStats_s {
4375   uint32_t nReasmPackets;           /**< Number of successfully reassembled packets of Group N*/
4376   uint32_t nFrags;                  /**< Number of fragmented IP packets of group N*/
4377   uint32_t nPackets;                /**< Number of packets of Group N */
4378   uint32_t nCxtTOwSOP;              /**< Number of IP packets where contexts associated with Group N time out  
4379                                          before being completely reassembled, the SOP fragment has been received */
4380   uint32_t nCxtTOwSOPBytes;         /**< Number of payload bytes of IP packets where contexts associated with Group N 
4381                                          time out before being completely reassembled, the SOP fragment has been received */
4382   uint32_t nCxtTOwoSOP;             /**< Number of IP packets where contexts associated with Group N time out before being 
4383                                          completely reassembled, the SOP fragment has not been received */
4384   uint32_t nCxtTOwoSOPBytes;        /**< Number of payload bytes of IP packets where contexts associated with Group N time out 
4385                                          before being completely reassembled, the SOP fragment has not been received */
4386   uint32_t nZeroByte;               /**< Number of IP fragments with zero-byte payload */
4387   uint32_t reserved2;               /**< Reserved for future use */
4388   uint32_t nIpv6Overlap;            /**< Number of IPv6 packets which are discarded because a fragment of this 
4389                                          packet arrives that overlaps data previously received in another 
4390                                          fragment for that same packet */
4391   uint32_t nIpv6OverlapBytes;       /**< Number of IPv6 payload bytes which are discarded because a fragment of this 
4392                                          packet arrives that overlaps data previously received in another 
4393                                          fragment for that same packet */
4394   uint32_t nLargePackets;           /**< Number of IP packets which are discarded because the completely reassembled 
4395                                          packet greater than 64KB */
4396   uint32_t nIpv4TcpErr;             /**< Number of IP packets which are discarded due to TCP error, i.e. a fragment is 
4397                                          received that has a protocol of TCP and a fragment offset of 1 */
4398   uint32_t nFragLenErr;             /**< Number of IP packets which are discarded due to an incorrect fragment length */
4399   uint32_t nIpv4IllegalIHL;         /**< Number of IPv4 fragments which are discarded due to an incorrect IP header length */
4400   uint32_t nSmallFragments;         /**< Number of IP fragments which is too small 
4401                                          - IPv4: Packets that are not last fragment and are smaller than minIpv4PktSize 
4402                                          - IPv6: Packets that are not last fragment and are smaller than 56 bytes 
4403                                          - IPV6: Packets that are last fragment and are smaller than 49 bytes */
4404   uint32_t nIllegalFragLen;         /**< Number of IP fragments that is not the last fragment, has a length 
4405                                          that is not a multiple of 8 bytes */
4406   uint32_t nCxtCompletedDiscard;    /**< Number of IP fragments which are discarded because they are for a context that has 
4407                                          already been completed or timed out */
4408   uint32_t nCxtCompletedDiscardBytes;   /**< Total payload bytes of IP fragments which are discarded because they are for a context that has 
4409                                          already been completed or timed out */
4410   
4411 } paRaGroupStats_t;
4413 /**
4414  * @ingroup palld_api_structures
4415  * @brief PA RA Statistics Structure
4416  *
4417  * @details This structures define the PA RA statistics provided 
4418  *          with API function @ref Pa_requestUsrStats ().
4419  */
4421 typedef struct paRaStats_s  {
4422     paRaGroupStats_t group[pa_RA_NUM_GROUPS];   /**< array of group-specific RA statistics */ 
4423 } paRaStats_t;
4425 /**
4426  * @ingroup palld_api_structures
4427  * @brief PA ACL Entry Statistics Structure
4428  *
4429  * @details This structures define the PA ACL per-entry statistics provided 
4430  *          with API function @ref Pa_queryAclStats ().
4431  */
4433 typedef struct paAclStats_s  {
4435   uint32_t   nMatchPackets;     /**< Number of packets which matchs the ACL rule */
4436   uint32_t   nMatchBytes;       /**< Total bytes of the matched packets */
4437   
4438 } paAclStats_t;
4441 /**
4442  * @ingroup palld_api_structures
4443  * @brief PA Timestamp Structure
4444  *
4445  * This structure defines the 48-bit timestamp provided upon request with @ref Pa_getTimestamp ().
4446  */
4447 typedef struct {
4448   uint32_t   hi;         /**< Upper 32 bits of the 48-bit PASS timestamp */
4449   uint16_t   lo;         /**< Lower 16 bits of the 48-bit PASS timestamp */
4450 } paTimestamp_t;
4452 /**
4453  *  @defgroup paApiParamValidBits  PA API Parameter Valid Bit Definitions
4454  *  @ingroup palld_api_constants
4455  *  @{
4456  *
4457  *  @name  PA API Parameter Valid Bit Definitions
4458  *
4459  *  Bitmap definition of the validBitmap in @ref paParamDesc. 
4460  */ 
4461 /*@{*/
4463 /**
4464  *  @def  pa_PARAM_VALID_LUTINST
4465  *        - Set: Application specifies the LUT1 instance
4466  *        - Clear: LLD determines the LUT1 instance based on other input parameters
4467  */
4468 #define pa_PARAM_VALID_LUTINST              (1<<0)
4470 /**
4471  *  @def  pa_PARAM_VALID_INDEX
4472  *        - Set: Application specifies the LUT1 index to insert this entry
4473  *        - Clear: PASS determines where in the LUT1 table to insert this entrry
4474  */
4475 #define pa_PARAM_VALID_INDEX                (1<<1)
4477 /**
4478  *  @def  pa_PARAM_VALID_PREVLINK
4479  *        - Set: Previous link  is valid and it should be used as part of classification criteria
4480  *        - Claer: Previous link is inavlid
4481  */
4482 #define pa_PARAM_VALID_PREVLINK             (1<<2)
4484 /**
4485  *  @def  pa_PARAM_VALID_NEXTLINK
4486  *        - Set: The specified virtual link in stead of the physical link should be used as part of 
4487  *               classification criteria at the next stage
4488  *        - Clear: Use physical link at the next stage
4489  */
4490 #define pa_PARAM_VALID_NEXTLINK             (1<<3)
4492 /* @} */ /* ingroup */
4493 /** @} */
4496 /**
4497  *  @ingroup palld_api_structures
4498  *  @brief  PA API parameters structure
4499  *
4500  *  @details  This structure defines the common parameters of the next generation APIs such as
4501  *            @ref Pa_addMac2 and @ref Pa_addIp2. This structure includes a validBitmap of 
4502  *            optional parameters so that it can evolve while maintaining backward-compatibility.
4503  *
4504  *            The parameter validBitmap specifies which optional parameters are valid 
4505  *            1: used; 0: not used.
4506  *              
4507  */
4508 typedef struct {
4509   uint32_t        validBitMap;  /**<  32-bit Bitmap corresponding to usage of each optional field */
4510   int             lutInst;      /**<  validBitmap[t0] Specify which LUT1 (0-2) should be used. */
4511   int             index;        /**<  validBitmap[t1] Specify the index of the LUT1 entry (0-63).*/
4512   paLnkHandle_t   prevLink;     /**<  validBitmap[t2] An optional L2 or L3 handle, or virtual link handle */
4513   paLnkHandle_t   nextLink;     /**<  validBitmap[t3] An optional virtual link handle */
4514   paRouteInfo2_t  *routeInfo;   /**<  Where to send a packet that matches */
4515   paRouteInfo2_t  *nextRtFail;  /**<  Where to send a packet that matches, but fails to match any entry at the next classification stage */
4516 } paParamDesc;
4518 /**
4519  *  @ingroup palld_api_functions
4520  *  @brief   Pa_addSrio adds a SRIO entry to the L2 table
4521  *
4522  *  @details This function is used to add or replace an entry into the L2 table (see @ref netlayers).
4523  *           A new entry is added if the SRIO configuration info is unique in the modules handle table. 
4524  *           If the value is not unique then the routing information for the existing entry is changed to
4525  *           the values provided in the function.
4526  *
4527  *           On return the command buffer (cmd) contains a formatted command for the sub-system. The 
4528  *           destination for the command is provided in cmdDest. The module user must send the formatted
4529  *           command to the sub-system. The sub-system will generate a reply
4530  *           and this reply must be sent back to this module through the API @ref Pa_forwardResult.
4531  *
4532  *           This command as well as @ref Pa_addIp operate with a strong dependence on entry order.
4533  *           See section table @ref order for a description on the operation of the sub-system and
4534  *           table entry ordering.
4535  *
4536  *  @param[in]      iHandle         The driver instance handle
4537  *  @param[in]      index           Specify the index of the LUT1 entry (0-63). Set to pa_LUT1_INDEX_NOT_SPECIFIED if not specified
4538  *  @param[in]      srioInfo        Value @ref paSrioInfo_t
4539  *  @param[in]      nextHdr         The next header type to be parsed following the SRIO classification
4540  *                                  Refer to @ref NextHeaderTypes for all supported protocols
4541  *                                  Set to pa_HDR_TYPE_UNKNOWN if no further prasing is required
4542  *  @param[in]      nextHdrOffset   Offset to the next header from the beginning of the packet
4543  *  @param[in]      routeInfo       Match packet routing information
4544  *  @param[in]      nextRtFail      Routing information for subsequent match failures
4545  *  @param[out]     handle          Pointer to L2 Handle
4546  *  @param[out]     cmd             Where the created command is placed
4547  *  @param[in,out]  cmdSize         Input the size of cmd buffer, on output the actual size used. @ref cmdMinBufSize
4548  *  @param[in]      reply           Where the sub-system sends the command reply
4549  *  @param[out]     cmdDest         Value (@ref cmdTxDest) 
4550  *  @retval                         Value (@ref ReturnValues)
4551  *  @pre                            A driver instance must be created and tables initialized
4552  *
4553  *  @note No table entry validation will be proformed if the LUT1 index is specified at this function
4554  *
4555  */
4557 paReturn_t Pa_addSrio (  Pa_Handle         iHandle,
4558                          int               index,
4559                          paSrioInfo_t      *srioInfo,
4560                          uint16_t          nextHdr,
4561                          uint16_t          nextHdrOffset,
4562                          paRouteInfo_t     *routeInfo,
4563                          paRouteInfo_t     *nextRtFail,
4564                          paHandleL2L3_t    *handle,
4565                          paCmd_t           cmd,
4566                          uint16_t          *cmdSize,
4567                          paCmdReply_t      *reply,
4568                          int               *cmdDest);
4570 /**
4571  *  @ingroup palld_api_functions
4572  *  @brief   Pa_addMac adds a mac address to the L2 table
4573  *
4574  *  @details This function is used to add or replace an entry into the L2 table (see @ref netlayers).
4575  *           A new entry is added if the MAC configuration info is unique in the modules handle table. If
4576  *           the value is not unique then the routing information for the existing entry is changed to
4577  *           the values provided in the function.
4578  *
4579  *           L2 values that are not to be used for packet routing are set to 0.
4580  *
4581  *           On return the command buffer (cmd) contains a formatted command for the sub-system. The 
4582  *           destination for the command is provided in cmdDest. The module user must send the formatted
4583  *           command to the sub-system. The sub-system will generate a reply
4584  *           and this reply must be sent back to this module through the @ref Pa_forwardResult API.
4585  *
4586  *           This command as well as @ref Pa_addIp operate with a strong dependence on entry order.
4587  *           See section table @ref order for a description on the operation of the sub-system and
4588  *           table entry ordering.
4589  *
4590  *
4591  *  @param[in]      iHandle     The driver instance handle
4592  *  @param[in]      index       Specify the index of the LUT1 entry (0-63). Set to pa_LUT1_INDEX_NOT_SPECIFIED if not specified
4593  *  @param[in]      ethInfo     Value @ref paEthInfo_t
4594  *  @param[in]      routeInfo   Match packet routing information
4595  *  @param[in]      nextRtFail  Routing information for subsequent match failures
4596  *  @param[out]     handle      Pointer to L2 Handle
4597  *  @param[out]     cmd         Where the created command is placed
4598  *  @param[in,out]  cmdSize     Input the size of cmd buffer, on output the actual size used. @ref cmdMinBufSize
4599  *  @param[in]      reply       Where the sub-system sends the command reply
4600  *  @param[out]     cmdDest     Value (@ref cmdTxDest) 
4601  *  @retval                     Value (@ref ReturnValues)
4602  *  @pre                        A driver instance must be created and tables initialized
4603  *
4604  *  @note No table entry validation will be proformed if the LUT1 index is specified at this function
4605  *
4606  */
4608 paReturn_t Pa_addMac  (  Pa_Handle         iHandle,
4609                          int               index,
4610                          paEthInfo_t       *ethInfo,
4611                          paRouteInfo_t     *routeInfo,
4612                          paRouteInfo_t     *nextRtFail,
4613                          paHandleL2L3_t    *handle,
4614                          paCmd_t           cmd,
4615                          uint16_t          *cmdSize,
4616                          paCmdReply_t      *reply,
4617                          int               *cmdDest);
4618                          
4619 /**
4620  *   @ingroup palld_api_functions
4621  *   @brief  Pa_addMac2 adds a mac address to the L2 table
4622  *
4623  *   @details  Pa_addMac2 is the next generation of API to replace @ref Pa_addMac eventually. This new API
4624  *             covers the entire functionality of Pa_addMac and it is designed to support more features
4625  *             while maintain backward-compatibility over time.
4626  *
4627  *  @param[in]      iHandle     The driver instance handle
4628  *  @param[in]      ethInfo     Value @ref paEthInfo2_t
4629  *  @param[in]      params      Common API parameters @ref paParamDesc 
4630  *  @param[out]     retHandle   Pointer to L2 Handle
4631  *  @param[out]     cmd         Where the created command is placed
4632  *  @param[in,out]  cmdSize     Input the size of cmd buffer, on output the actual size used. @ref cmdMinBufSize
4633  *  @param[in]      reply       Where the sub-system sends the command reply
4634  *  @param[out]     cmdDest     Value (@ref cmdTxDest) 
4635  *  @retval                     Value (@ref ReturnValues)
4636  *  @pre                        A driver instance must be created and tables initialized
4637  *              
4638  */
4639 paReturn_t Pa_addMac2  (  Pa_Handle        iHandle,
4640                           paEthInfo2_t     *ethInfo,    /**<  Value @ref paEthInfo2_t */
4641                           paParamDesc      *params,
4642                           paLnkHandle_t    *retHandle,  /**<  Pointer to the returned L2 handle */
4643                           paCmd_t          cmd,
4644                           uint16_t         *cmdSize,
4645                           paCmdReply_t     *reply,
4646                           int              *cmdDest
4647                        );
4648                          
4649 /**
4650  *   @ingroup palld_api_functions
4651  *   @brief  Pa_delHandle deletes a MAC/SRIO or IP handle
4652  *
4653  *   @details  This function is used to remove an entry from the sub-system L2 or L3 (LUT1) lookup (see @ref netlayers).
4654  *             When a handle is deleted it can create stale handles. For example, an L3 handle can reference
4655  *             an L2 handle, and an L4 handle can reference an L3 handle. The module does not check for 
4656  *             references to a stale handle, the module user is responsible for maintaining reference coherency.
4657  *             It is recommended that the handle should not be deleted if the API function @ref Pa_getHandleRefCount 
4658  *             returns non-zero reference count.
4659  *
4660  *   @param[in]     iHandle     The driver instance handle
4661  *   @param[in]     handle      Pointer to the l2/l3 handle to delete
4662  *   @param[out]    cmd         Where the created command is placed
4663  *   @param[in]     cmdSize     The size of the cmd buffer
4664  *   @param[in]     reply       Where the sub-system sends the command reply
4665  *   @param[out]    cmdDest     Value (@ref cmdTxDest)
4666  *   @retval                    Value (@ref ReturnValues)
4667  *   @pre                       A driver instance must be created and tables initialized
4668  */
4669 paReturn_t Pa_delHandle (Pa_Handle       iHandle,
4670                          paHandleL2L3_t  *handle, 
4671                          paCmd_t         cmd,
4672                          uint16_t        *cmdSize,
4673                          paCmdReply_t    *reply,
4674                          int             *cmdDest );
4676 /**
4677  *   @ingroup palld_api_functions
4678  *   @brief  Pa_delL4Handle deletes a UDP/TCP/GTPU/CustomLUT2 handle
4679  *
4680  *   @details This function is used to remove an entry from the sub-system L4 (LUT2) handle entry. 
4681  *
4682  *   @param[in]      iHandle   The driver instance handle
4683  *   @param[in, out] handle    Pointer to the L4 handle to delete
4684  *   @param[out]     cmd       Where the created command is placed
4685  *   @param[in]      cmdSize   The size of the cmd buffer
4686  *   @param[in]      reply     Where the sub-system sends the reply
4687  *   @param[out]     cmdDest   Value (@ref cmdTxDest)
4688  *   @retval                   Value (@ref ReturnValues)
4689  *   @pre                      A driver instance must be created and tables initialized
4690  */
4691 paReturn_t Pa_delL4Handle (Pa_Handle      iHandle,
4692                           paHandleL4_t    handle, 
4693                           paCmd_t         cmd,
4694                           uint16_t        *cmdSize,
4695                           paCmdReply_t    *reply,
4696                           int             *cmdDest );
4697                           
4698 /**
4699  *   @ingroup palld_api_functions
4700  *   @brief  Pa_delAclHandle deletes an ACL handle
4701  *
4702  *   @details  This function is used to remove an entry from the LUT1-ACL lookup 
4703  *
4704  *   @param[in]     iHandle     The driver instance handle
4705  *   @param[in]     handle      Pointer to the ACL handle to delete
4706  *   @param[out]    cmd         Where the created command is placed
4707  *   @param[in]     cmdSize     The size of the cmd buffer
4708  *   @param[in]     reply       Where the sub-system sends the command reply
4709  *   @param[out]    cmdDest     Value (@ref cmdTxDest)
4710  *   @retval                    Value (@ref ReturnValues)
4711  *   @pre                       A driver instance must be created and tables initialized
4712  */
4713 paReturn_t Pa_delAclHandle (Pa_Handle       iHandle,
4714                             paHandleAcl_t   *handle, 
4715                             paCmd_t         cmd,
4716                             uint16_t        *cmdSize,
4717                             paCmdReply_t    *reply,
4718                             int             *cmdDest );
4720 /**
4721  *   @ingroup palld_api_functions
4722  *   @brief  Pa_addIp adds an IP address to the L3 table
4723  *
4724  *   @details  This function is used to add or replace an entry in the L3 table (see @ref netlayers).
4725  *             A new entry is added if the IP configuration info is unique in the modules handle table.
4726  *             If the value is not unique then the routing information for the existing entry is changed
4727  *             to the values provided in the function.
4728  *
4729  *             The LLD will determine where this entry is added based on following rules
4730  *             - If there is no previous link or the previous link is a L2 (MAC/SRIO) entry, this entry will be
4731  *               added into LUT1_1
4732  *             - If the previous link is L3 (IP/Custom LUT1), this entry will be added into LUT1_2
4733  *             
4734  *             The module user can overwrite the default rules by specifying the desired LUT1 instance. 
4735  *
4736  *             The PASS will determine which entry of the specified LUT1 table is used for this entry based on
4737  *             its internal algorithm if the module user does not specify the LUT1 index.  
4738  *
4739  *             L3 values that are used for packet routing should be set as described in @ref paIpInfo_t.
4740  *
4741  *             The @ref paHandleL2L3_t prevLink is used to link this entry to an L2 or L3 entry already made
4742  *             by a call to @ref Pa_addMac or Pa_addIp. If the link is enabled then a packet will match the IP 
4743  *             information provided in ipInfo only if the same packet has already matched at the L2 level as  
4744  *             described by prevLink. To disable linking the value of prevLink is set to NULL.
4745  *
4746  *             On return the command buffer (cmd) contains a formatted command for the sub-system. The
4747  *             destination for the command is provided in cmdDest. The module user must send the formatted
4748  *             command to the sub-system. The sub-system will generate a reply and this reply must be
4749  *             sent back to this module through the API @ref Pa_forwardResult.
4750  *
4751  *             This command as well as @ref Pa_addMac operates with a strong dependence on entry order.
4752  *             See section table @ref order for a description on the operation of the sub-system and
4753  *             table entry ordering.
4754  *
4755  *
4756  *
4757  *   @param[in]    iHandle     The driver instance handle
4758  *   @param[in]    lutInst     Specify which LUT1 (0-2) should be used.  Set to pa_LUT_INST_NOT_SPECIFIED if not specified
4759  *   @param[in]    index       Specify the index of the LUT1 entry (0-63). Set to pa_LUT1_INDEX_NOT_SPECIFIED if not specified
4760  *   @param[in]    ipInfo      Value @ref paIpInfo_t
4761  *   @param[in]    prevLink    An optional L2 or L3 handle
4762  *   @param[in]    routeInfo   Where to send a packet that matches
4763  *   @param[in]    nextRtFail  Where to send a packet that matches, but later fails
4764  *   @param[out]   retHandle   Pointer to the returned L3 handle
4765  *   @param[out]   cmd         Buffer where the PASS command is created
4766  *   @param[in]    cmdSize     The size of the cmd buffer
4767  *   @param[in]    reply       Where the response to the PASS command is routed
4768  *   @param[out]   cmdDest     Value (@ref cmdTxDest)
4769  *   @retval                   Value (@ref ReturnValues)
4770  *   @pre                      A driver instance must be created and tables initialized
4771  *
4772  *  @note No table entry validation will be proformed if the LUT1 index is specified at this function
4773  *
4774  */
4775 paReturn_t  Pa_addIp  ( Pa_Handle          iHandle,
4776                         int                lutInst,
4777                         int                index, 
4778                         paIpInfo_t        *ipInfo,
4779                         paHandleL2L3_t     prevLink,
4780                         paRouteInfo_t     *routeInfo,
4781                         paRouteInfo_t     *nextRtFail,
4782                         paHandleL2L3_t    *retHandle,
4783                         paCmd_t            cmd,
4784                         uint16_t          *cmdSize,
4785                         paCmdReply_t      *reply,
4786                         int               *cmdDest );
4787                         
4788 /**
4789  *   @ingroup palld_api_functions
4790  *   @brief  Pa_addIp2 adds an IP address to the L3 table
4791  *
4792  *   @details  Pa_addIp2 is the next generation of API to replace @ref Pa_addIp eventually. This new API
4793  *             covers the entire functionality of Pa_addIP and it is designed to support more features
4794  *             while maintain backward-compatibility over time.
4795  *
4796  *  @param[in]      iHandle     The driver instance handle
4797  *  @param[in]      ipInfo      Value @ref paIpInfo2_t
4798  *  @param[in]      params      Common API parameters @ref paParamDesc 
4799  *  @param[out]     retHandle   Pointer to L3 Handle
4800  *  @param[out]     cmd         Where the created command is placed
4801  *  @param[in,out]  cmdSize     Input the size of cmd buffer, on output the actual size used. @ref cmdMinBufSize
4802  *  @param[in]      reply       Where the sub-system sends the command reply
4803  *  @param[out]     cmdDest     Value (@ref cmdTxDest) 
4804  *  @retval                     Value (@ref ReturnValues)
4805  *  @pre                        A driver instance must be created and tables initialized
4806  */
4807 paReturn_t  Pa_addIp2 ( Pa_Handle       iHandle,
4808                         paIpInfo2_t     *ipInfo,     
4809                         paParamDesc     *params,
4810                         paLnkHandle_t   *retHandle,  
4811                         paCmd_t         cmd,
4812                         uint16_t        *cmdSize,
4813                         paCmdReply_t    *reply,
4814                         int             *cmdDest
4815                         );
4817 /**
4818  *  @defgroup  VirtualLnkType Virtual Link types
4819  *  @ingroup palld_api_constants
4820  *  @{
4821  *
4822  *  @name   VirtualLnkTypes
4823  *  @brief  Defines the virtual link destination type
4824  *
4825  *  @note   The packet accelerator module supports linking to 
4826  *          virtual links at OuterIp only at the moment.
4827  *           
4828  */
4829 /* @{ */
4830 /**
4831  *  @def  pa_VIRTUAL_LNK_TYPE_MAC
4832  *        MAC
4833  */
4834 #define  pa_VIRTUAL_LNK_TYPE_MAC        0
4836 /**
4837  *  @def  pa_VIRTUAL_LNK_TYPE_OUTER_IP
4838  *        Outer IP
4839  */
4840 #define  pa_VIRTUAL_LNK_TYPE_OUTER_IP   1
4842 /**
4843  *  @def   pa_VIRTUAL_LNK_TYPE_INNER_IP
4844  *        Inner IP
4845  */
4846 #define  pa_VIRTUAL_LNK_TYPE_INNER_IP   2
4847   
4848 /*  @}  */  
4849 /** @} */
4851 /**
4852  *  @ingroup palld_api_functions
4853  *  @brief  Pa_addVirtualLink allocates a new virtual link within the PA instance
4854  *  
4855  *  @details  This function is called to request a new virtual link 
4856  *
4857  *  @param[in]      iHandle     The driver instance handle
4858  *  @param[in,out]  vlinkHdl    Pointer to virtual link handle
4859  *  @param[in]      lnkType     Value (@ref VirtualLnkType) 
4860  *  @retval                     Value (@ref ReturnValues)
4861  *  @pre                        A driver instance must be created and tables initialized
4862  *
4863  */
4864 paReturn_t Pa_addVirtualLink(Pa_Handle       iHandle,
4865                              paLnkHandle_t   *vlinkHdl, 
4866                              int8_t          lnkType      
4867                             );
4869 /**
4870  *  @ingroup palld_api_functions
4871  *  @brief  Pa_delVirtualLink frees the specified virtual link within the PA instance
4872  *
4873  *  @details  This function is used to remove a virtual link 
4874  *
4875  *  @param[in]      iHandle     The driver instance handle
4876  *  @param[in,out]  vlinkHdl    Pointer to virtual link handle
4877  *  @retval                     Value (@ref ReturnValues)
4878  *  @pre                        A driver instance must be created and tables initialized
4879  *
4880  */
4881 paReturn_t Pa_delVirtualLink(Pa_Handle       iHandle,
4882                              paLnkHandle_t   *vlinkHdl
4883                              );
4884                              
4885 /**
4886  *   @ingroup palld_api_functions
4887  *   @brief  Pa_addAcl adds an ACL entry to the ACL table
4888  *
4889  *   @details  This function is used to add an entry in the ACL table.
4890  *             The PASS ACL table maintains an ordered list of ACL rules. This function will add ACL entries
4891  *             in descending order, i.e. the new rule will be inserted at the bottom of the ACL table unless
4892  *             the parameter nextEntry is specified, in this case, the new entry will be added in front of the 
4893  *             next entry. 
4894  *
4895  *             The are two ACL (LUT1) tables supported by PASS, one for outer IP and the other for inner IP.
4896  *             The ACL instance should be specified by @ref paLut1Inst.  
4897  *
4898  *             The @ref paHandleL2L3_t prevLink is used to link this entry to an L2 or L3 entry already made
4899  *             by a call to @ref Pa_addMac or Pa_addIp. If the link is enabled then a packet will match the ACL 
4900  *             information provided in aclInfo only if the same packet has already matched at the L2/L3 level as  
4901  *             described by prevLink. To disable linking the value of prevLink is set to NULL.
4902  *
4903  *             On return the command buffer (cmd) contains a formatted command for the sub-system. The
4904  *             destination for the command is provided in cmdDest. The module user must send the formatted
4905  *             command to the sub-system. The sub-system will generate a reply and this reply must be
4906  *             sent back to this module through the API @ref Pa_forwardResult.
4907  *
4908  *   @param[in]    iHandle     The driver instance handle
4909  *   @param[in]    aclInst     Specify which ACL LUT1 (@ref paAclInst) should be used.  
4910  *   @param[in]    aclAction   Specify ACL match action as @ref paAclActionTypes
4911  *   @param[in]    aclInfo     Value @ref paAclInfo_t
4912  *   @param[in]    prevLink    An optional L2 or L3 handle
4913  *   @param[in]    nextEntry   An optional ACL handle as the next ACL rule
4914  *   @param[out]   retHandle   Pointer to the returned ACL handle
4915  *   @param[out]   cmd         Buffer where the PASS command is created
4916  *   @param[in]    cmdSize     The size of the cmd buffer
4917  *   @param[in]    reply       Where the response to the PASS command is routed
4918  *   @param[out]   cmdDest     Value (@ref cmdTxDest)
4919  *   @retval                   Value (@ref ReturnValues)
4920  *   @pre                      A driver instance must be created and tables initialized
4921  *
4922  *   @note No table entry validation will be proformed if the LUT1 index is specified at this function
4923  *   @note To maintain the entry order of the ACL table, the function does not support entry
4924  *         replacement with updated action. The application needs to call @ref Pa_delAclHandle at first and
4925  *         then call this API to add the replaced entry. 
4926  *
4927  */
4928 paReturn_t  Pa_addAcl  (Pa_Handle          iHandle,
4929                         int                aclInst,
4930                         int                aclAction,
4931                         paAclInfo_t       *aclInfo,
4932                         paHandleL2L3_t     prevLink,
4933                         paHandleAcl_t      nextEntry,
4934                         paHandleAcl_t     *retHandle,
4935                         paCmd_t            cmd,
4936                         uint16_t          *cmdSize,
4937                         paCmdReply_t      *reply,
4938                         int               *cmdDest );
4939                         
4940 /**
4941  *  @defgroup  paLut2PortSize LUT2 Port Size Values
4942  *  @ingroup palld_api_constants
4943  *  @{
4944  *
4945  *  @name   LUT2 Port Size Values
4946  *  @brief  Defines the LUT2 port size supported by PA.
4947  *
4948  *  @details The PA LUT2 supports both 16-bit and 32-bit entry matching. It can be used to classify 
4949  *           based on the UDP/IP 16-bit destination port with or without upper layer link or the GTP-U
4950  *           32-bit Tunnel ID. No other Layer 4 or Layer 5 protocol is supported. 
4951  */
4952 /* @{ */
4953 /**
4954  *  @def  pa_LUT2_PORT_SIZE_16
4955  *        16-bit port number such as UDP/TCP port
4956  *        
4957  */
4958 #define  pa_LUT2_PORT_SIZE_16    0
4960 /**
4961  *  @def  pa_LUT2_PORT_SIZE_32
4962  *        32-bit port number such as GTP-U Tunnel ID
4963  */
4964 #define  pa_LUT2_PORT_SIZE_32    1
4965   
4966 /*  @}  */  
4967 /** @} */
4968                         
4969                         
4970 /**
4971  *   @ingroup palld_api_functions
4972  *   @brief  Pa_addPort adds a destination port to the L4 (LUT2) table
4973  *
4974  *   @details This function is used to add an entry to the L4 (LUT2) table (see @ref netlayers). Only the
4975  *            destination port can be set, along with a link to previous L3 handle 
4976  *            (see @ref Pa_addIp) through linkHandle.
4977  *
4978  *            This module does not keep track of the L4 handles, so calling the function
4979  *            a second time with the same destination port and link handle will simply replace the
4980  *            previous entry. It is recommended to set the replace flag to indicate that this entry is
4981  *            already at the LUT2 table. This feature may be used to change the routing information without 
4982  *            deleting and adding the matching port. 
4983  *            This API also initiates the atomic queue diversion operation, which means that the QMSS moves 
4984  *            the entries in the diverted queue to the destination queue, if the divertQ is specified and 
4985  *            fReplace flag is set. In this case, the PASS will complete the LUT2 update, wait for the queue 
4986  *            diversion to be complete and then resume processing incoming packets.
4987  *            Unlike entries in the L2 and L3 table, the order of entry is not important.  
4988  *
4989  *            The type of transport header (TCP/UDP) is not specified here. If the type of transport
4990  *            is part of the packet routing criteria it is specified in the protocol type field
4991  *            in @ref paIpInfo_t in the call to @ref Pa_addIp.
4992  *
4993  *            This function supports both 16-bit and 32-bit port specified by the parameter portSize.
4994  *            However, there are the following restrictions for 32-bit ports
4995  *  @verbatim 
4996                1. The link to the previous LUT1 match can not be used so that the destID 
4997                   should be unique regressless of the previous L3 adddreses
4998                2. The 32-bit LUT2 lookup can not be mixed with the other TCP/UDP or custom LUT2 lookup. 
4999     @endverbatim
5000  *   
5001  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5002  *            The destination for the command is provided in cmdDest. The module user must send the
5003  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5004  *            must be sent back to this module through the @ref Pa_forwardResult API.
5005  *
5006  *   @param[in]     iHandle     The driver instance handle
5007  *   @param[in]     portSize    The input port size (@ref paLut2PortSize)
5008  *   @param[in]     destPort    The destination TCP/UDP port
5009  *   @param[in]     linkHandle  An L3 handle that is linked to the destination port
5010  *   @param[in]     fReplace    Flag to indicate whether the entry exists
5011  *   @param[in]     divertQ     The source queue for atomic queue diversion with LUT2 update
5012  *                              Set to pa_PARAMS_NOT_SPECIFIED if not specified
5013  *   @param[in]     routeInfo   Where to send a packet that matches
5014  *   @param[out]    retHandle   A blank handle where the return handle is placed
5015  *   @param[out]    cmd         Buffer where the PASS command is created
5016  *   @param[in]     cmdSize     The size of the cmd buffer
5017  *   @param[out]    reply       Where the response to the PASS command is routed
5018  *   @param[out]    cmdDest     Value (@ref cmdTxDest)
5019  *   @retval                    Value (@ref ReturnValues)
5020  *   @pre                       A driver instance must be created and tables initialized
5021  *
5022  */
5023 paReturn_t  Pa_addPort ( Pa_Handle       iHandle,
5024                          int             portSize,
5025                          uint32_t        destPort,
5026                          paHandleL2L3_t  linkHandle, 
5027                          uint16_t        fReplace,
5028                          uint16_t        divertQ,
5029                          paRouteInfo_t  *routeInfo,
5030                          paHandleL4_t    retHandle,
5031                          paCmd_t         cmd,
5032                          uint16_t       *cmdSize,
5033                          paCmdReply_t   *reply,
5034                          int            *cmdDest );
5035                          
5036                          
5037 /**
5038  *  @ingroup palld_api_functions
5039  *  @brief  Pa_setCustomLUT1 performs the global configuration for level 3 (LUT1) custom lookups
5040  *
5041  *  @details  This command is typically issued once per system and is used to configure the
5042  *            PA for performing network layer 3 (LUT1) custom lookups. 
5043  *            It specifies the offset and byte masks which the PA
5044  *            subsystem uses for parsing a packet that has entered custom LUT1 
5045  *            classification directed from the previous match route.
5046  *            It also specifies the next header type and offset to be used for continuous 
5047  *            parsing
5048  *
5049  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5050  *            The destination for the command is provided in cmdDest. The module user must send the
5051  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5052  *            must be sent back to this module through the @ref Pa_forwardResult API.
5053  *
5054  *  @param[in]    iHandle          The driver instance handle
5055  *  @param[in]    custIndex        The level 3 (LUT1) custom index
5056  *  @param[in]    parseByteOffset  Where the PA begins custom match (relative to the L3 start)
5057  *  @param[in]    nextHdr          The next header type to be parsed following the custom header
5058  *                                 Refer to @ref NextHeaderTypes for all supported protocols
5059  *                                 Set to pa_HDR_TYPE_UNKNOWN if no further prasing is required
5060  *  @param[in]    nextHdrOffset    Offset to the next header from the beginning of the custom header
5061  *  @param[in]    byteMasks        The bitmap of bits in the parse that matter
5062  *  @param[out]   cmd              Buffer where the PASS command is created
5063  *  @param[in]    cmdSize          On entry the size of the cmd buffer, on exit the size of the command
5064  *  @param[in]    reply            Where the response to the PASS command is routed
5065  *  @param[out]   cmdDest          Value (@ref cmdTxDest)
5066  *  @retval                        Value (@ref ReturnValues)
5067  *  @pre                           A driver instance must be created and tables initialized
5068  * 
5069  *  @note There is up to @ref pa_MAX_CUSTOM_TYPES_LUT1 LUT1 custom types supported by PASS.
5070  */
5071 paReturn_t Pa_setCustomLUT1 ( Pa_Handle       iHandle,
5072                               uint16_t        custIndex,
5073                               uint16_t        parseByteOffset,
5074                               uint16_t        nextHdr,
5075                               uint16_t        nextHdrOffset,
5076                               uint8_t         byteMasks[pa_NUM_BYTES_CUSTOM_LUT1],
5077                               paCmd_t         cmd,
5078                               uint16_t       *cmdSize,
5079                               paCmdReply_t   *reply,
5080                               int            *cmdDest );
5081                             
5082 /**
5083  *  @ingroup palld_api_functions
5084  *  @brief Pa_AddCustomLUT1 adds a custom lookup entry to the lookup tables (LUT1).
5085  *
5086  *  @details  This command is called to add a specific match entry to the L3 (LUT1) lookup table. This
5087  *            function is called once per desired custom LUT1 match criteria.
5088  *
5089  *            The LLD will determine where this entry is added based on following rules
5090  *            - If there is no previous link or the previous link is a L2 (MAC/SRIO) entry, this entry will be
5091  *              added into LUT1_1
5092  *            - If the previous link is L3 (IP/Custom LUT1), this entry will be added into LUT1_2
5093  *            
5094  *            The module user can overwrite the default rules by specifying the desired LUT1 instance. 
5095  *
5096  *            The PASS will determine which entry of the specified LUT1 table is used for this entry based on
5097  *            its internal algorithm if the module user does not specify the LUT1 index.  
5098  *
5099  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5100  *            The destination for the command is provided in cmdDest. The module user must send the
5101  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5102  *            must be sent back to this module through the @ref Pa_forwardResult API.
5103  *
5104  *  @param[in]   iHandle          The driver instance handle
5105  *  @param[in]   custIndex        The level 3 (LUT1) custom index
5106  *  @param[in]   lutInst          Specify which LUT1 (0-2) should be used.  Set to pa_LUT_INST_NOT_SPECIFIED if not specified
5107  *  @param[in]   index            Specify the index of the LUT1 entry (0-63). Set to pa_LUT1_INDEX_NOT_SPECIFIED if not specified
5108  *  @param[in]   match            The byte values that describe the match entry
5109  *  @param[in]   prevLink         An optional L2 or L3 handle that links to this lookup
5110  *  @param[in]   routeInfo        Where to send a packet that matches
5111  *  @param[in]   nextRtFail       Where to send a packet that matches here, but fails next parse level
5112  *  @param[out]  retHandle        The returned L3 handle
5113  *  @param[out]  cmd              Buffer where the command is created
5114  *  @param[in]   cmdSize          On entry the size of the cmd buffer, on exit the size of the command
5115  *  @param[in]   reply            Where the response to the PASS command is routed
5116  *  @param[out]  cmdDest          Value (@ref cmdTxDest)
5117  *  @retval                       Value (@ref ReturnValues)
5118  *  @pre                          A driver instance must be created and tables initialized
5119  */
5120 paReturn_t Pa_addCustomLUT1 ( Pa_Handle       iHandle,
5121                               uint16_t        custIndex,
5122                               int             lutInst,
5123                               int             index, 
5124                               uint8_t         match[pa_NUM_BYTES_CUSTOM_LUT1],
5125                               paHandleL2L3_t  prevLink,
5126                               paRouteInfo_t  *routeInfo,
5127                               paRouteInfo_t  *nextRtFail,
5128                               paHandleL2L3_t *retHandle,
5129                               paCmd_t         cmd,
5130                               uint16_t       *cmdSize,
5131                               paCmdReply_t   *reply,
5132                               int            *cmdDest );
5133                             
5134 /**
5135  *  @ingroup palld_api_functions
5136  *  @brief Pa_setCustomLUT2 performs the global configuration for level 4 (LUT2) custom lookups
5137  *
5138  *  @details  This command is typically called once per system and is used to configure the
5139  *            PA for performing network layer 4 (LUT2) custom lookups. 
5140  *            If handleLink is true then only 3 bytes and 3 offsets are available
5141  *            for matching. The fourth one is used to store the previous match information.
5142  *            In this case the first 3 values in the byteOffsets and byteMasks arrays are
5143  *            valid.
5144  *
5145  *            If setMask is non-zero, it will be ORed with the first byteMask and the match byte.
5146  *            It is used to distinguish this custom LUT2 entry from other custom LUT2 and standard 
5147  *            LUT2 entries.
5148  *            
5149  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5150  *            The destination for the command is provided in cmdDest. The module user must send the
5151  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5152  *            must be sent back to this module through the API @ref Pa_forwardResult.
5153  *
5154  *  @param[in]  iHandle         Driver instance handle
5155  *  @param[in]  custIndex       Level 4 (LUT2) custom index
5156  *  @param[in]  handleLink      Set to TRUE to use one byte of the match to hold previous match info
5157  *  @param[in]  custHdrSize     Size of fixed-length custom header in bytes, which is used to adjust 
5158  *                              location of the next protocol header in case the packet needs to be 
5159  *                              processed by another module such as SASS or host application. This 
5160  *                              parameter should be set to zero for all other types of headers
5161  *  @param[in]  byteOffsets     Array of offsets to the bytes to use in custom matching
5162  *  @param[in]  byteMasks       Array of bits that are valid in the custom matching
5163  *  @param[in]  setMask         Bits to be set at the first match byte
5164  *  @param[out] cmd             Buffer where the command is created
5165  *  @param[in]  cmdSize         On entry the size of the cmd buffer, on exit the size of the command
5166  *  @param[in]  reply           Where the response to the PASS command is routed
5167  *  @param[out] cmdDest         Value (@ref cmdTxDest)
5168  *  @retval                     Value (@ref ReturnValues)
5169  *  @pre                        A driver instance must be created and tables initialized
5170  *
5171  *  @note There is up to @ref pa_MAX_CUSTOM_TYPES_LUT2 LUT2 custom types supported by PASS.
5172  */
5173 paReturn_t Pa_setCustomLUT2 ( Pa_Handle       iHandle,
5174                               uint16_t        custIndex,
5175                               uint16_t        handleLink,
5176                               uint16_t        custHdrSize,
5177                               uint16_t        byteOffsets[pa_NUM_BYTES_CUSTOM_LUT2],
5178                               uint8_t         byteMasks[pa_NUM_BYTES_CUSTOM_LUT2],
5179                               uint8_t         setMask,
5180                               paCmd_t         cmd,
5181                               uint16_t       *cmdSize,
5182                               paCmdReply_t   *reply,
5183                               int            *cmdDest );
5184                             
5185 /**
5186  *  @ingroup palld_api_functions
5187  *  @brief  Pa_addCustomLUT2 adds a custom lookup to the LUT2 lookup tables
5188  * 
5189  *  @details  This command is called to add a specific entry to the L4 (LUT2) lookup table. This
5190  *            function is called once per desired custom LUT2 match criteria.
5191  *            This API also initiates the atomic queue diversion operation, which means that the QMSS moves 
5192  *            the entries in the diverted queue to the destination queue, if the divertQ is specified and 
5193  *            fReplace flag is set. In this case, the PASS will complete the LUT2 update, wait for the queue 
5194  *            diversion to be complete and then resume processing incoming packets.
5195  *
5196  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5197  *            The destination for the command is provided in cmdDest. The module user must send the
5198  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5199  *            must be sent back to this module through the @ref Pa_forwardResult API.
5200  *
5201  *  @param[in]  iHandle      The driver instance handle
5202  *  @param[in]  custIndex    The level 4 (LUT2) custom index
5203  *  @param[in]  match        The four match values, only 1st three valid if prevLink is non-NULL
5204  *  @param[in]  prevLink     An optional L2 or L3 handle that links to this lookup
5205  *  @param[in]  divertQ      The source queue for atomic queue diversion with LUT2 update
5206  *                           Set to pa_PARAMS_NOT_SPECIFIED if not specified
5207  *  @param[in]  fReplace     Flag to indicate whether the entry exists
5208  *  @param[in]  routeInfo    Where to send a packet that matches
5209  *  @param[out] retHandle    The returned L4 handle
5210  *  @param[out] cmd          The buffer where the command is created
5211  *  @param[in]  cmdSize      On entry the size of the cmd buffer, on exit the size of the command
5212  *  @param[in]  reply        Where the response to the PASS command is routed
5213  *  @param[out] cmdDest      Value (@ref cmdTxDest)
5214  *  @retval                  Value (@ref ReturnValues)
5215  *  @pre                     A driver instance must be created and tables initialized
5216  */
5217 paReturn_t Pa_addCustomLUT2 ( Pa_Handle       iHandle,
5218                               uint16_t        custIndex,
5219                               uint8_t         match[pa_NUM_BYTES_CUSTOM_LUT2],
5220                               paHandleL2L3_t  prevLink,
5221                               uint16_t        fReplace,
5222                               uint16_t        divertQ,
5223                               paRouteInfo_t  *routeInfo,
5224                               paHandleL4_t    retHandle,
5225                               paCmd_t         cmd,
5226                               uint16_t       *cmdSize,
5227                               paCmdReply_t   *reply,
5228                               int            *cmdDest );
5229                             
5230 /**
5231  *  @ingroup palld_api_functions
5232  *  @brief  Pa_forwardResult examines the reply of the sub-system to a command
5233  *
5234  *  @details  This command is used to pass the sub-system generated replies to commands back to
5235  *            this module. Functions @ref Pa_addMac, @ref Pa_addSrio, @ref Pa_addCustomLUT1 and 
5236  *            @ref Pa_addIp generate replies that must be
5237  *            forwarded to this module, or else handle deletion and link are not possible. Other
5238  *            commands generate replies that can be sent to this module which will return any
5239  *            warnings detected in the sub-system.
5240  *
5241  *  @param[in]    iHandle    The driver instance handle
5242  *  @param[in]    vresult    The command reply packet from the sub-system
5243  *  @param[out]   retHandle  Returns the handle associated with the command
5244  *  @param[out]   handleType Value @ref HandleTypes
5245  *  @param[out]   cmdDest    Value (@ref cmdTxDest)
5246  *  @retval                  Value (@ref ReturnValues)
5247  *  @pre                     A driver instance must be created and tables initialized
5248  */
5249 paReturn_t Pa_forwardResult (Pa_Handle iHandle, void *vresult, paEntryHandle_t *retHandle, int *handleType, int *cmdDest);
5252 /**
5253  *  @ingroup palld_api_functions
5254  *  @brief  Pa_configExceptionRoute configures the routing of packets based on a exception condition such as
5255  *          MAC briadcast, multicast or error packet
5256  *
5257  *  @details  This function is used to configure the sub-system to route packets that satisfy an exception
5258  *            rule or condition (see @ref ErouteTypes). For example,
5259  *            - failure to table match
5260  *            - parsing error i.e. the sub-system is not able to continuethe parse
5261  *            - MAC broadcast packets
5262  *            - IP multicast packets  
5263  *
5264  *            From one to @ref pa_EROUTE_MAX routes can be specified through a single call to this
5265  *            function.  Parameter nRoute is used to specify how many routes are contained in the
5266  *            routeTypes and eRoutes arrays. A value of 0 nRoutes results in no action by the function.
5267  *
5268  *            By default when each exception type is detected the packet is discarded silently. Once the
5269  *            route is changed through a call to this function it remains in the new state until the
5270  *            function is called again to explicitly change that route. The only way to revert back
5271  *            to the default of silent discard is to call this function again.
5272  *
5273  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5274  *            The destination for the command is provided in cmdDest. The module user must send the
5275  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5276  *            must be sent back to this module through the API @ref Pa_forwardResult.
5277  *
5278  *  @param[in]    iHandle     The driver instance handle
5279  *  @param[in]    nRoute      The number of exception routes specified
5280  *  @param[in]    routeTypes  Array of exception routing types (@ref ErouteTypes)
5281  *  @param[in]    eRoutes     Array of exception packet routing configuration
5282  *  @param[out]   cmd         Buffer where the sub-system command is created
5283  *  @param[in]    cmdSize     The size of the passCmd buffer
5284  *  @param[in]    reply       Where the response to the PASS command is routed
5285  *  @param[out]   cmdDest     Value (@ref cmdTxDest)
5286  *  @retval                   Value (@ref ReturnValues)
5287  *  @pre                      A driver instance must be created and tables initialized
5288  */
5289 paReturn_t Pa_configExceptionRoute (Pa_Handle       iHandle,
5290                                     int             nRoute,
5291                                     int            *routeTypes,
5292                                     paRouteInfo_t  *eRoutes,
5293                                     paCmd_t         cmd,
5294                                     uint16_t       *cmdSize,
5295                                     paCmdReply_t   *reply,
5296                                     int            *cmdDest);
5297                                  
5298 /**
5299  *  @ingroup palld_api_functions
5300  *  @brief  Pa_configCmdSet configures the command set which consists of a list of commands
5301  *
5302  *  @details  This function is used to configure the sub-system to format and store a list 
5303  *            of commands which are executed in order when a match occurs and the command set is 
5304  *            specified by the routing information.
5305  *
5306  *            The command set is created and refered to based on the command set index.  
5307  *            Once the command set is created through a call to this function it remains effective 
5308  *            until the function is called again to explicitly overwrite its content. It is not 
5309  *            recommended to update a command set when it is still used by one or more packet 
5310  *            routes.  
5311  *            There are @ref pa_MAX_CMD_SETS of command sets supported by the sub-system
5312  *
5313  *            The commands within the command set will be executed in order at PDSP4. The module user is 
5314  *            responsible for placing the commands in such ways that the packet offsets required by commands should
5315  *            be in ascending order, otherwise, the unexecutable command will be ignored. The command set
5316  *            should be terminated with a pa_CMD_NEXT_ROUTE or pa_CMD_MULTI_ROUTE command. If there is
5317  *            no final route command specified, the PASS will use the default next route command. Please note
5318  *            that all the commands following the pa_CMD_NEXT_ROUTE or pa_CMD_MULTI_ROUTE command will be ignored.  
5319  *            
5320  *            This API supports the following commands (@ref paCmdCode)
5321  *            @li  pa_CMD_REMOVE_HEADER
5322  *            @li  pa_CMD_COPY_DATA_TO_PSINFO 
5323  *            @li  pa_CMD_CRC_OP
5324  *            @li  pa_CMD_PATCH_DATA
5325  *            @li  pa_CMD_REMOVE_TAIL
5326  *            @li  pa_CMD_NEXT_ROUTE
5327  *            @li  pa_CMD_MULTI_ROUTE
5328  *            @li  pa_CMD_USR_STATS
5329  *            @li  pa_CMD_VERIFY_PKT_ERROR
5330  *            @li  pa_CMD_SPLIT 
5331  *
5332  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5333  *            The destination for the command is provided in cmdDest. The module user must send the
5334  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5335  *            must be sent back to this module through the API @ref Pa_forwardResult.
5336  *
5337  *  @param[in]    iHandle     The driver instance handle
5338  *  @param[in]    index       The command set index
5339  *  @param[in]    nCmd        The number of commands specified
5340  *  @param[in]    cmdInfo     Array of command configuration information
5341  *  @param[out]   cmd         Buffer where the sub-system command is created
5342  *  @param[in]    cmdSize     The size of the passCmd buffer
5343  *  @param[in]    reply       Where the response to the PASS command is routed
5344  *  @param[out]   cmdDest     Value (@ref cmdTxDest)
5345  *  @retval                   Value (@ref ReturnValues)
5346  *  @pre                      A driver instance must be created and tables initialized
5347  */
5348 paReturn_t Pa_configCmdSet (Pa_Handle       iHandle,
5349                             uint16_t        index,
5350                             int             nCmd,
5351                             paCmdInfo_t    *cmdInfo,
5352                             paCmd_t         cmd,
5353                             uint16_t       *cmdSize,
5354                             paCmdReply_t   *reply,
5355                             int            *cmdDest);
5356                             
5357 /**
5358  *  @ingroup palld_api_functions
5359  *  @brief  Pa_configMultiRouteSet configures the multi-route group which consists of packet multi-route
5360  *          entries
5361  *
5362  *  @details  This function is used to configure the sub-system to format and store a multi- 
5363  *            route set which contains routing information for up to @ref pa_MAX_MULTI_ROUTE_ENTRIES 
5364  *            destinations.
5365  *
5366  *            The multi-route group is created and refered to based on the multi-route index.  
5367  *            Once the multi-route group is created through a call to this function it remains effective 
5368  *            until the function is called again to explicitly overwrite its content. It is not 
5369  *            recommended to update a mult-route group when it is still used by one or more packet 
5370  *            routes.  
5371  *
5372  *            There are @ref pa_MAX_MULTI_ROUTE_SETS of multi-route sets supported by the sub-system
5373  *
5374  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5375  *            The destination for the command is provided in cmdDest. The module user must send the
5376  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5377  *            must be sent back to this module through the API @ref Pa_forwardResult.
5378  *
5379  *  @param[in]    iHandle     The driver instance handle
5380  *  @param[in]    mode        The operation mode (CONFIG or RESET) refer to @ref paMultiRouteModes_e
5381  *  @param[in]    index       The multi-route index
5382  *  @param[in]    nRoute      The number of routing entries specified
5383  *  @param[in]    routeEntry  Array of routing configuration information
5384  *  @param[out]   cmd         Buffer where the sub-system command is created
5385  *  @param[in]    cmdSize     The size of the passCmd buffer
5386  *  @param[in]    reply       Where the response to the PASS command is routed
5387  *  @param[out]   cmdDest     Value (@ref cmdTxDest)
5388  *  @retval                   Value (@ref ReturnValues)
5389  *  @pre                      A driver instance must be created and tables initialized
5390  */
5391 paReturn_t Pa_configMultiRoute (Pa_Handle               iHandle,
5392                                 paMultiRouteModes_e     mode,
5393                                 uint16_t                index,
5394                                 uint16_t                nRoute,
5395                                 paMultiRouteEntry_t    *routeEntry,
5396                                 paCmd_t                 cmd,
5397                                 uint16_t               *cmdSize,
5398                                 paCmdReply_t           *reply,
5399                                 int                    *cmdDest);
5400                                    
5401 /**
5402  *  @ingroup palld_api_functions
5403  *  @brief  Pa_configCrcEngine configures the specified CRC engine
5404  *
5405  *  @details  This function is used to configure the specified CRC engine by formating the 
5406  *            CRC configuration command packet. 
5407  *
5408  *            There are 6 CRC engines in the PA sun-system. Each CRC engine is connected to its 
5409  *            corresponding PDSP. It performs CRC operation required by the some network protocol 
5410  *            such as SCTP and/or the user-specified CRC command for its corresponding PDSP. 
5411  *            Therefore, it is referred by the PDSP number.  
5412  *
5413  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5414  *            The destination for the command is provided in cmdDest. The module user must send the
5415  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5416  *            must be sent back to this module through the @ref Pa_forwardResult API.
5417  *
5418  *  @note     Each CRC engine only supports one type of CRC per configuration.
5419  *            It is up to the module user to configure and use the CRC engine by calling this function
5420  *            for the specific use cases. For example, the CRC engine connected to PDSP2 should be 
5421  *            configured to perform CRC-32c checksum for SCTP over inner-IP use case.
5422  *
5423  *  @param[in]    iHandle     The driver instance handle
5424  *  @param[in]    index       The CRC engine index
5425  *  @param[in]    cfgInfo     The CRC engine configuration information
5426  *  @param[out]   cmd         Buffer where the sub-system command is created
5427  *  @param[in]    cmdSize     The size of the passCmd buffer
5428  *  @param[in]    reply       Where the response to the PASS command is routed
5429  *  @param[out]   cmdDest     Value (@ref cmdTxDest)
5430  *  @retval                   Value (@ref ReturnValues)
5431  *  @pre                      A driver instance must be created and tables initialized
5432  */
5433 paReturn_t Pa_configCrcEngine (Pa_Handle       iHandle,
5434                                uint16_t        index,
5435                                paCrcConfig_t  *cfgInfo,
5436                                paCmd_t         cmd,
5437                                uint16_t       *cmdSize,
5438                                paCmdReply_t   *reply,
5439                                int            *cmdDest);
5440                                
5441 /**
5442  *  @ingroup palld_api_functions
5443  *  @brief  Pa_configUsrStats configures the user-defined statistics operation
5444  *
5445  *  @details  This function performs the counter configuration for the multi-level hierarchical user-defined 
5446  *            statistics which consists of up to 64 64-bit counters and up to 192 32-bit counters. Each counter  
5447  *            can be linked to the next level counter. All counters in its linking chain will be incremented 
5448  *            when the lowest level counter is updated. The module user can specify the type of each counter and 
5449  *            how the counter is linked to the next level counter. 
5450  *            It is not recommended to re-configure the user-defined statistics when one or more counters are 
5451  *            still used by PASS. The command reply routing is optional because this command is always 
5452  *            processed by the PA sub-system.  
5453  *
5454  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5455  *            The destination for the command is provided in cmdDest. The module user must send the
5456  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5457  *            must be sent back to this module through the @ref Pa_forwardResult API.
5458  *
5459  *  @param[in]    iHandle     The driver instance handle
5460  *  @param[in]    cfgInfo     The user-defined statistics configuration information
5461  *  @param[out]   cmd         Buffer where the sub-system command is created
5462  *  @param[in]    cmdSize     The size of the passCmd buffer
5463  *  @param[in]    reply       Where the response to the PASS command is routed
5464  *  @param[out]   cmdDest     Value (@ref cmdTxDest)
5465  *  @retval                   Value (@ref ReturnValues)
5466  *  @pre                      A driver instance must be created and tables initialized
5467  */
5468 paReturn_t Pa_configUsrStats (Pa_Handle                iHandle,
5469                               paUsrStatsConfigInfo_t  *cfgInfo,
5470                               paCmd_t                  cmd,
5471                               uint16_t                *cmdSize,
5472                               paCmdReply_t            *reply,
5473                               int                     *cmdDest);
5475 /**
5476  *  @ingroup palld_api_functions
5477  *  @brief  Pa_configTimestamp configures the PA timer which is used to generate 48-bit timestamp
5478  *
5479  *  @details  This function is used to configure the 16-bit timer reserved for the 48-bit system 
5480  *            timestamp. The lower 32-bit of the system timestamp will be inserted into the timestamp 
5481  *            field in the packet descriptor for all input packets. It can be also inserted into 
5482  *            the timestamp report packets triggered by the egress packets per tx command.
5483  *            The 16-bit timer connected to PDSP0 is reserved for timestamp generation.
5484  *
5485  *  @param[in]    iHandle     The driver instance handle
5486  *  @param[in]    cfgInfo     The timestamp configuration information
5487  *  @retval                   Value (@ref ReturnValues)
5488  *  @pre                      A driver instance must be created and tables initialized
5489  *
5490  */
5491 paReturn_t Pa_configTimestamp (Pa_Handle            iHandle,
5492                                paTimestampConfig_t  *cfgInfo);
5493                                
5494 /**
5495  *  @ingroup palld_api_functions
5496  *  @brief  Pa_getTimestamp returns the 48-bit system timestamp
5497  *
5498  *  @details  This function is called to retrieve the current value of 48-bit PASS system timestamp.
5499  *
5500  *  @param[in]    iHandle     The driver instance handle
5501  *  @param[out]   pTimestamp  Pointer to the 48-bit timestamp
5502  *  @retval                   Value (@ref ReturnValues)
5503  *  @pre                      A driver instance must be created and tables initialized
5504  *
5505  */
5506 paReturn_t Pa_getTimestamp (Pa_Handle            iHandle,
5507                             paTimestamp_t        *pTimestamp);
5508                                
5510 /**
5511  *  @ingroup palld_api_functions
5512  *  @brief  Pa_requestStats requests sub-system statistics
5513  *
5514  *  @details  This function is used to request the operating statistics from the sub-system. 
5515  *            The statistics can be optionally cleared after reading through the doClear parameter.
5516  *            The statistics apply to the entire sub-system, and are not core dependent on multi-core
5517  *            devices.
5518  *
5519  *            On return the command buffer (cmd) contains a formatted command for the sub-system. 
5520  *            The destination for the command is provided in cmdDest. The module user must send the
5521  *            formatted command to the sub-system. The sub-system will generate a reply and this reply
5522  *            must be sent back to this module through the API @ref Pa_formatStatsReply.
5523  *
5524  *  @param[in]    iHandle    The driver instance handle
5525  *  @param[in]    doClear    If TRUE then stats are cleared after being read
5526  *  @param[out]   cmd        Buffer where the sub-system command is created
5527  *  @param[in]    cmdSize    The size of the cmd buffer
5528  *  @param[in]    reply      Where the response of the PASS command is routed
5529  *  @param[out]   cmdDest    Value (@ref cmdTxDest)
5530  *  @param[out]   pSysStats  Pointer to the sysStats buffer
5531  *  @retval                  Value (@ref ReturnValues)
5532  *  @pre                     A driver instance must be created and tables initialized
5533  *  
5534  *  @note This function is depreciated, use @ref Pa_querySysStats in stead.
5535  */
5536 paReturn_t Pa_requestStats (Pa_Handle      iHandle,
5537                             uint16_t       doClear, 
5538                             paCmd_t        cmd, 
5539                             uint16_t      *cmdSize, 
5540                             paCmdReply_t  *reply, 
5541                             int           *cmdDest,
5542                             paSysStats_t  *pSysStats);
5543                             
5544 /**
5545  *  @ingroup palld_api_functions
5546  *  @brief  Pa_querySysStats requests sub-system statistics
5547  *
5548  *  @details  This function is used to query the operating statistics from the sub-system. 
5549  *            The statistics can be optionally cleared after reading through the doClear parameter.
5550  *            The statistics apply to the entire sub-system, and are not core dependent on multi-core
5551  *            devices.
5552  *
5553  *  @param[in]    iHandle    The driver instance handle
5554  *  @param[in]    doClear    If TRUE then stats are cleared after being read
5555  *  @param[out]   pSysStats  Pointer to the sysStats buffer
5556  *  @retval                  Value (@ref ReturnValues)
5557  *  @pre                     A driver instance must be created and tables initialized
5558  */
5559 paReturn_t Pa_querySysStats (Pa_Handle      iHandle,
5560                              uint16_t       doClear, 
5561                              paSysStats_t  *pSysStats);
5562 /**
5563  *  @ingroup palld_api_functions
5564  *  @brief  Pa_formatStatsReply formats the stats reply from the PA
5565  *
5566  *  @details  This function is used to convert the stats from the sub-system into a format
5567  *            useful for the application
5568  *
5569  *  @param[in]    handle    The driver instance handle
5570  *  @param[in]    cmd       The buffer returned with the request stats response from PA
5571  *  @retval                 A pointer to the formatted stats
5572  *  @pre                    A call to @ref Pa_requestStats with output sent to PA and a 
5573  *                          reply generated from PA.
5574  */
5575 paSysStats_t* Pa_formatStatsReply (Pa_Handle    handle,
5576                                    paCmd_t      cmd);
5577                                    
5578 /**
5579  *  @ingroup palld_api_functions
5580  *  @brief  Pa_requestUsrStats queries user-defined statistics
5581  *
5582  *  @details  This function is used to query the user-defined statistics from the sub-system. 
5583  *            The statistics will be formatted and copied to the buffer provided.
5584  *            The sub-system statistics can be then optionally cleared if doClear is set. 
5585  *            In this case, the command buffer (cmd) contains a formatted command for the sub-system. 
5586  *            The destination for the command is provided in cmdDest. The module user must send the
5587  *            formatted command to the sub-system. 
5588  *
5589  *  @param[in]    iHandle    The driver instance handle
5590  *  @param[in]    doClear    If TRUE then stats are cleared after being read
5591  *  @param[out]   cmd        Buffer where the sub-system command is created
5592  *  @param[in]    cmdSize    The size of the cmd buffer
5593  *  @param[in]    reply      Where the response of the PASS command is routed
5594  *  @param[out]   cmdDest    Value (@ref cmdTxDest)
5595  *  @param[out]   pUsrStats  Pointer to the usrStats buffer
5596  *  @retval                  Value (@ref ReturnValues)
5597  *  @pre                     A driver instance must be created and tables initialized
5598  */
5599 paReturn_t Pa_requestUsrStats (Pa_Handle      iHandle,
5600                                uint16_t       doClear, 
5601                                paCmd_t        cmd, 
5602                                uint16_t      *cmdSize, 
5603                                paCmdReply_t  *reply, 
5604                                int           *cmdDest,
5605                                paUsrStats_t  *pUsrStats);
5606                                
5607 /**
5608  *  @ingroup palld_api_functions
5609  *  @brief  Pa_queryRaStats queries RA statistics
5610  *
5611  *  @details  This function is used to query the RA statistics from the sub-system. 
5612  *            The statistics will be formatted and copied to the buffer provided.
5613  *            The sub-system statistics can be then optionally cleared if doClear is set. 
5614  *
5615  *  @param[in]    iHandle    The driver instance handle
5616  *  @param[in]    doClear    If TRUE then stats are cleared after being read
5617  *  @param[out]   pRaStats   Pointer to the raStats buffer
5618  *  @retval                  Value (@ref ReturnValues)
5619  *  @pre                     A driver instance must be created and tables initialized
5620  */
5621 paReturn_t Pa_queryRaStats (Pa_Handle     iHandle,
5622                             uint16_t      doClear, 
5623                             paRaStats_t  *pRaStats);
5624                               
5625 /**
5626  *  @ingroup palld_api_functions
5627  *  @brief  Pa_queryAclStats queries ACL per-entry statistics
5628  *
5629  *  @details  This function is used to query the ACL per-entry statistics. 
5630  *            The statistics can be optionally cleared after reading through the doClear parameter.
5631  *
5632  *  @param[in]    iHandle    The driver instance handle
5633  *  @param[in]    aclHandle  The ACL handle
5634  *  @param[in]    doClear    If TRUE then stats are cleared after being read
5635  *  @param[out]   pAclStats  Pointer to the aclStats buffer
5636  *  @retval                  Value (@ref ReturnValues)
5637  *  @pre                     A driver instance must be created and tables initialized
5638  */
5639 paReturn_t Pa_queryAclStats (Pa_Handle      iHandle,
5640                              paHandleAcl_t  aclHandle,
5641                              uint16_t       doClear, 
5642                              paAclStats_t  *pAclStats);
5644 /**
5645  *  @ingroup palld_api_functions
5646  *  @brief  Pa_formatTxRoute formats the commands to add checksums and route a Tx packet
5647  *
5648  *  @details  This function is used to create the command block which is used by the packet accelerator
5649  *            sub-system to forward the packet with optional checksum generation.
5650  *            The module user can combine this block with other command blocks that control the security 
5651  *            accelerator. The combined block is then provided for the transmitted packets in the Protocol 
5652  *            specific section of the packet descriptor. This API needs only to be called once, and the same 
5653  *            protocol specific section can be used for every packet in the channel. If the length of the 
5654  *            checksum area changes with each packet, update the command buffer with the macro 
5655  *            PASS_SET_TX_CHKSUM_LENGTH()
5656  *
5657  *  @note     The Tx commands can be executed at either PDSP4 or PDSP5. However, it is highly
5658  *            recommended to use PDSP5 for load balance since PDSP4 will be used to execute 
5659  *            multi-routing and from-network command set.
5660  *
5661  *  @param[in]   chk0       Checksum 0 configuration. NULL if no checksum computation required
5662  *  @param[in]   chk1       Checksum 1 configuration. NULL if no checksum computation required
5663  *  @param[in]   route      Next packet routing from sub-system
5664  *  @param[out]  cmdBuffer  The routing command is formed in this buffer
5665  *  @param[in]   cmdSize    On entry the size of cmdBuffer. On exit the size of the command
5666  *  @retval                 Value (@ref ReturnValues)
5667  */
5668 paReturn_t Pa_formatTxRoute  (paTxChksum_t  *chk0,
5669                               paTxChksum_t  *chk1,
5670                               paRouteInfo_t *route,
5671                               void          *cmdBuffer,
5672                               uint16_t      *cmdSize );
5673                              
5674 /**
5675  *  @ingroup palld_api_functions
5676  *  @brief  Pa_formatRoutePatch formats the commands to route a packet and blind patch
5677  *
5678  *  @details  This function is used to create the command block which is used by the packet accelerator
5679  *            sub-system to perform blind patches on the packet. This function user optionally combines
5680  *            the generated block with other blocks to create compound commands. The command blocks are
5681  *            attached to data packets in the Protocol specific section of the packet descriptor.
5682  *
5683  *  @note     The Tx commands can be executed at either PDSP4 or PDSP5. However, it is highly
5684  *            recommended to use PDSP5 for load balance since PDSP4 will be used to execute 
5685  *            multi-routing and from-network command set.
5686  *
5687  *  @param[in]   route      Specifies where the packet is sent after the patch is complete
5688  *  @param[in]   patch      The patch information
5689  *  @param[out]  cmdBuffer  The routing command is formed in this buffer
5690  *  @param[in]   cmdSize    On entry this size of cmdBuffer. On exit the amound of cmdBuffer used
5691  *  @retval                 Value (@ref ReturnValues)
5692  */
5693                              
5694 paReturn_t Pa_formatRoutePatch (paRouteInfo_t *route,
5695                                 paPatchInfo_t *patch,
5696                                 void          *cmdBuffer,
5697                                 uint16_t      *cmdSize);
5698                                 
5699 /**
5700  *  @ingroup palld_api_functions
5701  *  @brief  Pa_formatTxCmd formats a list of commands to be executed on the packets to be transmitted
5702  *          over the network
5703  *
5704  *  @details  This function is used to create, append and update the list of commands which will be 
5705  *            executed by the packet accelerator and security accelerator sub-systems to perform a sequence 
5706  *            of actions on the packet. The command block should be attached to data packets in the 
5707  *            protocol specific section of the packet descriptor. 
5708  *
5709  *            This API may be called multiple times to add or update the command block.
5710  *            The same protocol specific section can be used for every packet in the channel after the
5711  *            command list is constructed. Multiple MACROs may be used to update some parameters
5712  *            such as packet length in the command buffer for each packet. 
5713  *
5714  *            This API supports the following commands (@ref paCmdCode):
5715  *            @li pa_CMD_NEXT_ROUTE
5716  *            @li pa_CMD_CRC_OP
5717  *            @li pa_CMD_PATCH_DATA
5718  *            @li pa_CMD_TX_CHECKSUM
5719  *            @li pa_CMD_REPORT_TX_TIMESTAMP
5720  *            @li pa_CMD_SA_PAYLOAD
5721  *            @li pa_CMD_IP_FRAGMENT
5722  *            @li pa_CMD_PATCH_MSG_LEN
5723  *
5724  *  @note     The Tx commands can be executed at either PDSP4 or PDSP5. However, it is highly
5725  *            recommended to use PDSP5 for load balance since PDSP4 will be used to execute 
5726  *            multi-routing and from-network command set.
5727  *
5728  *  @param[in]   nCmd       The number of commands specified
5729  *  @param[in]   cmdInfo    Array of command configuration information
5730  *  @param[in]   offset     The command buffer location where the new commands are inserted
5731  *  @param[out]  cmdBuffer  Buffer where the sub-system command is created
5732  *  @param[in]   cmdSize    On entry this size of cmdBuffer. On exit the amound of cmdBuffer used
5733  *  @retval                 Value (@ref ReturnValues)
5734  *
5735  *  @note The command buffer should be 4-byte aligned
5736  */
5737                              
5738 paReturn_t Pa_formatTxCmd (int             nCmd,
5739                            paCmdInfo_t    *cmdInfo,
5740                            uint16_t        offset,
5741                            void           *cmdBuffer,
5742                            uint16_t       *cmdSize);
5743                              
5744 /**
5745  *  @ingroup palld_api_functions
5746  *  @brief  Pa_resetControl controls the reset state of the Sub-system
5747  *
5748  *  @details  This function is used to assert or release reset for the sub-system. Asserting reset does not
5749  *            reset any of the sub-system tables (L2, L3 or L4, see @ref netlayers), but only the packet
5750  *            processing modules. To achieve a complete system reset the system level reset must be asserted
5751  *            through the power controller.
5752  *
5753  *  @param[in]   iHandle    The driver instance handle
5754  *  @param[in]   newState   Value @ref paSubSysStates
5755  *  @retval                 Value @ref paSubSysStates
5756  *  @pre                    None
5757  *
5758  *  @note This function will access the PA sub-system registers. It is up to the module user to provide critical
5759  *        section protection so that only one core or task should use this function at a time.
5760  */
5761 paSSstate_t Pa_resetControl (Pa_Handle iHandle, paSSstate_t newState);
5762                              
5763                              
5764 /**
5765  *  @ingroup palld_api_functions
5766  *  @brief  Pa_downloadImage downloads a PDSP image to a sub-system with the packet processing modules in reset.
5767  *
5768  *  @details This function is used to download an executable PDSP image to the specific packet processing module.
5769  *           See section table @ref appendix1 for a description of PDSP images provided by this module
5770  *
5771  *  @param[in]   iHandle   The driver instance handle
5772  *  @param[in]   modId     The PDSP number (0-5)
5773  *  @param[in]   image     The image to download
5774  *  @param[in]   sizeBytes The size of the image
5775  *  @retval                Value (@ref ReturnValues)
5776  *  @pre                   The packet processing modules must be in reset. See @ref Pa_resetControl.
5777  *
5778  *  @note This function will access the PA sub-system registers. It is up to the module user to provide critical
5779  *        section protection so that only one core or task should use this function at a time.
5780  */
5781 paReturn_t Pa_downloadImage (Pa_Handle iHandle, int modId, void* image, int sizeBytes);
5783 /**
5784  *  @ingroup palld_api_functions
5785  *  @brief  Pa_getHandleRefCount returns the number of reference channels linked to the LUT1 handle
5786  *
5787  *  @details  The LLD maintains the reference counter for LUT1 handles: MAC/IP. Given a handle, 
5788  *            the LLD would return how many references are being used in next header entry by invoking
5789  *            the function. For example, Query on MAC handle need to return how many IP handles are 
5790  *            referencing the MAC handles. Query on IP handle need to return how many next protocol 
5791  *            entries: IP/UDP are referencing to the IP handle.
5792  *            Therefore this function can be used to verify whether the LUT1 entry associated with
5793  *            the handle can be reomved.
5794  *
5795  *  @param[in]   iHandle    The driver instance handle
5796  *  @param[in]   l2l3handle The L2 or L3 handle to be queryed
5797  *  @param[out]  refCount   The number of reference channels
5798  *  @retval                 Value (@ref ReturnValues)
5799  */
5800 paReturn_t Pa_getHandleRefCount ( Pa_Handle       iHandle,
5801                                   paHandleL2L3_t  l2l3handle,
5802                                   uint16_t        *refCount );
5803                                   
5804 /**
5805  *  @ingroup palld_api_functions
5806  *  @brief  Pa_getPDSPVersion returns the PA PDSP version information.
5807  *
5808  *  @details This function is used to get the PA PDSP version information in 0xAABBCCDD format.
5809  *           where Arch (AA); API Changes (BB); Major (CC); Minor (DD
5810  *
5811  *  @param[in]   iHandle   The driver instance handle
5812  *  @param[in]   modId     The PDSP number (0-5)
5813  *  @param[out]  pVersion  The pointer to PDSP version number
5814  *  @retval                Value (@ref ReturnValues)
5815  *  @pre                   The PDSP image should be downloaded successfully.
5816  *
5817  */
5818 paReturn_t Pa_getPDSPVersion (Pa_Handle iHandle, int modId, uint32_t *pVersion);
5821 /**
5822  *  @ingroup palld_api_functions
5823  *  @brief  Pa_getVersion returns the PA LLD version information
5824  *
5825  *  @details This function is used to get the version information of the PA LLD in 0xAABBCCDD format.
5826  *           where Arch (AA); API Changes (BB); Major (CC); Minor (DD)
5827  *
5828  *  @retval                32-bit version information
5829  */
5830 uint32_t Pa_getVersion (void);
5833 /**
5834  *  @ingroup palld_api_functions
5835  *  @brief  Pa_getVersionStr returns the PA LLD version string
5836  *
5837  *  @details This function is used to get the version string of the PA LLD.
5838  *
5839  *  @retval                Version string
5840  */
5841 const char* Pa_getVersionStr (void);
5843 /**
5844  *  @ingroup palld_api_macros
5845  *  @brief  pa_RESET_SUBSYSTEM is used to reset the Sub-system
5846  *
5847  *  @details  This macro is used to put the packet processing sub-system into reset. It performs the same function
5848  *            as @ref Pa_resetControl, but in macro form. The module user must define the macro SYSTEM_WRITE32.
5849  *
5850  *  @pre      The module user must define a macro called SYSTEM_WRITE32(address, value) which writes a 32 bit
5851  *            value (value) to global address (address).
5852  *            
5853  */
5854 #define pa_RESET_SUBSYSTEM()      \
5855 {                                 \
5856       CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;    \
5857                                                                         \
5858       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[0].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5859       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[1].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5860       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[2].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5861       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[3].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5862       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[4].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5863       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[5].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_SOFT_RST_N_MASK));   \
5864       SYSTEM_WRITE32(&(passRegs->PKT_ID.PKT_ID_SOFT_RESET, 1);    \
5865       SYSTEM_WRITE32(&(passRegs->STATS.STATS_SOFT_RESET, 1);    \
5866       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[0].TIMER_CNTRL_REG,   0);    \
5867       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[1].TIMER_CNTRL_REG,   0);    \
5868       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[2].TIMER_CNTRL_REG,   0);    \
5869       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[3].TIMER_CNTRL_REG,   0);    \
5870       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[4].TIMER_CNTRL_REG,   0);    \
5871       SYSTEM_WRITE32(&(passRegs->PDSP_TIMER[5].TIMER_CNTRL_REG,   0);    \
5872 }      
5873       
5874 /**
5875  *  @ingroup palld_api_macros
5876  *  @brief  pa_ENABLE_SUBSYSTEM enables the subsystem.
5877  *
5878  *  @details This macro is used to release reset from the packet processing sub-system. It performs the same
5879  *           function as @ref Pa_resetControl, but in macro from. The module user must define the macro SYSTEM_WRITE32
5880  *           and SYSTEM_READ32.
5881  *
5882  *  @pre     The module user must define the macro SYSTEM_WRITE32(address, value) and SYSTEM_READ32 (address) which
5883  *           read and write to global address (address). 
5884  */
5885 #define pa_ENABLE_SUBSYSTEM()    \
5886 {                                 \
5887       CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;    \
5888                                                                         \
5889       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[0].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5890       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[1].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5891       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[2].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5892       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[3].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5893       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[4].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5894       SYSTEM_WRITE32(&(passRegs->PDSP_CTLSTAT[5].PDSP_CONTROL), (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK));   \
5895       while (SYSTEM_READ32(&(passRegs->MAILBOX[0].MBOX_SLOT[0])) == 0);          \
5896       while (SYSTEM_READ32(&(passRegs->MAILBOX[1].MBOX_SLOT[0])) == 0);          \
5897       while (SYSTEM_READ32(&(passRegs->MAILBOX[2].MBOX_SLOT[0])) == 0);          \
5898       while (SYSTEM_READ32(&(passRegs->MAILBOX[3].MBOX_SLOT[0])) == 0);          \
5899       while (SYSTEM_READ32(&(passRegs->MAILBOX[4].MBOX_SLOT[0])) == 0);          \
5900       while (SYSTEM_READ32(&(passRegs->MAILBOX[5].MBOX_SLOT[0])) == 0);          \
5901       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[1], 1);                    \
5902       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[0], 0);                    \
5903       while (SYSTEM_READ32(&(passRegs->MAILBOX[0].MBOX_SLOT[1])) == 1);          \
5904       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[1], 0);                    \
5905       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[2], 0);                    \
5906       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[3], 0);                    \
5907       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[4], 0);                    \
5908       SYSTEM_WRITE32(&(passRegs->MAILBOX[0].MBOX_SLOT[5], 0);                    \
5909 }      
5910      
5911      
5912 /**
5913  *  @ingroup palld_api_macros
5914  *  @brief  pa_DOWNLOAD_MODULE downloads an image
5915  *
5916  *  @details  This macro provides the same function as @ref Pa_downloadImage. A single image is downloaded to
5917  *            one of the packet processing modules.
5918  *
5919  *  @pre      The module user must define macro SYSTEM_COPY(dest, src, sizeWords) which copies sizeWords from
5920  *            address src to address dst. The packet processing module must have reset asserted.
5921  */
5922 #define pa_DOWNLOAD_MODULE(id,img,size)   \
5923 {                                 \
5924       CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;    \
5925                                                                         \
5926       SYSTEM_COPY(&(passRegs->PDSP_IRAM[id].PDSP_RAM[0]), img, size);   \
5927 }      
5928       
5929 /**
5930  *   @ingroup palld_api_macros
5931  *   @brief  pa_GET_SYSETM_STATE returns the state of the subsystem
5932  *
5933  *   @details  This macro provides the same functionality as @ref Pa_resetControl and returns the 
5934  *             current state in the macro argument.
5935  */
5936 #define pa_GET_SYSTEM_STATE(x)      \
5937   {  int enable=0; int disable=0;   \
5938       CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;    \
5939      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[0].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5940                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5941        enable++;  else disable++;                                                        \
5942      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[1].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5943                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5944        enable++;  else disable++;                                                        \
5945      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[2].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5946                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5947        enable++;  else disable++;                                                        \
5948      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[3].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5949                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5950        enable++;  else disable++;                                                        \
5951      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[4].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5952                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5953        enable++;  else disable++;                                                        \
5954      if ( (SYSTEM_READ32(&(passRegs->PDSP_CTLSTAT[5].PDSP_CONTROL)) & CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK) == \
5955                      (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK)    ) \
5956        enable++;  else disable++;                                                        \
5957      if ( (enable > 0) && (disable > 0) )  (x) = pa_STATE_INCONSISTENT;                  \
5958      else if (enable > 0)  (x) = pa_STATE_ENABLE;                                        \
5959      else (x) = pa_STATE_RESET;                                                          \
5960   }  (x) = (x)
5961   
5962   
5963 /**
5964  *  @ingroup palld_api_macros
5965  *  @brief  pa_SET_TX_CHKSUM_LENGTH sets the tx checksum length in a tx route block
5966  *
5967  *  @details  This macro is used to modify the length of a checksum field in a command packet
5968  *            created by a call to @ref Pa_formatTxRoute. In many cases packets in an outbound packet
5969  *            stream will have the same source and destination information (see @ref netlayers) but
5970  *            differ in the packet length. This macro will change the checksum calculation information
5971  *            which is sent to the sub-system. The length fields in L2, L3 and L4 must be changed by
5972  *            the module user before sending the packet, they are not changed by this macro. In the
5973  *                        case of IP L3 and TCP or UDP L4 the psuedo header checksum must also be changed
5974  *                        to reflect the change in packet length.
5975  */
5976 #define pa_SET_TX_CHKSUM_LENGTH(datap,cnum,len)  \
5977     PASAHO_CHKCRC_SET_LEN        ((&(((pasahoComChkCrc_t *)datap)[cnum])), len)
5979 /**
5980  *  @ingroup palld_api_macros
5981  *  @brief pa_SET_TX_INITVAL sets the initial value in a tx route block
5982  *
5983  *  @details  This macro is used to modify the initial value of a checksum field in a command packet
5984  *            created by a call to @ref Pa_formatTxRoute. This macro is used when a single call
5985  *                        to @ref Pa_formatTxRoute is desired, The application typically follows this with an update 
5986  *            to the length fields in network headers, either directly or through a blind patch. 
5987  *            For updates with IPv4 or IPv6 the pseudo header checksum must be updated as well, and this 
5988  *            macro is used to update the value. Typically the pseudo header checksum will be computed 
5989  *            with all values except the length, and then updated for each packet with a single ones' complement add.
5990  */
5991 #define pa_SET_TX_CHKSUM_INITVAL(datap,cnum,val)  \
5992         PASAHO_CHKCRC_SET_INITVAL   ((&(((pasahoComChkCrc_t *)datap)[cnum])), val)
5994 /**
5995  * @page netlayers
5996  *
5997  *  Network layers define a hierarchy of services delineated by functionality. Each layer can use the functionality
5998  *  of the next layer below, and offers services to the next layer above. The packet accelerator sub-system examines
5999  *  and routes packets based on fields in up to three layers of the Ethernet packets or L0-L2 header of the SRIO packets. 
6000  *  
6001  *  In layer 2, the MAC (Media Access Control) layer, 
6002  *  the sub-system classifies IEEE 802.3 packets based on (optionally) the destination MAC, source MAC, Ethertype, and 
6003  *  VLAN tags. 
6004  *
6005  *  In Layer 3, the network layer, IPv4 (Internet Protocol Version 4) and IPv6 (Internet Protocol
6006  *  Version 6) packets are routed based (optionally) on source IP address, destination IP address, IPv4 protocol,
6007  *  IPv6 next header, IPv4 Type of Service (recently changed to IPv4 differentiated service in RFC 2474), IPv6
6008  *  traffic class, and IPv6 flow label. For IP packets with security services the SPI (Security Parameters Index)
6009  *  is also included in the classification information. For IP packets with SCTP (Stream Control Transmission Protocol) 
6010  *  the SCTP destination port is also included in the classification information.
6011  *
6012  *  In layer 4, the transport layer, UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) packets
6013  *  are routed based on the destination port. However, the GTP-U (GPRS Tunnelling Protocol User Plane) over UDP packets 
6014  *  are routed based on its 32-bit TEID (Tunnel ID).   
6015  *
6016  *  For SRIO (Serial RapidIO), L0-L2 header information
6017  *  the sub-system classifies SRIO packets based on (optional) the source ID, destination ID, transport type, priority,
6018  *  message type, SRIO type 11 mailbox and letter, SRIO type 9 stream ID and class of service.
6019  * 
6020  */
6021  
6022  
6023 /**
6024  * @page cache
6025  *
6026  * The packet accelerator low level driver module will make call backs to the module user when it
6027  * is about to read from one of the two tables provided by the module user. If the module user
6028  * is operating in a multi-core environment with a single set of tables shared by all the cores,
6029  * then this function is used to tell a local core that it must invalidate its cache, without writeback.
6030  * This is necessary if cross core cache coherency is not maintained by the hardware in the device.
6031  * 
6032  * Without this it is possible for one core to be operating from a locally cached version of the 
6033  * tables which does not reflect any additions or deletions done by other cores.
6034  *
6035  * An alternative is to place the tables into non-cached memory.
6036  *
6037  */
6038   
6039 /**
6040  *  @page semaphores
6041  *
6042  *  The packet accelerator low level driver module will make call backs to the module user when it
6043  *  is about to modify from one of the two tables provided by the module user. If the module user
6044  *  is operating in a multi-core environment with a single set of tables shared by all the cores,
6045  *  then this function is used to tell the application to apply a cross core semaphore. 
6046  *
6047  *  When table modification is done the module will again make a call back to the module user
6048  *  to inform it to release the semaphore.
6049  */
6050    
6051    
6052 /**   
6053  *  @page order
6054  *
6055  *  The sub-system examines the L2 and L3 (LUT1) information (see @ref netlayers) in packets based on internal 
6056  *  table location. When function @ref Pa_addMac and @ref Pa_addIp are executed and the resulting packet 
6057  *  forwarded to the sub-system, the sub-system places the new entries at the highest free
6058  *  table location. When incoming packets are examined, the table is searched from lowest entry location
6059  *  to highest entry location until the first matching entry is found. That entry is used to route the
6060  *  packet.
6061  *
6062  *  Because of this it is required that entries into the table be made in order from the most general
6063  *  to the most specific. For example, when adding a mac address it is common to want to route the following:
6064  *  @li  dest mac only  -  Forward packet to host
6065  *  @li  dest mac + ethertype - Continue parsing
6066  *  @li  dest mac + source mac + ethertype - Forward packet to host
6067  *
6068  *  To get the desired routing the @ref Pa_addMac commands must be executed and the command packets forwarded
6069  *  to the sub-system in the order shown above. If they are entered in the reverse order then every packet
6070  *  which has the value dest MAC will be forwarded to the host since it matches the first entry in the list.
6071  *
6072  *  The order dependency applies to calls to @ref Pa_addMac and @ref Pa_addIp, but not to calls between these functions. 
6073  *  So all MAC entries can be made followed by all IP entries, or in the reverse order (provided the IP entries
6074  *  do not reference the MAC entries) without changing the operation of the sub-system.
6075  *
6076  */
6077  
6078 /**   
6079  *  @page appendix1 PDSP image
6080  *
6081  *  The sub-sustem contains six PDSPs wihich perform the command and packet processing. There are three PDSP
6082  *  images provided by the module under the pa/fw directory:
6083  *  @li Packet Classifier 1 image: classify1_bin.c for PDSP0, PDSP1 and PDSP2
6084  *  @li Packet Classifier 2 image: classify2_bin.c for PDSP3
6085  *  @li Packet Modifier image: pam_bin.c for PDSP4 and PDSP5
6086  *
6087  *  The PDSP executable images are provided to the module user as c-file contains the binary image. They should
6088  *  be included by the application and loaded into the corresponding PASS PDSP by invoking the API 
6089  *  @ref Pa_downloadImage at system startup.
6090  *
6091  */
6092  
6093  
6094  /**
6095   *  @page appendix2 CPPI Error Flags
6096   *
6097   *  The sub-system performs IPv4 header checksum, UDP/TCP checksum and SCTP CRC-32c checksum autonomously.
6098   *  The sub-system can also perform the CRC verification for incoming packet as one of the actions specified 
6099   *  by the post-classification command set.
6100   *
6101   *  The checksum and CRC verification results are recorded at the 4-bit error flags in the CPPI packet descriptor
6102   *  as described below:
6103   *  @li bit 3: IPv4 header checksum error
6104   *  @li bit 2: UDP/TCP or SCTP CRC-32c checksum error
6105   *  @li bit 1: Custom CRC checksum error
6106   *  @li bit 0: reserved
6107   * 
6108   */
6109   
6110  /**
6111   *  @page appendix3 PA-assisted IP Reassembly Operation
6112   *
6113   *  The current version of PASS does not support IP reassembly, the IP fragments can be detected by PASS, forwarded to 
6114   *  and reassembled at host. The reassembled IP packet may be forwarded back to PASS for continuous classification. 
6115   *  The drawback of this approach is that the order of the incoming packets will not be maintained.
6116   *
6117   *  To provide better support for IP reassembly, the PA-assisted IP Reassembly operation is introduced and summarized below:
6118   *  @li Array of traffic flows which consist of source IP, destination IP, protocol and counter are maintained at PASS PDSP.
6119   *  @li A traffic flow is activated by the PDSP when the first IP fragment with the source and destination IP and protocol is 
6120   *      detected and forwarded.
6121   *  @li The traffic flow is freed when its packet count reaches 0
6122   *  @li All packets belong to any active traffic flow will be forwarded to the host so the packet order will be maintained.
6123   *  @li IP fragments should be forwarded to host with "not availeable" traffic flow id if no traffic flow is available. 
6124   *      In this case, the packet order is not guaranteed to be maintained.
6125   *  @li PASS supports up to 32 active traffic flows for outer IP (PDSP1) and inner IP (PDSP2) respectively.
6126   *  @li The PA-assisted IP Reassembly Operation will be enabled by invoking API @ref Pa_control with the IP reassembly 
6127   *      configuration @ref paIpReassmConfig_t.
6128   *
6129   *  @note The minimum size packet wire rate throughput will not be guaranteed when this feature is enabled and there are active 
6130   *        traffic flows.
6131   *  
6132   *  The host IP reassembly module should interact with PASS and perform the full IP reassembly operation. The module user may choose 
6133   *  to implement a simplified version of IP reassembly algorithm to save CPU cycle in controlled IP environment. A sample reassembly
6134   *  module is provided in the PA LLD release package, which demonstrates how to interact with the NetCP to perform the IP reassembly
6135   *  operation. 
6136   *
6137   *  The sample code implements a simplified version of IP reassembly algorithm which supports non-overlapping segments only. The sample 
6138   *  code performs the following tasks:
6139   *  @li Maintain the IP reassembly contexts consist of source IP, destination IP, IP identification, protocol, fragments count and the 
6140   *      corresponding traffic flow id.
6141   *  @li Forward the non-fragmented IP packet with its flow id and count = 1 to PA PDSP queue. This avoids reordering the non-fragmented packets.
6142   *  @li For IPSEC inner IP fragments, call SA LLD to perform the post-decryption operation including padding check and IPSEC header 
6143   *      and authentication tag removal.
6144   *  @li Forward the reassembled IP packet with its flow id and fragments count to PA PDSP queue.
6145   *  @li Send a null packet with its flow id and fragments count to PA PDSP queue if the fragments are discarded due to timeout or other error.
6146   *
6147   */
6148   
6149   
6150 #ifdef __cplusplus
6152 #endif
6153   
6155 #endif  /* _PA_H */