xref: /freebsd/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_kg.h (revision 3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6)
1 /*
2  * Copyright 2008-2012 Freescale Semiconductor Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 
34 /******************************************************************************
35  @File          fm_kg.h
36 
37  @Description   FM KG private header
38 *//***************************************************************************/
39 #ifndef __FM_KG_H
40 #define __FM_KG_H
41 
42 #include "std_ext.h"
43 
44 /***********************************************************************/
45 /*          Keygen defines                                             */
46 /***********************************************************************/
47 /* maskes */
48 #if (DPAA_VERSION >= 11)
49 #define KG_SCH_VSP_SHIFT_MASK                   0x0003f000
50 #define KG_SCH_OM_VSPE                          0x00000001
51 #define KG_SCH_VSP_NO_KSP_EN                    0x80000000
52 
53 #define MAX_SP_SHIFT                            23
54 #define KG_SCH_VSP_MASK_SHIFT                   12
55 #define KG_SCH_VSP_SHIFT                        24
56 #endif /* (DPAA_VERSION >= 11) */
57 
58 typedef uint32_t t_KnownFieldsMasks;
59 #define KG_SCH_KN_PORT_ID                   0x80000000
60 #define KG_SCH_KN_MACDST                    0x40000000
61 #define KG_SCH_KN_MACSRC                    0x20000000
62 #define KG_SCH_KN_TCI1                      0x10000000
63 #define KG_SCH_KN_TCI2                      0x08000000
64 #define KG_SCH_KN_ETYPE                     0x04000000
65 #define KG_SCH_KN_PPPSID                    0x02000000
66 #define KG_SCH_KN_PPPID                     0x01000000
67 #define KG_SCH_KN_MPLS1                     0x00800000
68 #define KG_SCH_KN_MPLS2                     0x00400000
69 #define KG_SCH_KN_MPLS_LAST                 0x00200000
70 #define KG_SCH_KN_IPSRC1                    0x00100000
71 #define KG_SCH_KN_IPDST1                    0x00080000
72 #define KG_SCH_KN_PTYPE1                    0x00040000
73 #define KG_SCH_KN_IPTOS_TC1                 0x00020000
74 #define KG_SCH_KN_IPV6FL1                   0x00010000
75 #define KG_SCH_KN_IPSRC2                    0x00008000
76 #define KG_SCH_KN_IPDST2                    0x00004000
77 #define KG_SCH_KN_PTYPE2                    0x00002000
78 #define KG_SCH_KN_IPTOS_TC2                 0x00001000
79 #define KG_SCH_KN_IPV6FL2                   0x00000800
80 #define KG_SCH_KN_GREPTYPE                  0x00000400
81 #define KG_SCH_KN_IPSEC_SPI                 0x00000200
82 #define KG_SCH_KN_IPSEC_NH                  0x00000100
83 #define KG_SCH_KN_IPPID                     0x00000080
84 #define KG_SCH_KN_L4PSRC                    0x00000004
85 #define KG_SCH_KN_L4PDST                    0x00000002
86 #define KG_SCH_KN_TFLG                      0x00000001
87 
88 typedef uint8_t t_GenericCodes;
89 #define KG_SCH_GEN_SHIM1                       0x70
90 #define KG_SCH_GEN_DEFAULT                     0x10
91 #define KG_SCH_GEN_PARSE_RESULT_N_FQID         0x20
92 #define KG_SCH_GEN_START_OF_FRM                0x40
93 #define KG_SCH_GEN_SHIM2                       0x71
94 #define KG_SCH_GEN_IP_PID_NO_V                 0x72
95 #define KG_SCH_GEN_ETH                         0x03
96 #define KG_SCH_GEN_ETH_NO_V                    0x73
97 #define KG_SCH_GEN_SNAP                        0x04
98 #define KG_SCH_GEN_SNAP_NO_V                   0x74
99 #define KG_SCH_GEN_VLAN1                       0x05
100 #define KG_SCH_GEN_VLAN1_NO_V                  0x75
101 #define KG_SCH_GEN_VLAN2                       0x06
102 #define KG_SCH_GEN_VLAN2_NO_V                  0x76
103 #define KG_SCH_GEN_ETH_TYPE                    0x07
104 #define KG_SCH_GEN_ETH_TYPE_NO_V               0x77
105 #define KG_SCH_GEN_PPP                         0x08
106 #define KG_SCH_GEN_PPP_NO_V                    0x78
107 #define KG_SCH_GEN_MPLS1                       0x09
108 #define KG_SCH_GEN_MPLS2                       0x19
109 #define KG_SCH_GEN_MPLS3                       0x29
110 #define KG_SCH_GEN_MPLS1_NO_V                  0x79
111 #define KG_SCH_GEN_MPLS_LAST                   0x0a
112 #define KG_SCH_GEN_MPLS_LAST_NO_V              0x7a
113 #define KG_SCH_GEN_IPV4                        0x0b
114 #define KG_SCH_GEN_IPV6                        0x1b
115 #define KG_SCH_GEN_L3_NO_V                     0x7b
116 #define KG_SCH_GEN_IPV4_TUNNELED               0x0c
117 #define KG_SCH_GEN_IPV6_TUNNELED               0x1c
118 #define KG_SCH_GEN_MIN_ENCAP                   0x2c
119 #define KG_SCH_GEN_IP2_NO_V                    0x7c
120 #define KG_SCH_GEN_GRE                         0x0d
121 #define KG_SCH_GEN_GRE_NO_V                    0x7d
122 #define KG_SCH_GEN_TCP                         0x0e
123 #define KG_SCH_GEN_UDP                         0x1e
124 #define KG_SCH_GEN_IPSEC_AH                    0x2e
125 #define KG_SCH_GEN_SCTP                        0x3e
126 #define KG_SCH_GEN_DCCP                        0x4e
127 #define KG_SCH_GEN_IPSEC_ESP                   0x6e
128 #define KG_SCH_GEN_L4_NO_V                     0x7e
129 #define KG_SCH_GEN_NEXTHDR                     0x7f
130 /* shifts */
131 #define KG_SCH_PP_SHIFT_HIGH_SHIFT          27
132 #define KG_SCH_PP_SHIFT_LOW_SHIFT           12
133 #define KG_SCH_PP_MASK_SHIFT                16
134 #define KG_SCH_MODE_CCOBASE_SHIFT           24
135 #define KG_SCH_DEF_MAC_ADDR_SHIFT           30
136 #define KG_SCH_DEF_TCI_SHIFT                28
137 #define KG_SCH_DEF_ENET_TYPE_SHIFT          26
138 #define KG_SCH_DEF_PPP_SESSION_ID_SHIFT     24
139 #define KG_SCH_DEF_PPP_PROTOCOL_ID_SHIFT    22
140 #define KG_SCH_DEF_MPLS_LABEL_SHIFT         20
141 #define KG_SCH_DEF_IP_ADDR_SHIFT            18
142 #define KG_SCH_DEF_PROTOCOL_TYPE_SHIFT      16
143 #define KG_SCH_DEF_IP_TOS_TC_SHIFT          14
144 #define KG_SCH_DEF_IPV6_FLOW_LABEL_SHIFT    12
145 #define KG_SCH_DEF_IPSEC_SPI_SHIFT          10
146 #define KG_SCH_DEF_L4_PORT_SHIFT            8
147 #define KG_SCH_DEF_TCP_FLAG_SHIFT           6
148 #define KG_SCH_HASH_CONFIG_SHIFT_SHIFT      24
149 #define KG_SCH_GEN_MASK_SHIFT               16
150 #define KG_SCH_GEN_HT_SHIFT                 8
151 #define KG_SCH_GEN_SIZE_SHIFT               24
152 #define KG_SCH_GEN_DEF_SHIFT                29
153 #define FM_PCD_KG_KGAR_NUM_SHIFT            16
154 
155 /* others */
156 #define NUM_OF_SW_DEFAULTS                  3
157 #define MAX_PP_SHIFT                        23
158 #define MAX_KG_SCH_SIZE                     16
159 #define MASK_FOR_GENERIC_BASE_ID            0x20
160 #define MAX_HASH_SHIFT                      40
161 #define MAX_KG_SCH_FQID_BIT_OFFSET          31
162 #define MAX_KG_SCH_PP_BIT_OFFSET            15
163 #define MAX_DIST_FQID_SHIFT                 23
164 
165 #define GET_MASK_SEL_SHIFT(shift,i)                 \
166 switch (i) {                                        \
167     case (0):shift = 26;break;                      \
168     case (1):shift = 20;break;                      \
169     case (2):shift = 10;break;                      \
170     case (3):shift = 4;break;                       \
171     default:                                        \
172     RETURN_ERROR(MAJOR, E_INVALID_VALUE, NO_MSG);   \
173 }
174 
175 #define GET_MASK_OFFSET_SHIFT(shift,i)              \
176 switch (i) {                                        \
177     case (0):shift = 16;break;                      \
178     case (1):shift = 0;break;                       \
179     case (2):shift = 28;break;                      \
180     case (3):shift = 24;break;                      \
181     default:                                        \
182     RETURN_ERROR(MAJOR, E_INVALID_VALUE, NO_MSG);   \
183 }
184 
185 #define GET_MASK_SHIFT(shift,i)                     \
186 switch (i) {                                        \
187     case (0):shift = 24;break;                      \
188     case (1):shift = 16;break;                      \
189     case (2):shift = 8;break;                       \
190     case (3):shift = 0;break;                       \
191     default:                                        \
192     RETURN_ERROR(MAJOR, E_INVALID_VALUE, NO_MSG);   \
193 }
194 
195 /***********************************************************************/
196 /*          Keygen defines                                             */
197 /***********************************************************************/
198 
199 #define KG_DOUBLE_MEANING_REGS_OFFSET           0x100
200 #define NO_VALIDATION                           0x70
201 #define KG_ACTION_REG_TO                        1024
202 #define KG_MAX_PROFILE                          255
203 #define SCHEME_ALWAYS_DIRECT                    0xFFFFFFFF
204 
205 
206 #endif /* __FM_KG_H */
207