]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/pa-lld.git/blob - pasahost.h
PA LLD 3.0.0.10: merge latest changes from master
[keystone-rtos/pa-lld.git] / pasahost.h
1 #ifndef _PASAHOST_H
2 #define _PASAHOST_H
3 /**
4  *   @file  pasahost.h
5  *
6  *   @brief   
7  *      This file defines constants, data structures and macros used
8  *      among the PA LLD, SA LLD and the host.  
9  *
10  *  \par
11  *  NOTE:
12  *      (C) Copyright 2009-2013 Texas Instruments, Inc.
13  * 
14  *  Redistribution and use in source and binary forms, with or without 
15  *  modification, are permitted provided that the following conditions 
16  *  are met:
17  *
18  *    Redistributions of source code must retain the above copyright 
19  *    notice, this list of conditions and the following disclaimer.
20  *
21  *    Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the 
23  *    documentation and/or other materials provided with the   
24  *    distribution.
25  *
26  *    Neither the name of Texas Instruments Incorporated nor the names of
27  *    its contributors may be used to endorse or promote products derived
28  *    from this software without specific prior written permission.
29  *
30  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
31  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
32  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
34  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
35  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
36  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
39  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
40  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *
42 */
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 /** @defgroup pasaho_if_module PA/SA/Host Interface
48  *  @{
49  */
50 /** @} */
52 /** @defgroup pasaho_if_macros PA/SA/Host Macros
53  *  @ingroup pasaho_if_module
54  */
56 /** @defgroup pasaho_if_structures PA/SA/Host Data Structures
57  *  @ingroup pasaho_if_module
58  */
60 /** @defgroup pasaho_if_constants PA/SA/Host Constants (enum's and define's)
61  *  @ingroup pasaho_if_module
62  */
65 /**
66  *  @defgroup pasahoCommands PA/SA/Host Commands
67  *  @ingroup pasaho_if_constants
68  *  @{
69  *
70  *  @name PA/SA/Host Commands
71  *
72  *  Define PASS Firmware Commands
73  *  These values are placed in the 3 msbits of the protocol specific information
74  */
75 /*@{*/
76 /**
77  *  @def  PASAHO_CONFIGURE
78  *        PA/SA Configuration command
79  */
81 #define PASAHO_CONFIGURE                        4
83 /* PA commands for receive packet PDSPs */
84 /**
85  *  @def  PASAHO_PARX_PARSECMD
86  *        Instruct PDSP to parse the receive packet
87  */
89 #define PASAHO_PARX_PARSECMD            0
91 /**
92  *  @def  PASAHO_PARX_MULTI_ROUTE
93  *        Instruct PDSP to perform multiple routing
94  */
96 #define PASAHO_PARX_MULTI_ROUTE         5
98 /* PA commands for modify packet PDSPs */
99 /**
100  *  @def  PASAHO_PAMOD_CMPT_CHKSUM
101  *        Instruct PDSP to compute checksum
102  */
104 #define PASAHO_PAMOD_CMPT_CHKSUM        0
106 /**
107  *  @def  PASAHO_PAMOD_CMPT_CRC
108  *        Instruct PDSP to compute CRC
109  */
111 #define PASAHO_PAMOD_CMPT_CRC           1
113 /**
114  *  @def  PASAHO_PAMOD_PATCH
115  *        Instruct PDSP to perform blind patch
116  */
118 #define PASAHO_PAMOD_PATCH                      2
120 /**
121  *  @def  PASAHO_PAMOD_NROUTE
122  *        Provide PDSP with the next routing information
123  */
125 #define PASAHO_PAMOD_NROUTE                     3
128 /**
129  *  @def  PASAHO_PAMOD_EF_OP
130  *        Instruct PDSP to perform egress flow operation
131  */
133 #define PASAHO_PAMOD_EF_OP              5
135 /**
136  *  @def  PASAHO_PAMOD_REPORT_TIMESTAMP
137  *        Instruct PDSP to report the system timestamp at the timestamp field of the packet descriptor 
138  *        when the tx packet is delivered out of the PASS 
139  */
141 #define PASAHO_PAMOD_REPORT_TIMESTAMP  6   
144 /**
145  *  @def  PASAHO_PAMOD_GROUP_7
146  *        Define this group command so that several command can share the same command code. They will be distinguished
147  *        by its unique 5-bit sub-command code as defined at
148  */
150 #define PASAHO_PAMOD_GROUP_7        7   
153 /**
154  *  @def  PASAHO_PAMOD_DUMMY
155  *        No action is required. It is for SA alignment only
156  */
158 #define PASAHO_PAMOD_DUMMY                      PASAHO_PAMOD_GROUP_7
160 /**
161  *  @def  PASAHO_PAMOD_IP_FRAGMENT
162  *        Instruct PDSP to perform IPv4 fragmentation. The transmit IP packets will be divided into smaller 
163  *        IP fragments with the updated IPv4 header and checksum based on the specified MTU size and forwarded 
164  *        to the destination specified by the next route command. It is up to the module user to format the
165  *        correct IPv4 header. The IP fragmentation command will be ignored if any error is detected.
166  */
167 #define PASAHO_PAMOD_IP_FRAGMENT    PASAHO_PAMOD_GROUP_7  
169 /**
170  *  @def  PASAHO_PAMOD_PATCH_MSG_LEN
171  *        Instruct PDSP to perform message length patching after IPv4 fragmentation operation. This command is
172  *        valid only if it is in conjunction with the PASAHO_PAMOD_IP_FRAGMENT command.
173  */
174 #define PASAHO_PAMOD_PATCH_MSG_LEN  PASAHO_PAMOD_GROUP_7   
176 /* SA commands */
177 /**
178  *  @def  PASAHO_SA_LONG_INFO
179  *        Provide SA with the packet parsing information in the long form
180  */
182 #define PASAHO_SA_LONG_INFO         0
184 /**
185  *  @def  PASAHO_SA_SHORT_INFO
186  *        Provide SA with the packet parsing information in the short form
187  */
189 #define PASAHO_SA_SHORT_INFO        1
192 /**
193  *  @def  PASAHO_SA_AIR_INFO
194  *        Provide SA with the packet parsing information for the air ciphering 
195  *        operation
196  */
198 #define PASAHO_SA_AIR_INFO          2
201 /*@}*/
202 /** @} */
204 /** @name PASAHO Common Macros
205  *  
206  */
207 /*@{*/
209 /**
210  *  @ingroup pasaho_if_macros
211  *  @brief  PASAHO_READ_BITFIELD is used to read the specific bit fields
212  *
213  *  @details  It is one of the main macros for accessing configuration bit fields
214  *            Input parameter a contains bit field
215  *            b is bit offset withing bit field
216  *            c is number of bits used by that parameter
217  */
219 #define PASAHO_READ_BITFIELD(a,b,c)    (((a)>>(b)) & ((1UL<<(c))-1))
221 /**
222  *  @ingroup ingroup pasaho_if_macros
223  *  @brief  PASAHO_SET_BITFIELD is used to set the specific bit fields
224  *
225  *  @details  It is one of the main macros for accessing configuration bit fields
226  *            Input parameter a contains bit field
227  *            b is bit offset withing bit field
228  *            c is number of bits used by that parameter
229  *            x is new value of parameter that is packed in this bit field
230  *
231  *  @note    It enforces strict setting to prevent overflow into other bits, would
232  *           cost program space for additional protection. 
233  */
235 #define PASAHO_SET_BITFIELD(a,x,b,c)   (a) &= ~(((1UL<<(c))-1)<<(b)), \
236                                        (a) |= (((x) & ((1UL<<(c))-1))<<(b))
238 /**
239  *  @ingroup ingroup pasaho_if_macros
240  *  @brief  PASAHO_SET_CMDID is used to set the command ID
241  */
242 #define PASAHO_SET_CMDID(x,v)  PASAHO_SET_BITFIELD((x)->word0, (v), 29,3)
244 /**
245  *  @ingroup ingroup pasaho_if_macros
246  *  @brief  PASAHO_PACFG_CMD is used to set the PA configuration command only
247  */
248 #define PASAHO_PACFG_CMD        (((uint32_t)PASAHO_CONFIGURE << 5) << 24)
250 /*@}*/ /* @name PASAHO Common Macros */
253 /**
254  *  @defgroup pasahoHeaderTypes PASS Header Types
255  *  @ingroup pasaho_if_constants
256  *  @{
257  *
258  *  @name PASS Header Types
259  *  Definition of protocol header types used at the PASS PDSP Firmwase. In the 
260  *  long info field these values specify what the next header type will be
261  *  at the next parse offset 
262  */ 
263 /*@{*/
265 typedef enum {
267   PASAHO_HDR_MAC        = 0,        /**< MAC */
268   PASAHO_HDR_VLAN,                  /**< VLAN */
269   PASAHO_HDR_MPLS,                  /**< MPLS */
270   PASAHO_HDR_IPv4,                  /**< IPv4 */
271   PASAHO_HDR_IPv6,                  /**< IPv6 */
272   PASAHO_HDR_IPv6_EXT_HOP,          /**< IPv6 hop by hop extenstion header */
273   PASAHO_HDR_IPv6_EXT_ROUTE,        /**< IPv6 routing extenstion header */
274   PASAHO_HDR_IPv6_EXT_FRAG,         /**< IPv6 fragmentation extention header */
275   PASAHO_HDR_IPv6_EXT_DEST,         /**< IPv6 destination options header */
276   PASAHO_HDR_GRE,                   /**< Generic Routing Encapsulation header */
277   PASAHO_HDR_ESP,                   /**< Encapsulating Security Payload header */
278   PASAHO_HDR_ESP_DECODED,           /**< Decoded Encapsulating Security Payload header */
279   PASAHO_HDR_AUTH,                  /**< Authentication header */
280   PASAHO_HDR_CUSTOM_C1,             /**< Custom classify 1 header */
281   PASAHO_HDR_PPPoE,                 /**< PPPoE Header */
282   PASAHO_HDR_SCTP,                  /**< SCTP Header */
283   PASAHO_HDR_UNKNOWN,               /**< Next header type is unknown */
284   PASAHO_HDR_UDP,                   /**< User Datagram Protocol header */
285   PASAHO_HDR_UDP_LITE,              /**< Lightweight User Datagram Protocol header */
286   PASAHO_HDR_TCP,                   /**< Transmission Control Protocol header */
287   PASAHO_HDR_GTPU,                  /**< GTPU header */
288   PASAHO_HDR_ESP_DECODED_C2,        /**< Decoded Encapsulating Security Payload header at Classifyer2 */
289   PASAHO_HDR_CUSTOM_C2              /**< Custom classify 2 header */
290  
291 } pasaho_HeaderType_e;
292 /*@}*/
293 /** @} */
295 /**
296  *  @defgroup pasahoSubCmdCode PASS Sub-Command Code
297  *  @ingroup pasaho_if_constants
298  *  @{
299  *
300  *  @name PASS Sub-Command Code
301  *  Definition of the 5-bit sub-command codes which is used to specify the group 7 commands. 
302  */ 
303 /*@{*/
305 typedef enum {
307   PASAHO_SUB_CMD_DUMMY        = 0,   /**< Dummy */
308   PASAHO_SUB_CMD_IP_FRAG,            /**< IPv4 fragmentation */
309   PASAHO_SUB_CMD_PATCH_MSG_LEN       /**< Message length Patching */ 
310 } pasaho_SubCmdCode_e;
311 /*@}*/
312 /** @} */
314 /**
315  *  @defgroup pasahoPktType PASS Packet Type
316  *  @ingroup pasaho_if_constants
317  *  @{
318  *
319  *  @name PASS Packet Type
320  *  Definition of the MAC or IP packet types. 
321  */ 
322 /*@{*/
324 typedef enum {
326   PASAHO_PKT_TYPE_UNICAST        = 0,   /**< Unicast MAC/IP  */
327   PASAHO_PKT_TYPE_BROADCAST,            /**< Broadcast MAC/IP */
328   PASAHO_PKT_TYPE_MULTICAST             /**< Multicast MAC/IP */ 
329 } pasaho_pktType_e;
330 /*@}*/
331 /** @} */
335 /**
336  *  @ingroup pasaho_if_structures
337  *  @brief  pasahoCmdInfo_t defines the general short command information
338  *
339  */
341 typedef struct pasahoCmdInfo_s {
342     uint32_t  word0;    /**< Control block word 0 */
343 } pasahoCmdInfo_t;
345 /**
346  *  @ingroup pasaho_if_structures
347  *  @brief  pasahoLongInfo_t defines the packet parsing information in the long format. 
348  *          The information is structured as an array of 32 bit values. These values
349  *          are broken down through macros. This allows the representation to be
350  *          endian independent to the hardware which operates only on 32 bit values.
351  *
352  *  @details  
353  */
355 typedef struct pasahoLongInfo_s  {
357   uint32_t   word0;  /**< Control block word 0 */
358   uint32_t   word1;  /**< Control block word 1 */
359   uint32_t   word2;  /**< Control block word 2 */
360   uint32_t   word3;  /**< Control block word 3 */
361   uint32_t   word4;  /**< Control block word 4 */
362   uint32_t   word5;  /**< Control block word 5 */
363   
364 } pasahoLongInfo_t;
366 /** 
367  *  @defgroup PASAHO_long_info_command_gen1_macros  PASAHO Long Info Command Macros For First Generation PASS
368  *  @ingroup pasaho_if_macros
369  *  @{
370  *  @name PASAHO Long Info Command Macros For First Generation PASS
371  *  Macros used by the PASAHO Long Info Command
372  */
373 /*@{*/
375 #define PASAHO_LINFO_READ_CMDID_GEN1(x)          PASAHO_READ_BITFIELD((x)->word0,29,3)    /**< Extract the command ID defined at @ref pasahoCommands (PASS Gen1)*/
376 #define PASAHO_LINFO_READ_RECLEN_GEN1(x)         PASAHO_READ_BITFIELD((x)->word0,24,5)    /**< Extract the block length (PASS Gen1)*/
377 #define PASAHO_LINFO_READ_START_OFFSET_GEN1(x)   PASAHO_READ_BITFIELD((x)->word0,0,16)    /**< Extract the next parse start offset (PASS Gen1)*/
379 #define PASAHO_LINFO_IS_MAC_BROADCAST_GEN1(x)    PASAHO_READ_BITFIELD((x)->word0,16,1)    /**< Indicate whether it is a broadcast MAC packet (PASS Gen1)*/
380 #define PASAHO_LINFO_IS_MAC_MULTICAST_GEN1(x)    PASAHO_READ_BITFIELD((x)->word0,17,1)    /**< Indicate whether it is a multicast MAC packet (PASS Gen1)*/
381 #define PASAHO_LINFO_READ_MAC_PKTTYPE_GEN1(x)    PASAHO_READ_BITFIELD((x)->word0,16,2)    /**< Extract the MAC packet type (PASS Gen1)*/
383 #define PASAHO_LINFO_IS_IP_BROADCAST_GEN1(x)     PASAHO_READ_BITFIELD((x)->word0,18,1)    /**< Indicate whether it is a broadcast IP packet (PASS Gen1)*/
384 #define PASAHO_LINFO_IS_IP_MULTICAST_GEN1(x)     PASAHO_READ_BITFIELD((x)->word0,19,1)    /**< Indicate whether it is a multicast IP packet (PASS Gen1)*/
385 #define PASAHO_LINFO_READ_IP_PKTTYPE_GEN1(x)     PASAHO_READ_BITFIELD((x)->word0,18,2)    /**< Extract the IP packet type (PASS Gen1)*/
387 #define PASAHO_LINFO_READ_END_OFFSET_GEN1(x)     PASAHO_READ_BITFIELD((x)->word1,16,16)   /**< Extract the end of packet parse offset (PASS Gen1)*/
388 #define PASAHO_LINFO_READ_EIDX_GEN1(x)           PASAHO_READ_BITFIELD((x)->word1,11,5)    /**< Extract the error index (PASS Gen1)*/
389 #define PASAHO_LINFO_READ_PMATCH_GEN1(x)         PASAHO_READ_BITFIELD((x)->word1,10,1)    /**< Extract the previous match flag (PASS Gen1)*/
390 #define PASAHO_LINFO_READ_L1_PDSP_ID_GEN1(x)     PASAHO_READ_BITFIELD((x)->word1,6,3)     /**< Extract the first parse module ID (PASS Gen1)*/
391 #define PASAHO_LINFO_READ_L1_IDX_GEN1(x)         PASAHO_READ_BITFIELD((x)->word1,0,6)     /**< Extract the first parse module match index (PASS Gen1)*/
393 #define PASAHO_LINFO_READ_L3_OFFSET_GEN1(x)      PASAHO_READ_BITFIELD((x)->word2,24,8)    /**< Extract the offset to the level 3 header (PASS Gen1)*/
394 #define PASAHO_LINFO_READ_L4_OFFSET_GEN1(x)      PASAHO_READ_BITFIELD((x)->word2,16,8)    /**< Extract the offset to the level 4 header (PASS Gen1)*/
395 #define PASAHO_LINFO_READ_L5_OFFSET_GEN1(x)      PASAHO_READ_BITFIELD((x)->word2,8,8)     /**< Extract the offset to the level 5 header (PASS Gen1)*/
396 #define PASAHO_LINFO_READ_ESP_AH_OFFSET_GEN1(x)  PASAHO_READ_BITFIELD((x)->word2,0,8)     /**< Extract the offset to the security header (PASS Gen1)*/
398 #define PASAHO_LINFO_READ_HDR_BITMASK_GEN1(x)    PASAHO_READ_BITFIELD((x)->word3,21,11)   /**< Extract the bitmask of parsed header types (PASS Gen1)*/
399 #define PASAHO_LINFO_READ_HDR_BITMASK2_GEN1(x)   PASAHO_READ_BITFIELD((x)->word3, 4,4)    /**< Extract the bitmask2 of parsed header types (PASS Gen1)*/
400 #define PASAHO_LINFO_READ_NXT_HDR_TYPE_GEN1(x)   PASAHO_READ_BITFIELD((x)->word3,16,5)    /**< Extract the next header to parse type (PASS Gen1)*/
401 #define PASAHO_LINFO_READ_VLAN_COUNT_GEN1(x)     PASAHO_READ_BITFIELD((x)->word3,14,2)    /**< Extract the number of VLAN tags found (PASS Gen1)*/
402 #define PASAHO_LINFO_READ_IP_COUNT_GEN1(x)       PASAHO_READ_BITFIELD((x)->word3,8,3)     /**< Extract the number of IP headers found (PASS Gen1)*/
403 #define PASAHO_LINFO_READ_GRE_COUNT_GEN1(x)      PASAHO_READ_BITFIELD((x)->word3,11,3)    /**< Extract the number of GRE headers found (PASS Gen1)*/
404 #define PASAHO_LINFO_READ_FLAG_FRAG_GEN1(x)      PASAHO_READ_BITFIELD((x)->word3,3,1)     /**< Extract the fragmentation found flag (PASS Gen1)*/
405 #define PASAHO_LINFO_READ_INPORT_GEN1(x)         PASAHO_READ_BITFIELD((x)->word3,0,3)     /**< Extract the (1-based) input EMAC port number  
406                                                                                                0: Indicates that the packet does not enter PASS 
407                                                                                                through CPSW (PASS Gen1)*/
408 #define PASAHO_LINFO_READ_INNER_IP_OFFSET_GEN1(x) PASAHO_READ_BITFIELD((x)->word4,16,8)   /**< Extract the offset to the most inner IP header (PASS Gen1)*/
409 #define PASAHO_LINFO_READ_TSTAMP_MSB_GEN1(x)     PASAHO_READ_BITFIELD((x)->word5,0,16)    /**< Extract the most significant 16-bit of the 48-bit timestamp (PASS Gen1)*/
411 /*@}*/ /* PASAHO_long_info_command_gen1_macros */
412 /** @}*/ /* @name PASAHO Long Info Command Macros For First Generation PASS */
414 /** 
415  *  @defgroup PASAHO_long_info_command_gen2_macros  PASAHO Long Info Command Macros For Second Generation PASS
416  *  @ingroup pasaho_if_macros
417  *  @{
418  *  @name PASAHO Long Info Command Macros For Second Generation PASS
419  *  Macros used by the PASAHO Long Info Command
420  */
421 /*@{*/
423 #define PASAHO_LINFO_READ_CMDID_GEN2(x)          PASAHO_READ_BITFIELD((x)->word0,29,3)    /**< Extract the command ID defined at @ref pasahoCommands (PASS Gen2)*/
424 #define PASAHO_LINFO_READ_RECLEN_GEN2(x)         PASAHO_READ_BITFIELD((x)->word0,24,5)    /**< Extract the block length (PASS Gen2)*/
425 #define PASAHO_LINFO_READ_START_OFFSET_GEN2(x)   PASAHO_READ_BITFIELD((x)->word0,0,8)     /**< Extract the next parse start offset (PASS Gen2)*/
427 #define PASAHO_LINFO_IS_MAC_BROADCAST_GEN2(x)    PASAHO_READ_BITFIELD((x)->word0,16,1)    /**< Indicate whether it is a broadcast MAC packet (PASS Gen2)*/
428 #define PASAHO_LINFO_IS_MAC_MULTICAST_GEN2(x)    PASAHO_READ_BITFIELD((x)->word0,17,1)    /**< Indicate whether it is a multicast MAC packet (PASS Gen2)*/
429 #define PASAHO_LINFO_READ_MAC_PKTTYPE_GEN2(x)    PASAHO_READ_BITFIELD((x)->word0,16,2)    /**< Extract the MAC packet type (PASS Gen2)*/
431 #define PASAHO_LINFO_IS_IP_BROADCAST_GEN2(x)     PASAHO_READ_BITFIELD((x)->word0,16,1)    /**< Indicate whether it is a broadcast IP packet (PASS Gen2)*/
432 #define PASAHO_LINFO_IS_IP_MULTICAST_GEN2(x)     PASAHO_READ_BITFIELD((x)->word0,17,1)    /**< Indicate whether it is a multicast IP packet (PASS Gen2)*/
433 #define PASAHO_LINFO_READ_IP_PKTTYPE_GEN2(x)     PASAHO_READ_BITFIELD((x)->word0,16,2)    /**< Extract the IP packet type (PASS Gen2)*/
435 #define PASAHO_LINFO_READ_PMATCH_GEN2(x)         PASAHO_READ_BITFIELD((x)->word0,23,1)    /**< Extract the previous match flag (PASS Gen2)*/
436 #define PASAHO_LINFO_READ_FLAG_FRAG_GEN2(x)      PASAHO_READ_BITFIELD((x)->word0,19,1)    /**< Extract the fragmentation found flag (PASS Gen2)*/
438 #define PASAHO_LINFO_READ_END_OFFSET_GEN2(x)     PASAHO_READ_BITFIELD((x)->word1,16,16)   /**< Extract the end of packet parse offset (PASS Gen2)*/
439 #define PASAHO_LINFO_READ_EIDX_GEN2(x)           PASAHO_READ_BITFIELD((x)->word1,10,6)    /**< Extract the exception index (PASS Gen2)*/
440 #define PASAHO_LINFO_READ_NXT_HDR_TYPE_GEN2(x)   PASAHO_READ_BITFIELD((x)->word1,0,6)     /**< Extract the next header to parse type (PASS Gen2)*/
441 #define PASAHO_LINFO_READ_INPORT_GEN2(x)         PASAHO_READ_BITFIELD((x)->word1,6,4)     /**< Extract the (1-based) input EMAC port number  
442                                                                                                through CPSW (PASS Gen2)*/
444 #define PASAHO_LINFO_READ_L3_OFFSET_GEN2(x)      PASAHO_READ_BITFIELD((x)->word2,24,8)    /**< Extract the offset to the level 3 header (PASS Gen2)*/
445 #define PASAHO_LINFO_READ_L4_OFFSET_GEN2(x)      PASAHO_READ_BITFIELD((x)->word2,16,8)    /**< Extract the offset to the level 4 header (PASS Gen2)*/
446 #define PASAHO_LINFO_READ_L5_OFFSET_GEN2(x)      PASAHO_READ_BITFIELD((x)->word2,8,8)     /**< Extract the offset to the level 5 header (PASS Gen2)*/
447 #define PASAHO_LINFO_READ_ESP_AH_OFFSET_GEN2(x)  PASAHO_READ_BITFIELD((x)->word2,0,8)     /**< Extract the offset to the security header (PASS Gen2)*/
449 #define PASAHO_LINFO_READ_L1_PDSP_ID_GEN2(x)     PASAHO_READ_BITFIELD((x)->word3,26,6)    /**< Extract the first parse module ID (PASS Gen2)*/
450 #define PASAHO_LINFO_READ_L1_IDX_GEN2(x)         PASAHO_READ_BITFIELD((x)->word3,16,10)   /**< Extract the first parse module match index (PASS Gen2)*/
451 #define PASAHO_LINFO_READ_HDR_BITMASK_GEN2(x)    PASAHO_READ_BITFIELD((x)->word3,0,16)    /**< Extract the bitmask of parsed header types (PASS Gen2)*/
452 #define PASAHO_LINFO_READ_HDR_BITMASK2_GEN2(x)   0                                        /**< Extract the bitmask2 of parsed header types (PASS Gen2)*/
453 #define PASAHO_LINFO_READ_TSTAMP_MSB_GEN2(x)     PASAHO_READ_BITFIELD((x)->word5,0,16)    /**< Extract the most significant 16-bit of the 48-bit timestamp (PASS Gen2)*/
454 #define PASAHO_LINFO_READ_VLAN_COUNT_GEN2(x)     PASAHO_READ_BITFIELD((x)->word4,6,2)     /**< Extract the number of VLAN tags found (PASS Gen2)*/
455 #define PASAHO_LINFO_READ_IP_COUNT_GEN2(x)       PASAHO_READ_BITFIELD((x)->word4,0,3)     /**< Extract the number of IP headers found (PASS Gen2)*/
456 #define PASAHO_LINFO_READ_GRE_COUNT_GEN2(x)      PASAHO_READ_BITFIELD((x)->word4,3,3)     /**< Extract the number of GRE headers found (PASS Gen2)*/
458 #define PASAHO_LINFO_READ_INNER_IP_OFFSET_GEN2(x) PASAHO_READ_BITFIELD((x)->word5,24,8)   /**< Extract the offset to the inner IP header (PASS Gen2)*/
459 #define PASAHO_LINFO_READ_TSTAMP_MSB_GEN2(x)     PASAHO_READ_BITFIELD((x)->word5,0,16)    /**< Extract the most significant 16-bit of the 48-bit timestamp (PASS Gen2)*/
461 /*@}*/ /* PASAHO_long_info_command_gen2 macros */
462 /** @}*/ /* @name PASAHO Long Info Command Macros For Second Generation PASS */
464 /** 
465  *  @defgroup PASAHO_long_info_command_macros  PASAHO Long Info Command Macros
466  *  @ingroup pasaho_if_macros
467  *  @{
468  *  @name PASAHO Long Info Command Macros
469  *  Macros used by the PASAHO Long Info Command
470  */
471 /*@{*/
473 #ifdef NSS_GEN2
474 #define PASAHO_LINFO_READ_CMDID(x)          PASAHO_LINFO_READ_CMDID_GEN2(x)           /**< Extract the command ID defined at @ref pasahoCommands */
475 #define PASAHO_LINFO_READ_RECLEN(x)         PASAHO_LINFO_READ_RECLEN_GEN2(x)          /**< Extract the block length */
476 #define PASAHO_LINFO_READ_START_OFFSET(x)   PASAHO_LINFO_READ_START_OFFSET_GEN2(x)    /**< Extract the next parse start offset */
478 #define PASAHO_LINFO_IS_MAC_BROADCAST(x)    PASAHO_LINFO_IS_MAC_BROADCAST_GEN2(x)     /**< Indicate whether it is a broadcast MAC packet */
479 #define PASAHO_LINFO_IS_MAC_MULTICAST(x)    PASAHO_LINFO_IS_MAC_MULTICAST_GEN2(x)     /**< Indicate whether it is a multicast MAC packet */
480 #define PASAHO_LINFO_READ_MAC_PKTTYPE(x)    PASAHO_LINFO_READ_MAC_PKTTYPE_GEN2(x)     /**< Extract the MAC packet type */
482 #define PASAHO_LINFO_IS_IP_BROADCAST(x)     PASAHO_LINFO_IS_IP_BROADCAST_GEN2(x)      /**< Indicate whether it is a broadcast IP packet */
483 #define PASAHO_LINFO_IS_IP_MULTICAST(x)     PASAHO_LINFO_IS_IP_MULTICAST_GEN2(x)      /**< Indicate whether it is a multicast IP packet */
484 #define PASAHO_LINFO_READ_IP_PKTTYPE(x)     PASAHO_LINFO_READ_IP_PKTTYPE_GEN2(x)      /**< Extract the IP packet type */
486 #define PASAHO_LINFO_READ_PMATCH(x)         PASAHO_LINFO_READ_PMATCH_GEN2(x)          /**< Extract the previous match flag */
487 #define PASAHO_LINFO_READ_FLAG_FRAG(x)      PASAHO_LINFO_READ_FLAG_FRAG_GEN2(x)       /**< Extract the fragmentation found flag */
489 #define PASAHO_LINFO_READ_END_OFFSET(x)     PASAHO_LINFO_READ_END_OFFSET_GEN2(x)      /**< Extract the end of packet parse offset */
490 #define PASAHO_LINFO_READ_EIDX(x)           PASAHO_LINFO_READ_EIDX_GEN2(x)            /**< Extract the exception index */
491 #define PASAHO_LINFO_READ_NXT_HDR_TYPE(x)   PASAHO_LINFO_READ_NXT_HDR_TYPE_GEN2(x)    /**< Extract the next header to parse type */
492 #define PASAHO_LINFO_READ_INPORT(x)         PASAHO_LINFO_READ_INPORT_GEN2(x)          /**< Extract the (1-based) input EMAC port number  
493                                                                                            through CPSW */
495 #define PASAHO_LINFO_READ_L3_OFFSET(x)      PASAHO_LINFO_READ_L3_OFFSET_GEN2(x)       /**< Extract the offset to the level 3 header */
496 #define PASAHO_LINFO_READ_L4_OFFSET(x)      PASAHO_LINFO_READ_L4_OFFSET_GEN2(x)       /**< Extract the offset to the level 4 header */
497 #define PASAHO_LINFO_READ_L5_OFFSET(x)      PASAHO_LINFO_READ_L5_OFFSET_GEN2(x)       /**< Extract the offset to the level 5 header */
498 #define PASAHO_LINFO_READ_ESP_AH_OFFSET(x)  PASAHO_LINFO_READ_ESP_AH_OFFSET_GEN2(x)   /**< Extract the offset to the security header */
500 #define PASAHO_LINFO_READ_L1_PDSP_ID(x)     PASAHO_LINFO_READ_L1_PDSP_ID_GEN2(x)      /**< Extract the first parse module ID */
501 #define PASAHO_LINFO_READ_L1_IDX(x)         PASAHO_LINFO_READ_L1_IDX_GEN2(x)          /**< Extract the first parse module match index */
502 #define PASAHO_LINFO_READ_HDR_BITMASK(x)    PASAHO_LINFO_READ_HDR_BITMASK_GEN2(x)     /**< Extract the bitmask of parsed header types */
503 #define PASAHO_LINFO_READ_HDR_BITMASK2(x)   PASAHO_LINFO_READ_HDR_BITMASK2_GEN2(x)    /**< Extract the bitmask2 of parsed header types */
504 #define PASAHO_LINFO_READ_TSTAMP_MSB(x)     PASAHO_LINFO_READ_TSTAMP_MSB_GEN2(x)      /**< Extract the most significant 16-bit of the 48-bit timestamp */
505 #define PASAHO_LINFO_READ_VLAN_COUNT(x)     PASAHO_LINFO_READ_VLAN_COUNT_GEN2(x)      /**< Extract the number of VLAN tags found */
506 #define PASAHO_LINFO_READ_IP_COUNT(x)       PASAHO_LINFO_READ_IP_COUNT_GEN2(x)        /**< Extract the number of IP headers found */
507 #define PASAHO_LINFO_READ_GRE_COUNT(x)      PASAHO_LINFO_READ_GRE_COUNT_GEN2(x)       /**< Extract the number of GRE headers found */
509 #define PASAHO_LINFO_READ_INNER_IP_OFFSET(x)PASAHO_LINFO_READ_INNER_IP_OFFSET_GEN2(x) /**< Extract the offset to the inner IP header */
510 #define PASAHO_LINFO_READ_TSTAMP_MSB(x)     PASAHO_LINFO_READ_TSTAMP_MSB_GEN2(x)      /**< Extract the most significant 16-bit of the 48-bit timestamp */
512 #else
513 #define PASAHO_LINFO_READ_CMDID(x)          PASAHO_LINFO_READ_CMDID_GEN1(x)           /**< Extract the command ID defined at @ref pasahoCommands */
514 #define PASAHO_LINFO_READ_RECLEN(x)         PASAHO_LINFO_READ_RECLEN_GEN1(x)          /**< Extract the block length */
515 #define PASAHO_LINFO_READ_START_OFFSET(x)   PASAHO_LINFO_READ_START_OFFSET_GEN1(x)    /**< Extract the next parse start offset */
517 #define PASAHO_LINFO_IS_MAC_BROADCAST(x)    PASAHO_LINFO_IS_MAC_BROADCAST_GEN1(x)     /**< Indicate whether it is a broadcast MAC packet */
518 #define PASAHO_LINFO_IS_MAC_MULTICAST(x)    PASAHO_LINFO_IS_MAC_MULTICAST_GEN1(x)     /**< Indicate whether it is a multicast MAC packet */
519 #define PASAHO_LINFO_READ_MAC_PKTTYPE(x)    PASAHO_LINFO_READ_MAC_PKTTYPE_GEN1(x)     /**< Extract the MAC packet type */
521 #define PASAHO_LINFO_IS_IP_BROADCAST(x)     PASAHO_LINFO_IS_IP_BROADCAST_GEN1(x)      /**< Indicate whether it is a broadcast IP packet */
522 #define PASAHO_LINFO_IS_IP_MULTICAST(x)     PASAHO_LINFO_IS_IP_MULTICAST_GEN1(x)      /**< Indicate whether it is a multicast IP packet */
523 #define PASAHO_LINFO_READ_IP_PKTTYPE(x)     PASAHO_LINFO_READ_IP_PKTTYPE_GEN1(x)      /**< Extract the IP packet type */
525 #define PASAHO_LINFO_READ_END_OFFSET(x)     PASAHO_LINFO_READ_END_OFFSET_GEN1(x)      /**< Extract the end of packet parse offset */
526 #define PASAHO_LINFO_READ_EIDX(x)           PASAHO_LINFO_READ_EIDX_GEN1(x)            /**< Extract the error index */
527 #define PASAHO_LINFO_READ_PMATCH(x)         PASAHO_LINFO_READ_PMATCH_GEN1(x)          /**< Extract the previous match flag */
528 #define PASAHO_LINFO_READ_L1_PDSP_ID(x)     PASAHO_LINFO_READ_L1_PDSP_ID_GEN1(x)      /**< Extract the first parse module ID */
529 #define PASAHO_LINFO_READ_L1_IDX(x)         PASAHO_LINFO_READ_L1_IDX_GEN1(x)          /**< Extract the first parse module match index */
531 #define PASAHO_LINFO_READ_L3_OFFSET(x)      PASAHO_LINFO_READ_L3_OFFSET_GEN1(x)       /**< Extract the offset to the level 3 header */
532 #define PASAHO_LINFO_READ_L4_OFFSET(x)      PASAHO_LINFO_READ_L4_OFFSET_GEN1(x)       /**< Extract the offset to the level 4 header */
533 #define PASAHO_LINFO_READ_L5_OFFSET(x)      PASAHO_LINFO_READ_L5_OFFSET_GEN1(x)       /**< Extract the offset to the level 5 header */
534 #define PASAHO_LINFO_READ_ESP_AH_OFFSET(x)  PASAHO_LINFO_READ_ESP_AH_OFFSET_GEN1(x)   /**< Extract the offset to the security header */
536 #define PASAHO_LINFO_READ_HDR_BITMASK(x)    PASAHO_LINFO_READ_HDR_BITMASK_GEN1(x)     /**< Extract the bitmask of parsed header types */
537 #define PASAHO_LINFO_READ_HDR_BITMASK2(x)   PASAHO_LINFO_READ_HDR_BITMASK2_GEN1(x)    /**< Extract the bitmask2 of parsed header types */
538 #define PASAHO_LINFO_READ_NXT_HDR_TYPE(x)   PASAHO_LINFO_READ_NXT_HDR_TYPE_GEN1(x)    /**< Extract the next header to parse type */
539 #define PASAHO_LINFO_READ_VLAN_COUNT(x)     PASAHO_LINFO_READ_VLAN_COUNT_GEN1(x)      /**< Extract the number of VLAN tags found */
540 #define PASAHO_LINFO_READ_IP_COUNT(x)       PASAHO_LINFO_READ_IP_COUNT_GEN1(x)        /**< Extract the number of IP headers found */
541 #define PASAHO_LINFO_READ_GRE_COUNT(x)      PASAHO_LINFO_READ_GRE_COUNT_GEN1(x)       /**< Extract the number of GRE headers found */
542 #define PASAHO_LINFO_READ_FLAG_FRAG(x)      PASAHO_LINFO_READ_FLAG_FRAG_GEN1(x)       /**< Extract the fragmentation found flag */
543 #define PASAHO_LINFO_READ_INPORT(x)         PASAHO_LINFO_READ_INPORT_GEN1(x)          /**< Extract the (1-based) input EMAC port number  
544                                                                                            0: Indicates that the packet does not enter PASS 
545                                                                                            through CPSW */
546 #define PASAHO_LINFO_READ_INNER_IP_OFFSET(x)PASAHO_LINFO_READ_INNER_IP_OFFSET_GEN1(x) /**< Extract the offset to the inner IP header */
547 #define PASAHO_LINFO_READ_TSTAMP_MSB(x)     PASAHO_LINFO_READ_TSTAMP_MSB_GEN1(x)      /**< Extract the most significant 16-bit of the 48-bit timestamp */
548 #endif
550 /* Extract Protocol Information */
552 /*@}*/ /* PASAHO_long_info_command_macros */
553 /** @}*/ /* @name PASAHO Long Info Command Macros */
555 /**
556  *  @defgroup PASAHO_long_info_proto_ind_gen1_macros  PASAHO Long Info Protocol Indication Macros For First Generation PASS
557  *  @ingroup pasaho_if_macros
558  *  @{
559  *  @name PASAHO Long Info Protocol Indication Macros For First Generation PASS
560  */
561 #define PASAHO_LINFO_IS_MAC_GEN1(x)              PASAHO_READ_BITFIELD((x)->word3,21,1)    /**< Indicate whether it is a MAC packet (Pass Gen1)*/
562 #define PASAHO_LINFO_IS_802_3_GEN1(x)            PASAHO_READ_BITFIELD((x)->word3,7,1)     /**< Indicate whether it is a 802.3 packet (Pass Gen1)*/
563 #define PASAHO_LINFO_IS_WITH_VLAN_GEN1(x)        PASAHO_LINFO_READ_VLAN_COUNT(x)          /**< Indicate whether it is a MAC packet with VLAN (Pass Gen1)*/
564 #define PASAHO_LINFO_IS_WITH_MPLS_GEN1(x)        PASAHO_READ_BITFIELD((x)->word3,23,1)    /**< Indicate whether it is a MAC packet with MPLS (Pass Gen1)*/
565 #define PASAHO_LINFO_IS_PPPoE_GEN1(x)            PASAHO_READ_BITFIELD((x)->word3,6,1)     /**< Indicate whether it is a PPPoE packet (Pass Gen1)*/
566 #define PASAHO_LINFO_IS_IP_GEN1(x)               PASAHO_LINFO_READ_IP_COUNT(x)            /**< Indicate whether it is an IP packet (Pass Gen1)*/
567 #define PASAHO_LINFO_IS_IPSEC_ESP_GEN1(x)        PASAHO_READ_BITFIELD((x)->word3,25,1)    /**< Indicate whether it is an IPSEC ESP packet (Pass Gen1)*/
568 #define PASAHO_LINFO_IS_IPSEC_AH_GEN1(x)         PASAHO_READ_BITFIELD((x)->word3,26,1)    /**< Indicate whether it is an IPSEC AH packet (Pass Gen1)*/
569 #define PASAHO_LINFO_IS_UDP_GEN1(x)              PASAHO_READ_BITFIELD((x)->word3,27,1)    /**< Indicate whether it is an UDP packet (Pass Gen1)*/
570 #define PASAHO_LINFO_IS_UDP_LITE_GEN1(x)         PASAHO_READ_BITFIELD((x)->word3,28,1)    /**< Indicate whether it is an UDP Lite packet (Pass Gen1)*/
571 #define PASAHO_LINFO_IS_TCP_GEN1(x)              PASAHO_READ_BITFIELD((x)->word3,29,1)    /**< Indicate whether it is a TCP packet (Pass Gen1)*/
572 #define PASAHO_LINFO_IS_GRE_GEN1(x)              PASAHO_LINFO_READ_GRE_COUNT(x)           /**< Indicate whether it is a GRE packet (Pass Gen1)*/
573 #define PASAHO_LINFO_IS_GTPU_GEN1(x)             PASAHO_READ_BITFIELD((x)->word3,30,1)    /**< Indicate whether it is a GTPU packet (Pass Gen1)*/
574 #define PASAHO_LINFO_IS_CUSTOM_GEN1(x)           PASAHO_READ_BITFIELD((x)->word3,31,1)    /**< Indicate whether it is a Custom packet (Pass Gen1)*/
575 #define PASAHO_LINFO_IS_SCTP_GEN1(x)             PASAHO_READ_BITFIELD((x)->word3,4,1)     /**< Indicate whether it is a SCTP packet (Pass Gen1)*/
576 #define PASAHO_LINFO_IS_IPSEC_NAT_T_GEN1(x)      PASAHO_READ_BITFIELD((x)->word3,5,1)     /**< Indicate whether it is an IPSEC NAT-T packet (Pass Gen1)*/
578 /*@}*/ /* PASAHO_long_info_proto_ind_gen1_macross */
579 /** @}*/ /* @name PASAHO Long Info Protocol Indication Macross For First Generation PASS */
581 /**
582  *  @defgroup PASAHO_long_info_proto_ind_gen2_macros  PASAHO Long Info Protocol Indication Macros For Second Generation PASS
583  *  @ingroup pasaho_if_macros
584  *  @{
585  *  @name PASAHO Long Info Protocol Indication Macros For Second Generation PASS
586  */
587 #define PASAHO_LINFO_IS_MAC_GEN2(x)              PASAHO_READ_BITFIELD((x)->word3,0,1)     /**< Indicate whether it is a MAC packet (Pass Gen2)*/
588 #define PASAHO_LINFO_IS_WITH_VLAN_GEN2(x)        PASAHO_LINFO_READ_VLAN_COUNT(x)          /**< Indicate whether it is a MAC packet with VLAN (Pass Gen2)*/
589 #define PASAHO_LINFO_IS_WITH_MPLS_GEN2(x)        PASAHO_READ_BITFIELD((x)->word3,2,1)     /**< Indicate whether it is a MAC packet with MPLS (Pass Gen2)*/
590 #define PASAHO_LINFO_IS_802_3_GEN2(x)            PASAHO_READ_BITFIELD((x)->word3,3,1)     /**< Indicate whether it is a 802.3 packet (Pass Gen2)*/
591 #define PASAHO_LINFO_IS_PPPoE_GEN2(x)            PASAHO_READ_BITFIELD((x)->word3,4,1)     /**< Indicate whether it is a PPPoE packet (Pass Gen2)*/
592 #define PASAHO_LINFO_IS_IP_GEN2(x)               PASAHO_LINFO_READ_IP_COUNT(x)            /**< Indicate whether it is an IP packet (Pass Gen2)*/
593 #define PASAHO_LINFO_IS_IPv4_GEN2(x)             PASAHO_READ_BITFIELD((x)->word3,5,1)     /**< Indicate whether it is an IPv4 packet (Pass Gen2)*/
594 #define PASAHO_LINFO_IS_IPv6_GEN2(x)             PASAHO_READ_BITFIELD((x)->word3,6,1)     /**< Indicate whether it is an IPv4 packet (Pass Gen2)*/
595 #define PASAHO_LINFO_IS_IP_OPTIONS_GEN2(x)       PASAHO_READ_BITFIELD((x)->word3,7,1)     /**< Indicate whether there are IPV4 options or IPv6 extention headers (Pass Gen2)*/
596 #define PASAHO_LINFO_IS_IPSEC_ESP_GEN2(x)        PASAHO_READ_BITFIELD((x)->word3,8,1)     /**< Indicate whether it is an IPSEC ESP packet (Pass Gen2)*/
597 #define PASAHO_LINFO_IS_IPSEC_AH_GEN2(x)         PASAHO_READ_BITFIELD((x)->word3,9,1)     /**< Indicate whether it is an IPSEC AH packet (Pass Gen2)*/
598 #define PASAHO_LINFO_IS_SCTP_GEN2(x)             PASAHO_READ_BITFIELD((x)->word3,10,1)    /**< Indicate whether it is a SCTP packet (Pass Gen2)*/
599 #define PASAHO_LINFO_IS_UDP_GEN2(x)              PASAHO_READ_BITFIELD((x)->word3,11,1)    /**< Indicate whether it is an UDP packet (Pass Gen2)*/
600 #define PASAHO_LINFO_IS_UDP_LITE_GEN2(x)         PASAHO_READ_BITFIELD((x)->word3,11,1)    /**< Indicate whether it is an UDP Lite packet (Pass Gen2)*/
601 #define PASAHO_LINFO_IS_TCP_GEN2(x)              PASAHO_READ_BITFIELD((x)->word3,12,1)    /**< Indicate whether it is a TCP packet (Pass Gen2)*/
602 #define PASAHO_LINFO_IS_GRE_GEN2(x)              PASAHO_LINFO_READ_GRE_COUNT(x)           /**< Indicate whether it is a GRE packet (Pass Gen2)*/
603 #define PASAHO_LINFO_IS_GTPU_GEN2(x)             PASAHO_READ_BITFIELD((x)->word3,13,1)    /**< Indicate whether it is a GTPU packet (Pass Gen2)*/
604 #define PASAHO_LINFO_IS_CUSTOM_GEN2(x)           PASAHO_READ_BITFIELD((x)->word3,14,1)    /**< Indicate whether it is a Custom packet (Pass Gen2)*/
605 #define PASAHO_LINFO_IS_IPSEC_NAT_T_GEN2(x)      PASAHO_READ_BITFIELD((x)->word3,15,1)    /**< Indicate whether it is an IPSEC NAT-T packet (Pass Gen2)*/
607 /*@}*/ /* PASAHO_long_info_proto_ind_macross */
608 /** @}*/ /* @name PASAHO Long Info Protocol Indication Macross For Second Generation PASS */
610 /**
611  *  @defgroup PASAHO_long_info_proto_ind_macros  PASAHO Long Info Protocol Indication Macros
612  *  @ingroup pasaho_if_macros
613  *  @{
614  *  @name PASAHO Long Info Protocol Indication Macros
615  */
616 #ifdef NSS_GEN2
617 #define PASAHO_LINFO_IS_MAC(x)          PASAHO_LINFO_IS_MAC_GEN2(x)             /**< Indicate whether it is a MAC packet */
618 #define PASAHO_LINFO_IS_WITH_VLAN(x)    PASAHO_LINFO_IS_WITH_VLAN_GEN2(x)       /**< Indicate whether it is a MAC packet with VLAN */
619 #define PASAHO_LINFO_IS_WITH_MPLS(x)    PASAHO_LINFO_IS_WITH_MPLS_GEN2(x)       /**< Indicate whether it is a MAC packet with MPLS */
620 #define PASAHO_LINFO_IS_802_3(x)        PASAHO_LINFO_IS_802_3_GEN2(x)           /**< Indicate whether it is a 802.3 packet */
621 #define PASAHO_LINFO_IS_PPPoE(x)        PASAHO_LINFO_IS_PPPoE_GEN2(x)           /**< Indicate whether it is a PPPoE packet */
622 #define PASAHO_LINFO_IS_IP(x)           PASAHO_LINFO_IS_IP_GEN2(x)              /**< Indicate whether it is an IP packet */
623 #define PASAHO_LINFO_IS_IPv4(x)         PASAHO_LINFO_IS_IPv4_GEN2(x)            /**< Indicate whether it is an IPv4 packet */
624 #define PASAHO_LINFO_IS_IPv6(x)         PASAHO_LINFO_IS_IPv6_GEN2(x)            /**< Indicate whether it is an IPv4 packet */
625 #define PASAHO_LINFO_IS_IP_OPTIONS(x)   PASAHO_LINFO_IS_IP_OPTIONS_GEN2(x)      /**< Indicate whether there are IPV4 options or IPv6 extention headers */
626 #define PASAHO_LINFO_IS_IPSEC_ESP(x)    PASAHO_LINFO_IS_IPSEC_ESP_GEN2(x)       /**< Indicate whether it is an IPSEC ESP packet */
627 #define PASAHO_LINFO_IS_IPSEC_AH(x)     PASAHO_LINFO_IS_IPSEC_AH_GEN2(x)        /**< Indicate whether it is an IPSEC AH packet */
628 #define PASAHO_LINFO_IS_SCTP(x)         PASAHO_LINFO_IS_SCTP_GEN2(x)            /**< Indicate whether it is a SCTP packet */
629 #define PASAHO_LINFO_IS_UDP(x)          PASAHO_LINFO_IS_UDP_GEN2(x)             /**< Indicate whether it is an UDP packet */
630 #define PASAHO_LINFO_IS_UDP_LITE(x)     PASAHO_LINFO_IS_UDP_LITE_GEN2(x)        /**< Indicate whether it is an UDP Lite packet */
631 #define PASAHO_LINFO_IS_TCP(x)          PASAHO_LINFO_IS_TCP_GEN2(x)             /**< Indicate whether it is a TCP packet */
632 #define PASAHO_LINFO_IS_GRE(x)          PASAHO_LINFO_IS_GRE_GEN2(x)             /**< Indicate whether it is a GRE packet */
633 #define PASAHO_LINFO_IS_GTPU(x)         PASAHO_LINFO_IS_GTPU_GEN2(x)            /**< Indicate whether it is a GTPU packet */
634 #define PASAHO_LINFO_IS_CUSTOM(x)       PASAHO_LINFO_IS_CUSTOM_GEN2(x)          /**< Indicate whether it is a Custom packet */
635 #define PASAHO_LINFO_IS_IPSEC_NAT_T(x)  PASAHO_LINFO_IS_IPSEC_NAT_T_GEN2(x)     /**< Indicate whether it is an IPSEC NAT-T packet */
636 #else
637 #define PASAHO_LINFO_IS_MAC(x)          PASAHO_LINFO_IS_MAC_GEN1(x)             /**< Indicate whether it is a MAC packet */
638 #define PASAHO_LINFO_IS_802_3(x)        PASAHO_LINFO_IS_802_3_GEN1(x)           /**< Indicate whether it is a 802.3 packet */
639 #define PASAHO_LINFO_IS_WITH_VLAN(x)    PASAHO_LINFO_IS_WITH_VLAN_GEN1(x)       /**< Indicate whether it is a MAC packet with VLAN */
640 #define PASAHO_LINFO_IS_WITH_MPLS(x)    PASAHO_LINFO_IS_WITH_MPLS_GEN1(x)       /**< Indicate whether it is a MAC packet with MPLS */
641 #define PASAHO_LINFO_IS_PPPoE(x)        PASAHO_LINFO_IS_PPPoE_GEN1(x)           /**< Indicate whether it is a PPPoE packet */
642 #define PASAHO_LINFO_IS_IP(x)           PASAHO_LINFO_IS_IP_GEN1(x)              /**< Indicate whether it is an IP packet */
643 #define PASAHO_LINFO_IS_IPSEC_ESP(x)    PASAHO_LINFO_IS_IPSEC_ESP_GEN1(x)       /**< Indicate whether it is an IPSEC ESP packet */
644 #define PASAHO_LINFO_IS_IPSEC_AH(x)     PASAHO_LINFO_IS_IPSEC_AH_GEN1(x)        /**< Indicate whether it is an IPSEC AH packet */
645 #define PASAHO_LINFO_IS_UDP(x)          PASAHO_LINFO_IS_UDP_GEN1(x)             /**< Indicate whether it is an UDP packet */
646 #define PASAHO_LINFO_IS_UDP_LITE(x)     PASAHO_LINFO_IS_UDP_LITE_GEN1(x)        /**< Indicate whether it is an UDP Lite packet */
647 #define PASAHO_LINFO_IS_TCP(x)          PASAHO_LINFO_IS_TCP_GEN1(x)             /**< Indicate whether it is a TCP packet */
648 #define PASAHO_LINFO_IS_GRE(x)          PASAHO_LINFO_IS_GRE_GEN1(x)             /**< Indicate whether it is a GRE packet */
649 #define PASAHO_LINFO_IS_GTPU(x)         PASAHO_LINFO_IS_GTPU_GEN1(x)            /**< Indicate whether it is a GTPU packet */
650 #define PASAHO_LINFO_IS_CUSTOM(x)       PASAHO_LINFO_IS_CUSTOM_GEN1(x)          /**< Indicate whether it is a Custom packet */
651 #define PASAHO_LINFO_IS_SCTP(x)         PASAHO_LINFO_IS_SCTP_GEN1(x)            /**< Indicate whether it is a SCTP packet */
652 #define PASAHO_LINFO_IS_IPSEC_NAT_T(x)  PASAHO_LINFO_IS_IPSEC_NAT_T_GEN1(x)     /**< Indicate whether it is an IPSEC NAT-T packet */
653 #endif
655 /*@}*/ /* PASAHO_long_info_proto_ind_macross */
656 /** @}*/ /* @name PASAHO Long Info Protocol Indication Macross */
658 /**
659  *  @defgroup PASAHO_long_info_ipReassm_gen1_macros  PASAHO Long Info IP Reassembly Macros For First Generation PASS
660  *  @ingroup pasaho_if_macros
661  *  @{
662  *  @name PASAHO Long Info IpReassm Macros For First Generation PASS
663  *  Macros used by the PASAHO PASS-assisted IP Reassembly Operation
664  *
665  */
666 #define PASAHO_LINFO_READ_TFINDEX_GEN1(x)        PASAHO_READ_BITFIELD((x)->word4,24,8)     /**< Extract the IP Reassembly Traffic Flow Index (PASS Gen1)*/
667 #define PASAHO_LINFO_READ_FRANCNT_GEN1(x)        PASAHO_READ_BITFIELD((x)->word4,16,8)     /**< Extract the IP Reassembly Fragment count (PASS Gen1)*/
669 #define PASAHO_LINFO_SET_TFINDEX_GEN1(x, v)      PASAHO_SET_BITFIELD((x)->word4,(v),24,8)  /**< Set the IP Reassembly Traffic Flow Index (PASS Gen1)*/
670 #define PASAHO_LINFO_SET_FRANCNT_GEN1(x, v)      PASAHO_SET_BITFIELD((x)->word4,(v),16,8)  /**< Set the IP Reassembly Fragment count (PASS Gen1)*/
672 #define PASAHO_LINFO_IS_IPSEC_GEN1(x)            PASAHO_READ_BITFIELD((x)->word3,25,2)     /**< Indicate whether it is an IPSEC packet (PASS Gen1)*/
673 #define PASAHO_LINFO_CLR_IPSEC_GEN1(x)           PASAHO_SET_BITFIELD((x)->word3,0,25,2)    /**< Clear IPSEC indication bits (PASS Gen1)*/
674 #define PASAHO_LINFO_CLR_IPSEC_ESP_GEN1(x)       PASAHO_SET_BITFIELD((x)->word3,0,26,1)    /**< Clear IPSEC ESP indication bit (PASS Gen1)*/
675 #define PASAHO_LINFO_CLR_IPSEC_AH_GEN1(x)        PASAHO_SET_BITFIELD((x)->word3,0,25,1)    /**< Claer IPSEC AH indication bit (PASS Gen1)*/
676 #define PASAHO_LINFO_CLR_FLAG_FRAG_GEN1(x)       PASAHO_SET_BITFIELD((x)->word3,0,3,1)     /**< Clear the fragmentation found flag (PASS Gen1)*/
679 #define PASAHO_LINFO_SET_START_OFFSET_GEN1(x, v) PASAHO_SET_BITFIELD((x)->word0,(v),0,16)  /**< Update the next parse start offset (PASS Gen1)*/
680 #define PASAHO_LINFO_SET_END_OFFSET_GEN1(x, v)   PASAHO_SET_BITFIELD((x)->word1,(v),16,16) /**< Update the end of packet parse offset (PASS Gen1)*/
682 #define PASAHO_LINFO_SET_NULL_PKT_IND_GEN1(x, v) PASAHO_SET_BITFIELD((x)->word0,(v),21,1)  /**< Set the null packet flag which indicates that the packet should be dropped. 
683                                                                                            This flag should be set for the null packet to be delivered to PASS when
684                                                                                            the reassembly timeout occurs    (PASS Gen1)*/
686 /*@}*/ /* PASAHO_long_info_ipReassm_gen1_macros */
687 /** @}*/ /* @name PASAHO Long Info IpReassm Macros For First Generation PASS */
689 /**
690  *  @defgroup PASAHO_long_info_ipReassm_gen2_macros  PASAHO Long Info IP Reassembly Macros For Second Generation PASS
691  *  @ingroup pasaho_if_macros
692  *  @{
693  *  @name PASAHO Long Info IpReassm Macros
694  *  Macros used by the PASAHO PASS-assisted IP Reassembly Operation For Second Generation PASS
695  *
696  */
697 #define PASAHO_LINFO_READ_TFINDEX_GEN2(x)        PASAHO_READ_BITFIELD((x)->word5,24,8)     /**< Extract the IP Reassembly Traffic Flow Index (Pass Gen2)*/
698 #define PASAHO_LINFO_READ_FRANCNT_GEN2(x)        PASAHO_READ_BITFIELD((x)->word5,16,8)     /**< Extract the IP Reassembly Fragment count (Pass Gen2)*/
700 #define PASAHO_LINFO_SET_TFINDEX_GEN2(x, v)      PASAHO_SET_BITFIELD((x)->word5,(v),24,8)  /**< Set the IP Reassembly Traffic Flow Index (Pass Gen2)*/
701 #define PASAHO_LINFO_SET_FRANCNT_GEN2(x, v)      PASAHO_SET_BITFIELD((x)->word5,(v),16,8)  /**< Set the IP Reassembly Fragment count (Pass Gen2)*/
703 #define PASAHO_LINFO_IS_IPSEC_GEN2(x)            PASAHO_READ_BITFIELD((x)->word3,8,2)      /**< Indicate whether it is an IPSEC packet (Pass Gen2)*/
704 #define PASAHO_LINFO_CLR_IPSEC_GEN2(x)           PASAHO_SET_BITFIELD((x)->word3,0,8,2)     /**< Clear IPSEC indication bits (Pass Gen2)*/
705 #define PASAHO_LINFO_CLR_IPSEC_ESP_GEN2(x)       PASAHO_SET_BITFIELD((x)->word3,0,8,1)     /**< Clear IPSEC ESP indication bit (Pass Gen2)*/
706 #define PASAHO_LINFO_CLR_IPSEC_AH_GEN2(x)        PASAHO_SET_BITFIELD((x)->word3,0,9,1)     /**< Claer IPSEC AH indication bit (Pass Gen2)*/
707 #define PASAHO_LINFO_CLR_FLAG_FRAG_GEN2(x)       PASAHO_SET_BITFIELD((x)->word1,0,19,1)    /**< Clear the fragmentation found flag (Pass Gen2)*/
710 #define PASAHO_LINFO_SET_START_OFFSET_GEN2(x, v) PASAHO_SET_BITFIELD((x)->word0,(v),0,8)   /**< Update the next parse start offset (Pass Gen2)*/
711 #define PASAHO_LINFO_SET_END_OFFSET_GEN2(x, v)   PASAHO_SET_BITFIELD((x)->word1,(v),16,16) /**< Update the end of packet parse offset (Pass Gen2)*/
712 #define PASAHO_LINFO_SET_NXT_HDR_TYPE_GEN2(x, v) PASAHO_SET_BITFIELD((x)->word1,(v),0,6)   /**< Update the next header to parse type (Pass Gen2)*/
714 #define PASAHO_LINFO_SET_NULL_PKT_IND_GEN2(x, v) PASAHO_SET_BITFIELD((x)->word0,(v),13,1)  /**< Set the null packet flag which indicates that the packet should be dropped. 
715                                                                                                 This flag should be set for the null packet to be delivered to PASS when
716                                                                                                 the reassembly timeout occurs    (Pass Gen2)*/
717 /*@}*/ /* PASAHO_long_info_ipReassm_gen2_macros */
718 /** @}*/ /* @name PASAHO Long Info IpReassm Macros For Second Generation PASS */
720 /**
721  *  @defgroup PASAHO_long_info_ipReassm_macros  PASAHO Long Info IP Reassembly Macros
722  *  @ingroup pasaho_if_macros
723  *  @{
724  *  @name PASAHO Long Info IpReassm Macros
725  *  Macros used by the PASAHO PASS-assisted IP Reassembly Operation
726  *
727  */
728 #ifdef NSS_GEN2 
729 #define PASAHO_LINFO_READ_TFINDEX(x)        PASAHO_LINFO_READ_TFINDEX_GEN2(x)         /**< Extract the IP Reassembly Traffic Flow Index */
730 #define PASAHO_LINFO_READ_FRANCNT(x)        PASAHO_LINFO_READ_FRANCNT_GEN2(x)         /**< Extract the IP Reassembly Fragment count */
732 #define PASAHO_LINFO_SET_TFINDEX(x, v)      PASAHO_LINFO_SET_TFINDEX_GEN2(x, v)       /**< Set the IP Reassembly Traffic Flow Index */
733 #define PASAHO_LINFO_SET_FRANCNT(x, v)      PASAHO_LINFO_SET_FRANCNT_GEN2(x, v)       /**< Set the IP Reassembly Fragment count */
735 #define PASAHO_LINFO_IS_IPSEC(x)            PASAHO_LINFO_IS_IPSEC_GEN2(x)             /**< Indicate whether it is an IPSEC packet */
736 #define PASAHO_LINFO_CLR_IPSEC(x)           PASAHO_LINFO_CLR_IPSEC_GEN2(x)            /**< Clear IPSEC indication bits */
737 #define PASAHO_LINFO_CLR_IPSEC_ESP(x)       PASAHO_LINFO_CLR_IPSEC_ESP_GEN2(x)        /**< Clear IPSEC ESP indication bit */
738 #define PASAHO_LINFO_CLR_IPSEC_AH(x)        PASAHO_LINFO_CLR_IPSEC_AH_GEN2(x)         /**< Claer IPSEC AH indication bit */
739 #define PASAHO_LINFO_CLR_FLAG_FRAG(x)       PASAHO_LINFO_CLR_FLAG_FRAG_GEN2(x)        /**< Clear the fragmentation found flag */
742 #define PASAHO_LINFO_SET_START_OFFSET(x, v) PASAHO_LINFO_SET_START_OFFSET_GEN2(x, v)  /**< Update the next parse start offset */
743 #define PASAHO_LINFO_SET_END_OFFSET(x, v)   PASAHO_LINFO_SET_END_OFFSET_GEN2(x, v)    /**< Update the end of packet parse offset */
744 #define PASAHO_LINFO_SET_NXT_HDR_TYPE(x, v) PASAHO_LINFO_SET_NXT_HDR_TYPE_GEN2(x, v)  /**< Update the next header to parse type */
746 #define PASAHO_LINFO_SET_NULL_PKT_IND(x, v) PASAHO_LINFO_SET_NULL_PKT_IND_GEN2(x, v)  /**< Set the null packet flag which indicates that the packet should be dropped. 
747                                                                                            This flag should be set for the null packet to be delivered to PASS when
748                                                                                            the reassembly timeout occurs    */
749 #else
750 #define PASAHO_LINFO_READ_TFINDEX(x)        PASAHO_LINFO_READ_TFINDEX_GEN1(x)         /**< Extract the IP Reassembly Traffic Flow Index */
751 #define PASAHO_LINFO_READ_FRANCNT(x)        PASAHO_LINFO_READ_FRANCNT_GEN1(x)         /**< Extract the IP Reassembly Fragment count */
753 #define PASAHO_LINFO_SET_TFINDEX(x, v)      PASAHO_LINFO_SET_TFINDEX_GEN1(x, v)       /**< Set the IP Reassembly Traffic Flow Index */
754 #define PASAHO_LINFO_SET_FRANCNT(x, v)      PASAHO_LINFO_SET_FRANCNT_GEN1(x, v)       /**< Set the IP Reassembly Fragment count */
756 #define PASAHO_LINFO_IS_IPSEC(x)            PASAHO_LINFO_IS_IPSEC_GEN1(x)             /**< Indicate whether it is an IPSEC packet */
757 #define PASAHO_LINFO_CLR_IPSEC(x)           PASAHO_LINFO_CLR_IPSEC_GEN1(x)            /**< Clear IPSEC indication bits */
758 #define PASAHO_LINFO_CLR_IPSEC_ESP(x)       PASAHO_LINFO_CLR_IPSEC_ESP_GEN1(x)        /**< Clear IPSEC ESP indication bit */
759 #define PASAHO_LINFO_CLR_IPSEC_AH(x)        PASAHO_LINFO_CLR_IPSEC_AH_GEN1(x)         /**< Claer IPSEC AH indication bit */
760 #define PASAHO_LINFO_CLR_FLAG_FRAG(x)       PASAHO_LINFO_CLR_FLAG_FRAG_GEN1(x)        /**< Clear the fragmentation found flag */
763 #define PASAHO_LINFO_SET_START_OFFSET(x, v) PASAHO_LINFO_SET_START_OFFSET_GEN1(x, v)  /**< Update the next parse start offset */
764 #define PASAHO_LINFO_SET_END_OFFSET(x, v)   PASAHO_LINFO_SET_END_OFFSET_GEN1(x, v)    /**< Update the end of packet parse offset */
766 #define PASAHO_LINFO_SET_NULL_PKT_IND(x, v) PASAHO_LINFO_SET_NULL_PKT_IND_GEN1(x, v)  /**< Set the null packet flag which indicates that the packet should be dropped. 
767                                                                                            This flag should be set for the null packet to be delivered to PASS when
768                                                                                            the reassembly timeout occurs    */
770 #endif                                                                                           
771 /*@}*/ /* PASAHO_long_info_ipReassm_macros */
772 /** @}*/ /* @name PASAHO Long Info IpReassm Macros */
774 /**
775  *  @def  PA_INV_TF_INDEX
776  *        PASS-asssited IP reassembly traffic flow index to indicate that no traffic flow is available 
777  */
778 #define PA_INV_TF_INDEX     0xFF    
780 /**
781  *  @ingroup pasaho_if_structures
782  *  @brief  pasahoShortInfo_t defines the packet parsing information in the short format
783  *
784  *  @details pasahoShortInfo_t defines the packet parsing information in terms of
785  *           payload offset and payload length as described below
786  *           SRTP:      offset to the RTP header; RTP payload length including ICV
787  *           IPSEC AH:  offset to the Outer IP; IP payload length
788  *           IPSEC ESP: offset to the ESP header; ESP papload length including ICV
789  */
791 typedef struct pasahoShortInfo_s {
792     uint32_t  word0;   /**< Control block word 0 */
793     uint32_t  word1;   /**< Optional supplement data (It may be padding for alignment only) */
794 } pasahoShortInfo_t;
796 /** 
797  *  @defgroup PASAHO_short_info_command_macros  PASAHO Short Info Command Macros
798  *  @ingroup pasaho_if_macros
799  *  @{
800  *  @name PASAHO Short Info Command Macros
801  *  Macros used by the PASAHO Short Info Command
802  *  
803  */
804 /*@{*/
805 #define PASAHO_SINFO_READ_CMDID(x)          PASAHO_READ_BITFIELD((x)->word0,29,3)                           /**< Extract the command ID defined at @ref pasahoCommands */
806 #define PASAHO_SINFO_RESD_PAYLOAD_OFFSET(x) PASAHO_READ_BITFIELD((x)->word0,16,8)                           /**< Extract the offset to the packet payload */
807 #define PASAHO_SINFO_READ_PAYLOAD_LENGTH(x) PASAHO_READ_BITFIELD((x)->word0,0,16)                           /**< Extract the byte length of the payload */
809 #define PASAHO_SINFO_SET_PAYLOAD_OFFSET(x, v)  PASAHO_SET_BITFIELD((x)->word0, (v), 16, 8)                  /**< Set the offset to the payload */
810 #define PASAHO_SINFO_SET_PAYLOAD_LENGTH(x, v)  PASAHO_SET_BITFIELD((x)->word0, (v), 0,  16)                 /**< Set the payload length */
811 #define PASAHO_SINFO_FORMAT_CMD(offset, len)   (((offset) << 16) | (len) | (PASAHO_SA_SHORT_INFO << 29))    /**< Format the entire short info command */
813 /*@}*/ /* PASAHO_short_info_command_macros */
814 /** @}*/ /* @name PASAHO Short Info Command Macros */
816 /* Header bitmask bits */
817 /**
818  *  @defgroup pasahoHeaderBitmapGen1  PA/SA/HO Header Bitmap Bit Definitions For First Generation PASS
819  *  @ingroup pasaho_if_constants
820  *  @{
821  *
822  *  @name PA/SA/HO Header Bitmap Bit Definitions For First Generation PASS
823  *  Bitmap definition of the protocol header bitmask at the long info of First Generation PASS. 
824  */ 
825 /*@{*/
826 #define PASAHO_HDR_BITMASK_MAC_GEN1     (1 << 0)     /**< MAC present (PASS Gen1)*/
827 #define PASAHO_HDR_BITMASK_VLAN_GEN1    (1 << 1)     /**< VLAN present (PASS Gen1)*/
828 #define PASAHO_HDR_BITMASK_MPLS_GEN1    (1 << 2)     /**< MPLS present (PASS Gen1)*/
829 #define PASAHO_HDR_BITMASK_IP_GEN1      (1 << 3)     /**< IP present (PASS Gen1)*/
830 #define PASAHO_HDR_BITMASK_ESP_GEN1     (1 << 4)     /**< IPSEC/ESP present (PASS Gen1)*/
831 #define PASAHO_HDR_BITMASK_AH_GEN1      (1 << 5)     /**< IPSEC/AH present (PASS Gen1)*/
832 #define PASAHO_HDR_BITMASK_UDP_GEN1     (1 << 6)     /**< UDP present (PASS Gen1)*/
833 #define PASAHO_HDR_BITMASK_UDPLITE_GEN1 (1 << 7)     /**< UDPLITE present (PASS Gen1)*/
834 #define PASAHO_HDR_BITMASK_TCP_GEN1     (1 << 8)     /**< TCP present (PASS Gen1)*/
835 #define PASAHO_HDR_BITMASK_GTPU_GEN1    (1 << 9)     /**< GTPU present (PASS Gen1)*/
836 #define PASAHO_HDR_BITMASK_CUSTOM_GEN1  (1 << 10)    /**< Custom header present (PASS Gen1)*/
838 #define PASAHO_HDR_BITMASK2_SCTP_GEN1          (1 << 0)     /**< SCTP present (PASS Gen1)*/
839 #define PASAHO_HDR_BITMASK2_IPSEC_NAT_T_GEN1   (1 << 1)     /**< IPSEC NAT-T present (PASS Gen1)*/
840 #define PASAHO_HDR_BITMASK2_PPPoE_GEN1         (1 << 2)     /**< PPPoE present (PASS Gen1)*/
841 #define PASAHO_HDR_BITMASK2_802_3_GEN1         (1 << 3)     /**< 802.3 present (PASS Gen1)*/
843 /*@}*/
844 /** @} */
846 /* Header bitmask bits */
847 /**
848  *  @defgroup pasahoHeaderBitmapGen2  PA/SA/HO Header Bitmap Bit Definitions For Second Generation PASS
849  *  @ingroup pasaho_if_constants
850  *  @{
851  *
852  *  @name PA/SA/HO Header Bitmap Bit Definitions For Second Generation PASS
853  *  Bitmap definition of the protocol header bitmask at the long info  For Second Generation PASS. 
854  */ 
855 /*@{*/
856 #define PASAHO_HDR_BITMASK_MAC_GEN2     (1 << 0)     /**< MAC present (PASS Gen2)*/
857 #define PASAHO_HDR_BITMASK_VLAN_GEN2    (1 << 1)     /**< VLAN present (PASS Gen2)*/
858 #define PASAHO_HDR_BITMASK_MPLS_GEN2    (1 << 2)     /**< MPLS present (PASS Gen2)*/
859 #define PASAHO_HDR_BITMASK_802_3_GEN2   (1 << 3)     /**< 802.3 present (PASS Gen2)*/
860 #define PASAHO_HDR_BITMASK_PPPoE_GEN2   (1 << 4)     /**< PPPoE present (PASS Gen2)*/
861 #define PASAHO_HDR_BITMASK_IPv4_GEN2    (1 << 5)     /**< IPv4 present (PASS Gen2)*/
862 #define PASAHO_HDR_BITMASK_IPv6_GEN2    (1 << 6)     /**< IPv6 present (PASS Gen2)*/
863 #define PASAHO_HDR_BITMASK_IP_OPTS_GEN2 (1 << 7)     /**< IPv4 options or IPv6 extension headers present (PASS Gen2)*/
864 #define PASAHO_HDR_BITMASK_ESP_GEN2     (1 << 8)     /**< IPSEC/ESP present (PASS Gen2)*/
865 #define PASAHO_HDR_BITMASK_AH_GEN2      (1 << 9)     /**< IPSEC/AH present (PASS Gen2)*/
866 #define PASAHO_HDR_BITMASK_SCTP_GEN2    (1 << 10)    /**< SCTP present (PASS Gen2)*/
867 #define PASAHO_HDR_BITMASK_UDP_GEN2     (1 << 11)    /**< UDP present (PASS Gen2)*/
868 #define PASAHO_HDR_BITMASK_UDPLITE_GEN2 (1 << 11)    /**< UDPLITE present (PASS Gen2)*/
869 #define PASAHO_HDR_BITMASK_TCP_GEN2     (1 << 12)    /**< TCP present (PASS Gen2)*/
870 #define PASAHO_HDR_BITMASK_GTPU_GEN2    (1 << 13)     /**< GTPU present (PASS Gen2)*/
871 #define PASAHO_HDR_BITMASK_CUSTOM_GEN2  (1 << 14)    /**< Custom header present (PASS Gen2)*/
872 #define PASAHO_HDR_BITMASK_IPSEC_NAT_T_GEN2   (1 << 15)     /**< IPSEC NAT-T present (PASS Gen2)*/
874 /*@}*/
875 /** @} */
877 /* Header bitmask bits */
878 /**
879  *  @defgroup pasahoHeaderBitmap  PA/SA/HO Header Bitmap Bit Definitions
880  *  @ingroup pasaho_if_constants
881  *  @{
882  *
883  *  @name PA/SA/HO Header Bitmap Bit Definitions
884  *  Bitmap definition of the protocol header bitmask at the long info. 
885  */ 
886 /*@{*/
887 #ifdef NSS_GEN2
888 #define PASAHO_HDR_BITMASK_MAC         PASAHO_HDR_BITMASK_MAC_GEN2          /**< MAC present */
889 #define PASAHO_HDR_BITMASK_VLAN        PASAHO_HDR_BITMASK_VLAN_GEN2         /**< VLAN present */
890 #define PASAHO_HDR_BITMASK_MPLS        PASAHO_HDR_BITMASK_MPLS_GEN2         /**< MPLS present */
891 #define PASAHO_HDR_BITMASK_802_3       PASAHO_HDR_BITMASK_802_3_GEN2        /**< 802.3 present */
892 #define PASAHO_HDR_BITMASK_PPPoE       PASAHO_HDR_BITMASK_PPPoE_GEN2        /**< PPPoE present */
893 #define PASAHO_HDR_BITMASK_IPv4        PASAHO_HDR_BITMASK_IPv4_GEN2         /**< IPv4 present */
894 #define PASAHO_HDR_BITMASK_IPv6        PASAHO_HDR_BITMASK_IPv6_GEN2         /**< IPv6 present */
895 #define PASAHO_HDR_BITMASK_IP_OPTS     PASAHO_HDR_BITMASK_IP_OPTS_GEN2      /**< IPv4 options or IPv6 extension headers present */
896 #define PASAHO_HDR_BITMASK_ESP         PASAHO_HDR_BITMASK_ESP_GEN2          /**< IPSEC/ESP present */
897 #define PASAHO_HDR_BITMASK_AH          PASAHO_HDR_BITMASK_AH_GEN2           /**< IPSEC/AH present */
898 #define PASAHO_HDR_BITMASK_SCTP        PASAHO_HDR_BITMASK_SCTP_GEN2         /**< SCTP present */
899 #define PASAHO_HDR_BITMASK_UDP         PASAHO_HDR_BITMASK_UDP_GEN2          /**< UDP present */
900 #define PASAHO_HDR_BITMASK_UDPLITE     PASAHO_HDR_BITMASK_UDPLITE_GEN2      /**< UDPLITE present */
901 #define PASAHO_HDR_BITMASK_TCP         PASAHO_HDR_BITMASK_TCP_GEN2          /**< TCP present */
902 #define PASAHO_HDR_BITMASK_GTPU        PASAHO_HDR_BITMASK_GTPU_GEN2         /**< GTPU present */
903 #define PASAHO_HDR_BITMASK_CUSTOM      PASAHO_HDR_BITMASK_CUSTOM_GEN2       /**< Custom header present */
904 #define PASAHO_HDR_BITMASK_IPSEC_NAT_T PASAHO_HDR_BITMASK_IPSEC_NAT_T_GEN2  /**< IPSEC NAT-T present */
905 #else
906 #define PASAHO_HDR_BITMASK_MAC         PASAHO_HDR_BITMASK_MAC_GEN1          /**< MAC present */
907 #define PASAHO_HDR_BITMASK_VLAN        PASAHO_HDR_BITMASK_VLAN_GEN1         /**< VLAN present */
908 #define PASAHO_HDR_BITMASK_MPLS        PASAHO_HDR_BITMASK_MPLS_GEN1         /**< MPLS present */
909 #define PASAHO_HDR_BITMASK_IP          PASAHO_HDR_BITMASK_IP_GEN1           /**< IP present */
910 #define PASAHO_HDR_BITMASK_ESP         PASAHO_HDR_BITMASK_ESP_GEN1          /**< IPSEC/ESP present */
911 #define PASAHO_HDR_BITMASK_AH          PASAHO_HDR_BITMASK_AH_GEN1           /**< IPSEC/AH present */
912 #define PASAHO_HDR_BITMASK_UDP         PASAHO_HDR_BITMASK_UDP_GEN1          /**< UDP present */
913 #define PASAHO_HDR_BITMASK_UDPLITE     PASAHO_HDR_BITMASK_UDPLITE_GEN1      /**< UDPLITE present */
914 #define PASAHO_HDR_BITMASK_TCP         PASAHO_HDR_BITMASK_TCP_GEN1          /**< TCP present */
915 #define PASAHO_HDR_BITMASK_GTPU        PASAHO_HDR_BITMASK_GTPU_GEN1         /**< GTPU present */
916 #define PASAHO_HDR_BITMASK_CUSTOM      PASAHO_HDR_BITMASK_CUSTOM_GEN1       /**< Custom header present */
918 #define PASAHO_HDR_BITMASK2_SCTP        PASAHO_HDR_BITMASK2_SCTP_GEN1       /**< SCTP present */
919 #define PASAHO_HDR_BITMASK2_IPSEC_NAT_T PASAHO_HDR_BITMASK2_IPSEC_NAT_T_GEN1/**< IPSEC NAT-T present */
920 #define PASAHO_HDR_BITMASK2_PPPoE       PASAHO_HDR_BITMASK2_PPPoE_GEN1      /**< PPPoE present */
921 #define PASAHO_HDR_BITMASK2_802_3       PASAHO_HDR_BITMASK2_802_3_GEN1      /**< 802.3 present */
922 #endif
924 /*@}*/
925 /** @} */
930 /* Next Route command */
931 /**
932  *  @defgroup pasahoNrDestGen1  PA/SA/HO Destination Types at NextRoute Command of First Generation PASS
933  *  @ingroup pasaho_if_constants
934  *  @{
935  *
936  *  @name PA/SA/HO Destination Types at NextRoute Command of First Generation PASS
937  *  Bitmap definition of the destination type at the nextRoute command of First Generation PASS. 
938  */ 
939 /*@{*/
940 #define PASAHO_NR_DEST_PKTDMA_GEN1      6            /**< NextRoute Destination: PKTDMA (PASS Gen1)*/
941 #define PASAHO_NR_DEST_ETH_GEN1         7            /**< NextRoute Destination: Ethernet Port (PASS Gen1)*/
942 #define PASAHO_NR_DEST_SRIO_GEN1        0            /**< NextRoute Destination: SRIO (PASS Gen1)*/
944 /*@}*/
945 /** @} */
947 /**
948  *  @defgroup pasahoNrDestGen2  PA/SA/HO Destination Types at NextRoute Command of Second Generation PASS
949  *  @ingroup pasaho_if_constants
950  *  @{
951  *
952  *  @name PA/SA/HO Destination Types at NextRoute Command of Second Generation PASS
953  *  Bitmap definition of the destination type at the nextRoute command of Second Generation PASS. 
954  */ 
955 /*@{*/
956 #define PASAHO_NR_DEST_PKTDMA_GEN2      0            /**< NextRoute Destination: PKTDMA (PASS Gen2)*/
957 #define PASAHO_NR_DEST_ETH_GEN2         2            /**< NextRoute Destination: Ethernet Port (PASS Gen2)*/
958 #define PASAHO_NR_DEST_SRIO_GEN2        7            /**< NextRoute Destination: SRIO (PASS Gen2)*/
960 /*@}*/
961 /** @} */
963 /**
964  *  @defgroup pasahoNrDest  PA/SA/HO Destination Types at NextRoute Command
965  *  @ingroup pasaho_if_constants
966  *  @{
967  *
968  *  @name PA/SA/HO Destination Types at NextRoute Command
969  *  Bitmap definition of the destination type at the nextRoute command
970  */ 
971 #ifdef NSS_GEN2
972 #define PASAHO_NR_DEST_PKTDMA      PASAHO_NR_DEST_PKTDMA_GEN2   /**< NextRoute Destination: PKTDMA */
973 #define PASAHO_NR_DEST_ETH         PASAHO_NR_DEST_ETH_GEN2      /**< NextRoute Destination: Ethernet Port */
974 #define PASAHO_NR_DEST_SRIO        PASAHO_NR_DEST_SRIO_GEN2     /**< NextRoute Destination: SRIO */
975 #else
976 #define PASAHO_NR_DEST_PKTDMA      PASAHO_NR_DEST_PKTDMA_GEN1   /**< NextRoute Destination: PKTDMA */
977 #define PASAHO_NR_DEST_ETH         PASAHO_NR_DEST_ETH_GEN1      /**< NextRoute Destination: Ethernet Port */
978 #define PASAHO_NR_DEST_SRIO        PASAHO_NR_DEST_SRIO_GEN1     /**< NextRoute Destination: SRIO */
979 #endif
981 /*@}*/
982 /** @} */
984 /**
985  *  @ingroup pasaho_if_structures
986  *  @brief  pasahoNextRoute_t defines the next route command. The command structure is defined as 32 bit
987  *          values to work with the hardware regardless of the device endianness.
988  *
989  *  @details 
990  */
992 typedef struct pasahoNextRoute_s  {
993     uint32_t  word0;          /**< Contains the next route command information. @ref PASAHO_next_route_command_macros */
994     uint32_t  swInfo0;        /**< Information placed into returned descriptor. Used if next destination is the host */
995     uint32_t  swInfo1;        /**< Information placed into returned descriptor. Used if next destination is the host */
996     uint32_t  word1;          /**< Contains the optional information such as pktType for SRIO. @ref PASAHO_next_route_command_macros */
997 } pasahoNextRoute_t;
999 /** 
1000  *  @defgroup PASAHO_next_route_command_macros  PASAHO Next Route Command Macros
1001  *  @ingroup pasaho_if_macros
1002  *  @{
1003  *  @name PASAHO Next Route Command Macros
1004  *  Macros used by the PASAHO Next Route Command
1005  *  
1006  */
1007 /*@{*/
1009 #define PASAHO_SET_N(x,v)       PASAHO_SET_BITFIELD((x)->word0, (v), 28, 1)    /**< Sets the N bit which indicates the next command should be executed prior to the route command */
1010 #define PASAHO_SET_E(x,v)       PASAHO_SET_BITFIELD((x)->word0, (v), 27, 1)    /**< Sets the E bit which indicates the extened parameters (packet type and/or control flags) are present for SRIO */
1011 #define PASAHO_SET_DEST(x,v)    PASAHO_SET_BITFIELD((x)->word0, (v), 24, 3)    /**< Sets the destination of the route defined at @ref pktDest */
1012 #define PASAHO_SET_FLOW(x,v)    PASAHO_SET_BITFIELD((x)->word0, (v), 16, 8)    /**< Specifies the flow to use for packets sent to the host */
1013 #define PASAHO_SET_QUEUE(x,v)   PASAHO_SET_BITFIELD((x)->word0, (v), 0,  16)   /**< Specifies the queue to use for packets send to the host */
1014 #define PASAHO_SET_PKTTYPE(x,v) PASAHO_SET_BITFIELD((x)->word1, (v), 24, 8)    /**< Specifies the packet type to use for packets send to the SRIO */
1015 #define PASAHO_SET_TX_PADDING(x,v) PASAHO_SET_BITFIELD((x)->word1, (v), 0, 1)  /**< Sets the tx padding bit which indicates PASS should check padding condition and provide L2 zero padding if required */
1016 #define PASAHO_SET_TX_STATS(x,v) PASAHO_SET_BITFIELD((x)->word1, (v), 1, 1)    /**< Sets the tx stats bit which indicates PASS should increment the user statistics chain pointed by the user statistics index */
1017 #define PASAHO_SET_USR_STATS_INDEX(x,v) PASAHO_SET_BITFIELD((x)->word1, (v), 8, 16) /**< Specifies index of the first user-defined statistics to be updated */
1019 /*@}*/ /* PASAHO_next_route_command_macros */
1020 /** @}*/ /* @name PASAHO Next Route Command Macros */
1023 /* Compute checksum command */
1024 /**
1025  *  @ingroup pasaho_if_structures
1026  *  @brief  pasahoComChkCrc_t defines the checksum and CRC generation command. The command structure is defined as
1027  *          32 bit values to wrok with the hardware regardless of the device endianness.
1028  *
1029  *  @details 
1030  */
1032 typedef struct pasahoComChkCrc_s  {
1033     uint32_t  word0;        /**<  @ref PASAHO_chksum_command_macros */
1034     uint32_t  word1;        /**<  @ref PASAHO_chksum_command_macros */
1035     uint32_t  word2;        /**<  @ref PASAHO_chksum_command_macros */
1037 } pasahoComChkCrc_t;
1039 /** 
1040  *  @defgroup PASAHO_chksum_command_macros  PASAHO Checksum/CRC Command Macros
1041  *  @ingroup pasaho_if_macros
1042  *  @{
1043  *  @name PASAHO Checksum/CRC Command Macros
1044  *  Macros used by the ASAHO Checksum/CRC Command 
1045  */
1046 /*@{*/
1048 #define PASAHO_CHKCRC_SET_NEG0(x,v)        PASAHO_SET_BITFIELD((x)->word0, (v), 23, 1)           /**< Sets the negative 0 flag - if set a checksum computed as 0 will be sent as 0xffff */
1049 #define PASAHO_CHKCRC_SET_CTRL(x,v)        PASAHO_SET_BITFIELD((x)->word0, (v), 16, 4)           /**< Sets the optional flags of the CRC/Checksum command */
1050 #define PASAHO_CHKCRC_SET_CRCSIZE(x,v)     PASAHO_SET_BITFIELD((x)->word0, (v), 8,  8)           /**< Sets the size of the crc in bytes (PASS Gen2 only) */
1051 #define PASAHO_CHKCRC_SET_START(x,v)       PASAHO_SET_BITFIELD((x)->word0, (v), 0,  8)           /**< Sets the start offset of the checksum/crc */
1052 #define PASAHO_CHKCRC_SET_LEN(x,v)         PASAHO_SET_BITFIELD((x)->word1, (v), 16, 16)          /**< Sets the length of the checksum/crc */
1053 #define PASAHO_CHKCRC_SET_RESULT_OFF(x,v)  PASAHO_SET_BITFIELD((x)->word1, (v), 0,  16)          /**< Sets the offset to where to paste the checksum/crc into the packet */
1054 #define PASAHO_CHKCRC_SET_INITVAL(x,v)     PASAHO_SET_BITFIELD((x)->word2, (v), 16, 16)          /**< Sets the initial value of the 16-bit checksum */
1055 #define PASAHO_CHKCRC_SET_INITVAL32(x,v)   (x)->word2 = (v)                                      /**< Sets the initial value of the 32-bit crc (PASS Gen2 only)*/
1057 /*@}*/ /* @name PASAHO Checksum/CRC Command Macros */
1058 /** @}*/ /* PASAHO_chksum_command_macros */
1061 /* Blind patch command */
1062 /**
1063  *  @ingroup pasaho_if_structures
1064  *  @brief  pasahoComBlindPatch_t defines the blind patch command. The command structure is defined as
1065  *          32 bit values to work with the hardware regardless of the device endianness.
1066  *
1067  *  @details 
1068  */
1070 #define PASAHO_BPATCH_MAX_PATCH_WORDS   4
1071 typedef struct pasahoComBlindPatch_s  {
1072     uint32_t   word0;                                   /**<  @ref PASAHO_blind_patch_command_macros */
1073     uint32_t   patch[PASAHO_BPATCH_MAX_PATCH_WORDS];    /**<  @ref PASAHO_blind_patch_command_macros */
1074     
1075 } pasahoComBlindPatch_t;
1077 /** 
1078  *  @defgroup PASAHO_blind_patch_command_macros  PASAHO Blind Patch Command Macros
1079  *  @ingroup pasaho_if_macros
1080  *  @{
1081  *  @name PASAHO Blind Patch Command Macros
1082  *  Macros used by the PASAHO Blind Patch Command
1083  */
1085 #define PASAHO_BPATCH_SET_PATCH_NBYTES(x,v)    \
1086                           PASAHO_SET_BITFIELD((x)->word0, v, 24,  5)
1087 /**< Sets the number of bytes to patch */
1088                           
1089 #define PASAHO_BPATCH_SET_PATCH_CMDSIZE(x,v)   \
1090                           PASAHO_SET_BITFIELD((x)->word0, v, 20, 4)
1091 /**< Sets the size of the command in 32 bit word units */
1092                           
1093 #define PASAHO_BPATCH_SET_OVERWRITE(x,v)       \
1094                           PASAHO_SET_BITFIELD((x)->word0, v, 19, 1)
1095 /**< Sets the overwrite flag. If set the patch will overwrite existing packet data, 
1096      otherwise data may be inserted */  
1097      
1098 #define PASAHO_BPATCH_SET_DELETE(x,v)         \
1099                           PASAHO_SET_BITFIELD((x)->word0, v, 18, 1)
1100 /**< Sets the delete flag. If set, no data will be inserted */                          
1101                              
1102                           
1103 #define PASAHO_BPATCH_SET_OFFSET(x,v)         \
1104                           PASAHO_SET_BITFIELD((x)->word0, v, 0,  16)
1105 /**< Sets the offset to the start of the patch */                          
1106                           
1107 #define PASAHO_BPATCH_SET_PATCH_BYTE(x, byteNum, byte)  \
1108                                 PASAHO_SET_BITFIELD((x)->patch[(byteNum) >> 2], byte, ((3 - (byteNum & 0x3)) << 3), 8)
1109 /**< Sets the data to patch */                                                   
1110                                 
1111 /*@}*/ /* @name PASAHO Blind Patch Command Macros */
1112 /** @}*/ /* PASAHO_blind_patch_command_macros */        
1114 /* Report Timestamp command */
1115 /**
1116  *  @ingroup pasaho_if_structures
1117  *  @brief  pasahoReportTimestamp_t defines the report timestamp command. The command structure is defined as 32 bit
1118  *          values to work with the hardware regardless of the device endianness.
1119  *
1120  *  @details 
1121  */
1123 typedef struct pasahoReportTimestamp_s  {
1124     uint32_t  word0;          /**< Contains the report timestamp command information. @ref PASAHO_report_timestamp_command_macros */
1125     uint32_t  swInfo0;        /**< Information placed into returned descriptor of the reporting packet.  */
1126 } pasahoReportTimestamp_t;
1128 /** 
1129  *  @defgroup PASAHO_report_timestamp_command_macros PASAHO Report Timestamp Command Macros
1130  *  @ingroup pasaho_if_macros
1131  *  @{
1132  *  @name PASAHO Report Timestamp Command Macros
1133  *  Macros used by the PASAHO Report Timestamp Command
1134  *  
1135  */
1136 /*@{*/
1137 #define PASAHO_SET_REPORT_FLOW(x,v)    PASAHO_SET_BITFIELD((x)->word0, (v), 16, 8)    /**< Specifies the flow to use for report packets sent to the host */
1138 #define PASAHO_SET_REPORT_QUEUE(x,v)   PASAHO_SET_BITFIELD((x)->word0, (v), 0,  16)   /**< Specifies the queue to use for report packets send to the host */
1140 /*@}*/ /* @name PASAHO Report Timestamp Command Macros */
1141 /** @}*/ /* PASAHO_report_timestamp_command_macros */        
1143 /* IP Fragmentation command */
1144 /**
1145  *  @ingroup pasaho_if_structures
1146  *  @brief  pasahoIpFrag_t defines the IP Fragmentation command. The command structure is defined as 32 bit
1147  *          values to work with the hardware regardless of the device endianness.
1148  *
1149  *  @details 
1150  */
1152 typedef struct pasahoIpFrag_s  {
1153     uint32_t  word0;          /**< Contains the ip fragmentation command information. @ref PASAHO_ip_frag_command_macros */
1154 } pasahoIpFrag_t;
1156 /** 
1157  *  @defgroup PASAHO_ip_frag_command_macros  PASAHO IP Fragmentation Command Macros
1158  *  @ingroup pasaho_if_macros
1159  *  @{
1160  *  @name PASAHO IP Fragmentation Command Macros
1161  *  Macros used by the PASAHO IP Fragmentation Command
1162  *  
1163  */
1164 /*@{*/
1166 #define PASAHO_SET_SUB_CODE_IP_FRAG(x) PASAHO_SET_BITFIELD((x)->word0, PASAHO_SUB_CMD_IP_FRAG, 24, 5)    /**< Set sub-command code to indicate IP Fragmentation command */
1167 #define PASAHO_SET_SUB_CODE(x,v)  PASAHO_SET_BITFIELD((x)->word0, (v), 24, 5)  /**< Specifies the sub-command code */
1168 #define PASAHO_SET_IP_OFFSET(x,v) PASAHO_SET_BITFIELD((x)->word0, (v), 16, 8)  /**< Specifies the offset to the IP header to be fragmented */
1169 #define PASAHO_SET_MTU_SIZE(x,v)  PASAHO_SET_BITFIELD((x)->word0, (v), 0,  16) /**< Specifies the MTU size */
1171 /*@}*/ /* @name PASAHO IP Fragmentation Command Macros */
1172 /** @}*/ /* PASAHO_ip_frag_command_macros */
1175 /* Patch Message Length command */
1176 /**
1177  *  @ingroup pasaho_if_structures
1178  *  @brief  pasahoPatchMsgLen_t defines the message length patching command. The command structure is defined as 32 bit
1179  *          values to work with the hardware regardless of the device endianness.
1180  *
1181  *  @details 
1182  */
1184 typedef struct pasahoPatchMsgLen_s  {
1185     uint32_t  word0;          /**< Contains the message length patching command information. @ref PASAHO_patch_msg_len_command_macros */
1186 } pasahoPatchMsgLen_t;
1188 /** 
1189  *  @defgroup PASAHO_patch_msg_len_command_macros  PASAHO Message Length Patching Command Macros
1190  *  @ingroup pasaho_if_macros
1191  *  @{
1192  *  @name PASAHO Message Length Patching Command Macros
1193  *  Macros used by the PASAHO Message Length Patching Command
1194  *  
1195  */
1196 /*@{*/
1198 #define PASAHO_SET_SUB_CODE_PATCH_MSG_LEN(x) PASAHO_SET_BITFIELD((x)->word0, PASAHO_SUB_CMD_PATCH_MSG_LEN, 24, 5)    /**< Set sub-command code to indicate Message Length Patching command */
1199 #define PASAHO_SET_MSGLEN_OFFSET(x,v) PASAHO_SET_BITFIELD((x)->word0, (v), 16, 8)  /**< Specifies the offset to the message length field to be patched */
1200 #define PASAHO_SET_MSGLEN_SIZE(x,v) PASAHO_SET_BITFIELD((x)->word0, (v), 15,  1)   /**< Specifies the size of the length field (0: 16-bit; 1: 32-bit) */
1201 #define PASAHO_SET_MSGLEN(x,v)  PASAHO_SET_BITFIELD((x)->word0, (v), 0,  15)       /**< Specifies the message length excluding the IP header and payload length */
1203 /*@}*/ /* @name PASAHO Message Length Patching Command Macros */
1204 /** @}*/ /* PASAHO_patch_msg_len_command_macros */
1206 /* Compute checksum command */
1207 /**
1208  *  @ingroup pasaho_if_structures
1209  *  @brief  pasahoEfOp_t defines the egress flow operation command which is used to instruct PASS to 
1210  *          perform optional flow cache lookup and egress packet modification according to the associated
1211  *          egress flow records. The command structure is defined as 32 bit values to wrok with the hardware 
1212  *          regardless of the device endianness.
1213  *
1214  *  @details 
1215  */
1217 typedef struct pasahoEfOp_s  {
1218     uint32_t  word0;        /**<  @ref PASAHO_ef_op_command_macros */
1219     uint32_t  word1;        /**<  @ref PASAHO_ef_op_command_macros */
1220     uint32_t  word2;        /**<  @ref PASAHO_ef_op_command_macros */
1221     uint32_t  word3;        /**<  @ref PASAHO_ef_op_command_macros */
1222     uint32_t  word4;        /**<  @ref PASAHO_ef_op_command_macros */
1223     uint32_t  word5;        /**<  @ref PASAHO_ef_op_command_macros */
1225 } pasahoComEfOp_t;
1227 /**
1228  *  @defgroup pasahoEfOpCtrlBitmap  PA/SA/HO Egress Flow Opertaion Control Bitmap Bit Definitions
1229  *  @ingroup pasaho_if_constants
1230  *  @{
1231  *
1232  *  @name PA/SA/HO Egress Flow Opertaion Control Bitmap Bit Definitions
1233  *  Bitmap definition of the control bitmap at the Egress Flow operation info. 
1234  */ 
1235 /*@{*/
1237 #define PASAHO_HDR_EF_OP_CTRL_FC           (1 << 15)    /**< Enable Flow Cache lookup */
1238 #define PASAHO_HDR_EF_OP_CTRL_LVL4_REC     (1 << 7)     /**< Level 4 record prespent */
1239 #define PASAHO_HDR_EF_OP_CTRL_LVL3_REC     (1 << 6)     /**< Level 3 record prespent */
1240 #define PASAHO_HDR_EF_OP_CTRL_LVL2_REC     (1 << 5)     /**< Level 2 record prespent */
1241 #define PASAHO_HDR_EF_OP_CTRL_LVL1_REC     (1 << 4)     /**< Level 1 record prespent */
1243 /*@}*/
1244 /** @} */
1247 /** 
1248  *  @defgroup PASAHO_ef_op_command_macros  PASAHO Egress Flow Operation Command Macros
1249  *  @ingroup pasaho_if_macros
1250  *  @{
1251  *  @name PASAHO Egress Flow Operation Command Macros
1252  *  Macros used by the PASAHO Egress Flow Operation Command 
1253  */
1254 /*@{*/
1255 #define PASAHO_EF_OP_SET_CTRL(x,v)          PASAHO_SET_BITFIELD((x)->word0,(v), 8, 16)           /**< Sets the control flags of the Flow Cache operation command */
1256 #define PASAHO_EF_OP_SET_CTRL_FC(x,v)       PASAHO_SET_BITFIELD((x)->word0,(v), 23, 1)           /**< Enable/Disable Flow Cache lookup */
1257 #define PASAHO_EF_OP_SET_CTRL_LVL4(x,v)     PASAHO_SET_BITFIELD((x)->word0,(v), 15, 1)           /**< Enable/Disable Level 4 Egress Flow record */
1258 #define PASAHO_EF_OP_SET_CTRL_LVL3(x,v)     PASAHO_SET_BITFIELD((x)->word0,(v), 14, 1)           /**< Enable/Disable Level 3 Egress Flow record */
1259 #define PASAHO_EF_OP_SET_CTRL_LVL2(x,v)     PASAHO_SET_BITFIELD((x)->word0,(v), 13, 1)           /**< Enable/Disable Level 2 Egress Flow record */
1260 #define PASAHO_EF_OP_SET_CTRL_LVL1(x,v)     PASAHO_SET_BITFIELD((x)->word0,(v), 12, 1)           /**< Enable/Disable Level 1 Egress Flow record */
1262 #define PASAHO_EF_OP_SET_L2_OFFSET(x, v)    PASAHO_SET_BITFIELD((x)->word1,(v),8,8)              /**< Set the l2 offset */
1263 #define PASAHO_EF_OP_SET_L3_OFFSET2(x, v)   PASAHO_SET_BITFIELD((x)->word1,(v),0,8)              /**< Set the l3 offset for inner or fisrt IP */
1264 #define PASAHO_EF_OP_SET_L3_OFFSET(x, v)    PASAHO_SET_BITFIELD((x)->word2,(v),24,8)             /**< Set the l3 offset for outer or fisrt IP */
1265 #define PASAHO_EF_OP_SET_IPSEC_OFFSET(x, v) PASAHO_SET_BITFIELD((x)->word2,(v),0, 8)             /**< Set the IPSEC offset if the IPSEC header exists in the packet */
1266 #define PASAHO_EF_OP_SET_END_OFFSET(x, v)   PASAHO_SET_BITFIELD((x)->word1,(v),16,16)            /**< Set the end offset as end of L4 (UDP/UDPLite/TCP) payload */
1268 #define PASAHO_EF_OP_SET_LVL1_REC(x, v)     PASAHO_SET_BITFIELD((x)->word3,(v),24, 8)            /**< Set the index of Egress Flow level 1 record */
1269 #define PASAHO_EF_OP_SET_LVL2_REC(x, v)     PASAHO_SET_BITFIELD((x)->word3,(v),16, 8)            /**< Set the index of Egress Flow level 2 record */
1270 #define PASAHO_EF_OP_SET_LVL3_REC(x, v)     PASAHO_SET_BITFIELD((x)->word3,(v), 8, 8)            /**< Set the index of Egress Flow level 3 record */
1271 #define PASAHO_EF_OP_SET_LVL4_REC(x, v)     PASAHO_SET_BITFIELD((x)->word3,(v), 0, 8)            /**< Set the index of Egress Flow level 4 record */
1273 /*@}*/
1274 /** @} */
1276 #ifdef __cplusplus
1278 #endif
1280 #endif  /* _PASAHO_H */