2 * Copyright (C) 2013 Realtek Semiconductor Corp.
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
10 * Purpose : RTL8367/RTL8367C switch high-level API
12 * Feature : The file includes 1X module high-layer API defination
16 #ifndef __RTK_API_DOT1X_H__
17 #define __RTK_API_DOT1X_H__
20 /* Type of port-based dot1x auth/unauth*/
21 typedef enum rtk_dot1x_auth_status_e
26 } rtk_dot1x_auth_status_t
;
28 typedef enum rtk_dot1x_direction_e
33 } rtk_dot1x_direction_t
;
35 /* unauth pkt action */
36 typedef enum rtk_dot1x_unauth_action_e
38 DOT1X_ACTION_DROP
= 0,
39 DOT1X_ACTION_TRAP2CPU
,
40 DOT1X_ACTION_GUESTVLAN
,
42 } rtk_dot1x_unauth_action_t
;
45 * rtk_dot1x_unauthPacketOper_set
47 * Set 802.1x unauth action configuration.
50 * unauth_action - 802.1X unauth action.
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.
60 * This API can set 802.1x unauth action configuration.
61 * The unauth action is as following:
63 * - DOT1X_ACTION_TRAP2CPU
64 * - DOT1X_ACTION_GUESTVLAN
66 extern rtk_api_ret_t
rtk_dot1x_unauthPacketOper_set(rtk_port_t port
, rtk_dot1x_unauth_action_t unauth_action
);
69 * rtk_dot1x_unauthPacketOper_get
71 * Get 802.1x unauth action configuration.
75 * pUnauth_action - 802.1X unauth action.
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.
83 * This API can get 802.1x unauth action configuration.
84 * The unauth action is as following:
86 * - DOT1X_ACTION_TRAP2CPU
87 * - DOT1X_ACTION_GUESTVLAN
89 extern rtk_api_ret_t
rtk_dot1x_unauthPacketOper_get(rtk_port_t port
, rtk_dot1x_unauth_action_t
*pUnauth_action
);
92 * rtk_dot1x_eapolFrame2CpuEnable_set
94 * Set 802.1x EAPOL packet trap to CPU configuration
96 * enable - The status of 802.1x EAPOL packet.
101 * RT_ERR_FAILED - Failed
102 * RT_ERR_SMI - SMI access error
103 * RT_ERR_ENABLE - Invalid enable input.
105 * To support 802.1x authentication functionality, EAPOL frame (ether type = 0x888E) has to
107 * The status of EAPOL frame trap to CPU is as following:
111 extern rtk_api_ret_t
rtk_dot1x_eapolFrame2CpuEnable_set(rtk_enable_t enable
);
114 * rtk_dot1x_eapolFrame2CpuEnable_get
116 * Get 802.1x EAPOL packet trap to CPU configuration
120 * pEnable - The status of 802.1x EAPOL packet.
123 * RT_ERR_FAILED - Failed
124 * RT_ERR_SMI - SMI access error
125 * RT_ERR_INPUT - Invalid input parameters.
127 * To support 802.1x authentication functionality, EAPOL frame (ether type = 0x888E) has to
129 * The status of EAPOL frame trap to CPU is as following:
133 extern rtk_api_ret_t
rtk_dot1x_eapolFrame2CpuEnable_get(rtk_enable_t
*pEnable
);
136 * rtk_dot1x_portBasedEnable_set
138 * Set 802.1x port-based enable configuration
141 * enable - The status of 802.1x port.
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
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:
159 extern rtk_api_ret_t
rtk_dot1x_portBasedEnable_set(rtk_port_t port
, rtk_enable_t enable
);
162 * rtk_dot1x_portBasedEnable_get
164 * Get 802.1x port-based enable configuration
168 * pEnable - The status of 802.1x port.
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.
176 * The API can get the 802.1x port-based port status.
178 extern rtk_api_ret_t
rtk_dot1x_portBasedEnable_get(rtk_port_t port
, rtk_enable_t
*pEnable
);
181 * rtk_dot1x_portBasedAuthStatus_set
183 * Set 802.1x port-based auth. port configuration
186 * port_auth - The status of 802.1x port.
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
196 * The authenticated status of 802.1x port-based network access control is as following:
200 extern rtk_api_ret_t
rtk_dot1x_portBasedAuthStatus_set(rtk_port_t port
, rtk_dot1x_auth_status_t port_auth
);
203 * rtk_dot1x_portBasedAuthStatus_get
205 * Get 802.1x port-based auth. port configuration
209 * pPort_auth - The status of 802.1x port.
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.
217 * The API can get 802.1x port-based port auth.information.
219 extern rtk_api_ret_t
rtk_dot1x_portBasedAuthStatus_get(rtk_port_t port
, rtk_dot1x_auth_status_t
*pPort_auth
);
222 * rtk_dot1x_portBasedDirection_set
224 * Set 802.1x port-based operational direction configuration
227 * port_direction - Operation direction
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
237 * The operate controlled direction of 802.1x port-based network access control is as following:
241 extern rtk_api_ret_t
rtk_dot1x_portBasedDirection_set(rtk_port_t port
, rtk_dot1x_direction_t port_direction
);
244 * rtk_dot1x_portBasedDirection_get
246 * Get 802.1X port-based operational direction configuration
250 * pPort_direction - Operation direction
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.
258 * The API can get 802.1x port-based operational direction information.
260 extern rtk_api_ret_t
rtk_dot1x_portBasedDirection_get(rtk_port_t port
, rtk_dot1x_direction_t
*pPort_direction
);
263 * rtk_dot1x_macBasedEnable_set
265 * Set 802.1x mac-based port enable configuration
268 * enable - The status of 802.1x port.
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
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:
285 extern rtk_api_ret_t
rtk_dot1x_macBasedEnable_set(rtk_port_t port
, rtk_enable_t enable
);
288 * rtk_dot1x_macBasedEnable_get
290 * Get 802.1x mac-based port enable configuration
294 * pEnable - The status of 802.1x port.
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.
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:
308 extern rtk_api_ret_t
rtk_dot1x_macBasedEnable_get(rtk_port_t port
, rtk_enable_t
*pEnable
);
311 * rtk_dot1x_macBasedAuthMac_add
313 * Add an authenticated MAC to ASIC
316 * pAuth_mac - The authenticated MAC.
317 * fid - filtering database.
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
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.
331 extern rtk_api_ret_t
rtk_dot1x_macBasedAuthMac_add(rtk_port_t port
, rtk_mac_t
*pAuth_mac
, rtk_fid_t fid
);
334 * rtk_dot1x_macBasedAuthMac_del
336 * Delete an authenticated MAC to ASIC
339 * pAuth_mac - The authenticated MAC.
340 * fid - filtering database.
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.
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.
353 extern rtk_api_ret_t
rtk_dot1x_macBasedAuthMac_del(rtk_port_t port
, rtk_mac_t
*pAuth_mac
, rtk_fid_t fid
);
356 * rtk_dot1x_macBasedDirection_set
358 * Set 802.1x mac-based operational direction configuration
360 * mac_direction - Operation direction
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
370 * The operate controlled direction of 802.1x mac-based network access control is as following:
374 extern rtk_api_ret_t
rtk_dot1x_macBasedDirection_set(rtk_dot1x_direction_t mac_direction
);
377 * rtk_dot1x_macBasedDirection_get
379 * Get 802.1x mac-based operational direction configuration
383 * pMac_direction - Operation direction
386 * RT_ERR_FAILED - Failed
387 * RT_ERR_SMI - SMI access error
388 * RT_ERR_INPUT - Invalid input parameters.
390 * The API can get 802.1x mac-based operational direction information.
392 extern rtk_api_ret_t
rtk_dot1x_macBasedDirection_get(rtk_dot1x_direction_t
*pMac_direction
);
395 * Set 802.1x guest VLAN configuration
397 * Set 802.1x mac-based operational direction configuration
399 * vid - 802.1x guest VLAN ID
404 * RT_ERR_FAILED - Failed
405 * RT_ERR_SMI - SMI access error
406 * RT_ERR_INPUT - Invalid input parameter.
408 * The operate controlled 802.1x guest VLAN
410 extern rtk_api_ret_t
rtk_dot1x_guestVlan_set(rtk_vlan_t vid
);
413 * rtk_dot1x_guestVlan_get
415 * Get 802.1x guest VLAN configuration
419 * pVid - 802.1x guest VLAN ID
422 * RT_ERR_FAILED - Failed
423 * RT_ERR_SMI - SMI access error
424 * RT_ERR_INPUT - Invalid input parameters.
426 * The API can get 802.1x guest VLAN information.
428 extern rtk_api_ret_t
rtk_dot1x_guestVlan_get(rtk_vlan_t
*pVid
);
431 * rtk_dot1x_guestVlan2Auth_set
433 * Set 802.1x guest VLAN to auth host configuration
435 * enable - The status of guest VLAN to auth host.
440 * RT_ERR_FAILED - Failed
441 * RT_ERR_SMI - SMI access error
442 * RT_ERR_INPUT - Invalid input parameter.
444 * The operational direction of 802.1x guest VLAN to auth host control is as following:
448 extern rtk_api_ret_t
rtk_dot1x_guestVlan2Auth_set(rtk_enable_t enable
);
451 * rtk_dot1x_guestVlan2Auth_get
453 * Get 802.1x guest VLAN to auth host configuration
457 * pEnable - The status of guest VLAN to auth host.
460 * RT_ERR_FAILED - Failed
461 * RT_ERR_SMI - SMI access error
462 * RT_ERR_INPUT - Invalid input parameters.
464 * The API can get 802.1x guest VLAN to auth host information.
466 extern rtk_api_ret_t
rtk_dot1x_guestVlan2Auth_get(rtk_enable_t
*pEnable
);
469 #endif /* __RTK_API_DOT1X_H__ */