blob: 7ab0132e5251e1c0c3d51c096c7878e749a4dbae [file] [log] [blame]
developer69bcd592024-03-25 14:26:39 +08001/* FILE NAME: air_lag.h
2 * PURPOSE:
3 * Define the Link Agrregation function in AIR SDK.
4 *
5 * NOTES:
6 * None
7 */
8
9#ifndef AIR_LAG_H
10#define AIR_LAG_H
11
12/* INCLUDE FILE DECLARATIONS
13*/
14
15/* NAMING CONSTANT DECLARATIONS
16*/
17#define AIR_LAG_MAX_MEM_NUM (4)
18#define AIR_LAG_MAX_PTG_NUM (2)
19
20#define AIR_LAG_MAX_SA_LRN_NUM BITS(0,12)
21#define AIR_GRP_PORT(p,n) (((p) & BITS(0,4)) << (n * 8))
22#define AIR_LAG_MAX_BUSY_TIME (20)
23
24
25
26/* MACRO FUNCTION DECLARATIONS
27*/
28
29/* DATA TYPE DECLARATIONS
30*/
31typedef struct AIR_LAG_PTGINFO_S
32{
33 UI32_T csr_gp_enable[4];
34 UI32_T csr_gp_port[4];
35}AIR_LAG_PTGINFO_T;
36
37
38typedef struct AIR_LAG_DISTINFO_S
39{
40 UI32_T sp:1;
41 UI32_T sa:1;
42 UI32_T da:1;
43 UI32_T sip:1;
44 UI32_T dip:1;
45 UI32_T sport:1;
46 UI32_T dport:1;
47 UI32_T reverse:25;
48}AIR_LAG_DISTINFO_T;
49
50/* EXPORTED SUBPROGRAM SPECIFICATIONS
51*/
52/* FUNCTION NAME: air_lag_setMember
53 * PURPOSE:
54 * Set LAG member(s) for a specific LAG port.
55 *
56 * INPUT:
57 * unit -- Device ID
58 * ptg_index -- Port trunk index
59 * mem_index -- Member index
60 * mem_en -- enable Member
61 * port_index -- Member port
62 *
63 * OUTPUT:
64 * None
65 *
66 * RETURN:
67 * AIR_E_OK
68 * AIR_E_BAD_PARAMETER
69 *
70 * NOTES:
71 * None
72 */
73AIR_ERROR_NO_T
74air_lag_setMember(
75 const UI32_T unit,
76 const UI32_T ptg_index,
77 const UI32_T mem_index,
78 const UI32_T mem_en,
79 const UI32_T port_index);
80
81
82/* FUNCTION NAME: air_lag_getMember
83 * PURPOSE:
84 * Get LAG member count.
85 *
86 * INPUT:
87 * unit -- Device ID
88 * ptg_index -- Port trunk index
89 *
90 * OUTPUT:
91 * member -- Member ports of one port trunk
92 *
93 * RETURN:
94 * AIR_E_OK
95 * AIR_E_BAD_PARAMETER
96 *
97 * NOTES:
98 * None
99 */
100AIR_ERROR_NO_T
101air_lag_getMember(
102 const UI32_T unit,
103 const UI32_T ptg_index,
104 AIR_LAG_PTGINFO_T * member);
105
106/* FUNCTION NAME: air_lag_set_ptgc_state
107 * PURPOSE:
108 * set port trunk group control state.
109 *
110 * INPUT:
111 * unit -- Device ID
112 * ptgc_enable -- enabble or disable port trunk function
113 *
114 * OUTPUT:
115 * none
116 *
117 * RETURN:
118 * AIR_E_OK
119 * AIR_E_BAD_PARAMETER
120 *
121 * NOTES:
122 * None
123 */
124AIR_ERROR_NO_T
125air_lag_set_ptgc_state(
126 const UI32_T unit,
127 const BOOL_T ptgc_enable);
128
129/* FUNCTION NAME: air_lag_get_ptgc_state
130 * PURPOSE:
131 * Get port trunk group control state.
132 *
133 * INPUT:
134 * unit -- Device ID
135 *
136 * OUTPUT:
137 * ptr_state -- port trunk fucntion is enable or disable
138 *
139 * RETURN:
140 * AIR_E_OK
141 * AIR_E_BAD_PARAMETER
142 *
143 * NOTES:
144 * None
145 */
146AIR_ERROR_NO_T
147air_lag_get_ptgc_state(
148 const UI32_T unit,
149 UI32_T *ptr_state);
150
151
152/* FUNCTION NAME: air_lag_setDstInfo
153 * PURPOSE:
154 * Set information for the packet distribution.
155 *
156 * INPUT:
157 * unit -- Device ID
158 * dstInfo -- Infomation selection of packet distribution
159 *
160 * OUTPUT:
161 * None
162 *
163 * RETURN:
164 * AIR_E_OK
165 * AIR_E_BAD_PARAMETER
166 * AIR_E_TIMEOUT
167 *
168 * NOTES:
169 * None
170 */
171AIR_ERROR_NO_T
172air_lag_setDstInfo(
173 const UI32_T unit,
174 const AIR_LAG_DISTINFO_T dstInfo);
175
176/* FUNCTION NAME: air_lag_getDstInfo
177 * PURPOSE:
178 * Set port trunk hashtype.
179 *
180 * INPUT:
181 * unit -- Device ID
182 *
183 * OUTPUT:
184 * ptr_dstInfo -- Infomation selection of packet distribution
185 *
186 * RETURN:
187 * AIR_E_OK
188 * AIR_E_BAD_PARAMETER
189 * AIR_E_TIMEOUT
190 *
191 * NOTES:
192 * None
193 */
194AIR_ERROR_NO_T
195air_lag_getDstInfo(
196 const UI32_T unit,
197 AIR_LAG_DISTINFO_T *ptr_dstInfo);
198
199
200/* FUNCTION NAME: air_lag_setState
201 * PURPOSE:
202 * Set the enable/disable for a specific LAG port.
203 *
204 * INPUT:
205 * unit -- Device ID
206 * hashtype -- crc32msb/crc32lsb/crc16/xor4
207 * OUTPUT:
208 * None
209 *
210 * RETURN:
211 * AIR_E_OK
212 * AIR_E_BAD_PARAMETER
213 *
214 * NOTES:
215 * None
216 */
217AIR_ERROR_NO_T
218air_lag_sethashtype(
219 const UI32_T unit,
220 const UI32_T hashtype);
221
222/* FUNCTION NAME: air_lag_getState
223 * PURPOSE:
224 * Get port trunk hashtype.
225 *
226 * INPUT:
227 * unit -- Device ID
228 *
229 * OUTPUT:
230 * hashtype -- crc32msb/crc32lsb/crc16/xor4
231 * RETURN:
232 * AIR_E_OK
233 * AIR_E_BAD_PARAMETER
234 *
235 * NOTES:
236 * None
237 */
238AIR_ERROR_NO_T
239air_lag_gethashtype(
240 const UI32_T unit,
241 UI32_T *hashtype);
242
243/* FUNCTION NAME: air_lag_setSpSel
244 * PURPOSE:
245 * Set the enable/disable for selection source port composition.
246 *
247 * INPUT:
248 * unit -- Device ID
249 * enable -- enable or disable source port compare
250 * OUTPUT:
251 * None
252 *
253 * RETURN:
254 * AIR_E_OK
255 * AIR_E_BAD_PARAMETER
256 *
257 * NOTES:
258 * None
259 */
260AIR_ERROR_NO_T
261air_lag_setSpSel(
262 const UI32_T unit,
263 const BOOL_T spsel_enable);
264
265/* FUNCTION NAME: air_lag_getSpSel
266 * PURPOSE:
267 * Get selection source port composition.
268 *
269 * INPUT:
270 * unit -- Device ID
271 *
272 * OUTPUT:
273 * ptr_state -- source port compare is enable or disable
274 * RETURN:
275 * AIR_E_OK
276 * AIR_E_BAD_PARAMETER
277 *
278 * NOTES:
279 * None
280 */
281AIR_ERROR_NO_T
282air_lag_getSpSel(
283 const UI32_T unit,
284 UI32_T *ptr_state);
285
286/* FUNCTION NAME: air_lag_setPTSeed
287 * PURPOSE:
288 * Set the enable/disable for a specific LAG port.
289 *
290 * INPUT:
291 * unit -- Device ID
292 * ptseed -- port trunk rand seed
293 * OUTPUT:
294 * None
295 *
296 * RETURN:
297 * AIR_E_OK
298 * AIR_E_BAD_PARAMETER
299 *
300 * NOTES:
301 * None
302 */
303AIR_ERROR_NO_T
304air_lag_setPTSeed(
305 const UI32_T unit,
306 const UI32_T ptseed);
307
308/* FUNCTION NAME: air_lag_getPTSeed
309 * PURPOSE:
310 * Get port trunk hashtype.
311 *
312 * INPUT:
313 * unit -- Device ID
314 *
315 * OUTPUT:
316 * ptseed -- port trunk rand seed
317 * RETURN:
318 * AIR_E_OK
319 * AIR_E_BAD_PARAMETER
320 *
321 * NOTES:
322 * None
323 */
324AIR_ERROR_NO_T
325air_lag_getPTSeed(
326 const UI32_T unit,
327 UI32_T *ptseed);
328
329
330#endif /* End of AIR_LAG_H */