mediatek: mt7622: rtl8367c: source comment fixes
[openwrt/staging/stintel.git] / target / linux / mediatek / files / drivers / net / phy / rtk / rtl8367c / include / dot1x.h
1 /*
2 * Copyright (C) 2013 Realtek Semiconductor Corp.
3 * All Rights Reserved.
4 *
5 * Unless you and Realtek execute a separate written software license
6 * agreement governing use of this software, this software is licensed
7 * to you under the terms of the GNU General Public License version 2,
8 * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9 *
10 * Purpose : RTL8367/RTL8367C switch high-level API
11 *
12 * Feature : The file includes 1X module high-layer API definition
13 *
14 */
15
16 #ifndef __RTK_API_DOT1X_H__
17 #define __RTK_API_DOT1X_H__
18
19
20 /* Type of port-based dot1x auth/unauth*/
21 typedef enum rtk_dot1x_auth_status_e
22 {
23 UNAUTH = 0,
24 AUTH,
25 AUTH_STATUS_END
26 } rtk_dot1x_auth_status_t;
27
28 typedef enum rtk_dot1x_direction_e
29 {
30 DIR_BOTH = 0,
31 DIR_IN,
32 DIRECTION_END
33 } rtk_dot1x_direction_t;
34
35 /* unauth pkt action */
36 typedef enum rtk_dot1x_unauth_action_e
37 {
38 DOT1X_ACTION_DROP = 0,
39 DOT1X_ACTION_TRAP2CPU,
40 DOT1X_ACTION_GUESTVLAN,
41 DOT1X_ACTION_END
42 } rtk_dot1x_unauth_action_t;
43
44 /* Function Name:
45 * rtk_dot1x_unauthPacketOper_set
46 * Description:
47 * Set 802.1x unauth action configuration.
48 * Input:
49 * port - Port id.
50 * unauth_action - 802.1X unauth action.
51 * Output:
52 * None
53 * Return:
54 * RT_ERR_OK - OK
55 * RT_ERR_FAILED - Failed
56 * RT_ERR_SMI - SMI access error
57 * RT_ERR_PORT_ID - Invalid port number.
58 * RT_ERR_INPUT - Invalid input parameter.
59 * Note:
60 * This API can set 802.1x unauth action configuration.
61 * The unauth action is as following:
62 * - DOT1X_ACTION_DROP
63 * - DOT1X_ACTION_TRAP2CPU
64 * - DOT1X_ACTION_GUESTVLAN
65 */
66 extern rtk_api_ret_t rtk_dot1x_unauthPacketOper_set(rtk_port_t port, rtk_dot1x_unauth_action_t unauth_action);
67
68 /* Function Name:
69 * rtk_dot1x_unauthPacketOper_get
70 * Description:
71 * Get 802.1x unauth action configuration.
72 * Input:
73 * port - Port id.
74 * Output:
75 * pUnauth_action - 802.1X unauth action.
76 * Return:
77 * RT_ERR_OK - OK
78 * RT_ERR_FAILED - Failed
79 * RT_ERR_SMI - SMI access error
80 * RT_ERR_INPUT - Invalid input parameters.
81 * RT_ERR_PORT_ID - Invalid port number.
82 * Note:
83 * This API can get 802.1x unauth action configuration.
84 * The unauth action is as following:
85 * - DOT1X_ACTION_DROP
86 * - DOT1X_ACTION_TRAP2CPU
87 * - DOT1X_ACTION_GUESTVLAN
88 */
89 extern rtk_api_ret_t rtk_dot1x_unauthPacketOper_get(rtk_port_t port, rtk_dot1x_unauth_action_t *pUnauth_action);
90
91 /* Function Name:
92 * rtk_dot1x_eapolFrame2CpuEnable_set
93 * Description:
94 * Set 802.1x EAPOL packet trap to CPU configuration
95 * Input:
96 * enable - The status of 802.1x EAPOL packet.
97 * Output:
98 * None
99 * Return:
100 * RT_ERR_OK - OK
101 * RT_ERR_FAILED - Failed
102 * RT_ERR_SMI - SMI access error
103 * RT_ERR_ENABLE - Invalid enable input.
104 * Note:
105 * To support 802.1x authentication functionality, EAPOL frame (ether type = 0x888E) has to
106 * be trapped to CPU.
107 * The status of EAPOL frame trap to CPU is as following:
108 * - DISABLED
109 * - ENABLED
110 */
111 extern rtk_api_ret_t rtk_dot1x_eapolFrame2CpuEnable_set(rtk_enable_t enable);
112
113 /* Function Name:
114 * rtk_dot1x_eapolFrame2CpuEnable_get
115 * Description:
116 * Get 802.1x EAPOL packet trap to CPU configuration
117 * Input:
118 * None
119 * Output:
120 * pEnable - The status of 802.1x EAPOL packet.
121 * Return:
122 * RT_ERR_OK - OK
123 * RT_ERR_FAILED - Failed
124 * RT_ERR_SMI - SMI access error
125 * RT_ERR_INPUT - Invalid input parameters.
126 * Note:
127 * To support 802.1x authentication functionality, EAPOL frame (ether type = 0x888E) has to
128 * be trapped to CPU.
129 * The status of EAPOL frame trap to CPU is as following:
130 * - DISABLED
131 * - ENABLED
132 */
133 extern rtk_api_ret_t rtk_dot1x_eapolFrame2CpuEnable_get(rtk_enable_t *pEnable);
134
135 /* Function Name:
136 * rtk_dot1x_portBasedEnable_set
137 * Description:
138 * Set 802.1x port-based enable configuration
139 * Input:
140 * port - Port id.
141 * enable - The status of 802.1x port.
142 * Output:
143 * None
144 * Return:
145 * RT_ERR_OK - OK
146 * RT_ERR_FAILED - Failed
147 * RT_ERR_SMI - SMI access error
148 * RT_ERR_PORT_ID - Invalid port number.
149 * RT_ERR_ENABLE - Invalid enable input.
150 * RT_ERR_DOT1X_PORTBASEDPNEN - 802.1X port-based enable error
151 * Note:
152 * The API can update the port-based port enable register content. If a port is 802.1x
153 * port based network access control "enabled", it should be authenticated so packets
154 * from that port won't be dropped or trapped to CPU.
155 * The status of 802.1x port-based network access control is as following:
156 * - DISABLED
157 * - ENABLED
158 */
159 extern rtk_api_ret_t rtk_dot1x_portBasedEnable_set(rtk_port_t port, rtk_enable_t enable);
160
161 /* Function Name:
162 * rtk_dot1x_portBasedEnable_get
163 * Description:
164 * Get 802.1x port-based enable configuration
165 * Input:
166 * port - Port id.
167 * Output:
168 * pEnable - The status of 802.1x port.
169 * Return:
170 * RT_ERR_OK - OK
171 * RT_ERR_FAILED - Failed
172 * RT_ERR_SMI - SMI access error
173 * RT_ERR_INPUT - Invalid input parameters.
174 * RT_ERR_PORT_ID - Invalid port number.
175 * Note:
176 * The API can get the 802.1x port-based port status.
177 */
178 extern rtk_api_ret_t rtk_dot1x_portBasedEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
179
180 /* Function Name:
181 * rtk_dot1x_portBasedAuthStatus_set
182 * Description:
183 * Set 802.1x port-based auth. port configuration
184 * Input:
185 * port - Port id.
186 * port_auth - The status of 802.1x port.
187 * Output:
188 * None
189 * Return:
190 * RT_ERR_OK - OK
191 * RT_ERR_FAILED - Failed
192 * RT_ERR_SMI - SMI access error
193 * RT_ERR_PORT_ID - Invalid port number.
194 * RT_ERR_DOT1X_PORTBASEDAUTH - 802.1X port-based auth error
195 * Note:
196 * The authenticated status of 802.1x port-based network access control is as following:
197 * - UNAUTH
198 * - AUTH
199 */
200 extern rtk_api_ret_t rtk_dot1x_portBasedAuthStatus_set(rtk_port_t port, rtk_dot1x_auth_status_t port_auth);
201
202 /* Function Name:
203 * rtk_dot1x_portBasedAuthStatus_get
204 * Description:
205 * Get 802.1x port-based auth. port configuration
206 * Input:
207 * port - Port id.
208 * Output:
209 * pPort_auth - The status of 802.1x port.
210 * Return:
211 * RT_ERR_OK - OK
212 * RT_ERR_FAILED - Failed
213 * RT_ERR_SMI - SMI access error
214 * RT_ERR_INPUT - Invalid input parameters.
215 * RT_ERR_PORT_ID - Invalid port number.
216 * Note:
217 * The API can get 802.1x port-based port auth.information.
218 */
219 extern rtk_api_ret_t rtk_dot1x_portBasedAuthStatus_get(rtk_port_t port, rtk_dot1x_auth_status_t *pPort_auth);
220
221 /* Function Name:
222 * rtk_dot1x_portBasedDirection_set
223 * Description:
224 * Set 802.1x port-based operational direction configuration
225 * Input:
226 * port - Port id.
227 * port_direction - Operation direction
228 * Output:
229 * None
230 * Return:
231 * RT_ERR_OK - OK
232 * RT_ERR_FAILED - Failed
233 * RT_ERR_SMI - SMI access error
234 * RT_ERR_PORT_ID - Invalid port number.
235 * RT_ERR_DOT1X_PORTBASEDOPDIR - 802.1X port-based operation direction error
236 * Note:
237 * The operate controlled direction of 802.1x port-based network access control is as following:
238 * - BOTH
239 * - IN
240 */
241 extern rtk_api_ret_t rtk_dot1x_portBasedDirection_set(rtk_port_t port, rtk_dot1x_direction_t port_direction);
242
243 /* Function Name:
244 * rtk_dot1x_portBasedDirection_get
245 * Description:
246 * Get 802.1X port-based operational direction configuration
247 * Input:
248 * port - Port id.
249 * Output:
250 * pPort_direction - Operation direction
251 * Return:
252 * RT_ERR_OK - OK
253 * RT_ERR_FAILED - Failed
254 * RT_ERR_SMI - SMI access error
255 * RT_ERR_INPUT - Invalid input parameters.
256 * RT_ERR_PORT_ID - Invalid port number.
257 * Note:
258 * The API can get 802.1x port-based operational direction information.
259 */
260 extern rtk_api_ret_t rtk_dot1x_portBasedDirection_get(rtk_port_t port, rtk_dot1x_direction_t *pPort_direction);
261
262 /* Function Name:
263 * rtk_dot1x_macBasedEnable_set
264 * Description:
265 * Set 802.1x mac-based port enable configuration
266 * Input:
267 * port - Port id.
268 * enable - The status of 802.1x port.
269 * Output:
270 * None
271 * Return:
272 * RT_ERR_OK - OK
273 * RT_ERR_FAILED - Failed
274 * RT_ERR_SMI - SMI access error
275 * RT_ERR_PORT_ID - Invalid port number.
276 * RT_ERR_ENABLE - Invalid enable input.
277 * RT_ERR_DOT1X_MACBASEDPNEN - 802.1X mac-based enable error
278 * Note:
279 * If a port is 802.1x MAC based network access control "enabled", the incoming packets should
280 * be authenticated so packets from that port won't be dropped or trapped to CPU.
281 * The status of 802.1x MAC-based network access control is as following:
282 * - DISABLED
283 * - ENABLED
284 */
285 extern rtk_api_ret_t rtk_dot1x_macBasedEnable_set(rtk_port_t port, rtk_enable_t enable);
286
287 /* Function Name:
288 * rtk_dot1x_macBasedEnable_get
289 * Description:
290 * Get 802.1x mac-based port enable configuration
291 * Input:
292 * port - Port id.
293 * Output:
294 * pEnable - The status of 802.1x port.
295 * Return:
296 * RT_ERR_OK - OK
297 * RT_ERR_FAILED - Failed
298 * RT_ERR_SMI - SMI access error
299 * RT_ERR_INPUT - Invalid input parameters.
300 * RT_ERR_PORT_ID - Invalid port number.
301 * Note:
302 * If a port is 802.1x MAC based network access control "enabled", the incoming packets should
303 * be authenticated so packets from that port wont be dropped or trapped to CPU.
304 * The status of 802.1x MAC-based network access control is as following:
305 * - DISABLED
306 * - ENABLED
307 */
308 extern rtk_api_ret_t rtk_dot1x_macBasedEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
309
310 /* Function Name:
311 * rtk_dot1x_macBasedAuthMac_add
312 * Description:
313 * Add an authenticated MAC to ASIC
314 * Input:
315 * port - Port id.
316 * pAuth_mac - The authenticated MAC.
317 * fid - filtering database.
318 * Output:
319 * None
320 * Return:
321 * RT_ERR_OK - OK
322 * RT_ERR_FAILED - Failed
323 * RT_ERR_SMI - SMI access error
324 * RT_ERR_PORT_ID - Invalid port number.
325 * RT_ERR_ENABLE - Invalid enable input.
326 * RT_ERR_DOT1X_MACBASEDPNEN - 802.1X mac-based enable error
327 * Note:
328 * The API can add a 802.1x authenticated MAC address to port. If the MAC does not exist in LUT,
329 * user can't add this MAC to auth status.
330 */
331 extern rtk_api_ret_t rtk_dot1x_macBasedAuthMac_add(rtk_port_t port, rtk_mac_t *pAuth_mac, rtk_fid_t fid);
332
333 /* Function Name:
334 * rtk_dot1x_macBasedAuthMac_del
335 * Description:
336 * Delete an authenticated MAC to ASIC
337 * Input:
338 * port - Port id.
339 * pAuth_mac - The authenticated MAC.
340 * fid - filtering database.
341 * Output:
342 * None
343 * Return:
344 * RT_ERR_OK - OK
345 * RT_ERR_FAILED - Failed
346 * RT_ERR_SMI - SMI access error
347 * RT_ERR_MAC - Invalid MAC address.
348 * RT_ERR_PORT_ID - Invalid port number.
349 * Note:
350 * The API can delete a 802.1x authenticated MAC address to port. It only change the auth status of
351 * the MAC and won't delete it from LUT.
352 */
353 extern rtk_api_ret_t rtk_dot1x_macBasedAuthMac_del(rtk_port_t port, rtk_mac_t *pAuth_mac, rtk_fid_t fid);
354
355 /* Function Name:
356 * rtk_dot1x_macBasedDirection_set
357 * Description:
358 * Set 802.1x mac-based operational direction configuration
359 * Input:
360 * mac_direction - Operation direction
361 * Output:
362 * None
363 * Return:
364 * RT_ERR_OK - OK
365 * RT_ERR_FAILED - Failed
366 * RT_ERR_SMI - SMI access error
367 * RT_ERR_INPUT - Invalid input parameter.
368 * RT_ERR_DOT1X_MACBASEDOPDIR - 802.1X mac-based operation direction error
369 * Note:
370 * The operate controlled direction of 802.1x mac-based network access control is as following:
371 * - BOTH
372 * - IN
373 */
374 extern rtk_api_ret_t rtk_dot1x_macBasedDirection_set(rtk_dot1x_direction_t mac_direction);
375
376 /* Function Name:
377 * rtk_dot1x_macBasedDirection_get
378 * Description:
379 * Get 802.1x mac-based operational direction configuration
380 * Input:
381 * port - Port id.
382 * Output:
383 * pMac_direction - Operation direction
384 * Return:
385 * RT_ERR_OK - OK
386 * RT_ERR_FAILED - Failed
387 * RT_ERR_SMI - SMI access error
388 * RT_ERR_INPUT - Invalid input parameters.
389 * Note:
390 * The API can get 802.1x mac-based operational direction information.
391 */
392 extern rtk_api_ret_t rtk_dot1x_macBasedDirection_get(rtk_dot1x_direction_t *pMac_direction);
393
394 /* Function Name:
395 * Set 802.1x guest VLAN configuration
396 * Description:
397 * Set 802.1x mac-based operational direction configuration
398 * Input:
399 * vid - 802.1x guest VLAN ID
400 * Output:
401 * None
402 * Return:
403 * RT_ERR_OK - OK
404 * RT_ERR_FAILED - Failed
405 * RT_ERR_SMI - SMI access error
406 * RT_ERR_INPUT - Invalid input parameter.
407 * Note:
408 * The operate controlled 802.1x guest VLAN
409 */
410 extern rtk_api_ret_t rtk_dot1x_guestVlan_set(rtk_vlan_t vid);
411
412 /* Function Name:
413 * rtk_dot1x_guestVlan_get
414 * Description:
415 * Get 802.1x guest VLAN configuration
416 * Input:
417 * None
418 * Output:
419 * pVid - 802.1x guest VLAN ID
420 * Return:
421 * RT_ERR_OK - OK
422 * RT_ERR_FAILED - Failed
423 * RT_ERR_SMI - SMI access error
424 * RT_ERR_INPUT - Invalid input parameters.
425 * Note:
426 * The API can get 802.1x guest VLAN information.
427 */
428 extern rtk_api_ret_t rtk_dot1x_guestVlan_get(rtk_vlan_t *pVid);
429
430 /* Function Name:
431 * rtk_dot1x_guestVlan2Auth_set
432 * Description:
433 * Set 802.1x guest VLAN to auth host configuration
434 * Input:
435 * enable - The status of guest VLAN to auth host.
436 * Output:
437 * None
438 * Return:
439 * RT_ERR_OK - OK
440 * RT_ERR_FAILED - Failed
441 * RT_ERR_SMI - SMI access error
442 * RT_ERR_INPUT - Invalid input parameter.
443 * Note:
444 * The operational direction of 802.1x guest VLAN to auth host control is as following:
445 * - ENABLED
446 * - DISABLED
447 */
448 extern rtk_api_ret_t rtk_dot1x_guestVlan2Auth_set(rtk_enable_t enable);
449
450 /* Function Name:
451 * rtk_dot1x_guestVlan2Auth_get
452 * Description:
453 * Get 802.1x guest VLAN to auth host configuration
454 * Input:
455 * None
456 * Output:
457 * pEnable - The status of guest VLAN to auth host.
458 * Return:
459 * RT_ERR_OK - OK
460 * RT_ERR_FAILED - Failed
461 * RT_ERR_SMI - SMI access error
462 * RT_ERR_INPUT - Invalid input parameters.
463 * Note:
464 * The API can get 802.1x guest VLAN to auth host information.
465 */
466 extern rtk_api_ret_t rtk_dot1x_guestVlan2Auth_get(rtk_enable_t *pEnable);
467
468
469 #endif /* __RTK_API_DOT1X_H__ */
470