mediatek: add support for rtl8367c
[openwrt/openwrt.git] / target / linux / mediatek / files-5.4 / drivers / net / phy / rtk / rtl8367c / include / qos.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 QoS module high-layer API defination
13 *
14 */
15
16 #ifndef __RTK_API_QOS_H__
17 #define __RTK_API_QOS_H__
18
19 /*
20 * Data Type Declaration
21 */
22 #define QOS_DEFAULT_TICK_PERIOD (19-1)
23 #define QOS_DEFAULT_BYTE_PER_TOKEN 34
24 #define QOS_DEFAULT_LK_THRESHOLD (34*3) /* Why use 0x400? */
25
26
27 #define QOS_DEFAULT_INGRESS_BANDWIDTH 0x3FFF /* 0x3FFF => unlimit */
28 #define QOS_DEFAULT_EGRESS_BANDWIDTH 0x3D08 /*( 0x3D08 + 1) * 64Kbps => 1Gbps*/
29 #define QOS_DEFAULT_PREIFP 1
30 #define QOS_DEFAULT_PACKET_USED_PAGES_FC 0x60
31 #define QOS_DEFAULT_PACKET_USED_FC_EN 0
32 #define QOS_DEFAULT_QUEUE_BASED_FC_EN 1
33
34 #define QOS_DEFAULT_PRIORITY_SELECT_PORT 8
35 #define QOS_DEFAULT_PRIORITY_SELECT_1Q 0
36 #define QOS_DEFAULT_PRIORITY_SELECT_ACL 0
37 #define QOS_DEFAULT_PRIORITY_SELECT_DSCP 0
38
39 #define QOS_DEFAULT_DSCP_MAPPING_PRIORITY 0
40
41 #define QOS_DEFAULT_1Q_REMARKING_ABILITY 0
42 #define QOS_DEFAULT_DSCP_REMARKING_ABILITY 0
43 #define QOS_DEFAULT_QUEUE_GAP 20
44 #define QOS_DEFAULT_QUEUE_NO_MAX 6
45 #define QOS_DEFAULT_AVERAGE_PACKET_RATE 0x3FFF
46 #define QOS_DEFAULT_BURST_SIZE_IN_APR 0x3F
47 #define QOS_DEFAULT_PEAK_PACKET_RATE 2
48 #define QOS_DEFAULT_SCHEDULER_ABILITY_APR 1 /*disable*/
49 #define QOS_DEFAULT_SCHEDULER_ABILITY_PPR 1 /*disable*/
50 #define QOS_DEFAULT_SCHEDULER_ABILITY_WFQ 1 /*disable*/
51
52 #define QOS_WEIGHT_MAX 127
53
54 #define RTK_MAX_NUM_OF_PRIORITY 8
55 #define RTK_MAX_NUM_OF_QUEUE 8
56
57 #define RTK_PRIMAX 7
58 #define RTK_QIDMAX 7
59 #define RTK_DSCPMAX 63
60
61
62 /* enum Priority Selection Index */
63 typedef enum rtk_qos_priDecTbl_e
64 {
65 PRIDECTBL_IDX0 = 0,
66 PRIDECTBL_IDX1,
67 PRIDECTBL_END,
68 }rtk_qos_priDecTbl_t;
69
70
71 /* Types of 802.1p remarking source */
72 typedef enum rtk_qos_1pRmkSrc_e
73 {
74 DOT1P_RMK_SRC_USER_PRI,
75 DOT1P_RMK_SRC_TAG_PRI,
76 DOT1P_RMK_SRC_END
77 } rtk_qos_1pRmkSrc_t;
78
79
80 /* Types of DSCP remarking source */
81 typedef enum rtk_qos_dscpRmkSrc_e
82 {
83 DSCP_RMK_SRC_INT_PRI,
84 DSCP_RMK_SRC_DSCP,
85 DSCP_RMK_SRC_USER_PRI,
86 DSCP_RMK_SRC_END
87 } rtk_qos_dscpRmkSrc_t;
88
89
90
91
92 typedef struct rtk_priority_select_s
93 {
94 rtk_uint32 port_pri;
95 rtk_uint32 dot1q_pri;
96 rtk_uint32 acl_pri;
97 rtk_uint32 dscp_pri;
98 rtk_uint32 cvlan_pri;
99 rtk_uint32 svlan_pri;
100 rtk_uint32 dmac_pri;
101 rtk_uint32 smac_pri;
102 } rtk_priority_select_t;
103
104 typedef struct rtk_qos_pri2queue_s
105 {
106 rtk_uint32 pri2queue[RTK_MAX_NUM_OF_PRIORITY];
107 } rtk_qos_pri2queue_t;
108
109 typedef struct rtk_qos_queue_weights_s
110 {
111 rtk_uint32 weights[RTK_MAX_NUM_OF_QUEUE];
112 } rtk_qos_queue_weights_t;
113
114 typedef enum rtk_qos_scheduling_type_e
115 {
116 WFQ = 0, /* Weighted-Fair-Queue */
117 WRR, /* Weighted-Round-Robin */
118 SCHEDULING_TYPE_END
119 } rtk_qos_scheduling_type_t;
120
121 typedef rtk_uint32 rtk_queue_num_t; /* queue number*/
122
123 /* Function Name:
124 * rtk_qos_init
125 * Description:
126 * Configure Qos default settings with queue number assigment to each port.
127 * Input:
128 * queueNum - Queue number of each port.
129 * Output:
130 * None
131 * Return:
132 * RT_ERR_OK - OK
133 * RT_ERR_FAILED - Failed
134 * RT_ERR_SMI - SMI access error
135 * RT_ERR_QUEUE_NUM - Invalid queue number.
136 * RT_ERR_INPUT - Invalid input parameters.
137 * Note:
138 * This API will initialize related Qos setting with queue number assigment.
139 * The queue number is from 1 to 8.
140 */
141 extern rtk_api_ret_t rtk_qos_init(rtk_queue_num_t queueNum);
142
143 /* Function Name:
144 * rtk_qos_priSel_set
145 * Description:
146 * Configure the priority order among different priority mechanism.
147 * Input:
148 * index - Priority decision table index (0~1)
149 * pPriDec - Priority assign for port, dscp, 802.1p, cvlan, svlan, acl based priority decision.
150 * Output:
151 * None
152 * Return:
153 * RT_ERR_OK - OK
154 * RT_ERR_FAILED - Failed
155 * RT_ERR_SMI - SMI access error
156 * RT_ERR_QOS_SEL_PRI_SOURCE - Invalid priority decision source parameter.
157 * Note:
158 * ASIC will follow user priority setting of mechanisms to select mapped queue priority for receiving frame.
159 * If two priority mechanisms are the same, the ASIC will chose the highest priority from mechanisms to
160 * assign queue priority to receiving frame.
161 * The priority sources are:
162 * - PRIDEC_PORT
163 * - PRIDEC_ACL
164 * - PRIDEC_DSCP
165 * - PRIDEC_1Q
166 * - PRIDEC_1AD
167 * - PRIDEC_CVLAN
168 * - PRIDEC_DA
169 * - PRIDEC_SA
170 */
171 extern rtk_api_ret_t rtk_qos_priSel_set(rtk_qos_priDecTbl_t index, rtk_priority_select_t *pPriDec);
172
173
174 /* Function Name:
175 * rtk_qos_priSel_get
176 * Description:
177 * Get the priority order configuration among different priority mechanism.
178 * Input:
179 * index - Priority decision table index (0~1)
180 * Output:
181 * pPriDec - Priority assign for port, dscp, 802.1p, cvlan, svlan, acl based priority decision .
182 * Return:
183 * RT_ERR_OK - OK
184 * RT_ERR_FAILED - Failed
185 * RT_ERR_SMI - SMI access error
186 * Note:
187 * ASIC will follow user priority setting of mechanisms to select mapped queue priority for receiving frame.
188 * If two priority mechanisms are the same, the ASIC will chose the highest priority from mechanisms to
189 * assign queue priority to receiving frame.
190 * The priority sources are:
191 * - PRIDEC_PORT,
192 * - PRIDEC_ACL,
193 * - PRIDEC_DSCP,
194 * - PRIDEC_1Q,
195 * - PRIDEC_1AD,
196 * - PRIDEC_CVLAN,
197 * - PRIDEC_DA,
198 * - PRIDEC_SA,
199 */
200 extern rtk_api_ret_t rtk_qos_priSel_get(rtk_qos_priDecTbl_t index, rtk_priority_select_t *pPriDec);
201
202 /* Function Name:
203 * rtk_qos_1pPriRemap_set
204 * Description:
205 * Configure 1Q priorities mapping to internal absolute priority.
206 * Input:
207 * dot1p_pri - 802.1p priority value.
208 * int_pri - internal priority value.
209 * Output:
210 * None
211 * Return:
212 * RT_ERR_OK - OK
213 * RT_ERR_FAILED - Failed
214 * RT_ERR_SMI - SMI access error
215 * RT_ERR_INPUT - Invalid input parameters.
216 * RT_ERR_VLAN_PRIORITY - Invalid 1p priority.
217 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
218 * Note:
219 * Priority of 802.1Q assignment for internal asic priority, and it is used for queue usage and packet scheduling.
220 */
221 extern rtk_api_ret_t rtk_qos_1pPriRemap_set(rtk_pri_t dot1p_pri, rtk_pri_t int_pri);
222
223 /* Function Name:
224 * rtk_qos_1pPriRemap_get
225 * Description:
226 * Get 1Q priorities mapping to internal absolute priority.
227 * Input:
228 * dot1p_pri - 802.1p priority value .
229 * Output:
230 * pInt_pri - internal priority value.
231 * Return:
232 * RT_ERR_OK - OK
233 * RT_ERR_FAILED - Failed
234 * RT_ERR_SMI - SMI access error
235 * RT_ERR_VLAN_PRIORITY - Invalid priority.
236 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
237 * Note:
238 * Priority of 802.1Q assigment for internal asic priority, and it is uesed for queue usage and packet scheduling.
239 */
240 extern rtk_api_ret_t rtk_qos_1pPriRemap_get(rtk_pri_t dot1p_pri, rtk_pri_t *pInt_pri);
241
242
243 /* Function Name:
244 * rtk_qos_1pRemarkSrcSel_set
245 * Description:
246 * Set remarking source of 802.1p remarking.
247 * Input:
248 * type - remarking source
249 * Output:
250 * None
251 * Return:
252 * RT_ERR_OK
253 * RT_ERR_FAILED
254 * RT_ERR_NOT_INIT - The module is not initial
255 * RT_ERR_PORT_ID - invalid port id
256 * RT_ERR_INPUT - invalid input parameter
257
258 * Note:
259 * The API can configure 802.1p remark functionality to map original 802.1p value or internal
260 * priority to TX DSCP value.
261 */
262 extern rtk_api_ret_t rtk_qos_1pRemarkSrcSel_set(rtk_qos_1pRmkSrc_t type);
263
264 /* Function Name:
265 * rtk_qos_1pRemarkSrcSel_get
266 * Description:
267 * Get remarking source of 802.1p remarking.
268 * Input:
269 * none
270 * Output:
271 * pType - remarking source
272 * Return:
273 * RT_ERR_OK
274 * RT_ERR_FAILED
275 * RT_ERR_NOT_INIT - The module is not initial
276 * RT_ERR_PORT_ID - invalid port id
277 * RT_ERR_INPUT - invalid input parameter
278 * RT_ERR_NULL_POINTER - input parameter may be null pointer
279
280 * Note:
281 * None
282 */
283 extern rtk_api_ret_t rtk_qos_1pRemarkSrcSel_get(rtk_qos_1pRmkSrc_t *pType);
284
285 /* Function Name:
286 * rtk_qos_dscpPriRemap_set
287 * Description:
288 * Map dscp value to internal priority.
289 * Input:
290 * dscp - Dscp value of receiving frame
291 * int_pri - internal priority value .
292 * Output:
293 * None
294 * Return:
295 * RT_ERR_OK - OK
296 * RT_ERR_FAILED - Failed
297 * RT_ERR_SMI - SMI access error
298 * RT_ERR_INPUT - Invalid input parameters.
299 * RT_ERR_QOS_DSCP_VALUE - Invalid DSCP value.
300 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
301 * Note:
302 * The Differentiated Service Code Point is a selector for router's per-hop behaviors. As a selector, there is no implication that a numerically
303 * greater DSCP implies a better network service. As can be seen, the DSCP totally overlaps the old precedence field of TOS. So if values of
304 * DSCP are carefully chosen then backward compatibility can be achieved.
305 */
306 extern rtk_api_ret_t rtk_qos_dscpPriRemap_set(rtk_dscp_t dscp, rtk_pri_t int_pri);
307
308 /* Function Name:
309 * rtk_qos_dscpPriRemap_get
310 * Description:
311 * Get dscp value to internal priority.
312 * Input:
313 * dscp - Dscp value of receiving frame
314 * Output:
315 * pInt_pri - internal priority value.
316 * Return:
317 * RT_ERR_OK - OK
318 * RT_ERR_FAILED - Failed
319 * RT_ERR_SMI - SMI access error
320 * RT_ERR_QOS_DSCP_VALUE - Invalid DSCP value.
321 * Note:
322 * The Differentiated Service Code Point is a selector for router's per-hop behaviors. As a selector, there is no implication that a numerically
323 * greater DSCP implies a better network service. As can be seen, the DSCP totally overlaps the old precedence field of TOS. So if values of
324 * DSCP are carefully chosen then backward compatibility can be achieved.
325 */
326 extern rtk_api_ret_t rtk_qos_dscpPriRemap_get(rtk_dscp_t dscp, rtk_pri_t *pInt_pri);
327
328 /* Function Name:
329 * rtk_qos_portPri_set
330 * Description:
331 * Configure priority usage to each port.
332 * Input:
333 * port - Port id.
334 * int_pri - internal priority value.
335 * Output:
336 * None
337 * Return:
338 * RT_ERR_OK - OK
339 * RT_ERR_FAILED - Failed
340 * RT_ERR_SMI - SMI access error
341 * RT_ERR_PORT_ID - Invalid port number.
342 * RT_ERR_QOS_SEL_PORT_PRI - Invalid port priority.
343 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
344 * Note:
345 * The API can set priority of port assignments for queue usage and packet scheduling.
346 */
347 extern rtk_api_ret_t rtk_qos_portPri_set(rtk_port_t port, rtk_pri_t int_pri) ;
348
349 /* Function Name:
350 * rtk_qos_portPri_get
351 * Description:
352 * Get priority usage to each port.
353 * Input:
354 * port - Port id.
355 * Output:
356 * pInt_pri - internal priority value.
357 * Return:
358 * RT_ERR_OK - OK
359 * RT_ERR_FAILED - Failed
360 * RT_ERR_SMI - SMI access error
361 * RT_ERR_PORT_ID - Invalid port number.
362 * RT_ERR_INPUT - Invalid input parameters.
363 * Note:
364 * The API can get priority of port assignments for queue usage and packet scheduling.
365 */
366 extern rtk_api_ret_t rtk_qos_portPri_get(rtk_port_t port, rtk_pri_t *pInt_pri) ;
367
368 /* Function Name:
369 * rtk_qos_queueNum_set
370 * Description:
371 * Set output queue number for each port.
372 * Input:
373 * port - Port id.
374 * index - Mapping queue number (1~8)
375 * Output:
376 * None
377 * Return:
378 * RT_ERR_OK - OK
379 * RT_ERR_FAILED - Failed
380 * RT_ERR_SMI - SMI access error
381 * RT_ERR_PORT_ID - Invalid port number.
382 * RT_ERR_QUEUE_NUM - Invalid queue number.
383 * Note:
384 * The API can set the output queue number of the specified port. The queue number is from 1 to 8.
385 */
386 extern rtk_api_ret_t rtk_qos_queueNum_set(rtk_port_t port, rtk_queue_num_t queue_num);
387
388 /* Function Name:
389 * rtk_qos_queueNum_get
390 * Description:
391 * Get output queue number.
392 * Input:
393 * port - Port id.
394 * Output:
395 * pQueue_num - Mapping queue number
396 * Return:
397 * RT_ERR_OK - OK
398 * RT_ERR_FAILED - Failed
399 * RT_ERR_SMI - SMI access error
400 * RT_ERR_PORT_ID - Invalid port number.
401 * Note:
402 * The API will return the output queue number of the specified port. The queue number is from 1 to 8.
403 */
404 extern rtk_api_ret_t rtk_qos_queueNum_get(rtk_port_t port, rtk_queue_num_t *pQueue_num);
405
406 /* Function Name:
407 * rtk_qos_priMap_set
408 * Description:
409 * Set output queue number for each port.
410 * Input:
411 * queue_num - Queue number usage.
412 * pPri2qid - Priority mapping to queue ID.
413 * Output:
414 * None
415 * Return:
416 * RT_ERR_OK - OK
417 * RT_ERR_FAILED - Failed
418 * RT_ERR_SMI - SMI access error
419 * RT_ERR_INPUT - Invalid input parameters.
420 * RT_ERR_QUEUE_NUM - Invalid queue number.
421 * RT_ERR_QUEUE_ID - Invalid queue id.
422 * RT_ERR_PORT_ID - Invalid port number.
423 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
424 * Note:
425 * ASIC supports priority mapping to queue with different queue number from 1 to 8.
426 * For different queue numbers usage, ASIC supports different internal available queue IDs.
427 */
428 extern rtk_api_ret_t rtk_qos_priMap_set(rtk_queue_num_t queue_num, rtk_qos_pri2queue_t *pPri2qid);
429
430
431 /* Function Name:
432 * rtk_qos_priMap_get
433 * Description:
434 * Get priority to queue ID mapping table parameters.
435 * Input:
436 * queue_num - Queue number usage.
437 * Output:
438 * pPri2qid - Priority mapping to queue ID.
439 * Return:
440 * RT_ERR_OK - OK
441 * RT_ERR_FAILED - Failed
442 * RT_ERR_SMI - SMI access error
443 * RT_ERR_INPUT - Invalid input parameters.
444 * RT_ERR_QUEUE_NUM - Invalid queue number.
445 * Note:
446 * The API can return the mapping queue id of the specified priority and queue number.
447 * The queue number is from 1 to 8.
448 */
449 extern rtk_api_ret_t rtk_qos_priMap_get(rtk_queue_num_t queue_num, rtk_qos_pri2queue_t *pPri2qid);
450
451 /* Function Name:
452 * rtk_qos_schedulingQueue_set
453 * Description:
454 * Set weight and type of queues in dedicated port.
455 * Input:
456 * port - Port id.
457 * pQweights - The array of weights for WRR/WFQ queue (0 for STRICT_PRIORITY queue).
458 * Output:
459 * None
460 * Return:
461 * RT_ERR_OK - OK
462 * RT_ERR_FAILED - Failed
463 * RT_ERR_SMI - SMI access error
464 * RT_ERR_PORT_ID - Invalid port number.
465 * RT_ERR_QOS_QUEUE_WEIGHT - Invalid queue weight.
466 * Note:
467 * The API can set weight and type, strict priority or weight fair queue (WFQ) for
468 * dedicated port for using queues. If queue id is not included in queue usage,
469 * then its type and weight setting in dummy for setting. There are priorities
470 * as queue id in strict queues. It means strict queue id 5 carrying higher priority
471 * than strict queue id 4. The WFQ queue weight is from 1 to 128, and weight 0 is
472 * for strict priority queue type.
473 */
474 extern rtk_api_ret_t rtk_qos_schedulingQueue_set(rtk_port_t port, rtk_qos_queue_weights_t *pQweights);
475
476 /* Function Name:
477 * rtk_qos_schedulingQueue_get
478 * Description:
479 * Get weight and type of queues in dedicated port.
480 * Input:
481 * port - Port id.
482 * Output:
483 * pQweights - The array of weights for WRR/WFQ queue (0 for STRICT_PRIORITY queue).
484 * Return:
485 * RT_ERR_OK - OK
486 * RT_ERR_FAILED - Failed
487 * RT_ERR_SMI - SMI access error
488 * RT_ERR_INPUT - Invalid input parameters.
489 * RT_ERR_PORT_ID - Invalid port number.
490 * Note:
491 * The API can get weight and type, strict priority or weight fair queue (WFQ) for dedicated port for using queues.
492 * The WFQ queue weight is from 1 to 128, and weight 0 is for strict priority queue type.
493 */
494 extern rtk_api_ret_t rtk_qos_schedulingQueue_get(rtk_port_t port, rtk_qos_queue_weights_t *pQweights);
495
496 /* Function Name:
497 * rtk_qos_1pRemarkEnable_set
498 * Description:
499 * Set 1p Remarking state
500 * Input:
501 * port - Port id.
502 * enable - State of per-port 1p Remarking
503 * Output:
504 * None
505 * Return:
506 * RT_ERR_OK - OK
507 * RT_ERR_FAILED - Failed
508 * RT_ERR_SMI - SMI access error
509 * RT_ERR_PORT_ID - Invalid port number.
510 * RT_ERR_ENABLE - Invalid enable parameter.
511 * Note:
512 * The API can enable or disable 802.1p remarking ability for whole system.
513 * The status of 802.1p remark:
514 * - DISABLED
515 * - ENABLED
516 */
517 extern rtk_api_ret_t rtk_qos_1pRemarkEnable_set(rtk_port_t port, rtk_enable_t enable);
518
519 /* Function Name:
520 * rtk_qos_1pRemarkEnable_get
521 * Description:
522 * Get 802.1p remarking ability.
523 * Input:
524 * port - Port id.
525 * Output:
526 * pEnable - Status of 802.1p remark.
527 * Return:
528 * RT_ERR_OK - OK
529 * RT_ERR_FAILED - Failed
530 * RT_ERR_SMI - SMI access error
531 * RT_ERR_PORT_ID - Invalid port number.
532 * Note:
533 * The API can get 802.1p remarking ability.
534 * The status of 802.1p remark:
535 * - DISABLED
536 * - ENABLED
537 */
538 extern rtk_api_ret_t rtk_qos_1pRemarkEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
539
540 /* Function Name:
541 * rtk_qos_1pRemark_set
542 * Description:
543 * Set 802.1p remarking parameter.
544 * Input:
545 * int_pri - Internal priority value.
546 * dot1p_pri - 802.1p priority value.
547 * Output:
548 * None
549 * Return:
550 * RT_ERR_OK - OK
551 * RT_ERR_FAILED - Failed
552 * RT_ERR_SMI - SMI access error
553 * RT_ERR_VLAN_PRIORITY - Invalid 1p priority.
554 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
555 * Note:
556 * The API can set 802.1p parameters source priority and new priority.
557 */
558 extern rtk_api_ret_t rtk_qos_1pRemark_set(rtk_pri_t int_pri, rtk_pri_t dot1p_pri);
559
560 /* Function Name:
561 * rtk_qos_1pRemark_get
562 * Description:
563 * Get 802.1p remarking parameter.
564 * Input:
565 * int_pri - Internal priority value.
566 * Output:
567 * pDot1p_pri - 802.1p priority value.
568 * Return:
569 * RT_ERR_OK - OK
570 * RT_ERR_FAILED - Failed
571 * RT_ERR_SMI - SMI access error
572 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
573 * Note:
574 * The API can get 802.1p remarking parameters. It would return new priority of ingress priority.
575 */
576 extern rtk_api_ret_t rtk_qos_1pRemark_get(rtk_pri_t int_pri, rtk_pri_t *pDot1p_pri);
577
578 /* Function Name:
579 * rtk_qos_dscpRemarkEnable_set
580 * Description:
581 * Set DSCP remarking ability.
582 * Input:
583 * port - Port id.
584 * enable - status of DSCP remark.
585 * Output:
586 * None
587 * Return:
588 * RT_ERR_OK - OK
589 * RT_ERR_FAILED - Failed
590 * RT_ERR_SMI - SMI access error
591 * RT_ERR_PORT_ID - Invalid port number.
592 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
593 * RT_ERR_ENABLE - Invalid enable parameter.
594 * Note:
595 * The API can enable or disable DSCP remarking ability for whole system.
596 * The status of DSCP remark:
597 * - DISABLED
598 * - ENABLED
599 */
600 extern rtk_api_ret_t rtk_qos_dscpRemarkEnable_set(rtk_port_t port, rtk_enable_t enable);
601
602 /* Function Name:
603 * rtk_qos_dscpRemarkEnable_get
604 * Description:
605 * Get DSCP remarking ability.
606 * Input:
607 * port - Port id.
608 * Output:
609 * pEnable - status of DSCP remarking.
610 * Return:
611 * RT_ERR_OK - OK
612 * RT_ERR_FAILED - Failed
613 * RT_ERR_SMI - SMI access error
614 * RT_ERR_PORT_ID - Invalid port number.
615 * Note:
616 * The API can get DSCP remarking ability.
617 * The status of DSCP remark:
618 * - DISABLED
619 * - ENABLED
620 */
621 extern rtk_api_ret_t rtk_qos_dscpRemarkEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
622
623 /* Function Name:
624 * rtk_qos_dscpRemark_set
625 * Description:
626 * Set DSCP remarking parameter.
627 * Input:
628 * int_pri - Internal priority value.
629 * dscp - DSCP value.
630 * Output:
631 * None
632 * Return:
633 * RT_ERR_OK - OK
634 * RT_ERR_FAILED - Failed
635 * RT_ERR_SMI - SMI access error
636 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
637 * RT_ERR_QOS_DSCP_VALUE - Invalid DSCP value.
638 * Note:
639 * The API can set DSCP value and mapping priority.
640 */
641 extern rtk_api_ret_t rtk_qos_dscpRemark_set(rtk_pri_t int_pri, rtk_dscp_t dscp);
642
643 /* Function Name:
644 * rtk_qos_dscpRemark_get
645 * Description:
646 * Get DSCP remarking parameter.
647 * Input:
648 * int_pri - Internal priority value.
649 * Output:
650 * Dscp - DSCP value.
651 * Return:
652 * RT_ERR_OK - OK
653 * RT_ERR_FAILED - Failed
654 * RT_ERR_SMI - SMI access error
655 * RT_ERR_QOS_INT_PRIORITY - Invalid priority.
656 * Note:
657 * The API can get DSCP parameters. It would return DSCP value for mapping priority.
658 */
659 extern rtk_api_ret_t rtk_qos_dscpRemark_get(rtk_pri_t int_pri, rtk_dscp_t *pDscp);
660
661 /* Function Name:
662 * rtk_qos_dscpRemarkSrcSel_set
663 * Description:
664 * Set remarking source of DSCP remarking.
665 * Input:
666 * type - remarking source
667 * Output:
668 * None
669 * Return:
670 * RT_ERR_OK
671 * RT_ERR_FAILED
672 * RT_ERR_NOT_INIT - The module is not initial
673 * RT_ERR_PORT_ID - invalid port id
674 * RT_ERR_INPUT - invalid input parameter
675
676 * Note:
677 * The API can configure DSCP remark functionality to map original DSCP value or internal
678 * priority to TX DSCP value.
679 */
680 extern rtk_api_ret_t rtk_qos_dscpRemarkSrcSel_set(rtk_qos_dscpRmkSrc_t type);
681
682
683 /* Function Name:
684 * rtk_qos_dcpRemarkSrcSel_get
685 * Description:
686 * Get remarking source of DSCP remarking.
687 * Input:
688 * none
689 * Output:
690 * pType - remarking source
691 * Return:
692 * RT_ERR_OK
693 * RT_ERR_FAILED
694 * RT_ERR_NOT_INIT - The module is not initial
695 * RT_ERR_PORT_ID - invalid port id
696 * RT_ERR_INPUT - invalid input parameter
697 * RT_ERR_NULL_POINTER - input parameter may be null pointer
698
699 * Note:
700 * None
701 */
702 extern rtk_api_ret_t rtk_qos_dscpRemarkSrcSel_get(rtk_qos_dscpRmkSrc_t *pType);
703
704
705 /* Function Name:
706 * rtk_qos_dscpRemark2Dscp_set
707 * Description:
708 * Set DSCP to remarked DSCP mapping.
709 * Input:
710 * dscp - DSCP value
711 * rmkDscp - remarked DSCP value
712 * Output:
713 * None.
714 * Return:
715 * RT_ERR_OK
716 * RT_ERR_FAILED
717 * RT_ERR_QOS_DSCP_VALUE - Invalid dscp value
718 * Note:
719 * dscp parameter can be DSCP value or internal priority according to configuration of API
720 * dal_apollomp_qos_dscpRemarkSrcSel_set(), because DSCP remark functionality can map original DSCP
721 * value or internal priority to TX DSCP value.
722 */
723 extern rtk_api_ret_t rtk_qos_dscpRemark2Dscp_set(rtk_dscp_t dscp, rtk_dscp_t rmkDscp);
724
725 /* Function Name:
726 * rtk_qos_dscpRemark2Dscp_get
727 * Description:
728 * Get DSCP to remarked DSCP mapping.
729 * Input:
730 * dscp - DSCP value
731 * Output:
732 * pDscp - remarked DSCP value
733 * Return:
734 * RT_ERR_OK
735 * RT_ERR_FAILED
736 * RT_ERR_QOS_DSCP_VALUE - Invalid dscp value
737 * RT_ERR_NULL_POINTER - NULL pointer
738 * Note:
739 * None.
740 */
741 extern rtk_api_ret_t rtk_qos_dscpRemark2Dscp_get(rtk_dscp_t dscp, rtk_dscp_t *pDscp);
742
743 /* Function Name:
744 * rtk_qos_portPriSelIndex_set
745 * Description:
746 * Configure priority decision index to each port.
747 * Input:
748 * port - Port id.
749 * index - priority decision index.
750 * Output:
751 * None
752 * Return:
753 * RT_ERR_OK - OK
754 * RT_ERR_FAILED - Failed
755 * RT_ERR_SMI - SMI access error
756 * RT_ERR_PORT_ID - Invalid port number.
757 * RT_ERR_ENTRY_INDEX - Invalid entry index.
758 * Note:
759 * The API can set priority of port assignments for queue usage and packet scheduling.
760 */
761 extern rtk_api_ret_t rtk_qos_portPriSelIndex_set(rtk_port_t port, rtk_qos_priDecTbl_t index);
762
763 /* Function Name:
764 * rtk_qos_portPriSelIndex_get
765 * Description:
766 * Get priority decision index from each port.
767 * Input:
768 * port - Port id.
769 * Output:
770 * pIndex - priority decision index.
771 * Return:
772 * RT_ERR_OK - OK
773 * RT_ERR_FAILED - Failed
774 * RT_ERR_SMI - SMI access error
775 * RT_ERR_PORT_ID - Invalid port number.
776 * Note:
777 * The API can get priority of port assignments for queue usage and packet scheduling.
778 */
779 extern rtk_api_ret_t rtk_qos_portPriSelIndex_get(rtk_port_t port, rtk_qos_priDecTbl_t *pIndex);
780
781 #endif /* __RTK_API_QOS_H__ */