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 CPU module high-layer API defination
16 #ifndef __RTK_API_CPU_H__
17 #define __RTK_API_CPU_H__
21 * Data Type Declaration
23 typedef enum rtk_cpu_insert_e
25 CPU_INSERT_TO_ALL
= 0,
26 CPU_INSERT_TO_TRAPPING
,
31 typedef enum rtk_cpu_position_e
38 typedef enum rtk_cpu_tag_length_e
43 }rtk_cpu_tag_length_t
;
46 typedef enum rtk_cpu_rx_length_e
57 * Set CPU port function enable/disable.
59 * enable - CPU port function enable
64 * RT_ERR_FAILED - Failed
65 * RT_ERR_SMI - SMI access error
66 * RT_ERR_INPUT - Invalid input parameter.
67 * RT_ERR_PORT_ID - Invalid port number.
69 * The API can set CPU port function enable/disable.
71 extern rtk_api_ret_t
rtk_cpu_enable_set(rtk_enable_t enable
);
76 * Get CPU port and its setting.
80 * pEnable - CPU port function enable
83 * RT_ERR_FAILED - Failed
84 * RT_ERR_SMI - SMI access error
85 * RT_ERR_INPUT - Invalid input parameters.
86 * RT_ERR_L2_NO_CPU_PORT - CPU port is not exist
88 * The API can get CPU port function enable/disable.
90 extern rtk_api_ret_t
rtk_cpu_enable_get(rtk_enable_t
*pEnable
);
95 * Set CPU port and CPU tag insert mode.
98 * mode - CPU tag insert for packets egress from CPU port.
103 * RT_ERR_FAILED - Failed
104 * RT_ERR_SMI - SMI access error
105 * RT_ERR_INPUT - Invalid input parameter.
106 * RT_ERR_PORT_ID - Invalid port number.
108 * The API can set CPU port and inserting proprietary CPU tag mode (Length/Type 0x8899)
109 * to the frame that transmitting to CPU port.
110 * The inset cpu tag mode is as following:
111 * - CPU_INSERT_TO_ALL
112 * - CPU_INSERT_TO_TRAPPING
113 * - CPU_INSERT_TO_NONE
115 extern rtk_api_ret_t
rtk_cpu_tagPort_set(rtk_port_t port
, rtk_cpu_insert_t mode
);
118 * rtk_cpu_tagPort_get
120 * Get CPU port and CPU tag insert mode.
125 * pMode - CPU tag insert for packets egress from CPU port, 0:all insert 1:Only for trapped packets 2:no insert.
128 * RT_ERR_FAILED - Failed
129 * RT_ERR_SMI - SMI access error
130 * RT_ERR_INPUT - Invalid input parameters.
131 * RT_ERR_L2_NO_CPU_PORT - CPU port is not exist
133 * The API can get configured CPU port and its setting.
134 * The inset cpu tag mode is as following:
135 * - CPU_INSERT_TO_ALL
136 * - CPU_INSERT_TO_TRAPPING
137 * - CPU_INSERT_TO_NONE
139 extern rtk_api_ret_t
rtk_cpu_tagPort_get(rtk_port_t
*pPort
, rtk_cpu_insert_t
*pMode
);
142 * rtk_cpu_awarePort_set
144 * Set CPU aware port mask.
146 * portmask - Port mask.
151 * RT_ERR_FAILED - Failed
152 * RT_ERR_SMI - SMI access error
153 * RT_ERR_PORT_MASK - Invalid port mask.
155 * The API can set configured CPU aware port mask.
157 extern rtk_api_ret_t
rtk_cpu_awarePort_set(rtk_portmask_t
*pPortmask
);
161 * rtk_cpu_awarePort_get
163 * Get CPU aware port mask.
167 * pPortmask - Port mask.
170 * RT_ERR_FAILED - Failed
171 * RT_ERR_SMI - SMI access error
173 * The API can get configured CPU aware port mask.
175 extern rtk_api_ret_t
rtk_cpu_awarePort_get(rtk_portmask_t
*pPortmask
);
178 * rtk_cpu_tagPosition_set
180 * Set CPU tag position.
182 * position - CPU tag position.
187 * RT_ERR_FAILED - Failed
188 * RT_ERR_SMI - SMI access error
189 * RT_ERR_INPUT - Invalid input.
191 * The API can set CPU tag position.
193 extern rtk_api_ret_t
rtk_cpu_tagPosition_set(rtk_cpu_position_t position
);
196 * rtk_cpu_tagPosition_get
198 * Get CPU tag position.
202 * pPosition - CPU tag position.
205 * RT_ERR_FAILED - Failed
206 * RT_ERR_SMI - SMI access error
207 * RT_ERR_INPUT - Invalid input.
209 * The API can get CPU tag position.
211 extern rtk_api_ret_t
rtk_cpu_tagPosition_get(rtk_cpu_position_t
*pPosition
);
214 * rtk_cpu_tagLength_set
216 * Set CPU tag length.
218 * length - CPU tag length.
223 * RT_ERR_FAILED - Failed
224 * RT_ERR_SMI - SMI access error
225 * RT_ERR_INPUT - Invalid input.
227 * The API can set CPU tag length.
229 extern rtk_api_ret_t
rtk_cpu_tagLength_set(rtk_cpu_tag_length_t length
);
232 * rtk_cpu_tagLength_get
234 * Get CPU tag length.
238 * pLength - CPU tag length.
241 * RT_ERR_FAILED - Failed
242 * RT_ERR_SMI - SMI access error
243 * RT_ERR_INPUT - Invalid input.
245 * The API can get CPU tag length.
247 extern rtk_api_ret_t
rtk_cpu_tagLength_get(rtk_cpu_tag_length_t
*pLength
);
250 * rtk_cpu_acceptLength_set
252 * Set CPU accept length.
254 * length - CPU tag length.
259 * RT_ERR_FAILED - Failed
260 * RT_ERR_SMI - SMI access error
261 * RT_ERR_INPUT - Invalid input.
263 * The API can set CPU accept length.
265 extern rtk_api_ret_t
rtk_cpu_acceptLength_set(rtk_cpu_rx_length_t length
);
268 * rtk_cpu_acceptLength_get
270 * Get CPU accept length.
274 * pLength - CPU tag length.
277 * RT_ERR_FAILED - Failed
278 * RT_ERR_SMI - SMI access error
279 * RT_ERR_INPUT - Invalid input.
281 * The API can get CPU accept length.
283 extern rtk_api_ret_t
rtk_cpu_acceptLength_get(rtk_cpu_rx_length_t
*pLength
);
286 * rtk_cpu_priRemap_set
288 * Configure CPU priorities mapping to internal absolute priority.
290 * int_pri - internal priority value.
291 * new_pri - new internal priority value.
296 * RT_ERR_FAILED - Failed
297 * RT_ERR_SMI - SMI access error
298 * RT_ERR_INPUT - Invalid input parameters.
299 * RT_ERR_VLAN_PRIORITY - Invalid 1p priority.
300 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
302 * Priority of CPU tag assignment for internal asic priority, and it is used for queue usage and packet scheduling.
304 extern rtk_api_ret_t
rtk_cpu_priRemap_set(rtk_pri_t int_pri
, rtk_pri_t new_pri
);
307 * rtk_cpu_priRemap_get
309 * Configure CPU priorities mapping to internal absolute priority.
311 * int_pri - internal priority value.
313 * pNew_pri - new internal priority value.
316 * RT_ERR_FAILED - Failed
317 * RT_ERR_SMI - SMI access error
318 * RT_ERR_INPUT - Invalid input parameters.
319 * RT_ERR_VLAN_PRIORITY - Invalid 1p priority.
320 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
322 * Priority of CPU tag assignment for internal asic priority, and it is used for queue usage and packet scheduling.
324 extern rtk_api_ret_t
rtk_cpu_priRemap_get(rtk_pri_t int_pri
, rtk_pri_t
*pNew_pri
);
327 #endif /* __RTK_API_CPU_H__ */